diff --git a/BbookstoreMVC/.classpath b/BbookstoreMVC/.classpath deleted file mode 100644 index f4917a2..0000000 --- a/BbookstoreMVC/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/BbookstoreMVC/.project b/BbookstoreMVC/.project deleted file mode 100644 index 7257ec6..0000000 --- a/BbookstoreMVC/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - BbookstoreMVC - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/BbookstoreMVC/.settings/.jsdtscope b/BbookstoreMVC/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/BbookstoreMVC/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/BbookstoreMVC/.settings/org.eclipse.jdt.core.prefs b/BbookstoreMVC/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/BbookstoreMVC/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/BbookstoreMVC/.settings/org.eclipse.wst.common.component b/BbookstoreMVC/.settings/org.eclipse.wst.common.component deleted file mode 100644 index a0b6bf1..0000000 --- a/BbookstoreMVC/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/BbookstoreMVC/.settings/org.eclipse.wst.common.project.facet.core.xml b/BbookstoreMVC/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index acf76ca..0000000 --- a/BbookstoreMVC/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/BbookstoreMVC/.settings/org.eclipse.wst.jsdt.ui.superType.container b/BbookstoreMVC/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/BbookstoreMVC/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/BbookstoreMVC/.settings/org.eclipse.wst.jsdt.ui.superType.name b/BbookstoreMVC/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/BbookstoreMVC/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/BbookstoreMVC/WebContent/META-INF/MANIFEST.MF b/BbookstoreMVC/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/BbookstoreMVC/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/BbookstoreMVC/WebContent/WEB-INF/DisplayBooks.jsp b/BbookstoreMVC/WebContent/WEB-INF/DisplayBooks.jsp deleted file mode 100644 index 3dd82ff..0000000 --- a/BbookstoreMVC/WebContent/WEB-INF/DisplayBooks.jsp +++ /dev/null @@ -1,72 +0,0 @@ -<%@page import="java.util.Date"%> -<%@page import="com.training.java.servlet.domain.Book"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@page errorPage="error.jsp" %> - - - - - - -Insert title here - - - - <%! - - public Date getCurrentDate() - { - return new Date(); - } - - %> - - - - - - - - - - - <% - List books = (List) request - .getAttribute("BooksToDisplay"); - for (Book aBook : books) { - %> - - - - - - <% - } - %> -
TitleAuthorISBN
<%=aBook.getTitle()%><%=aBook.getAuthor()%><%=aBook.getIsbn()%>
- - Current date = <%=getCurrentDate() %>
- - -

Book details from EL :

- - Title = ${requestScope.book.title}
- Author = ${requestScope.book.author}
- ISBN = ${requestScope.book.isbn}
- - Request Parameters : ${param.fn}
- -

Third book details:

- - Title = ${customer.contact.address.streetNum}
- Author = ${BooksToDisplay[0].author}
- ISBN = ${BooksToDisplay[0].isbn}
- - - - <%@include file="footer.jsp" %> - - - \ No newline at end of file diff --git a/BbookstoreMVC/WebContent/WEB-INF/error.jsp b/BbookstoreMVC/WebContent/WEB-INF/error.jsp deleted file mode 100644 index fbb3b42..0000000 --- a/BbookstoreMVC/WebContent/WEB-INF/error.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@ page isErrorPage="true"%> - - - - - -Insert title here - - - -

An unknown error occured, please contact us at error@amazon.com or 1800-AMAZON

- -<% - exception.printStackTrace(); -%> - - - - \ No newline at end of file diff --git a/BbookstoreMVC/WebContent/WEB-INF/footer.jsp b/BbookstoreMVC/WebContent/WEB-INF/footer.jsp deleted file mode 100644 index e1b4b51..0000000 --- a/BbookstoreMVC/WebContent/WEB-INF/footer.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

Please contact us info@amazon.com

- - - \ No newline at end of file diff --git a/BbookstoreMVC/WebContent/WEB-INF/header.jsp b/BbookstoreMVC/WebContent/WEB-INF/header.jsp deleted file mode 100644 index e1e27bf..0000000 --- a/BbookstoreMVC/WebContent/WEB-INF/header.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

amazon.com

-

Earth's best customer centric store..We are proud of what we do..

- - - \ No newline at end of file diff --git a/BbookstoreMVC/WebContent/WEB-INF/lib/commons-lang-2.6.jar b/BbookstoreMVC/WebContent/WEB-INF/lib/commons-lang-2.6.jar deleted file mode 100644 index 98467d3..0000000 Binary files a/BbookstoreMVC/WebContent/WEB-INF/lib/commons-lang-2.6.jar and /dev/null differ diff --git a/BbookstoreMVC/WebContent/WEB-INF/lib/ojdbc6.jar b/BbookstoreMVC/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/BbookstoreMVC/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/BbookstoreMVC/WebContent/WEB-INF/web.xml b/BbookstoreMVC/WebContent/WEB-INF/web.xml deleted file mode 100644 index 40aa0f6..0000000 --- a/BbookstoreMVC/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - BbookstoreMVC - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ListBookServlet - ListBookServlet - com.training.java.servlet.web.ListBookServlet - - - ListBookServlet - /list - - \ No newline at end of file diff --git a/BbookstoreMVC/src/com/training/java/servlet/domain/Book.java b/BbookstoreMVC/src/com/training/java/servlet/domain/Book.java deleted file mode 100644 index 1d30fe0..0000000 --- a/BbookstoreMVC/src/com/training/java/servlet/domain/Book.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.java.servlet.domain; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - public void init() - { - - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } - - public int getPages() { - return pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - -} diff --git a/BbookstoreMVC/src/com/training/java/servlet/domain/BookDAO.java b/BbookstoreMVC/src/com/training/java/servlet/domain/BookDAO.java deleted file mode 100644 index 9827402..0000000 --- a/BbookstoreMVC/src/com/training/java/servlet/domain/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.servlet.domain; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/BbookstoreMVC/src/com/training/java/servlet/domain/BookDAOJDBCImpl.java b/BbookstoreMVC/src/com/training/java/servlet/domain/BookDAOJDBCImpl.java deleted file mode 100644 index b4a20b4..0000000 --- a/BbookstoreMVC/src/com/training/java/servlet/domain/BookDAOJDBCImpl.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.training.java.servlet.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class BookDAOJDBCImpl implements BookDAO { - - private String jdbcURL; - private String username; - private String password; - - public BookDAOJDBCImpl(String jdbcURL, String username, String password) - { - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(book_id_seq.nextval, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - statement.setInt(6, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } - - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/BbookstoreMVC/src/com/training/java/servlet/domain/DAOException.java b/BbookstoreMVC/src/com/training/java/servlet/domain/DAOException.java deleted file mode 100644 index fb0fd0a..0000000 --- a/BbookstoreMVC/src/com/training/java/servlet/domain/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.servlet.domain; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/BbookstoreMVC/src/com/training/java/servlet/domain/package-info.java b/BbookstoreMVC/src/com/training/java/servlet/domain/package-info.java deleted file mode 100644 index 05aa146..0000000 --- a/BbookstoreMVC/src/com/training/java/servlet/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.domain; \ No newline at end of file diff --git a/BbookstoreMVC/src/com/training/java/servlet/web/ListBookServlet.java b/BbookstoreMVC/src/com/training/java/servlet/web/ListBookServlet.java deleted file mode 100644 index 3e29f6b..0000000 --- a/BbookstoreMVC/src/com/training/java/servlet/web/ListBookServlet.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.training.java.servlet.web; - -import java.io.IOException; -import java.util.Date; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.servlet.domain.Book; -import com.training.java.servlet.domain.BookDAO; -import com.training.java.servlet.domain.BookDAOJDBCImpl; -import com.training.java.servlet.domain.DAOException; - -/** - * Servlet implementation class ListBookServlet - */ -public class ListBookServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListBookServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - List books = null; - - try { - books = dao.getAllBooks(); - } catch (DAOException e) { - e.printStackTrace(); - } - - request.setAttribute("BooksToDisplay", books); - - - - Book book = new Book(10, "Gandhi CEO", "Suneetha", "9876", 221, new Date()); - - HttpSession session = request.getSession(); - session.setAttribute("book", book); - - RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/DisplayBooks.jsp"); - dispatcher.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - } - -} diff --git a/BbookstoreMVC/src/com/training/java/servlet/web/package-info.java b/BbookstoreMVC/src/com/training/java/servlet/web/package-info.java deleted file mode 100644 index 6f7d93c..0000000 --- a/BbookstoreMVC/src/com/training/java/servlet/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.web; \ No newline at end of file diff --git a/CarRental/.classpath b/CarRental/.classpath deleted file mode 100644 index 23a27a7..0000000 --- a/CarRental/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/CarRental/.project b/CarRental/.project deleted file mode 100644 index c15badd..0000000 --- a/CarRental/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - CarRental - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/CarRental/.settings/.jsdtscope b/CarRental/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/CarRental/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/CarRental/.settings/org.eclipse.jdt.core.prefs b/CarRental/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/CarRental/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/CarRental/.settings/org.eclipse.wst.common.component b/CarRental/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 2c394cc..0000000 --- a/CarRental/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/CarRental/.settings/org.eclipse.wst.common.project.facet.core.xml b/CarRental/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 113dbf9..0000000 --- a/CarRental/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/CarRental/.settings/org.eclipse.wst.jsdt.ui.superType.container b/CarRental/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/CarRental/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/CarRental/.settings/org.eclipse.wst.jsdt.ui.superType.name b/CarRental/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/CarRental/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/CarRental/WebContent/META-INF/MANIFEST.MF b/CarRental/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/CarRental/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/CarRental/WebContent/WEB-INF/lib/ojdbc6.jar b/CarRental/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/CarRental/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/CarRental/WebContent/WEB-INF/web.xml b/CarRental/WebContent/WEB-INF/web.xml deleted file mode 100644 index 398a111..0000000 --- a/CarRental/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - CarRental - - - index.html - - - - - ListServlet - ListServlet - com.training.java.servlet.web.ListServlet - - - ListServlet - /list - - \ No newline at end of file diff --git a/CarRental/WebContent/index.html b/CarRental/WebContent/index.html deleted file mode 100644 index 22e65e8..0000000 --- a/CarRental/WebContent/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - -Insert title here - - - -

Welcome to our Car Rental shop!!


- -
- - - -
- - - \ No newline at end of file diff --git a/CarRental/dbscript.sql b/CarRental/dbscript.sql deleted file mode 100644 index 91801ee..0000000 --- a/CarRental/dbscript.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TABLE CAR (VIN_NUMBER VARCHAR2(7 BYTE) primary key, MAKE VARCHAR2(20 BYTE), MODEL VARCHAR2(20 BYTE), YEAR NUMBER(4,0), PRICE NUMBER(18,2));a - diff --git a/CarRental/readme.txt b/CarRental/readme.txt deleted file mode 100644 index 2e02ba9..0000000 --- a/CarRental/readme.txt +++ /dev/null @@ -1 +0,0 @@ -This is a CarRental web application using Servlets to display the list of cars that are stored in the database. \ No newline at end of file diff --git a/CarRental/src/com/training/java/servlet/domain/BaseDAO.java b/CarRental/src/com/training/java/servlet/domain/BaseDAO.java deleted file mode 100644 index ee1193c..0000000 --- a/CarRental/src/com/training/java/servlet/domain/BaseDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.training.java.servlet.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - private static final String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE"; - private static final String username = "amazon"; - private static final String password = "amazon"; - - // getConnection method - - protected Connection getConnection() throws DAOException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - - } catch (ClassNotFoundException ex) { - throw new DAOException(ex, "Class Not Found"); - } catch (SQLException ex) { - throw new DAOException(ex); - } - - } - - /** - * Close all resources: - * - * Close connection Close statement Close resultSet - */ - protected void closeResources(Connection connection, Statement statement, - ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} - diff --git a/CarRental/src/com/training/java/servlet/domain/Car.java b/CarRental/src/com/training/java/servlet/domain/Car.java deleted file mode 100644 index 54535c8..0000000 --- a/CarRental/src/com/training/java/servlet/domain/Car.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.servlet.domain; - -/** - * Car class provided getters to access the instance variables. - * - * @author Satya - * - */ - -public class Car { - - private String vinNumber; - private String make; - private String model; - private int year; - private double price; - - // Constructor to Initiate Instance variables - - public Car(String vinNumber, String make, String model, int year, - double price) { - super(); - this.vinNumber = vinNumber; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - - } - - // Getter methods to access the instance Variables. - - public String getVinNumber() { - return vinNumber; - } - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public int getYear() { - return year; - } - - public double getPrice() { - return price; - } - -} diff --git a/CarRental/src/com/training/java/servlet/domain/CarDAO.java b/CarRental/src/com/training/java/servlet/domain/CarDAO.java deleted file mode 100644 index bc9273c..0000000 --- a/CarRental/src/com/training/java/servlet/domain/CarDAO.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.java.servlet.domain; - - -import java.util.List; - -/** - * This is a Data Access object Interface. - * - * @author Satya - * - */ -public interface CarDAO { - - // Contract - List getAllCars() throws DAOException; - - void addCar(Car car) throws DAOException; - - void updateCar(Car car) throws DAOException; - - void deleteCar(String vinNumber) throws DAOException; - - Car findByPrimaryKey(String vinNumber) throws DAOException; - -} - diff --git a/CarRental/src/com/training/java/servlet/domain/CarDAOJDBCImpl.java b/CarRental/src/com/training/java/servlet/domain/CarDAOJDBCImpl.java deleted file mode 100644 index ffe6f2a..0000000 --- a/CarRental/src/com/training/java/servlet/domain/CarDAOJDBCImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.training.java.servlet.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class CarDAOJDBCImpl extends BaseDAO implements CarDAO { - - @Override - public List getAllCars() throws DAOException { - - // Create a list of Cars. - List cars = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - // Calling getConnection() - - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("Select * from Car"); - - while (resultSet.next()) { - - String vinNumber = resultSet.getString("VIN_NUMBER"); - String make = resultSet.getString("MAKE"); - String model = resultSet.getString("MODEL"); - int year = resultSet.getInt("YEAR"); - double price = resultSet.getDouble("PRICE"); - - // Instantiate Car - - Car car = new Car(vinNumber, make, model, year, price); - - // add the car to list - - cars.add(car); - - } - - } catch (SQLException ex) { - - throw new DAOException(ex, - "Error while adding a record to database"); - - } finally { - // calling colseResources method to close all resources. - closeResources(connection, statement, resultSet); - - } - - return cars; - } - - // adding record to car table through DAO - @Override - public void addCar(Car car) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - String vinNumber = car.getVinNumber(); - String make = car.getMake(); - String model = car.getModel(); - int year = car.getYear(); - double price = car.getPrice(); - - statement = connection - .prepareStatement("insert into Car values(?,?,?,?,?)"); - statement.setString(1, vinNumber); - statement.setString(2, make); - statement.setString(3, model); - statement.setInt(4, year); - statement.setDouble(5, price); - - int noOfRowsInserted = statement.executeUpdate(); - - if (noOfRowsInserted != 1) { - throw new DAOException("Inserting Car failed"); - } - - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } - - @Override - public void updateCar(Car car) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - String vinNumber = car.getVinNumber(); - String make = car.getMake(); - String model = car.getModel(); - int year = car.getYear(); - double price = car.getPrice(); - statement = connection - .prepareStatement("update car set vin_Number=?,make =?,model=?,year=?, price=? where Vin_Number = ?"); - - statement.setString(1, vinNumber); - statement.setString(2, make); - statement.setString(3, model); - statement.setInt(4, year); - statement.setDouble(5, price); - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - throw new DAOException("Update failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public void deleteCar(String vinNumber) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("Delete car where Vin_Number = ?"); - - statement.setString(1, vinNumber); - - int noOfRowsDeleted = statement.executeUpdate(); - - if (noOfRowsDeleted != 1) { - throw new DAOException("Update failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public Car findByPrimaryKey(String vinNumber) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - statement = connection - .prepareStatement("Select * from Car where Vin_Number = ?"); - - statement.setString(1, vinNumber); - - resultSet = statement.executeQuery(); - if (resultSet.next()) { - String vinnumber = resultSet.getString("VIN_NUMBER"); - String make = resultSet.getString("MAKE"); - String model = resultSet.getString("MODEL"); - int year = resultSet.getInt("YEAR"); - double price = resultSet.getDouble("PRICE"); - } - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - throw new DAOException("Update failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while selecting a record from the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - return null; - } - -} diff --git a/CarRental/src/com/training/java/servlet/domain/DAOException.java b/CarRental/src/com/training/java/servlet/domain/DAOException.java deleted file mode 100644 index 9edeb07..0000000 --- a/CarRental/src/com/training/java/servlet/domain/DAOException.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.java.servlet.domain; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/CarRental/src/com/training/java/servlet/web/ListServlet.java b/CarRental/src/com/training/java/servlet/web/ListServlet.java deleted file mode 100644 index 6a27bc1..0000000 --- a/CarRental/src/com/training/java/servlet/web/ListServlet.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.training.java.servlet.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.domain.Car; -import com.training.java.servlet.domain.CarDAO; -import com.training.java.servlet.domain.CarDAOJDBCImpl; -import com.training.java.servlet.domain.DAOException; - -/** - * Servlet implementation class ListServlet - */ -public class ListServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - //Call DAO and get the List objects - - CarDAO dao = new CarDAOJDBCImpl(); - - try { - List cars = dao.getAllCars(); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - - for(Car aCar : cars) - { - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - } - - out.println("
VIN NumberMakeModelYearPrice
" + aCar.getVinNumber() + "" + aCar.getMake() + "" + aCar.getModel() + "" + aCar.getYear() + "" + aCar.getPrice() + "
"); - - } catch (DAOException e) { - e.printStackTrace(); - } - - } - -} diff --git a/CoreJava/.classpath b/CoreJava/.classpath deleted file mode 100644 index 3d10b7b..0000000 --- a/CoreJava/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/CoreJava/.project b/CoreJava/.project deleted file mode 100644 index c0645cd..0000000 --- a/CoreJava/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - CoreJava - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/CoreJava/.settings/org.eclipse.jdt.core.prefs b/CoreJava/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index a9b6ca9..0000000 --- a/CoreJava/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Sat Jun 18 17:49:17 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/CoreJava/doc/readme.txt b/CoreJava/doc/readme.txt deleted file mode 100644 index f18e6ed..0000000 --- a/CoreJava/doc/readme.txt +++ /dev/null @@ -1,91 +0,0 @@ - In this project, this is the order you may want to practice the examples. - -Topic : Hello world -package : com.training.java.core.helloworld -classes : HelloWorld.java - HelloWorldWithArguments.java - -Topic : Basic OO concepts -package : com.training.java.core.oop.basic -classes : Car.java - CarDemo.java - -Topic : Variables & Arrays -package : com.training.java.core.arrays -classes : ArrayDemo1.java - -Topic : Operators -package : com.training.java.core.operators -classes : ArithmeticDemo.java - ConcatenationDemo.java - ComparisonDemo.java - ConditionalDemo.java - TernaryOperatorDemo.java - -Topic : Control flow statements -package : com.training.java.core.controlflow -classes : IfElseDemo.java - SwitchDemo.java - SwitchDemoFallThrough.java - WhileDemo.java - DoWhileDemo.java - ForDemo.java - -Topic : Method overloading -package : com.training.java.core.overloading -classes : DataArtitist.java - -Topic : Inheritance - 1 -package : com.training.java.core.inheritance -classes : Animal.java - Bear.java - Dog.java - AnimalDmo.java - -Topic : Inheritance - 2 -package : com.training.java.core.inheritance -classes : Car.java - PoliceCar.java - SportsCar.java - CarDemo.java - -Topic : Method overriding and polymorphism -package : com.training.java.core.overriding -classes : Animal.java - Bear.java - Dog.java - AnimalDmo.java - -Topic : Abstract methods and classes -package : com.training.java.core.abstractclass -classes : Vehicle.java - Car.java - AbstractDemo.java - -Topic : Interfaces -package : com.training.java.core.interfaces -classes : Vehicle.java - Car.java - AbstractDemo.java - -Topic : Collections - basic -package : com.training.java.core.collections -classes : Book.java - BookListExample.java - GenericsExample.java - -Topic : Collections - Sets -package : com.training.java.core.collections -classes : SimpleHashSetDemo.java - SimpleLinkedHashSetDemo.java - SimpleTreeSetDemo.java - Book.java - TreeSetComparisionDemo.java - - - - - - - - \ No newline at end of file diff --git a/CoreJava/lib/junit-4.8.2.jar b/CoreJava/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/CoreJava/lib/junit-4.8.2.jar and /dev/null differ diff --git a/CoreJava/src/Test.html b/CoreJava/src/Test.html deleted file mode 100644 index 9755c03..0000000 --- a/CoreJava/src/Test.html +++ /dev/null @@ -1,50 +0,0 @@ - - - -My title - - - - This is my first HTML page! - - -

- This is my webpage and I welcome you -

- This is another line. -
I want to start one more line here.. - - Welcome to Venkat's Java Training! - - - - - - - - - - - - - - - - - -
NameCityPhone Number
VenkatTroy248-229-5135
NitinTroy248-248-2488
- -
- Please enter your First Name :
- Please enter your Last Name :
- Please enter your Password :


- - - -
- - - - - - diff --git a/CoreJava/src/com/training/java/core/abstractclass/AbstractDemo.java b/CoreJava/src/com/training/java/core/abstractclass/AbstractDemo.java deleted file mode 100644 index 1352482..0000000 --- a/CoreJava/src/com/training/java/core/abstractclass/AbstractDemo.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.core.abstractclass; - -public class AbstractDemo -{ - - /** - * @param args - */ - public static void main(String[] args) - { - Vehicle car = new Car(); - - car.start(); - car.drive(); - car.stop(); - } - -} diff --git a/CoreJava/src/com/training/java/core/abstractclass/Car.java b/CoreJava/src/com/training/java/core/abstractclass/Car.java deleted file mode 100644 index ce3e750..0000000 --- a/CoreJava/src/com/training/java/core/abstractclass/Car.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.core.abstractclass; - -public class Car extends Vehicle -{ - public void drive() - { - System.out.println("Car is driving.."); - } -} diff --git a/CoreJava/src/com/training/java/core/abstractclass/Vehicle.java b/CoreJava/src/com/training/java/core/abstractclass/Vehicle.java deleted file mode 100644 index 386a6ad..0000000 --- a/CoreJava/src/com/training/java/core/abstractclass/Vehicle.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.java.core.abstractclass; - -/** - * @author Hari - * - */ -public abstract class Vehicle -{ - /** - * This is a concrete method. - */ - public void start() - { - System.out.println("Vehicle is starting"); - } - - /** - * This is a concrete method. - */ - public void stop() - { - System.out.println("Vehicle is stopping"); - } - - /** - * Since we think every vehicle drives differently, we make it abstract. - */ - public abstract void drive(); - -} diff --git a/CoreJava/src/com/training/java/core/abstractclass2/AbstractClassDemo.java b/CoreJava/src/com/training/java/core/abstractclass2/AbstractClassDemo.java deleted file mode 100644 index 9e82577..0000000 --- a/CoreJava/src/com/training/java/core/abstractclass2/AbstractClassDemo.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.abstractclass2; - - - -public class AbstractClassDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Car car = new RaceCar(); - - car.start(); - car.drive(); - car.stop(); - - } - -} diff --git a/CoreJava/src/com/training/java/core/abstractclass2/Car.java b/CoreJava/src/com/training/java/core/abstractclass2/Car.java deleted file mode 100644 index 5bf0a41..0000000 --- a/CoreJava/src/com/training/java/core/abstractclass2/Car.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.core.abstractclass2; - -public abstract class Car { - - public void start() - { - System.out.println("Car is starting"); - } - - public void stop() - { - System.out.println("Car is stopping"); - } - - public abstract void drive(); -} diff --git a/CoreJava/src/com/training/java/core/abstractclass2/PoliceCar.java b/CoreJava/src/com/training/java/core/abstractclass2/PoliceCar.java deleted file mode 100644 index 54734b5..0000000 --- a/CoreJava/src/com/training/java/core/abstractclass2/PoliceCar.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.core.abstractclass2; - -public class PoliceCar extends Car { - - @Override - public void drive() { - System.out.println("Police car is driving to catch someone.."); - } - -} diff --git a/CoreJava/src/com/training/java/core/abstractclass2/RaceCar.java b/CoreJava/src/com/training/java/core/abstractclass2/RaceCar.java deleted file mode 100644 index 4c85e7f..0000000 --- a/CoreJava/src/com/training/java/core/abstractclass2/RaceCar.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.core.abstractclass2; - -public class RaceCar extends Car { - - @Override - public void drive() { - System.out.println("RaceCar is driving...zoom zoom.."); - } - -} diff --git a/CoreJava/src/com/training/java/core/arrays/ArrayDemo1.java b/CoreJava/src/com/training/java/core/arrays/ArrayDemo1.java deleted file mode 100644 index c1e3a60..0000000 --- a/CoreJava/src/com/training/java/core/arrays/ArrayDemo1.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.training.java.core.arrays; - -/** - * In this example, we will learn how to declare an Array, creating and - * initializing an array, adding elements to an array and read from an array... - * - * - * @author Hari - * - */ -public class ArrayDemo1 { - - public static void main(String[] args) { - - // How to declare an array of Strings - String[] states; - - // How to create an array? Arrays are created using new operator. Here, - // we want to create an array of states that holds up to 10 Strings. - states = new String[10]; - - //Now, how to assign values to the array elements? - states[0] = "MI"; - states[1] = "OH"; - states[2] = "CA"; - states[3] = "FL"; - states[4] = "MO"; - states[5] = "OK"; - states[6] = "TX"; - states[7] = "FL"; - states[8] = "IL"; - states[9] = "WI"; - - //We have an array that have 10 elements. Now, how do I read the array elements? We read them using index. How can I read 7th element in the array? - String seventhState = states[6]; - - System.out.println("Seventh state in states array is " + seventhState); - } -} diff --git a/CoreJava/src/com/training/java/core/arrays/ArrayDominator.java b/CoreJava/src/com/training/java/core/arrays/ArrayDominator.java deleted file mode 100644 index 3d23e63..0000000 --- a/CoreJava/src/com/training/java/core/arrays/ArrayDominator.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.training.java.core.arrays; - -import java.util.HashMap; -import java.util.Map; - -public class ArrayDominator { - - /** - * @param args - */ - public static void main(String[] args) { - - int[] testNumbers = {2, 8, 8, 8, 8, 8, 2}; - - int dominator = getDomainator(testNumbers); - System.out.println("dominator = " + dominator); - } - - private static int getDomainator(int[] array) - { - int halfSize = array.length/2; - Map valueAndSizeMap = new HashMap(); - - for(int i=0; i entry : valueAndSizeMap.entrySet()) - { - System.out.println("key = " + entry.getKey() + " value = " + entry.getValue()); - if(entry.getValue() > halfSize) - { - return entry.getKey(); - } - } - - return -1; - } -} diff --git a/CoreJava/src/com/training/java/core/arrays/readme.txt b/CoreJava/src/com/training/java/core/arrays/readme.txt deleted file mode 100644 index 7dc7b1b..0000000 --- a/CoreJava/src/com/training/java/core/arrays/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -Read about Arrays in : http://download.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html - diff --git a/CoreJava/src/com/training/java/core/collections/Assignment.txt b/CoreJava/src/com/training/java/core/collections/Assignment.txt deleted file mode 100644 index 9ffaf5d..0000000 --- a/CoreJava/src/com/training/java/core/collections/Assignment.txt +++ /dev/null @@ -1,30 +0,0 @@ -The following assignments must be done for Collections.. - -Please create separate packages for each object..For example, Car object gets - -com.training.java.core.collections.car.pre15 -com.training.java.core.collections.car.post15 - ---> Create a class called Laptop.java and add the appropriate attributes. Create three different Laptop instances and add them to a Collection. - Now, read from that Collection and print each attribute in console (both 1.4 and 1.5 style and mutable and immutable way) - - attributes of Laptop : company, model, operatingSystem, processor - ---> Create a class called Car.java and add the appropriate attributes. Create three different Car instances and add them to a Collection. - Now, read from that Collection and print each attribute in console. (both 1.4 and 1.5 style and mutable and immutable way) - - attributes of Car : make, model, year, price - ---> Create a class called Television.java and add the appropriate attributes. Create three different Television instances and add them to a Collection. - Now, read from that Collection and print each attribute in console. (both 1.4 and 1.5 style and mutable and immutable way) - - attributes of Television : company, type (LCD, LED, Plasma), 3D enabled, price - - --> CellPhone : company, model, description, operatingSstem, price - --> School : name, city, school district, greatSchoolRanking - --> AirLine : name, capitalCity, numberOfAirPlanes - --> Microwave : company, type, capacity, color, price - --> Printer : compamy, price, isWireless, model, color, pagesPerMinute, isColor - --> DVDPlayer : company, price, model, color, isBlueRay, numberOfCDs - --> Washer : company, price, model, color, capacity, type (front loader, top loader) - diff --git a/CoreJava/src/com/training/java/core/collections/Book.java b/CoreJava/src/com/training/java/core/collections/Book.java deleted file mode 100644 index fbec689..0000000 --- a/CoreJava/src/com/training/java/core/collections/Book.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.core.collections; - -public class Book { - private String author; - private String publisher; - private String title; - private int numberOfPages; - - public String getAuthor() { - return author; - } - public void setAuthor(String author) { - this.author = author; - } - public String getPublisher() { - return publisher; - } - public void setPublisher(String publisher) { - this.publisher = publisher; - } - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - public int getNumberOfPages() { - return numberOfPages; - } - public void setNumberOfPages(int numberOfPages) { - this.numberOfPages = numberOfPages; - } -} diff --git a/CoreJava/src/com/training/java/core/collections/BookListExample.java b/CoreJava/src/com/training/java/core/collections/BookListExample.java deleted file mode 100644 index 4306e46..0000000 --- a/CoreJava/src/com/training/java/core/collections/BookListExample.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.training.java.core.collections; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -public class BookListExample { - - /** - * Here, we will instantiate 3 books, add them to a collection and read from the collection. - * - * @param args - */ - public static void main(String[] args) { - - //Create Head First Java Book - Book headFirstJava = new Book(); - headFirstJava.setAuthor("Cathy Sierra"); - headFirstJava.setNumberOfPages(496); - headFirstJava.setPublisher("Orielly"); - headFirstJava.setTitle("Head First Java"); - - //Create Hibernate in Action Book - Book hibernateInAction = new Book(); - hibernateInAction.setAuthor("Gavin King"); - hibernateInAction.setNumberOfPages(265); - hibernateInAction.setPublisher("Manning"); - hibernateInAction.setTitle("Hibernate in Action"); - - //Create Spring in Action Book - Book springInAction = new Book(); - springInAction.setAuthor("Craig Walls"); - springInAction.setNumberOfPages(356); - springInAction.setPublisher("Manning"); - springInAction.setTitle("Spring in Action"); - - //Now, add all these 3 books to collection - Collection books = new ArrayList(); - books.add(headFirstJava); - books.add(hibernateInAction); - books.add(springInAction); - - //Now, lets read the books from collection and print them - Iterator booksIterator = books.iterator(); - while(booksIterator.hasNext()) - { - Book aBook = (Book) booksIterator.next(); - - System.out.println("*************************************"); - System.out.println("Author = " + aBook.getAuthor()); - System.out.println("Title = " + aBook.getTitle()); - System.out.println("Publisher = " + aBook.getPublisher()); - System.out.println("Number of pages = " + aBook.getNumberOfPages()); - System.out.println("*************************************"); - System.out.println(); - } - } -} diff --git a/CoreJava/src/com/training/java/core/collections/GenericsExample.java b/CoreJava/src/com/training/java/core/collections/GenericsExample.java deleted file mode 100644 index c287893..0000000 --- a/CoreJava/src/com/training/java/core/collections/GenericsExample.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.training.java.core.collections; - -import java.util.ArrayList; -import java.util.Collection; - -public class GenericsExample { - - /** - * @param args - */ - public static void main(String[] args) { - - //Create Head First Java Book - Book headFirstJava = new Book(); - headFirstJava.setAuthor("Cathy Sierra"); - headFirstJava.setNumberOfPages(496); - headFirstJava.setPublisher("Orielly"); - headFirstJava.setTitle("Head First Java"); - - //Create Hibernate in Action Book - Book hibernateInAction = new Book(); - hibernateInAction.setAuthor("Gavin King"); - hibernateInAction.setNumberOfPages(265); - hibernateInAction.setPublisher("Manning"); - hibernateInAction.setTitle("Hibernate in Action"); - - //Create Spring in Action Book - Book springInAction = new Book(); - springInAction.setAuthor("Craig Walls"); - springInAction.setNumberOfPages(356); - springInAction.setPublisher("Manning"); - springInAction.setTitle("Spring in Action"); - - //Now, add all these 3 books to collection - Collection books = new ArrayList(); - books.add(headFirstJava); - books.add(hibernateInAction); - books.add(springInAction); - - //Now, lets read the books from collection and print them - for(Book aBook : books) - { - System.out.println("*************************************"); - System.out.println("Author = " + aBook.getAuthor()); - System.out.println("Title = " + aBook.getTitle()); - System.out.println("Publisher = " + aBook.getPublisher()); - System.out.println("Number of pages = " + aBook.getNumberOfPages()); - System.out.println("*************************************"); - System.out.println(); - } - } -} diff --git a/CoreJava/src/com/training/java/core/collections/map/HashMapDemo.java b/CoreJava/src/com/training/java/core/collections/map/HashMapDemo.java deleted file mode 100644 index 18d5e49..0000000 --- a/CoreJava/src/com/training/java/core/collections/map/HashMapDemo.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.training.java.core.collections.map; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -/** - * @author Venkat - * - */ -public class HashMapDemo -{ - /** - * @param args - */ - public static void main(String[] args) - { - Map telephoneDirectory = new HashMap(); - - telephoneDirectory.put("venkat", "2482295135"); - telephoneDirectory.put("prasad", "2482029187"); - telephoneDirectory.put("Soumith", "2482022951"); - - //Method 1 to get keys and values - Set keySet = telephoneDirectory.keySet(); - - for(String aKey : keySet) - { - System.out.println("A key = " + aKey); - String value = telephoneDirectory.get(aKey); - System.out.println("A Value = " + value); - } - - //Method 2 to get keys and values - Set> entrySet = telephoneDirectory.entrySet(); - for(Entry eachEntry : entrySet) - { - System.out.println("Key = " + eachEntry.getKey()); - System.out.println("Value = " + eachEntry.getValue()); - } - - - String soumithsNumber = telephoneDirectory.get("Soumith"); - System.out.println("soumithsNumber = " + soumithsNumber); - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/map/readme.txt b/CoreJava/src/com/training/java/core/collections/map/readme.txt deleted file mode 100644 index 5d93e99..0000000 --- a/CoreJava/src/com/training/java/core/collections/map/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ ---> Create a HashMap of Book objects with title as the key and retrieve the books by title ---> Create a TreeMap of Book objects with title as key..Override compareTo() in Book and observe the output. \ No newline at end of file diff --git a/CoreJava/src/com/training/java/core/collections/post15/ArrayListDemo.java b/CoreJava/src/com/training/java/core/collections/post15/ArrayListDemo.java deleted file mode 100644 index d24bf1b..0000000 --- a/CoreJava/src/com/training/java/core/collections/post15/ArrayListDemo.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.core.collections.post15; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class ArrayListDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - //Create a container - List names = new ArrayList(); - - names.add("Venkat"); - names.add("Jiten"); - names.add("Manpreet"); - names.add("Priya"); - names.add("Rinku"); - names.add("Ronnie"); - names.add("Sasikala"); - names.add("Yousuf"); - - //Read with for each loop - for(String aName : names) - { - System.out.println("name = " + aName); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/post15/ArrayListDemo2.java b/CoreJava/src/com/training/java/core/collections/post15/ArrayListDemo2.java deleted file mode 100644 index d04605f..0000000 --- a/CoreJava/src/com/training/java/core/collections/post15/ArrayListDemo2.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.training.java.core.collections.post15; - -import java.util.ArrayList; -import java.util.List; - -public class ArrayListDemo2 { - - /** - * @param args - */ - public static void main(String[] args) { - - Book headFirstJava = new Book(); - headFirstJava.setAuthor("Cathy Sierra"); - headFirstJava.setTitle("Head First Java"); - headFirstJava.setIsbn("12345"); - - Book springInAction = new Book(); - springInAction.setAuthor("Cariag Walls"); - springInAction.setTitle("Spring in Action"); - springInAction.setIsbn("54321"); - - Book hibernateInAction = new Book(); - hibernateInAction.setAuthor("Gavin King"); - hibernateInAction.setTitle("Hibernate in Action"); - hibernateInAction.setIsbn("99999"); - - Book jqueryInActon = new Book(); - jqueryInActon.setAuthor("Venkat Hari"); - jqueryInActon.setTitle("jQuery in Action"); - jqueryInActon.setIsbn("98765"); - - List books = new ArrayList(); - - books.add(headFirstJava); - books.add(springInAction); - books.add(hibernateInAction); - books.add(jqueryInActon); - - for(Book aBook : books) - { - System.out.println("Start printing book details *******"); - System.out.println("Author = " + aBook.getAuthor()); - System.out.println("Title = " + aBook.getTitle()); - System.out.println("ISBN = " + aBook.getIsbn()); - System.out.println("End printing book details *******"); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/post15/ArrayListDemo3.java b/CoreJava/src/com/training/java/core/collections/post15/ArrayListDemo3.java deleted file mode 100644 index 4a9ac36..0000000 --- a/CoreJava/src/com/training/java/core/collections/post15/ArrayListDemo3.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.java.core.collections.post15; - -import java.util.ArrayList; -import java.util.List; - -public class ArrayListDemo3 { - - /** - * @param args - */ - public static void main(String[] args) { - - ImmutableBook headFirstJava = new ImmutableBook("Head First Java", "Cathy Sierra", "12345"); - ImmutableBook springInAction = new ImmutableBook("Spring in Action", "Cariag Walls", "54321"); - ImmutableBook hibernateInAction = new ImmutableBook("Hibernate in Action", "Gavin King", "99999"); - ImmutableBook jqueryInActon = new ImmutableBook("jQuery in Action", "Venkat Hari", "98765"); - - List books = new ArrayList(); - - books.add(headFirstJava); - books.add(springInAction); - books.add(hibernateInAction); - books.add(jqueryInActon); - - for(ImmutableBook aBook : books) - { - System.out.println("Start printing book details *******"); - System.out.println("Author = " + aBook.getAuthor()); - System.out.println("Title = " + aBook.getTitle()); - System.out.println("ISBN = " + aBook.getIsbn()); - System.out.println("End printing book details *******"); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/post15/Book.java b/CoreJava/src/com/training/java/core/collections/post15/Book.java deleted file mode 100644 index 8383b94..0000000 --- a/CoreJava/src/com/training/java/core/collections/post15/Book.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.collections.post15; - -public class Book { - - private String title; - private String author; - private String isbn; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } -} diff --git a/CoreJava/src/com/training/java/core/collections/post15/ImmutableBook.java b/CoreJava/src/com/training/java/core/collections/post15/ImmutableBook.java deleted file mode 100644 index 916a5db..0000000 --- a/CoreJava/src/com/training/java/core/collections/post15/ImmutableBook.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.collections.post15; - -public class ImmutableBook { - - private String title; - private String author; - private String isbn; - - public ImmutableBook(String title, String author, String isbn) - { - this.title = title; - this.author = author; - this.isbn = isbn; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } -} diff --git a/CoreJava/src/com/training/java/core/collections/pre15/ArrayListDemo.java b/CoreJava/src/com/training/java/core/collections/pre15/ArrayListDemo.java deleted file mode 100644 index b6bb2c3..0000000 --- a/CoreJava/src/com/training/java/core/collections/pre15/ArrayListDemo.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.training.java.core.collections.pre15; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class ArrayListDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - //Create a container - List names = new ArrayList(); - - names.add("Venkat"); - names.add("Jiten"); - names.add("Manpreet"); - names.add("Priya"); - names.add("Rinku"); - names.add("Ronnie"); - names.add("Sasikala"); - names.add("Yousuf"); - - Iterator namesIterator = names.iterator(); - - while(namesIterator.hasNext()) - { - String name = (String) namesIterator.next(); - - System.out.println("name = " + name); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/pre15/ArrayListDemo2.java b/CoreJava/src/com/training/java/core/collections/pre15/ArrayListDemo2.java deleted file mode 100644 index d9f7a9b..0000000 --- a/CoreJava/src/com/training/java/core/collections/pre15/ArrayListDemo2.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.java.core.collections.pre15; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class ArrayListDemo2 { - - /** - * @param args - */ - public static void main(String[] args) { - - Book headFirstJava = new Book(); - headFirstJava.setAuthor("Cathy Sierra"); - headFirstJava.setTitle("Head First Java"); - headFirstJava.setIsbn("12345"); - - Book springInAction = new Book(); - springInAction.setAuthor("Cariag Walls"); - springInAction.setTitle("Spring in Action"); - springInAction.setIsbn("54321"); - - Book hibernateInAction = new Book(); - hibernateInAction.setAuthor("Gavin King"); - hibernateInAction.setTitle("Hibernate in Action"); - hibernateInAction.setIsbn("99999"); - - Book jqueryInActon = new Book(); - jqueryInActon.setAuthor("Venkat Hari"); - jqueryInActon.setTitle("jQuery in Action"); - jqueryInActon.setIsbn("98765"); - - List books = new ArrayList(); - - books.add(headFirstJava); - books.add(springInAction); - books.add(hibernateInAction); - books.add(jqueryInActon); - - //Read from List - Iterator booksIterator = books.iterator(); - while(booksIterator.hasNext()) - { - Book aBook = (Book) booksIterator.next(); - - System.out.println("Start printing book details *******"); - System.out.println("Author = " + aBook.getAuthor()); - System.out.println("Title = " + aBook.getTitle()); - System.out.println("ISBN = " + aBook.getIsbn()); - System.out.println("End printing book details *******"); - } - - - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/pre15/ArrayListDemo3.java b/CoreJava/src/com/training/java/core/collections/pre15/ArrayListDemo3.java deleted file mode 100644 index 8bbebca..0000000 --- a/CoreJava/src/com/training/java/core/collections/pre15/ArrayListDemo3.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.java.core.collections.pre15; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class ArrayListDemo3 { - - /** - * @param args - */ - public static void main(String[] args) { - - ImmutableBook headFirstJava = new ImmutableBook("Head First Java", "Cathy Sierra", "12345"); - ImmutableBook springInAction = new ImmutableBook("Spring in Action", "Cariag Walls", "54321"); - ImmutableBook hibernateInAction = new ImmutableBook("Hibernate in Action", "Gavin King", "99999"); - ImmutableBook jqueryInActon = new ImmutableBook("jQuery in Action", "Venkat Hari", "98765"); - - List books = new ArrayList(); - - books.add(headFirstJava); - books.add(springInAction); - books.add(hibernateInAction); - books.add(jqueryInActon); - - // Read from List - Iterator booksIterator = books.iterator(); - while (booksIterator.hasNext()) { - ImmutableBook aBook = (ImmutableBook) booksIterator.next(); - - System.out.println("Start printing book details *******"); - System.out.println("Author = " + aBook.getAuthor()); - System.out.println("Title = " + aBook.getTitle()); - System.out.println("ISBN = " + aBook.getIsbn()); - System.out.println("End printing book details *******"); - } - - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/pre15/Book.java b/CoreJava/src/com/training/java/core/collections/pre15/Book.java deleted file mode 100644 index a3af89c..0000000 --- a/CoreJava/src/com/training/java/core/collections/pre15/Book.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.collections.pre15; - -public class Book { - - private String title; - private String author; - private String isbn; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } -} diff --git a/CoreJava/src/com/training/java/core/collections/pre15/ImmutableBook.java b/CoreJava/src/com/training/java/core/collections/pre15/ImmutableBook.java deleted file mode 100644 index 2391e84..0000000 --- a/CoreJava/src/com/training/java/core/collections/pre15/ImmutableBook.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.collections.pre15; - -public class ImmutableBook { - - private String title; - private String author; - private String isbn; - - public ImmutableBook(String title, String author, String isbn) - { - this.title = title; - this.author = author; - this.isbn = isbn; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } -} diff --git a/CoreJava/src/com/training/java/core/collections/readme.txt b/CoreJava/src/com/training/java/core/collections/readme.txt deleted file mode 100644 index d36f313..0000000 --- a/CoreJava/src/com/training/java/core/collections/readme.txt +++ /dev/null @@ -1,25 +0,0 @@ -The following assignments must be done for Collections.. - ---> Create a class called Laptop.java and add the appropriate attributes. Create three different Laptop instances and add them to a Collection. - Now, read from that Collection and print each attribute in console (both 1.4 and 1.5 style and mutable and immutable way) - - attributes of Laptop : company, model, operatingSystem, processor - ---> Create a class called Car.java and add the appropriate attributes. Create three different Car instances and add them to a Collection. - Now, read from that Collection and print each attribute in console. (both 1.4 and 1.5 style and mutable and immutable way) - - attributes of Car : make, model, year, price - ---> Create a class called Television.java and add the appropriate attributes. Create three different Television instances and add them to a Collection. - Now, read from that Collection and print each attribute in console. (both 1.4 and 1.5 style and mutable and immutable way) - - attributes of Television : company, type (LCD, LED, Plasma), 3D enabled, price - - --> CellPhone : company, model, description, operatingSstem, price - --> School : name, city, school district, greatSchoolRanking - --> AirLine : name, capitalCity, numberOfAirPlanes - --> Microwave : company, type, capacity, color, price - --> Printer : compamy, price, isWireless, model, color, pagesPerMinute, isColor - --> DVDPlayer : company, price, model, color, isBlueRay, numberOfCDs - --> Washer : company, price, model, color, capacity, type (front loader, top loader) - diff --git a/CoreJava/src/com/training/java/core/collections/set/Book.java b/CoreJava/src/com/training/java/core/collections/set/Book.java deleted file mode 100644 index 955087f..0000000 --- a/CoreJava/src/com/training/java/core/collections/set/Book.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.training.java.core.collections.set; - -public class Book implements Comparable { - private String author; - private String publisher; - private String title; - private int numberOfPages; - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getPublisher() { - return publisher; - } - - public void setPublisher(String publisher) { - this.publisher = publisher; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public int getNumberOfPages() { - return numberOfPages; - } - - public void setNumberOfPages(int numberOfPages) { - this.numberOfPages = numberOfPages; - } - - @Override - public int compareTo(Book that) { - - int returnValue = this.author.compareTo(that.author); - if (returnValue == 0) { - returnValue = this.title.compareTo(that.title); - } - - return returnValue; - } - - @Override - public boolean equals(Object that) { - - if (that instanceof Book) { - Book thatBookObj = (Book) that; - - return thatBookObj.getAuthor().equals(this.getAuthor()); - } else { - return false; - } - } - - @Override - public int hashCode() { - return this.author.hashCode(); - } -} diff --git a/CoreJava/src/com/training/java/core/collections/set/HashSetEqualsDemo.java b/CoreJava/src/com/training/java/core/collections/set/HashSetEqualsDemo.java deleted file mode 100644 index 2bef8e9..0000000 --- a/CoreJava/src/com/training/java/core/collections/set/HashSetEqualsDemo.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.HashSet; -import java.util.Set; - -public class HashSetEqualsDemo { - - /** - * @param args - */ - public static void main(String[] args) { - // Create Head First Java Book - Book headFirstJava = new Book(); - headFirstJava.setAuthor("Cathy Sierra"); - headFirstJava.setNumberOfPages(496); - headFirstJava.setPublisher("Orielly"); - headFirstJava.setTitle("Head First Java"); - - // Create Hibernate in Action Book - Book headFirstJava2 = new Book(); - headFirstJava2.setAuthor("Cathy Sierra"); - headFirstJava2.setNumberOfPages(500); - headFirstJava2.setPublisher("Manning"); - headFirstJava2.setTitle("Head First Java2"); - - // Create Spring in Action Book - Book springInAction = new Book(); - springInAction.setAuthor("Craig Walls"); - springInAction.setNumberOfPages(356); - springInAction.setPublisher("Manning"); - springInAction.setTitle("Spring in Action"); - - // Now, add all these 3 books to Set, which is a TreeSet - Set books = new HashSet(); - books.add(headFirstJava); - books.add(headFirstJava2); - books.add(springInAction); - - // Now, lets read the books from Set and print them. Observe that only - // one Head First Java book is printed because two book objects are - // equal if they have the same autho (we overrode equals() and - // hashCode() methods). - - for (Book aBook : books) { - System.out.println("*************************************"); - System.out.println("Author = " + aBook.getAuthor()); - System.out.println("Title = " + aBook.getTitle()); - System.out.println("Publisher = " + aBook.getPublisher()); - System.out.println("Number of pages = " + aBook.getNumberOfPages()); - System.out.println("*************************************"); - System.out.println(); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/set/SimpleHashSetDemo.java b/CoreJava/src/com/training/java/core/collections/set/SimpleHashSetDemo.java deleted file mode 100644 index a981f19..0000000 --- a/CoreJava/src/com/training/java/core/collections/set/SimpleHashSetDemo.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.HashSet; -import java.util.Set; - -public class SimpleHashSetDemo { - - public static void main(String[] args) { - - Set states = new HashSet(); - - states.add("TX"); - states.add("OH"); - states.add("MI"); - states.add("MI"); - states.add("AB"); - states.add("CO"); - states.add(null); - - // Observe the output carefully..The order is neither sorted nor the - // order you added to the Set. It is completely random. Also, keep in - // mind that there is no guarantee that it gets printed in the same - // order you run every time. You cannot depend on the order at all. But, - // this is quicker than all other set types, so if you need a simple, no - // order Set with better performance, HashSet is your bet. Also observe - // that the duplicated element MI is not being printed twice, because Sets - // don't support duplicate values. Also observe that HashSet accepts - // null values. - - for (String aState : states) { - System.out.println("aState = " + aState); - } - } -} diff --git a/CoreJava/src/com/training/java/core/collections/set/SimpleLinkedHashSetDemo.java b/CoreJava/src/com/training/java/core/collections/set/SimpleLinkedHashSetDemo.java deleted file mode 100644 index 96aa1b0..0000000 --- a/CoreJava/src/com/training/java/core/collections/set/SimpleLinkedHashSetDemo.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.LinkedHashSet; -import java.util.Set; - -public class SimpleLinkedHashSetDemo { - - /** - * @param args - */ - public static void main(String[] args) { - Set states = new LinkedHashSet(); - - states.add("TX"); - states.add("OH"); - states.add("MI"); - states.add("MI"); - states.add("AB"); - states.add("CO"); - states.add(null); - - // Observe the output carefully. In the case of LinkedHashSet, it stores - // in the order you placed in the Set. It keeps that order.Also observe - // that the duplicated element MI is not being printed, because Sets - // don't support duplicate values. Also observe that LinkedHashSet (sub - // class of HashSet) accepts null values. - - for (String aState : states) { - System.out.println("aState = " + aState); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/set/SimpleTreeSetDemo.java b/CoreJava/src/com/training/java/core/collections/set/SimpleTreeSetDemo.java deleted file mode 100644 index 2c62f95..0000000 --- a/CoreJava/src/com/training/java/core/collections/set/SimpleTreeSetDemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.Set; -import java.util.TreeSet; - -public class SimpleTreeSetDemo { - - /** - * @param args - */ - public static void main(String[] args) { - Set states = new TreeSet(); - - states.add("TX"); - states.add("OH"); - states.add("MI"); - states.add("MI"); - states.add("AB"); - states.add("CO"); - - // TreeSet does NOT support null, if you try to add - // null, it throws NullPointerException - - // states.add(null); - - // Observe the output carefully. In the case of TreeSet, it prints in - // the natural order of values. For Strings, the order is alphabetical, - // for numbers it is natural number order.Also observe - // that the duplicated element MI is not being printed, because Sets - // don't support duplicate values. Also observe that TreeSet does NOT - // accept null. - - for (String aState : states) { - System.out.println("aState = " + aState); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/collections/set/TreeSetComparisionDemo.java b/CoreJava/src/com/training/java/core/collections/set/TreeSetComparisionDemo.java deleted file mode 100644 index 16d7c2c..0000000 --- a/CoreJava/src/com/training/java/core/collections/set/TreeSetComparisionDemo.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.Set; -import java.util.TreeSet; - -public class TreeSetComparisionDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - // Create Head First Java Book - Book headFirstJava = new Book(); - headFirstJava.setAuthor("Cathy Sierra"); - headFirstJava.setNumberOfPages(496); - headFirstJava.setPublisher("Orielly"); - headFirstJava.setTitle("Head First Java"); - - // Create Hibernate in Action Book - Book hibernateInAction = new Book(); - hibernateInAction.setAuthor("Gavin King"); - hibernateInAction.setNumberOfPages(265); - hibernateInAction.setPublisher("Manning"); - hibernateInAction.setTitle("Hibernate in Action"); - - // Create Spring in Action Book - Book springInAction = new Book(); - springInAction.setAuthor("Craig Walls"); - springInAction.setNumberOfPages(356); - springInAction.setPublisher("Manning"); - springInAction.setTitle("Spring in Action"); - - // Now, add all these 3 books to Set, which is a TreeSet - Set books = new TreeSet(); - books.add(headFirstJava); - books.add(hibernateInAction); - books.add(springInAction); - - // Now, lets read the books from Set and print them. Observe that it has - // been sorted by author (that is what we mentioned in our compareTo() - // method in Book class). - - for (Book aBook : books) { - System.out.println("*************************************"); - System.out.println("Author = " + aBook.getAuthor()); - System.out.println("Title = " + aBook.getTitle()); - System.out.println("Publisher = " + aBook.getPublisher()); - System.out.println("Number of pages = " + aBook.getNumberOfPages()); - System.out.println("*************************************"); - System.out.println(); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/constructor/Car.java b/CoreJava/src/com/training/java/core/constructor/Car.java deleted file mode 100644 index 03e5999..0000000 --- a/CoreJava/src/com/training/java/core/constructor/Car.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.java.core.constructor; - -public class Car { - - private String color; - private int numberOfGears; - private int maximumSpeed = 140; - private int currentSpeed; - private String vinNumber; - - public Car(String color, int numberOfGears) { - this.color = color; - this.numberOfGears = numberOfGears; - } - - public Car(String color, int numberOfGears, String vinNumber) { - this.color = color; - this.numberOfGears = numberOfGears; - this.vinNumber = vinNumber; - } - - public void start() { - System.out.println("Starting " + color + " color car with " - + numberOfGears + " gears with VIN = " + vinNumber); - } - - public void stop() { - System.out.println("Stopping"); - } - - public void setColor(String color) - { - this.color = color; - } - - public void setNumberOfGears(int numberOfGears) - { - this.numberOfGears = numberOfGears; - } -} diff --git a/CoreJava/src/com/training/java/core/constructor/CarDemo.java b/CoreJava/src/com/training/java/core/constructor/CarDemo.java deleted file mode 100644 index 49faa02..0000000 --- a/CoreJava/src/com/training/java/core/constructor/CarDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.core.constructor; - -public class CarDemo { - - /** - * @param args - */ - public static void main(String[] args) { - Car car = new Car("blue", 5, "123456"); - - car.start(); - car.stop(); - - car.setColor("red"); - car.setNumberOfGears(6); - - car.start(); - car.stop(); - - } - -} diff --git a/CoreJava/src/com/training/java/core/constructor/RaceCar.java b/CoreJava/src/com/training/java/core/constructor/RaceCar.java deleted file mode 100644 index d3d3010..0000000 --- a/CoreJava/src/com/training/java/core/constructor/RaceCar.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.java.core.constructor; - -public class RaceCar extends Car { - - private String gridMetal; - - public RaceCar(String color, int numberOfGears, String gridMetal) - { - super(color, numberOfGears); - this.gridMetal = gridMetal; - } - - public void start() - { - super.start(); - System.out.println("With gridMetal = " + gridMetal); - } - -} diff --git a/CoreJava/src/com/training/java/core/constructor/RaceCarDemo.java b/CoreJava/src/com/training/java/core/constructor/RaceCarDemo.java deleted file mode 100644 index 2c49f8d..0000000 --- a/CoreJava/src/com/training/java/core/constructor/RaceCarDemo.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.core.constructor; - -public class RaceCarDemo { - - /** - * @param args - */ - public static void main(String[] args) { - Car car = new RaceCar("blue", 5, "Alluminimum"); - - car.start(); - car.stop(); - } - -} diff --git a/CoreJava/src/com/training/java/core/constructor2/Car.java b/CoreJava/src/com/training/java/core/constructor2/Car.java deleted file mode 100644 index 0a8c80e..0000000 --- a/CoreJava/src/com/training/java/core/constructor2/Car.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.training.java.core.constructor2; - -public class Car { - - private String make; - private String model; - private String vinNumber; - private String color; - - Car(String vinNumber, String color, String make, String model) - { - this.vinNumber = vinNumber; - this.color = color; - this.make = make; - this.model = model; - } - - Car(String vinNumber, String make, String model) - { - this.vinNumber = vinNumber; - this.make = make; - this.model = model; - } - - String getMake() { - return make; - } - - String getModel() { - return model; - } - - String getVinNumber() { - return vinNumber; - } - - String getColor() { - return color; - } - - void setColor(String newColor) - { - color = newColor; - } -} diff --git a/CoreJava/src/com/training/java/core/constructor2/ConstructorDemo.java b/CoreJava/src/com/training/java/core/constructor2/ConstructorDemo.java deleted file mode 100644 index bc83040..0000000 --- a/CoreJava/src/com/training/java/core/constructor2/ConstructorDemo.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.core.constructor2; - -public class ConstructorDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Car car = new Car("12345", "Ford", "Focus"); - - car.setColor("Blue"); - - System.out.println("Vin number = " + car.getVinNumber()); - System.out.println("Color = " + car.getColor()); - } - -} diff --git a/CoreJava/src/com/training/java/core/controlflow/DoWhileDemo.java b/CoreJava/src/com/training/java/core/controlflow/DoWhileDemo.java deleted file mode 100644 index 8812850..0000000 --- a/CoreJava/src/com/training/java/core/controlflow/DoWhileDemo.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.controlflow; - -/** - * The difference between do-while and while is that do-while evaluates its - * expression at the bottom of the loop instead of the top. Therefore, the - * statements within the do block are always executed at least once, as shown in - * the following DoWhileDemo program: - * - * @author Hari - * - */ -public class DoWhileDemo { - public static void main(String[] args) { - int count = 1; - do { - System.out.println("Count is: " + count); - count++; - } while (count < 11); - } -} diff --git a/CoreJava/src/com/training/java/core/controlflow/EnhancedForDemo.java b/CoreJava/src/com/training/java/core/controlflow/EnhancedForDemo.java deleted file mode 100644 index 6cef88b..0000000 --- a/CoreJava/src/com/training/java/core/controlflow/EnhancedForDemo.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.controlflow; - -/** - * The for statement also has another form designed for iteration through - * Collections and arrays. This form is sometimes referred to as the enhanced - * for statement, and can be used to make your loops more compact and easy to - * read. To demonstrate, consider the following array, which holds the numbers 1 - * through 10: - * - * @author Hari - * - */ -public class EnhancedForDemo { - public static void main(String[] args) { - int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - for (int item : numbers) { - System.out.println("Count is: " + item); - } - } -} \ No newline at end of file diff --git a/CoreJava/src/com/training/java/core/controlflow/ForDemo.java b/CoreJava/src/com/training/java/core/controlflow/ForDemo.java deleted file mode 100644 index 3984117..0000000 --- a/CoreJava/src/com/training/java/core/controlflow/ForDemo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.java.core.controlflow; - -/** - * The for statement provides a compact way to iterate over a range of values. - * Programmers often refer to it as the "for loop" because of the way in which - * it repeatedly loops until a particular condition is satisfied. The general - * form of the for statement can be expressed as follows: for (initialization; - * termination; increment) { statement(s) } When using this version of the for - * statement, keep in mind that: The initialization expression initializes the - * loop; it's executed once, as the loop begins. When the termination expression - * evaluates to false, the loop terminates. The increment expression is invoked - * after each iteration through the loop; it is perfectly acceptable for this - * expression to increment or decrement a value.. - * - * @author Hari - * - */ -public class ForDemo { - public static void main(String[] args) { - for (int i = 1; i < 11; i++) { - System.out.println("Count is: " + i); - } - } -} diff --git a/CoreJava/src/com/training/java/core/controlflow/IfElseDemo.java b/CoreJava/src/com/training/java/core/controlflow/IfElseDemo.java deleted file mode 100644 index 3ccecfe..0000000 --- a/CoreJava/src/com/training/java/core/controlflow/IfElseDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.core.controlflow; - -public class IfElseDemo { - public static void main(String[] args) { - - int testscore = 76; - char grade; - - if (testscore >= 90) { - grade = 'A'; - } else if (testscore >= 80) { - grade = 'B'; - } else if (testscore >= 70) { - grade = 'C'; - } else if (testscore >= 60) { - grade = 'D'; - } else { - grade = 'F'; - } - System.out.println("Grade = " + grade); - } -} diff --git a/CoreJava/src/com/training/java/core/controlflow/SwitchDemo.java b/CoreJava/src/com/training/java/core/controlflow/SwitchDemo.java deleted file mode 100644 index 1e7881e..0000000 --- a/CoreJava/src/com/training/java/core/controlflow/SwitchDemo.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.core.controlflow; - -public class SwitchDemo { - public static void main(String[] args) { - - //Get month number from user - int month = Integer.parseInt(args[0]); - - String monthString; - switch (month) { - case 1: - monthString = "January"; - break; - case 2: - monthString = "February"; - break; - case 3: - monthString = "March"; - break; - case 4: - monthString = "April"; - break; - case 5: - monthString = "May"; - break; - case 6: - monthString = "June"; - break; - case 7: - monthString = "July"; - break; - case 8: - monthString = "August"; - break; - case 9: - monthString = "September"; - break; - case 10: - monthString = "October"; - break; - case 11: - monthString = "November"; - break; - case 12: - monthString = "December"; - break; - default: - monthString = "Invalid month"; - break; - } - System.out.println(monthString); - } -} diff --git a/CoreJava/src/com/training/java/core/controlflow/SwitchDemoFallThrough.java b/CoreJava/src/com/training/java/core/controlflow/SwitchDemoFallThrough.java deleted file mode 100644 index 2ad56f3..0000000 --- a/CoreJava/src/com/training/java/core/controlflow/SwitchDemoFallThrough.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.training.java.core.controlflow; - -/** - * Deciding whether to use if-then-else statements or a switch statement is - * based on readability and the expression that the statement is testing. An - * if-then-else statement can test expressions based on ranges of values or - * conditions, whereas a switch statement tests expressions based only on a - * single integer, enumerated value, or String object. - * - * Another point of interest is the break statement. Each break statement - * terminates the enclosing switch statement. Control flow continues with the - * first statement following the switch block. The break statements are - * necessary because without them, statements in switch blocks fall through: All - * statements after the matching case label are executed in sequence, regardless - * of the expression of subsequent case labels, until a break statement is - * encountered. The program SwitchDemoFallThrough shows statements in a switch - * block that fall through. The program displays the month corresponding to the - * integer month and the months that follow in the year: - * - * - * @author Hari - * - */ -public class SwitchDemoFallThrough { - - public static void main(String args[]) { - java.util.ArrayList futureMonths = new java.util.ArrayList(); - - int month = 8; - - switch (month) { - case 1: - futureMonths.add("January"); - case 2: - futureMonths.add("February"); - case 3: - futureMonths.add("March"); - case 4: - futureMonths.add("April"); - case 5: - futureMonths.add("May"); - case 6: - futureMonths.add("June"); - case 7: - futureMonths.add("July"); - case 8: - futureMonths.add("August"); - case 9: - futureMonths.add("September"); - case 10: - futureMonths.add("October"); - case 11: - futureMonths.add("November"); - case 12: - futureMonths.add("December"); - break; - default: - break; - } - - if (futureMonths.isEmpty()) { - System.out.println("Invalid month number"); - } else { - for (String monthName : futureMonths) { - System.out.println(monthName); - } - } - } -} diff --git a/CoreJava/src/com/training/java/core/controlflow/WhileDemo.java b/CoreJava/src/com/training/java/core/controlflow/WhileDemo.java deleted file mode 100644 index 20f63f6..0000000 --- a/CoreJava/src/com/training/java/core/controlflow/WhileDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.core.controlflow; - -/** - * The while statement evaluates expression, which must return a boolean value. - * If the expression evaluates to true, the while statement executes the - * statement(s) in the while block. The while statement continues testing the - * expression and executing its block until the expression evaluates to false. - * Using the while statement to print the values from 1 through 10 can be - * accomplished as in the following WhileDemo program. - * - * @author Hari - * - */ -public class WhileDemo { - public static void main(String[] args) { - int count = 1; - while (count < 11) { - System.out.println("Count is: " + count); - count++; - } - } -} diff --git a/CoreJava/src/com/training/java/core/encapsulation/Television.java b/CoreJava/src/com/training/java/core/encapsulation/Television.java deleted file mode 100644 index 96899d9..0000000 --- a/CoreJava/src/com/training/java/core/encapsulation/Television.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.java.core.encapsulation; -public class Television { - - private String color; - private String model; - private String make; - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public String getMake() { - return make; - } - - public void setMake(String make) { - this.make = make; - } -} diff --git a/CoreJava/src/com/training/java/core/encapsulation/TelevisionDemo.java b/CoreJava/src/com/training/java/core/encapsulation/TelevisionDemo.java deleted file mode 100644 index df6cff3..0000000 --- a/CoreJava/src/com/training/java/core/encapsulation/TelevisionDemo.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.encapsulation; - -public class TelevisionDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Television tv = new Television(); - tv.setColor("Black"); - tv.setMake("Samsung"); - tv.setModel("LNS3251D"); - - System.out.println("Model = " + tv.getModel()); - System.out.println("Make = " + tv.getMake()); - System.out.println("Color = " + tv.getColor()); - } - -} diff --git a/CoreJava/src/com/training/java/core/enums/Fruit.java b/CoreJava/src/com/training/java/core/enums/Fruit.java deleted file mode 100644 index bf4a197..0000000 --- a/CoreJava/src/com/training/java/core/enums/Fruit.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.core.enums; - -public enum Fruit { - - APPLE, - GRAPE, - ORANGE, - BANANA; - -} diff --git a/CoreJava/src/com/training/java/core/enums/FruitDemo.java b/CoreJava/src/com/training/java/core/enums/FruitDemo.java deleted file mode 100644 index d453f74..0000000 --- a/CoreJava/src/com/training/java/core/enums/FruitDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.core.enums; - -public class FruitDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - FruitDescriptor desc = new FruitDescriptor(); - String color = desc.getColor(Fruit.APPLE); - - System.out.println("Fruit color = " + color); - - } - -} diff --git a/CoreJava/src/com/training/java/core/enums/FruitDescriptor.java b/CoreJava/src/com/training/java/core/enums/FruitDescriptor.java deleted file mode 100644 index cb88e52..0000000 --- a/CoreJava/src/com/training/java/core/enums/FruitDescriptor.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.core.enums; - -public class FruitDescriptor { - - public String getColor(Fruit fruit) - { - if(fruit == Fruit.APPLE) - { - return "red"; - } - else if(fruit == Fruit.ORANGE) - { - return "orange"; - } - else if(fruit == Fruit.BANANA) - { - return "yellow"; - } - - return null; - } - -} diff --git a/CoreJava/src/com/training/java/core/enums/State.java b/CoreJava/src/com/training/java/core/enums/State.java deleted file mode 100644 index 84da524..0000000 --- a/CoreJava/src/com/training/java/core/enums/State.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.java.core.enums; - -public enum State -{ - MICHIGAN("MI", "Michigan"), - OHIO("OH", "Ohio"); - - private String stateCode; - private String stateDesc; - - private State(String _stateCode, String _stateDesc) - { - stateCode = _stateCode; - stateDesc = _stateDesc; - } - - public String getStateCode() - { - return stateCode; - } - - public String getStateDescription() - { - return stateDesc; - } -} diff --git a/CoreJava/src/com/training/java/core/enums/StateClient.java b/CoreJava/src/com/training/java/core/enums/StateClient.java deleted file mode 100644 index d3d4d3c..0000000 --- a/CoreJava/src/com/training/java/core/enums/StateClient.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.core.enums; - -public class StateClient -{ - - /** - * @param args - */ - public static void main(String[] args) - { - StateScribe sc = new StateScribe(); - String desc = sc.getDesc(State.OHIO); - System.out.println("Description = " + desc); - } - -} diff --git a/CoreJava/src/com/training/java/core/enums/StateScribe.java b/CoreJava/src/com/training/java/core/enums/StateScribe.java deleted file mode 100644 index 784f96c..0000000 --- a/CoreJava/src/com/training/java/core/enums/StateScribe.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.core.enums; - -public class StateScribe -{ - public String getDesc(State state) - { - return state.getStateDescription(); - } - -} diff --git a/CoreJava/src/com/training/java/core/equals/Car.java b/CoreJava/src/com/training/java/core/equals/Car.java deleted file mode 100644 index d9e6ed3..0000000 --- a/CoreJava/src/com/training/java/core/equals/Car.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.java.core.equals; - -public class Car { - - private String vinNumber; - private String make; - private String model; - - public Car(String vinNumber, String make, String model) - { - this.vinNumber = vinNumber; - this.make = make; - this.model = model; - } - - @Override - public boolean equals(Object obj) { - - if (obj instanceof Car) - { - Car car2 = (Car) obj; - return this.vinNumber.equals(car2.vinNumber); - } - else - { - return false; - } - } - - @Override - public int hashCode() { - return vinNumber.hashCode() + make.hashCode() + model.hashCode(); - } - -} diff --git a/CoreJava/src/com/training/java/core/equals/EqualsDemo.java b/CoreJava/src/com/training/java/core/equals/EqualsDemo.java deleted file mode 100644 index c04b014..0000000 --- a/CoreJava/src/com/training/java/core/equals/EqualsDemo.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.equals; - -public class EqualsDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - String firstName1 = new String("Fahmee"); - String firstName2 = new String("fahmee"); - - boolean equals = (firstName1.equals(firstName2)); - - System.out.println("Are objects equal? " + equals); - - - Car car1 = new Car("1234", "Ford", "Focus"); - Car car2 = new Car("8765", "Ford", "Focus"); - - boolean carsEqual = car1.equals("venkat"); - - System.out.println("Are these two cars equal? " + carsEqual); - - } - -} diff --git a/CoreJava/src/com/training/java/core/exceptions/CheckedExceptionExample.java b/CoreJava/src/com/training/java/core/exceptions/CheckedExceptionExample.java deleted file mode 100644 index 0455c17..0000000 --- a/CoreJava/src/com/training/java/core/exceptions/CheckedExceptionExample.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.training.java.core.exceptions; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - -public class CheckedExceptionExample { - - /** - * @param args - */ - public static void main(String[] args) { - - CheckedExceptionExample ce = new CheckedExceptionExample(); - ce.printStatesToFile(); - } - - private List getStates() - { - List states = new ArrayList(); - - states.add("MI"); - states.add("OH"); - - return states; - } - - private void printStatesToFile() - { - List states = getStates(); - - try { - PrintWriter out = new PrintWriter( - new FileWriter("C:\\states.txt")); - - for (int i = 0; i < states.size(); i++) { - out.println("State " + i + " = " + states.get(i)); - } - out.close(); - } catch (IOException e) { - //You are forced to catch the Exception here, since it is a checked Exception. - e.printStackTrace(); - } - - } -} diff --git a/CoreJava/src/com/training/java/core/exceptions/Exception1.java b/CoreJava/src/com/training/java/core/exceptions/Exception1.java deleted file mode 100644 index f9d8397..0000000 --- a/CoreJava/src/com/training/java/core/exceptions/Exception1.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.java.core.exceptions; - -public class Exception1 { - - /** - * @param args - */ - public static void main(String[] args) { - - try - { - System.out.println("First argument is " + args[0]); - } - catch(ArrayIndexOutOfBoundsException ex) - { - ex.printStackTrace(); - } - - System.out.println("Hello"); - System.out.println("How are "); - - } - -} diff --git a/CoreJava/src/com/training/java/core/exceptions/Exception2.java b/CoreJava/src/com/training/java/core/exceptions/Exception2.java deleted file mode 100644 index cf29375..0000000 --- a/CoreJava/src/com/training/java/core/exceptions/Exception2.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.java.core.exceptions; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -public class Exception2 { - - /** - * @param args - */ - public static void main(String[] args) { - - try { - FileWriter writer = new FileWriter("G:\\test.txt"); - PrintWriter out = new PrintWriter(writer); - - out.write("Hello \r"); - out.write(" How are you doing \r"); - out.write(" I am writing to a file for the first time..yahoo!!!"); - - out.close(); - - - } catch (IOException e) { - e.printStackTrace(); - } - - - - - - } - -} diff --git a/CoreJava/src/com/training/java/core/exceptions/Exception3.java b/CoreJava/src/com/training/java/core/exceptions/Exception3.java deleted file mode 100644 index 6e9c6cb..0000000 --- a/CoreJava/src/com/training/java/core/exceptions/Exception3.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.core.exceptions; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -public class Exception3 { - - public void print() throws IOException { - FileWriter writer = new FileWriter("G:\\test.txt"); - PrintWriter out = new PrintWriter(writer); - - out.write("Hello \r"); - out.write(" How are you doing \r"); - out.write(" I am writing to a file for the first time..yahoo!!!"); - - out.close(); - - } - -} diff --git a/CoreJava/src/com/training/java/core/exceptions/Exception3Client.java b/CoreJava/src/com/training/java/core/exceptions/Exception3Client.java deleted file mode 100644 index 5406573..0000000 --- a/CoreJava/src/com/training/java/core/exceptions/Exception3Client.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.java.core.exceptions; - -import java.io.IOException; - -public class Exception3Client { - - /** - * @param args - */ - public static void main(String[] args) { - - Exception3 exc = new Exception3(); - - try { - exc.print(); - } catch (IOException e) { - e.printStackTrace(); - } - - - - } - -} diff --git a/CoreJava/src/com/training/java/core/exceptions/FinallyDemo.java b/CoreJava/src/com/training/java/core/exceptions/FinallyDemo.java deleted file mode 100644 index 4ae805c..0000000 --- a/CoreJava/src/com/training/java/core/exceptions/FinallyDemo.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.core.exceptions; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -public class FinallyDemo { - - /** - * @param args - */ - public static void main(String[] args) { - PrintWriter out = null; - try { - FileWriter writer = new FileWriter("C:\\test.txt"); - out = new PrintWriter(writer); - - out.write("Hello \r"); - out.write(" How are you doing \r"); - out.write(" I am writing to a file for the first time..yahoo!!!"); - - out.close(); - - } catch (IOException e) { - e.printStackTrace(); - } finally { - if (out != null) { - out.close(); - } - } - } - -} diff --git a/CoreJava/src/com/training/java/core/exceptions/custom/InsufficientFundsException.java b/CoreJava/src/com/training/java/core/exceptions/custom/InsufficientFundsException.java deleted file mode 100644 index 67b3737..0000000 --- a/CoreJava/src/com/training/java/core/exceptions/custom/InsufficientFundsException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.core.exceptions.custom; - -public class InsufficientFundsException extends Exception -{ - public InsufficientFundsException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/CoreJava/src/com/training/java/core/exceptions/custom/MoneyTransfer.java b/CoreJava/src/com/training/java/core/exceptions/custom/MoneyTransfer.java deleted file mode 100644 index 3e9913d..0000000 --- a/CoreJava/src/com/training/java/core/exceptions/custom/MoneyTransfer.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.training.java.core.exceptions.custom; - -public class MoneyTransfer -{ - private double checkingAcctBalance; - private double savingsAcctBalance; - - public MoneyTransfer(double checkingAcctBalance, double savingsAcctBalance) - { - this.checkingAcctBalance = checkingAcctBalance; - this.savingsAcctBalance = savingsAcctBalance; - } - - public void transferMoney(double transferAmount) throws InsufficientFundsException - { - if(transferAmount > checkingAcctBalance) - { - throw new InsufficientFundsException("You don't have enough money to transfer"); - } - - checkingAcctBalance -= transferAmount; - savingsAcctBalance += transferAmount; - } - - public double getCheckingAcctBalance() - { - return checkingAcctBalance; - } - - public double getSavingsAcctBalance() - { - return savingsAcctBalance; - } -} diff --git a/CoreJava/src/com/training/java/core/exceptions/custom/MoneyTransferDemo.java b/CoreJava/src/com/training/java/core/exceptions/custom/MoneyTransferDemo.java deleted file mode 100644 index 9b0e848..0000000 --- a/CoreJava/src/com/training/java/core/exceptions/custom/MoneyTransferDemo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.java.core.exceptions.custom; - -public class MoneyTransferDemo -{ - - /** - * @param args - */ - public static void main(String[] args) - { - MoneyTransfer mt = new MoneyTransfer(5000.00, 5000.00); - try - { - mt.transferMoney(7500.00); - - System.out.println("Checking acct balance after transfer = " + mt.getCheckingAcctBalance()); - System.out.println("Savings acct balance after transfer = " + mt.getSavingsAcctBalance()); - } catch (InsufficientFundsException e) - { - System.out.println(e.getCause()); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/helloworld/HelloWorld.java b/CoreJava/src/com/training/java/core/helloworld/HelloWorld.java deleted file mode 100644 index b1b9a69..0000000 --- a/CoreJava/src/com/training/java/core/helloworld/HelloWorld.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.core.helloworld; - -/** - * The objective of this class is to just print Hello world to the console. - * @author Hari - * - */ -public class HelloWorld { - - /** - * @param args - */ - public static void main(String[] args) { - - System.out.println("Hello world"); - } - -} diff --git a/CoreJava/src/com/training/java/core/helloworld/HelloWorldWithArguments.java b/CoreJava/src/com/training/java/core/helloworld/HelloWorldWithArguments.java deleted file mode 100644 index c7d646d..0000000 --- a/CoreJava/src/com/training/java/core/helloworld/HelloWorldWithArguments.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.java.core.helloworld; - -/** - * This class expects the user of this program to enter his/her first and last - * name. It then wishes him/her with a personalized message. You can learn how - * to pass and read arguments to main method. - * - * @author Hari - * - */ -public class HelloWorldWithArguments { - - /** - * @param args - */ - public static void main(String[] args) { - - //Read the arguments that are passed to main method into variables. - String firstName = args[0]; - String lastName = args[1]; - - //Now, print a personalized Hello. Also realize how we use + operator to concatenate 2 Strings. - - System.out.println("Hello " + firstName + " " + lastName); - } -} diff --git a/CoreJava/src/com/training/java/core/inheritance/Animal.java b/CoreJava/src/com/training/java/core/inheritance/Animal.java deleted file mode 100644 index f4d04b3..0000000 --- a/CoreJava/src/com/training/java/core/inheritance/Animal.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.training.java.core.inheritance; - -public class Animal -{ - private static int animalNumber; - private int numberOfLegs; - private boolean tail; - private boolean horns; - private boolean wild; - private String color; - private int age; - private boolean veggie; - private boolean bite; - private boolean hungry; - private boolean distracted; - private String currentState; - - public Animal(int numberofLegs, boolean tail, boolean horns, boolean wild) - { - this.numberOfLegs = numberofLegs; - this.tail = tail; - this.horns = horns; - this.wild = wild; - animalNumber++; - } - public static int getAnimalCount() - { - return animalNumber; - } - - public void eat(String food) - { - System.out.println("I am eating " + food); - hungry = false; - } - - public void distract(String how) - { - System.out.println("Damn it, I got distracted by " + how); - distracted = true; - } - - public void sleep(int numberOfHours) - { - if (distracted) - { - System.out.println("I am distracted, so I can't sleep"); - } else - { - System.out.println("I am sleeping for " + numberOfHours + " hours"); - } - } - - public void run(int speed, int minutes) - { - System.out.println("I am running at " + speed + " miles per hour for " - + minutes + " minutes"); - currentState="Running"; - } - - public void makeSound() - { - System.out.println("I am making sound"); - } -} diff --git a/CoreJava/src/com/training/java/core/inheritance/AnimalDemo.java b/CoreJava/src/com/training/java/core/inheritance/AnimalDemo.java deleted file mode 100644 index 70ef205..0000000 --- a/CoreJava/src/com/training/java/core/inheritance/AnimalDemo.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.java.core.inheritance; - -public class AnimalDemo -{ - /** - * @param args. - */ - public static void main(String[] args) - { - //The most straight forward scenario - Animal a = new Animal(4,true,false,true); - a.eat("carrots"); - a.run(30, 10); - a.makeSound(); - - Dog tommy = new Dog(4,true,false,false,false); - tommy.eat("apple"); - tommy.run(100, 10); - tommy.makeSound(); - tommy.bark(); - - Bear b= new Bear(4,true,false,true, true, "Polar",false); - b.kill("deer"); - b.getInfo(); - - int count = Animal.getAnimalCount(); - System.out.println("number of animals " + count); - - } - -} diff --git a/CoreJava/src/com/training/java/core/inheritance/Bear.java b/CoreJava/src/com/training/java/core/inheritance/Bear.java deleted file mode 100644 index d25bbf4..0000000 --- a/CoreJava/src/com/training/java/core/inheritance/Bear.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.core.inheritance; - -public class Bear extends Animal -{ - private boolean killer; - private String kind; - private boolean trained; - - public Bear(int numberofLegs, boolean tail, boolean horns, boolean wild, - boolean killer, String kind, boolean trained) - { - super(numberofLegs, tail, horns, wild); - this.killer = killer; - this.kind = kind; - this.trained = trained; - } - - public void kill(String what) - { - System.out.println("I killed " + what); - } - - public void getInfo() - { - System.out.println("Killer = " + killer); - System.out.println("Kind = " + kind); - System.out.println("Trained = " + trained); - } -} diff --git a/CoreJava/src/com/training/java/core/inheritance/Car.java b/CoreJava/src/com/training/java/core/inheritance/Car.java deleted file mode 100644 index 41c8b54..0000000 --- a/CoreJava/src/com/training/java/core/inheritance/Car.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.training.java.core.inheritance; - -public class Car -{ - protected int currentSpeed; - private boolean started; - private String color; - - public Car() - { - } - - public Car(String color) - { - this.color = color; - } - - public void start() - { - System.out.println("Car is starting"); - started = true; - } - - public void stop() - { - System.out.println("Car is stopping"); - started = false; - } - - public void accelerate(int increaseMiles) - { - currentSpeed += increaseMiles; - } - - public void applyBrakes(int decreaseMiles) - { - currentSpeed -= decreaseMiles; - } - - public void printInformation() - { - System.out.println("The color is " + color); - System.out.println("The started flag is " + started); - System.out.println("Current speed = " + currentSpeed); - } -} diff --git a/CoreJava/src/com/training/java/core/inheritance/CarDemo.java b/CoreJava/src/com/training/java/core/inheritance/CarDemo.java deleted file mode 100644 index 927679e..0000000 --- a/CoreJava/src/com/training/java/core/inheritance/CarDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.core.inheritance; - -public class CarDemo -{ - - /** - * @param args - */ - public static void main(String[] args) - { - SportsCar car = new SportsCar(); - - car.start(); - car.accelerate(20); - car.applyBrakes(10); - car.printInformation(); - - car.nitro(); - car.printInformation(); - } - -} diff --git a/CoreJava/src/com/training/java/core/inheritance/Dog.java b/CoreJava/src/com/training/java/core/inheritance/Dog.java deleted file mode 100644 index fe9a50c..0000000 --- a/CoreJava/src/com/training/java/core/inheritance/Dog.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.core.inheritance; - -public class Dog extends Animal -{ - private boolean sniffer; - - public Dog(int numberofLegs, boolean tail, boolean horns, boolean wild, - boolean sniffer) - { - super(numberofLegs, tail, horns, wild); - this.sniffer = sniffer; - } - - public void bark() - { - System.out.println("Dog is barking"); - } -} diff --git a/CoreJava/src/com/training/java/core/inheritance/InheritanceDemo.java b/CoreJava/src/com/training/java/core/inheritance/InheritanceDemo.java deleted file mode 100644 index 4a170f7..0000000 --- a/CoreJava/src/com/training/java/core/inheritance/InheritanceDemo.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright © Flagstar Bank 2011. - * - * Copyright in the application source code, and in the information and - * material therein and in their arrangement, is owned by Flagstar Bank, FSB - * unless otherwise indicated. - * - * You shall not remove or obscure any copyright, trademark or other notices. - * You may not copy, republish, redistribute, transmit, participate in the - * transmission of, create derivatives of, alter edit or exploit in any - * manner any material including by storage on retrieval systems, without the - * express written permission of Flagstar Bank. - */ - -package com.training.java.core.inheritance; - -/** - * CarDemo. - * - * @author Venkata Hari - */ - -public class InheritanceDemo -{ - public static void main(String[] args) - { - // Car can call all of his methods, no surprise - Car aCar = new Car(); - - System.out.println("************Car BEGIN*************"); - aCar.start(); - aCar.accelerate(50); - aCar.applyBrakes(10); - aCar.printInformation(); - aCar.stop(); - System.out.println("************Car END*************"); - System.out.println(); - - // Now, we will instantiate PoliceCar and we will be able to call all the methods from Car without duplicating - // the code into PoliceCar - PoliceCar aPoliceCar = new PoliceCar(); - - System.out.println("************PoliceCar BEGIN*************"); - aPoliceCar.start(); - aPoliceCar.accelerate(90); - aPoliceCar.applyBrakes(40); - aPoliceCar.accelerate(20); - aPoliceCar.turnOnSiren(); - aPoliceCar.turnOnLedLights(); - aPoliceCar.printInformation(); - aPoliceCar.stop(); - System.out.println("************PoliceCar BEGIN*************"); - } - -} diff --git a/CoreJava/src/com/training/java/core/inheritance/PoliceCar.java b/CoreJava/src/com/training/java/core/inheritance/PoliceCar.java deleted file mode 100644 index 09a5f72..0000000 --- a/CoreJava/src/com/training/java/core/inheritance/PoliceCar.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright © Flagstar Bank 2011. - * - * Copyright in the application source code, and in the information and - * material therein and in their arrangement, is owned by Flagstar Bank, FSB - * unless otherwise indicated. - * - * You shall not remove or obscure any copyright, trademark or other notices. - * You may not copy, republish, redistribute, transmit, participate in the - * transmission of, create derivatives of, alter edit or exploit in any - * manner any material including by storage on retrieval systems, without the - * express written permission of Flagstar Bank. - */ - -package com.training.java.core.inheritance; - -/** - * PoliceCar. - * - * @author Venkata Hari - */ - -public class PoliceCar extends Car -{ - private boolean sirenOn; - private boolean ledLightsOn; - - public void turnOnSiren() - { - System.out.println("Turning on siren for PoliceCar"); - sirenOn = true; - } - - public void turnOffSiren() - { - System.out.println("Turning off siren for PoliceCar"); - sirenOn = false; - } - - public void turnOnLedLights() - { - System.out.println("Turning on LED lights for PoliceCar"); - ledLightsOn = true; - } - - public void turnOffLedLights() - { - System.out.println("Turning off LED lights for PoliceCar"); - ledLightsOn = false; - } -} diff --git a/CoreJava/src/com/training/java/core/inheritance/SportsCar.java b/CoreJava/src/com/training/java/core/inheritance/SportsCar.java deleted file mode 100644 index 3c33bd9..0000000 --- a/CoreJava/src/com/training/java/core/inheritance/SportsCar.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.training.java.core.inheritance; - -public class SportsCar extends Car -{ - public void nitro() - { - System.out.println("Nitro has been turned on.."); - currentSpeed += 100; - } - -} diff --git a/CoreJava/src/com/training/java/core/interfaces/Car.java b/CoreJava/src/com/training/java/core/interfaces/Car.java deleted file mode 100644 index 3d2ad36..0000000 --- a/CoreJava/src/com/training/java/core/interfaces/Car.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.core.interfaces; - -public class Car implements Vehicle -{ - public void drive() - { - System.out.println("Car is driving.."); - } - - public void start() { - System.out.println("Car is starting.."); - } - - public void stop() { - System.out.println("Car is stopping.."); - } -} diff --git a/CoreJava/src/com/training/java/core/interfaces/InterfaceDemo.java b/CoreJava/src/com/training/java/core/interfaces/InterfaceDemo.java deleted file mode 100644 index 89e4322..0000000 --- a/CoreJava/src/com/training/java/core/interfaces/InterfaceDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.core.interfaces; - -public class InterfaceDemo -{ - - /** - * @param args - */ - public static void main(String[] args) - { - Vehicle car = new Car(); - car.start(); - car.drive(); - car.stop(); - } - -} diff --git a/CoreJava/src/com/training/java/core/interfaces/Vehicle.java b/CoreJava/src/com/training/java/core/interfaces/Vehicle.java deleted file mode 100644 index 6901b18..0000000 --- a/CoreJava/src/com/training/java/core/interfaces/Vehicle.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.interfaces; - -/** - * In the interface example, we think starting, stopping and driving a vehicle - * is entirely different in each vehicle. So we don't give any concrete any - * implementation in Vehicle. We design it as an interface and in interface all - * methods are by default abstract. Also, we don't need to declare them as - * abstract. Car and other vehicles can implement these abstract methods and - * give their implementation. - * - * @author Hari - * - */ -public interface Vehicle { - void start(); - - void stop(); - - void drive(); -} diff --git a/CoreJava/src/com/training/java/core/interfaces2/Car.java b/CoreJava/src/com/training/java/core/interfaces2/Car.java deleted file mode 100644 index 2a14a61..0000000 --- a/CoreJava/src/com/training/java/core/interfaces2/Car.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.core.interfaces2; - -public interface Car { - - void start(); - void stop(); - void drive(); - -} diff --git a/CoreJava/src/com/training/java/core/interfaces2/InterfaceDemo.java b/CoreJava/src/com/training/java/core/interfaces2/InterfaceDemo.java deleted file mode 100644 index 438b77b..0000000 --- a/CoreJava/src/com/training/java/core/interfaces2/InterfaceDemo.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.core.interfaces2; - -public class InterfaceDemo { - - /** - * @param args - */ - public static void main(String[] args) { - Car car = new RaceCar(); - - car.start(); - car.drive(); - car.stop(); - } - -} diff --git a/CoreJava/src/com/training/java/core/interfaces2/PoliceCar.java b/CoreJava/src/com/training/java/core/interfaces2/PoliceCar.java deleted file mode 100644 index 509fb02..0000000 --- a/CoreJava/src/com/training/java/core/interfaces2/PoliceCar.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.core.interfaces2; - -public class PoliceCar implements Car { - - @Override - public void start() { - System.out.println("PoliceCar is starting"); - } - - @Override - public void stop() { - System.out.println("PoliceCar is stopping"); - - } - - @Override - public void drive() { - System.out.println("PoliceCar is driving"); - } - -} diff --git a/CoreJava/src/com/training/java/core/interfaces2/RaceCar.java b/CoreJava/src/com/training/java/core/interfaces2/RaceCar.java deleted file mode 100644 index f275ff0..0000000 --- a/CoreJava/src/com/training/java/core/interfaces2/RaceCar.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.interfaces2; - -public class RaceCar implements Car { - - @Override - public void start() { - System.out.println("Race car is starting"); - } - - @Override - public void stop() { - System.out.println("Race car is stopping"); - } - - @Override - public void drive() { - System.out.println("Race car is driving..zoom zoom.."); - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/BoxingDemo.java b/CoreJava/src/com/training/java/core/jdk15/BoxingDemo.java deleted file mode 100644 index 8d070bf..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/BoxingDemo.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.java.core.jdk15; - -import java.util.ArrayList; -import java.util.List; - -public class BoxingDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - List ages = new ArrayList(); - - ////Compiler boxed int primitives into Integer objects - ages.add(23); - ages.add(22); - ages.add(28); - - int[] ageArray = new int[3]; - - for(int i=0; i List toList(T[] array) - { - List list = new ArrayList(); - - for(T current : array) - { - list.add(current); - } - - return list; - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/ListsTest.java b/CoreJava/src/com/training/java/core/jdk15/ListsTest.java deleted file mode 100644 index 15e77a9..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/ListsTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.core.jdk15; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.List; - -import org.junit.Test; - -public class ListsTest { - - @Test - public void testToList() { - String[] names = {"Venkat", "Jiten", "Manpreet"}; - - Lists l = new Lists(); - List namesList = l.toList(names); - - assertNotNull(namesList); - assertEquals(names.length, namesList.size()); - - for(String aName : namesList) - { - System.out.println("aName = " + aName); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/SampleTestClass1.java b/CoreJava/src/com/training/java/core/jdk15/SampleTestClass1.java deleted file mode 100644 index 3ace191..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/SampleTestClass1.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.core.jdk15; - -public class SampleTestClass1 { - - @Test - public void testPrint() - { - System.out.println("Hello"); - } - - public void testMethod2() - { - System.out.println("test method2"); - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/Test.java b/CoreJava/src/com/training/java/core/jdk15/Test.java deleted file mode 100644 index 97fcb1e..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/Test.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.core.jdk15; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface Test { - - - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/TestRunner.java b/CoreJava/src/com/training/java/core/jdk15/TestRunner.java deleted file mode 100644 index 1de86b1..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/TestRunner.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.jdk15; - -import java.lang.reflect.Method; - -public class TestRunner { - - /** - * @param args - * @throws Exception - */ - public static void main(String[] args) throws Exception { - - Class className = Class.forName("com.training.java.core.jdk15.SampleTestClass1"); - - Method[] methods = className.getDeclaredMethods(); - - for(Method aMethod : methods) - { - if(aMethod.getAnnotation(Test.class) != null) - { - System.out.println("Annotation exists on method " + aMethod.getName()); - } - else - { - System.out.println("Annotation does NOT exist on method " + aMethod.getName()); - } - } - - - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/VarArgsDemo.java b/CoreJava/src/com/training/java/core/jdk15/VarArgsDemo.java deleted file mode 100644 index 661867e..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/VarArgsDemo.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.jdk15; - - -public class VarArgsDemo { - - public void print(String city, String... names) - { - for(String eachName : names) - { - System.out.println("each name = " + eachName); - } - } - - public static void main(String[] args) { - VarArgsDemo demo = new VarArgsDemo(); - - demo.print("Troy", "Rinku", "Ronnie", "Yousuf", "Sasi"); - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/AutoBoxingDemo.java b/CoreJava/src/com/training/java/core/jdk15/two/AutoBoxingDemo.java deleted file mode 100644 index 8b7ff29..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/AutoBoxingDemo.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.jdk15.two; - -import java.util.ArrayList; -import java.util.List; - -public class AutoBoxingDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - List ages = new ArrayList(); - ages.add(24); - ages.add(32); - ages.add(56); - - int[] primitiveAges = new int[3]; - - for(int i=0; i< ages.size(); i++) - { - primitiveAges[i] = ages.get(i); - } - - for(int i=0; i< primitiveAges.length; i++) - { - System.out.println("Age = " + primitiveAges[i]); - } - - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/Calculator.java b/CoreJava/src/com/training/java/core/jdk15/two/Calculator.java deleted file mode 100644 index b3f6adb..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/Calculator.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.core.jdk15.two; - -public class Calculator { - - public double add(double i, double j) { - return i+j; - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/CalculatorTest.java b/CoreJava/src/com/training/java/core/jdk15/two/CalculatorTest.java deleted file mode 100644 index 0e8e8e6..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/CalculatorTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.java.core.jdk15.two; - -import static junit.framework.Assert.assertEquals; - -public class CalculatorTest { - - @CustomTest(enabled="true") - public void testAdd() - { - Calculator c = new Calculator(); - int result = (int) c.add(5, 3); - - assertEquals(8, result); - - System.out.println("Result = " + result); - } - - @CustomTest(enabled="true") - public void testSub() - { - - } - - public void testMultiply() - { - - } - - @CustomTest(enabled="true") - public void testDivide() - { - - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/Calendar.java b/CoreJava/src/com/training/java/core/jdk15/two/Calendar.java deleted file mode 100644 index 51b23f9..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/Calendar.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.training.java.core.jdk15.two; - -public class Calendar { - - public static String getDescriptiveDayOfWeek(DayOfWeek dayOfWeek) - { - if(dayOfWeek == DayOfWeek.MONDAY) - { - return "Monday"; - } - else if(dayOfWeek == DayOfWeek.TUESDAY) - { - return "Tuesday"; - } - else if(dayOfWeek == DayOfWeek.WEDNESDAY) - { - return "Wed"; - } - else if(dayOfWeek == DayOfWeek.THURSDAY) - { - return "Thu"; - } - else if(dayOfWeek == DayOfWeek.FRIDAY) - { - return "Fri"; - } - else if(dayOfWeek == DayOfWeek.SATURDAY) - { - return "Sat"; - } - else - { - return "Sunday"; - } - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/CalendarClient.java b/CoreJava/src/com/training/java/core/jdk15/two/CalendarClient.java deleted file mode 100644 index 6d70a47..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/CalendarClient.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.core.jdk15.two; - -public class CalendarClient { - - /** - * @param args - */ - public static void main(String[] args) { - String day = Calendar.getDescriptiveDayOfWeek(DayOfWeek.TUESDAY); - System.out.println("day of week = " + day); - - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/Car.java b/CoreJava/src/com/training/java/core/jdk15/two/Car.java deleted file mode 100644 index d31bff7..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/Car.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.core.jdk15.two; - -public interface Car { - - abstract void start(); - abstract void stop(); - abstract void drive(); - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/CustomTest.java b/CoreJava/src/com/training/java/core/jdk15/two/CustomTest.java deleted file mode 100644 index 605c81d..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/CustomTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.core.jdk15.two; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface CustomTest { - - String enabled(); - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/CustomTestFramework.java b/CoreJava/src/com/training/java/core/jdk15/two/CustomTestFramework.java deleted file mode 100644 index fd2ff8e..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/CustomTestFramework.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.java.core.jdk15.two; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -public class CustomTestFramework { - - /** - * @param args - * @throws ClassNotFoundException - */ - public static void main(String[] args) throws ClassNotFoundException { - - Class clazz = Class.forName(args[0]); - - Field[] fields = clazz.getDeclaredFields(); - - - - Method[] methods = clazz.getDeclaredMethods(); - for(Method method : methods) - { - if (method.getAnnotation(CustomTest.class) != null) - { - System.out.println("Yes, I found the test case, and its name = " + method.getName()); - } - } - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/DayOfWeek.java b/CoreJava/src/com/training/java/core/jdk15/two/DayOfWeek.java deleted file mode 100644 index f29eee9..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/DayOfWeek.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.core.jdk15.two; - -public enum DayOfWeek { - SUNDAY, - MONDAY, - TUESDAY, - WEDNESDAY, - THURSDAY, - FRIDAY, - SATURDAY; -} - - diff --git a/CoreJava/src/com/training/java/core/jdk15/two/ForEachDemo.java b/CoreJava/src/com/training/java/core/jdk15/two/ForEachDemo.java deleted file mode 100644 index ebffeac..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/ForEachDemo.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.jdk15.two; - -import java.util.ArrayList; -import java.util.Collection; - -public class ForEachDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Collection names = new ArrayList(); - names.add("Ankita"); - names.add("Gunjan"); - names.add("Kulsoom"); - - for(String name : names) - { - System.out.println("Name = " + name); - } - - //For each loop with Array - String[] days = {"Monday", "Tuesday"}; - - for(String day : days) - { - System.out.println("Day = " + day); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/Lists.java b/CoreJava/src/com/training/java/core/jdk15/two/Lists.java deleted file mode 100644 index 33fe754..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/Lists.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.jdk15.two; - -import java.util.ArrayList; -import java.util.List; - -public class Lists { - - public static List toList(T... elements) - { - List list = new ArrayList(); - - for(T anElement : elements) - { - list.add(anElement); - } - - return list; - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/ListsDemo.java b/CoreJava/src/com/training/java/core/jdk15/two/ListsDemo.java deleted file mode 100644 index db68782..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/ListsDemo.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.java.core.jdk15.two; - -import java.util.Arrays; -import java.util.List; - - -public class ListsDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Car car1 = new PoliceCar(); - Car car2 = new PoliceCar(); - Car car3 = new PoliceCar(); - - List carsList = Arrays.asList(car1, car2, car3); - - for(Car aCar : carsList) - { - aCar.drive(); - } - - List namesList = Arrays.asList("Leanid", "Ankita", "Sheeba"); - for(String name : namesList) - { - System.out.println("Name = " + name); - } - } -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/OldStyleLists.java b/CoreJava/src/com/training/java/core/jdk15/two/OldStyleLists.java deleted file mode 100644 index 263d515..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/OldStyleLists.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.jdk15.two; - -import java.util.ArrayList; -import java.util.List; - -public class OldStyleLists { - - public static List toList(Object[] elements) - { - List list = new ArrayList(); - - for(Object obj : elements) - { - list.add(obj); - } - - return list; - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/OldStyleListsDemo.java b/CoreJava/src/com/training/java/core/jdk15/two/OldStyleListsDemo.java deleted file mode 100644 index 91566fb..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/OldStyleListsDemo.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.core.jdk15.two; - -import java.util.Iterator; -import java.util.List; - -public class OldStyleListsDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - String[] names = {"Tom", "Leanid", "Gunjan"}; - - Car car1 = new PoliceCar(); - Car car2 = new PoliceCar(); - Car car3 = new PoliceCar(); - - Car[] cars = {car1, car2, car3}; - - List namesList = OldStyleLists.toList(cars); - - Iterator ite = namesList.iterator(); - while(ite.hasNext()) - { - String name = (String) ite.next(); - System.out.println("Name = " + name); - } - - - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/PoliceCar.java b/CoreJava/src/com/training/java/core/jdk15/two/PoliceCar.java deleted file mode 100644 index ce5a288..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/PoliceCar.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.core.jdk15.two; - -public class PoliceCar implements Car { - - @Override - public void start() { - System.out.println("PoliceCae starts"); - - for(int i=0; i<10; i++) - { - System.out.println("I am inside for loop"); - } - } - - @Override - public void stop() { - System.out.println("PoliceCae stops"); - } - - @Override - public void drive() { - System.out.println("PoliceCae drives"); - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/ReflectionDemo.java b/CoreJava/src/com/training/java/core/jdk15/two/ReflectionDemo.java deleted file mode 100644 index d20d158..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/ReflectionDemo.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.jdk15.two; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; - -public class ReflectionDemo { - - /** - * @param args - * @throws ClassNotFoundException - */ - public static void main(String[] args) throws ClassNotFoundException { - - String className = "java.util.ArrayList"; - - Class clazz = Class.forName(className); - - Method[] methods = clazz.getDeclaredMethods(); - for(Method method : methods) - { - System.out.println("Method name = " + method.getName()); - } - - Constructor[] constructors = clazz.getDeclaredConstructors(); - for(Constructor c : constructors) - { - System.out.println("Name = " + c.getName()); - } - - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/State.java b/CoreJava/src/com/training/java/core/jdk15/two/State.java deleted file mode 100644 index f3aba53..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/State.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.core.jdk15.two; - -public enum State { - - MICHIGAN("Michigan", "MI"), - OHIO("Ohio", "OH"), - VIRGINIA("Virginia", "VA"), - DC("DC", "DC"), - TEXAS("Texas", "TX"); - - private String name; - private String stateCode; - private State(String name, String stateCode) - { - this.name = name; - this.stateCode = stateCode; - } - - public String getName() - { - return name; - } - - public String getStateCode() - { - return stateCode; - } -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/StateDescriptorClient.java b/CoreJava/src/com/training/java/core/jdk15/two/StateDescriptorClient.java deleted file mode 100644 index ffc5ab3..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/StateDescriptorClient.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.java.core.jdk15.two; - -public class StateDescriptorClient { - - /** - * @param args - */ - public static void main(String[] args) { - System.out.println("name = " + State.TEXAS.getName()); - } - -} diff --git a/CoreJava/src/com/training/java/core/jdk15/two/VarArgsDemo.java b/CoreJava/src/com/training/java/core/jdk15/two/VarArgsDemo.java deleted file mode 100644 index 0128f50..0000000 --- a/CoreJava/src/com/training/java/core/jdk15/two/VarArgsDemo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.core.jdk15.two; - -public class VarArgsDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - printNames("Sheeba", "Nanda", "Mira", "Leanid", "Gunan", "Fahmee", "Alam"); - printAges(23, 56, 43, 24); - } - - private static void printAges(int...ages) { - for(int age : ages) - { - System.out.println("Age = " + age); - } - } - - public static void printNames(String type, String age, String... names) - { - for(String name : names) - { - System.out.println("Name = " + name); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/lang/ImmutabilityDemo.java b/CoreJava/src/com/training/java/core/lang/ImmutabilityDemo.java deleted file mode 100644 index 1f370cf..0000000 --- a/CoreJava/src/com/training/java/core/lang/ImmutabilityDemo.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.java.core.lang; - -public class ImmutabilityDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Person sasi = new Person("Sasikala", "RajKumar", 20, "Troy"); - - sasi.setAge(25); - sasi.setCity("Rochester"); - - System.out.println(sasi.getFirstName() + ", " + sasi.getLastName() - + ", " + sasi.getAge() + ", " + sasi.getCity()); - - Person immutableSasi = new Person("Sasikala", "RajKumar", 20, "Troy"); - - System.out.println(immutableSasi.getFirstName() + ", " - + immutableSasi.getLastName() + ", " + immutableSasi.getAge() - + ", " + immutableSasi.getCity()); - - } - -} diff --git a/CoreJava/src/com/training/java/core/lang/ImmutablePerson.java b/CoreJava/src/com/training/java/core/lang/ImmutablePerson.java deleted file mode 100644 index c5c306d..0000000 --- a/CoreJava/src/com/training/java/core/lang/ImmutablePerson.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.core.lang; - -public class ImmutablePerson { - - private String firstName; - private String lastName; - private int age; - private String city; - - public ImmutablePerson(String firstName, String lastName, int age, String city) - { - this.firstName = firstName; - this.lastName = lastName; - this.age = age; - this.city = city; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public int getAge() { - return age; - } - - public String getCity() { - return city; - } -} diff --git a/CoreJava/src/com/training/java/core/lang/Person.java b/CoreJava/src/com/training/java/core/lang/Person.java deleted file mode 100644 index 35ebe98..0000000 --- a/CoreJava/src/com/training/java/core/lang/Person.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.training.java.core.lang; - -public final class Person { - - private String firstName; - private String lastName; - private int age; - private String city; - - public Person(String firstName, String lastName, int age, String city) - { - this.firstName = firstName; - this.lastName = lastName; - this.age = age; - this.city = city; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - -} diff --git a/CoreJava/src/com/training/java/core/lang/StringBufferDemo.java b/CoreJava/src/com/training/java/core/lang/StringBufferDemo.java deleted file mode 100644 index 1ec2784..0000000 --- a/CoreJava/src/com/training/java/core/lang/StringBufferDemo.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.java.core.lang; - -public class StringBufferDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - StringBuffer name = new StringBuffer(); - - name.append("Venkat"); - name.append(" Hari"); - - System.out.println(name.toString()); - - } - -} diff --git a/CoreJava/src/com/training/java/core/lang/StringBuilderDemo.java b/CoreJava/src/com/training/java/core/lang/StringBuilderDemo.java deleted file mode 100644 index 6efa680..0000000 --- a/CoreJava/src/com/training/java/core/lang/StringBuilderDemo.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.java.core.lang; - -public class StringBuilderDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - StringBuilder name = new StringBuilder(); - - name.append("Venkat"); - name.append(" Hari"); - - - System.out.println("name = " + name); - } - -} diff --git a/CoreJava/src/com/training/java/core/lang/StringDemo.java b/CoreJava/src/com/training/java/core/lang/StringDemo.java deleted file mode 100644 index 3a5b335..0000000 --- a/CoreJava/src/com/training/java/core/lang/StringDemo.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.core.lang; - -public class StringDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - String name = "Venkat"; - name = name.replace('V', 'K'); - - System.out.println("name = " + name); - } - -} diff --git a/CoreJava/src/com/training/java/core/oop/basic/Car.java b/CoreJava/src/com/training/java/core/oop/basic/Car.java deleted file mode 100644 index d66bcf3..0000000 --- a/CoreJava/src/com/training/java/core/oop/basic/Car.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.training.java.core.oop.basic; - -/** - * Every object has state and behavior. Object stores its state in fields - * (variables). Remember, this is a class (blue print) not an actual instance - * (object). So creating an actual instance of this class is not this classes's - * job. Also this class doesn't have main method, so you cannot run (execute) - * this class. - * - * @author Hari - * - */ -public class Car { - - // Car stores its state in fields..these are all state information. - int currentSpeed = 0; - boolean started = false; - - // Behaviors are methods..See how behaviors (methods) change the state - // (fields). - - void speedUp(int increment) { - currentSpeed = currentSpeed + increment; - } - - void applyBrakes(int decrement) { - currentSpeed = currentSpeed - decrement; - } - - void start() { - started = true; - } - - void stop() { - started = false; - currentSpeed = 0; - } - - void printInfo() { - System.out.println("Car started = " + started); - System.out.println("Current speed = " + currentSpeed); - } -} diff --git a/CoreJava/src/com/training/java/core/oop/basic/CarDemo.java b/CoreJava/src/com/training/java/core/oop/basic/CarDemo.java deleted file mode 100644 index 0d58552..0000000 --- a/CoreJava/src/com/training/java/core/oop/basic/CarDemo.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.training.java.core.oop.basic; - -/** - * This class will create the actual instances (objects) of Car class. Since - * this class has main method, we can run (execute) it. - * - * @author Hari - * - */ -public class CarDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - //Create a car - Car car1 = new Car(); - - //Start the car, speed up to 20 mph and then print the information - car1.start(); - car1.speedUp(20); - car1.printInfo(); - - //Apply brakes by 5 mph and print the information - car1.applyBrakes(5); - car1.printInfo(); - - //Stop the car now and print the information - car1.stop(); - car1.printInfo(); - } - -} diff --git a/CoreJava/src/com/training/java/core/operators/ArithmeticDemo.java b/CoreJava/src/com/training/java/core/operators/ArithmeticDemo.java deleted file mode 100644 index 2f0ab83..0000000 --- a/CoreJava/src/com/training/java/core/operators/ArithmeticDemo.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.core.operators; - -class ArithmeticDemo { - - public static void main(String[] args) { - - int result = 1 + 2; // result is now 3 - System.out.println(result); - - result = result - 1; // result is now 2 - System.out.println(result); - - result = result * 2; // result is now 4 - System.out.println(result); - - result = result / 2; // result is now 2 - System.out.println(result); - - result = result + 8; // result is now 10 - result = result % 7; // result is now 3 - System.out.println(result); - } -} diff --git a/CoreJava/src/com/training/java/core/operators/CompaarisionDemo.java b/CoreJava/src/com/training/java/core/operators/CompaarisionDemo.java deleted file mode 100644 index a215e75..0000000 --- a/CoreJava/src/com/training/java/core/operators/CompaarisionDemo.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.operators; - -/** - * Very straight forward example. The only thing that needs to be observed here - * is to use "==" for equality, not "=". "=" is an assignment operator that is - * used to assign value to a variable. - * - * @author Hari - * - */ -class ComparisonDemo { - - public static void main(String[] args) { - int value1 = 1; - int value2 = 2; - - if (value1 == value2) - System.out.println("value1 == value2"); - - if (value1 != value2) - System.out.println("value1 != value2"); - - if (value1 > value2) - System.out.println("value1 > value2"); - - if (value1 < value2) - System.out.println("value1 < value2"); - - if (value1 <= value2) - System.out.println("value1 <= value2"); - } -} diff --git a/CoreJava/src/com/training/java/core/operators/ConcatenationDemo.java b/CoreJava/src/com/training/java/core/operators/ConcatenationDemo.java deleted file mode 100644 index c449a83..0000000 --- a/CoreJava/src/com/training/java/core/operators/ConcatenationDemo.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.java.core.operators; - -/** - * The + operator can also be used for concatenating (joining) two strings - * together, as shown in this example. - * - * @author Hari - * - */ -public class ConcatenationDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - String firstPart = "Any intelligent fool can make things bigger, more complex, and more violent."; - String secondPart = "It takes a touch of genius -- and a lot of courage -- "; - String thirdPart = "to move in the opposite direction."; - String fourthPart = " - Albert Einstein"; - - String totalQuote = firstPart + secondPart + thirdPart + fourthPart; - System.out.println(totalQuote); - } - -} diff --git a/CoreJava/src/com/training/java/core/operators/ConditionalDemo.java b/CoreJava/src/com/training/java/core/operators/ConditionalDemo.java deleted file mode 100644 index ec1e1c1..0000000 --- a/CoreJava/src/com/training/java/core/operators/ConditionalDemo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.java.core.operators; - -/** - * The && and || operators perform Conditional-AND and Conditional-OR operations - * on two boolean expressions. These operators exhibit "short-circuiting" - * behavior, which means that the second operand is evaluated only if needed. - * - * @author Hari - * - */ -class ConditionalDemo { - - public static void main(String[] args) { - - int value1 = 1; - int value2 = 2; - - if ((value1 == 1) && (value2 == 2)) - System.out.println("value1 is 1 AND value2 is 2"); - - if ((value1 == 1) || (value2 == 1)) - System.out.println("value1 is 1 OR value2 is 1"); - } -} diff --git a/CoreJava/src/com/training/java/core/operators/TernaryOperatorDemo.java b/CoreJava/src/com/training/java/core/operators/TernaryOperatorDemo.java deleted file mode 100644 index f85aef6..0000000 --- a/CoreJava/src/com/training/java/core/operators/TernaryOperatorDemo.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.operators; - -/** - * Another conditional operator is ?:, which can be thought of as shorthand for - * an if-then-else statement. This operator is also known as the ternary - * operator because it uses three operands. In the following example, this - * operator should be read as: - * "If someCondition is true, assign the value of value1 to result. Otherwise, assign the value of value2 to result." - * - * @author Hari - * - */ -public class TernaryOperatorDemo { - - public static void main(String[] args) { - - int value1 = 1; - int value2 = 2; - int result; - - boolean someCondition = true; - result = someCondition ? value1 : value2; - - System.out.println(result); - - } -} diff --git a/CoreJava/src/com/training/java/core/operators/readme.txt b/CoreJava/src/com/training/java/core/operators/readme.txt deleted file mode 100644 index 243cf9a..0000000 --- a/CoreJava/src/com/training/java/core/operators/readme.txt +++ /dev/null @@ -1,42 +0,0 @@ -Summary of Operators - -The following quick reference summarizes the operators supported by the Java programming language. -Simple Assignment Operator - -= Simple assignment operator - -Arithmetic Operators - -+ Additive operator (also used for String concatenation) -- Subtraction operator -* Multiplication operator -/ Division operator -% Remainder operator - -Unary Operators - -+ Unary plus operator; indicates positive value (numbers are positive without this, however) -- Unary minus operator; negates an expression -++ Increment operator; increments a value by 1 --- Decrement operator; decrements a value by 1 -! Logical complement operator; inverts the value of a boolean - -Equality and Relational Operators - -== Equal to -!= Not equal to -> Greater than ->= Greater than or equal to -< Less than -<= Less than or equal to - -Conditional Operators - -&& Conditional-AND -|| Conditional-OR -?: Ternary (shorthand for if-then-else statement) - -Type Comparison Operator - -instanceof Compares an object to a specified type - diff --git a/CoreJava/src/com/training/java/core/overloading/DataArtist.java b/CoreJava/src/com/training/java/core/overloading/DataArtist.java deleted file mode 100644 index cf48ea6..0000000 --- a/CoreJava/src/com/training/java/core/overloading/DataArtist.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright © Flagstar Bank 2011. - * - * Copyright in the application source code, and in the information and - * material therein and in their arrangement, is owned by Flagstar Bank, FSB - * unless otherwise indicated. - * - * You shall not remove or obscure any copyright, trademark or other notices. - * You may not copy, republish, redistribute, transmit, participate in the - * transmission of, create derivatives of, alter edit or exploit in any - * manner any material including by storage on retrieval systems, without the - * express written permission of Flagstar Bank. - */ - -package com.training.java.core.overloading; - -/** - * This data artist draws various shapes, given the parameters. - * - * @author Venkata Hari - */ - -public class DataArtist -{ - /** - * Drawing a Square. - * - * @param lengthOfSide - */ - public void draw(double lengthOfSide) - { - System.out.println("Drawing a square using length of side"); - } - -} diff --git a/CoreJava/src/com/training/java/core/overriding/Animal.java b/CoreJava/src/com/training/java/core/overriding/Animal.java deleted file mode 100644 index 4345974..0000000 --- a/CoreJava/src/com/training/java/core/overriding/Animal.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.training.java.core.overriding; - -public class Animal -{ - private static int animalNumber; - private int numberOfLegs; - private boolean tail; - private boolean horns; - private boolean wild; - private String color; - private int age; - private boolean veggie; - private boolean bite; - protected boolean hungry; - private boolean distracted; - private String currentState; - - public Animal(int numberofLegs, boolean tail, boolean horns, boolean wild) - { - this.numberOfLegs = numberofLegs; - this.tail = tail; - this.horns = horns; - this.wild = wild; - animalNumber++; - } - public static int getAnimalCount() - { - return animalNumber; - } - - public void eat(String food) - { - System.out.println("I am eating " + food); - hungry = false; - } - - public void distract(String how) - { - System.out.println("Damn it, I got distracted by " + how); - distracted = true; - } - - public void sleep(int numberOfHours) - { - if (distracted) - { - System.out.println("I am distracted, so I can't sleep"); - } else - { - System.out.println("I am sleeping for " + numberOfHours + " hours"); - } - } - - public void run(int speed, int minutes) - { - System.out.println("I am running at " + speed + " miles per hour for " - + minutes + " minutes"); - currentState="Running"; - } - - public void makeSound() - { - System.out.println("I am making sound"); - } -} diff --git a/CoreJava/src/com/training/java/core/overriding/AnimalDemo.java b/CoreJava/src/com/training/java/core/overriding/AnimalDemo.java deleted file mode 100644 index 95e9577..0000000 --- a/CoreJava/src/com/training/java/core/overriding/AnimalDemo.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.overriding; - -public class AnimalDemo -{ - /** - * @param args. - */ - public static void main(String[] args) - { - //The most straight forward scenario - Animal a = new Animal(4,true,false,true); - a.eat("carrots"); - a.run(30, 10); - a.makeSound(); - - Dog tommy = new Dog(4,true,false,false,false); - tommy.eat("apple"); - tommy.run(100, 10); - tommy.makeSound(); - tommy.bark(); - - Bear b= new Bear(4,true,false,true, true, "Polar",false); - b.eat("honey"); - b.kill("deer"); - b.getInfo(); - - int count = Animal.getAnimalCount(); - System.out.println("number of animals " + count); - - } - -} diff --git a/CoreJava/src/com/training/java/core/overriding/Bear.java b/CoreJava/src/com/training/java/core/overriding/Bear.java deleted file mode 100644 index 33f8a9d..0000000 --- a/CoreJava/src/com/training/java/core/overriding/Bear.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.java.core.overriding; - -public class Bear extends Animal -{ - private boolean killer; - private String kind; - private boolean trained; - - public Bear(int numberofLegs, boolean tail, boolean horns, boolean wild, - boolean killer, String kind, boolean trained) - { - super(numberofLegs, tail, horns, wild); - this.killer = killer; - this.kind = kind; - this.trained = trained; - } - - public void kill(String what) - { - System.out.println("I killed " + what); - } - - public void eat(String food) - { - System.out.println("I am Bear, eating " + food + " differently, not like others."); - hungry = true; - } - - public void getInfo() - { - System.out.println("Killer = " + killer); - System.out.println("Kind = " + kind); - System.out.println("Trained = " + trained); - } -} diff --git a/CoreJava/src/com/training/java/core/overriding/Dog.java b/CoreJava/src/com/training/java/core/overriding/Dog.java deleted file mode 100644 index d0eeaf6..0000000 --- a/CoreJava/src/com/training/java/core/overriding/Dog.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.core.overriding; - -public class Dog extends Animal -{ - private boolean sniffer; - - public Dog(int numberofLegs, boolean tail, boolean horns, boolean wild, - boolean sniffer) - { - super(numberofLegs, tail, horns, wild); - this.sniffer = sniffer; - } - - public void bark() - { - System.out.println("Dog is barking"); - } -} diff --git a/CoreJava/src/com/training/java/core/polymorphism/Car.java b/CoreJava/src/com/training/java/core/polymorphism/Car.java deleted file mode 100644 index 10a4344..0000000 --- a/CoreJava/src/com/training/java/core/polymorphism/Car.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright © Flagstar Bank 2012. - * - * Copyright in the application source code, and in the information and - * material therein and in their arrangement, is owned by Flagstar Bank, FSB - * unless otherwise indicated. - * - * You shall not remove or obscure any copyright, trademark or other notices. - * You may not copy, republish, redistribute, transmit, participate in the - * transmission of, create derivatives of, alter edit or exploit in any - * manner any material including by storage on retrieval systems, without the - * express written permission of Flagstar Bank. - */ - -package com.training.java.core.polymorphism; - -/** - * Car. - * - * @author Venkata Hari - */ - -public class Car -{ - private int currentSpeed; - private final int maximumSpeed = 140; - private int numberOfTires; - private boolean started; - - /** - * @return currentSpeed - */ - public int getCurrentSpeed() - { - return currentSpeed; - } - - /** - * @param currentSpeed sets currentSpeed - */ - public void setCurrentSpeed(final int currentSpeed) - { - this.currentSpeed = currentSpeed; - } - - /** - * @return numberOfTires - */ - public int getNumberOfTires() - { - return numberOfTires; - } - - /** - * @param numberOfTires sets numberOfTires - */ - public void setNumberOfTires(final int numberOfTires) - { - this.numberOfTires = numberOfTires; - } - - /** - * @return started - */ - public boolean isStarted() - { - return started; - } - - /** - * @param started sets started - */ - public void setStarted(final boolean started) - { - this.started = started; - } - - /** - * @return maximumSpeed - */ - public int getMaximumSpeed() - { - return maximumSpeed; - } - - public void start() - { - System.out.println("Car is starting"); - started = true; - } - - public void stop() - { - System.out.println("Car is stopping"); - started = false; - } - - public void accelerate(final int byHowMuch) - { - int tempSpeed = currentSpeed + byHowMuch; - currentSpeed = (tempSpeed > maximumSpeed) ? maximumSpeed : tempSpeed; - } - - public void applyBrakes(final int byHowMuch) - { - int tempSpeed = currentSpeed - byHowMuch; - currentSpeed = (tempSpeed < 0) ? 0 : tempSpeed; - } -} diff --git a/CoreJava/src/com/training/java/core/polymorphism/PolymorphismDemo.java b/CoreJava/src/com/training/java/core/polymorphism/PolymorphismDemo.java deleted file mode 100644 index eb5d77b..0000000 --- a/CoreJava/src/com/training/java/core/polymorphism/PolymorphismDemo.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright © Flagstar Bank 2012. - * - * Copyright in the application source code, and in the information and - * material therein and in their arrangement, is owned by Flagstar Bank, FSB - * unless otherwise indicated. - * - * You shall not remove or obscure any copyright, trademark or other notices. - * You may not copy, republish, redistribute, transmit, participate in the - * transmission of, create derivatives of, alter edit or exploit in any - * manner any material including by storage on retrieval systems, without the - * express written permission of Flagstar Bank. - */ - -package com.training.java.core.polymorphism; - -/** - * PolymorphismDemo. - * - * @author Venkata Hari - */ - -public class PolymorphismDemo -{ - /** - * @param args - */ - public static void main(final String[] args) - { - Car car = new Suv(); - - Traveller traveller = new Traveller(car); - traveller.travel(); - } -} diff --git a/CoreJava/src/com/training/java/core/polymorphism/RaceCar.java b/CoreJava/src/com/training/java/core/polymorphism/RaceCar.java deleted file mode 100644 index 31374d4..0000000 --- a/CoreJava/src/com/training/java/core/polymorphism/RaceCar.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © Flagstar Bank 2012. - * - * Copyright in the application source code, and in the information and - * material therein and in their arrangement, is owned by Flagstar Bank, FSB - * unless otherwise indicated. - * - * You shall not remove or obscure any copyright, trademark or other notices. - * You may not copy, republish, redistribute, transmit, participate in the - * transmission of, create derivatives of, alter edit or exploit in any - * manner any material including by storage on retrieval systems, without the - * express written permission of Flagstar Bank. - */ - -package com.training.java.core.polymorphism; - -/** - * RaceCar. - * - * @author Venkata Hari - */ - -public class RaceCar extends Car -{ - /** - * {@inheritDoc} - */ - @Override - public void accelerate(final int byHowMuch) - { - System.out.println("Race car is accelerating"); - int tempSpeed = getCurrentSpeed() + (byHowMuch * 2); - if (tempSpeed > getMaximumSpeed()) - { - setCurrentSpeed(getMaximumSpeed()); - } - else - { - setCurrentSpeed(tempSpeed); - } - } -} diff --git a/CoreJava/src/com/training/java/core/polymorphism/Suv.java b/CoreJava/src/com/training/java/core/polymorphism/Suv.java deleted file mode 100644 index e71aa5f..0000000 --- a/CoreJava/src/com/training/java/core/polymorphism/Suv.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © Flagstar Bank 2012. - * - * Copyright in the application source code, and in the information and - * material therein and in their arrangement, is owned by Flagstar Bank, FSB - * unless otherwise indicated. - * - * You shall not remove or obscure any copyright, trademark or other notices. - * You may not copy, republish, redistribute, transmit, participate in the - * transmission of, create derivatives of, alter edit or exploit in any - * manner any material including by storage on retrieval systems, without the - * express written permission of Flagstar Bank. - */ - -package com.training.java.core.polymorphism; - -/** - * Suv. - * - * @author Venkata Hari - */ - -public class Suv extends Car -{ - /** - * {@inheritDoc} - */ - @Override - public void accelerate(final int byHowMuch) - { - System.out.println("SUV is accelerating"); - int tempSpeed = getCurrentSpeed() + (int) (byHowMuch * 0.5); - if (tempSpeed > getMaximumSpeed()) - { - setCurrentSpeed(getMaximumSpeed()); - } - else - { - setCurrentSpeed(tempSpeed); - } - } -} diff --git a/CoreJava/src/com/training/java/core/polymorphism/Traveller.java b/CoreJava/src/com/training/java/core/polymorphism/Traveller.java deleted file mode 100644 index 51bc2e6..0000000 --- a/CoreJava/src/com/training/java/core/polymorphism/Traveller.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright © Flagstar Bank 2012. - * - * Copyright in the application source code, and in the information and - * material therein and in their arrangement, is owned by Flagstar Bank, FSB - * unless otherwise indicated. - * - * You shall not remove or obscure any copyright, trademark or other notices. - * You may not copy, republish, redistribute, transmit, participate in the - * transmission of, create derivatives of, alter edit or exploit in any - * manner any material including by storage on retrieval systems, without the - * express written permission of Flagstar Bank. - */ - -package com.training.java.core.polymorphism; - -/** - * Traveller. - * - * @author Venkata Hari - */ - -public class Traveller -{ - private final Car car; - - public Traveller(final Car car) - { - this.car = car; - } - - public void travel() - { - System.out.println("Traveller is travelling in a car"); - car.start(); - System.out.println("Current speed = " + car.getCurrentSpeed()); - car.accelerate(50); - System.out.println("Current speed = " + car.getCurrentSpeed()); - car.applyBrakes(20); - System.out.println("Current speed = " + car.getCurrentSpeed()); - car.stop(); - } - -} diff --git a/CoreJava/src/com/training/java/core/staticexample/Car.java b/CoreJava/src/com/training/java/core/staticexample/Car.java deleted file mode 100644 index 2e0440d..0000000 --- a/CoreJava/src/com/training/java/core/staticexample/Car.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.training.java.core.staticexample; - -public class Car { - - private String color; - private String vinNumber; - - private static int numberOfCarsCreated; - public static final int MAX_SPEED_LIMIT = 140; - - public Car() - { - numberOfCarsCreated++; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public String getVinNumber() { - return vinNumber; - } - - public void setVinNumber(String vinNumber) { - this.vinNumber = vinNumber; - } - - public static int getNumberOfCarsCreated() - { - return numberOfCarsCreated; - } - -} diff --git a/CoreJava/src/com/training/java/core/staticexample/StaticDemo.java b/CoreJava/src/com/training/java/core/staticexample/StaticDemo.java deleted file mode 100644 index dca91e9..0000000 --- a/CoreJava/src/com/training/java/core/staticexample/StaticDemo.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.staticexample; - -public class StaticDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Car camry = new Car(); - camry.setColor("Blue"); - camry.setVinNumber("12345"); - - Car focus = new Car(); - focus.setColor("Red"); - focus.setVinNumber("98765"); - - System.out.println("vin number of camry = " + camry.getVinNumber()); - System.out.println("color of focus = " + focus.getColor()); - - System.out.println("Max speed limit is " + Car.MAX_SPEED_LIMIT); - System.out.println("No of cars created = " + Car.getNumberOfCarsCreated()); - - - } - -} diff --git a/CoreJava/src/com/training/java/core/tdd/Book.java b/CoreJava/src/com/training/java/core/tdd/Book.java deleted file mode 100644 index d98104a..0000000 --- a/CoreJava/src/com/training/java/core/tdd/Book.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.core.tdd; - -public class Book { - - private String title; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - -} diff --git a/CoreJava/src/com/training/java/core/tdd/BookStore.java b/CoreJava/src/com/training/java/core/tdd/BookStore.java deleted file mode 100644 index 0e1bc3c..0000000 --- a/CoreJava/src/com/training/java/core/tdd/BookStore.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.tdd; - -import java.util.ArrayList; -import java.util.List; - -public class BookStore { - - private List books = new ArrayList(); - - public BookStore() - { - Book aBook = new Book(); - - aBook.setTitle("Head First Java"); - - books.add(aBook); - } - - public List getAllBooks() { - return books; - } - - public void add(Book aBook) { - books.add(aBook); - } - -} diff --git a/CoreJava/src/com/training/java/core/tdd/BookStoreTest.java b/CoreJava/src/com/training/java/core/tdd/BookStoreTest.java deleted file mode 100644 index cfe80cf..0000000 --- a/CoreJava/src/com/training/java/core/tdd/BookStoreTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.training.java.core.tdd; - -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class BookStoreTest { - - private BookStore store; - - @Before - public void init() - { - store = new BookStore(); - } - - @After - public void teardown() - { - store = null; - } - - - @Test - public void getAllBooksShouldNotReturnNull() { - List books = store.getAllBooks(); - Assert.assertNotNull(books); - } - - @Test - public void getAllBooksShouldReturnAtleaseOneBook() { - List books = store.getAllBooks(); - - Assert.assertFalse("books should not be empty", books.isEmpty()); - } - - @Test - public void get_all_books_should_return_a_head_first_java_book() { - List books = store.getAllBooks(); - - boolean headFirstJavaBookFound = false; - for (Book aBook : books) { - if (aBook.getTitle().equals("Head First Java")) { - headFirstJavaBookFound = true; - } - } - - Assert.assertTrue("Head First Java book not found", - headFirstJavaBookFound); - } - - @Test - public void add_spring_in_action_book_should_add_to_store() { - - Book aBook = new Book(); - aBook.setTitle("Spring in Action"); - - store.add(aBook); - - List allBooksFromStore = store.getAllBooks(); - - boolean isMyBookFound = false; - for (Book current : allBooksFromStore) { - if (current.getTitle().equals("Spring in Action")) { - isMyBookFound = true; - } - } - - Assert.assertTrue("Spring in Action book not found", isMyBookFound); - } - - @Test - public void no_book_from_store_exist_without_title() { - List allBooksFromStore = store.getAllBooks(); - - for(Book current : allBooksFromStore) - { - if(current.getTitle() == null || current.getTitle().length() == 0) - { - TestCase.fail("Every book should have a title"); - } - } - } - -} diff --git a/CoreJava/src/com/training/java/core/threads/ThreadDemo.java b/CoreJava/src/com/training/java/core/threads/ThreadDemo.java deleted file mode 100644 index 1bb7ffd..0000000 --- a/CoreJava/src/com/training/java/core/threads/ThreadDemo.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.java.core.threads; - -public class ThreadDemo implements Runnable { - - /** - * @param args - */ - public static void main(String[] args) { - - System.out.println("Entered main thread"); - - ThreadDemo td = new ThreadDemo(); - td.startAndRunChildThread(); - - for(int i=0; i<1000; i++) - { - System.out.println("In main thread, i = " + i); - } - } - - public void startAndRunChildThread() - { - //Create and spawn new thread - new Thread(this).start(); - } - - @Override - public void run() { - for(int j=0; j<1000; j++) - { - System.out.println("Child thread..j = " + j); - } - } - -} diff --git a/CoreJava/src/com/training/java/core/typecasting/TypeCastingDemo.java b/CoreJava/src/com/training/java/core/typecasting/TypeCastingDemo.java deleted file mode 100644 index 27d3007..0000000 --- a/CoreJava/src/com/training/java/core/typecasting/TypeCastingDemo.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.core.typecasting; - -public class TypeCastingDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - /* - int age = 20; - - long bigAge = age; - */ - - long age = 20; - - int smallAge = (int) age; - - System.out.println("smallAge = " + smallAge); - - - } - -} diff --git a/CoreJava/src/com/training/java/core/unittest/Calculator.java b/CoreJava/src/com/training/java/core/unittest/Calculator.java deleted file mode 100644 index c04d922..0000000 --- a/CoreJava/src/com/training/java/core/unittest/Calculator.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.unittest; - -public class Calculator -{ - public static int add(int i, int j) - { - return i+j; - } - - public static int subtract(int i, int j) - { - return i-j; - } - - public static int divide(int i, int j) - { - return i/j; - } - -} diff --git a/CoreJava/src/com/training/java/core/unittest/CalculatorTest.java b/CoreJava/src/com/training/java/core/unittest/CalculatorTest.java deleted file mode 100644 index 08e824c..0000000 --- a/CoreJava/src/com/training/java/core/unittest/CalculatorTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.java.core.unittest; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - - -public class CalculatorTest -{ - @Test - public void testAdd() - { - int result = Calculator.add(5, 3); - System.out.println("result = " + result); - assertEquals("The addition of 5 and 3 should be 8", 8, result); - } - - @Test - public void testSubtract() - { - int result = Calculator.subtract(10, 20); - assertEquals("10-20 should be -10", -10, result); - } - - @Test - public void testDivide() - { - int result = Calculator.divide(10, 2); - assertEquals("10/2 should be 5", 5, result); - } -} diff --git a/CoreJava/src/com/training/java/core/xml/Book.java b/CoreJava/src/com/training/java/core/xml/Book.java deleted file mode 100644 index ff60539..0000000 --- a/CoreJava/src/com/training/java/core/xml/Book.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.core.xml; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class Book { - - @XmlElement - private String title; - - @XmlElement - private String author; - - public Book() - { - - } - - public Book(String title, String author) { - this.title = title; - this.author = author; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - -} diff --git a/CoreJava/src/com/training/java/core/xml/DOMParserDemo.java b/CoreJava/src/com/training/java/core/xml/DOMParserDemo.java deleted file mode 100644 index 29e91d0..0000000 --- a/CoreJava/src/com/training/java/core/xml/DOMParserDemo.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.training.java.core.xml; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -public class DOMParserDemo { - - /** - * @param args - */ - public static void main(String[] args) throws Exception { - new DOMParserDemo().parse(); - } - - private void parse() throws Exception { - - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - - Document document = builder.parse("students.xml"); - - //Get the root element - Element rootElement = document.getDocumentElement(); - - //This is how you get the node name - String rootElementName = rootElement.getNodeName(); - System.out.println("Root element name = " + rootElementName); - - //Get the student nodes under students root node - NodeList studentNodes = rootElement.getElementsByTagName("student"); - - for(int i=0; i - Manpreet - Kaur - Troy - - \ No newline at end of file diff --git a/CoreJava_Feb2015/.classpath b/CoreJava_Feb2015/.classpath deleted file mode 100644 index 63b7e89..0000000 --- a/CoreJava_Feb2015/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/CoreJava_Feb2015/.project b/CoreJava_Feb2015/.project deleted file mode 100644 index 4aa7db4..0000000 --- a/CoreJava_Feb2015/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - CoreJava_Feb2015 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/CoreJava_Feb2015/.settings/org.eclipse.jdt.core.prefs b/CoreJava_Feb2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index bb35fa0..0000000 --- a/CoreJava_Feb2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/CoreJava_Feb2015/src/AdditionDemo.java b/CoreJava_Feb2015/src/AdditionDemo.java deleted file mode 100644 index e857f0e..0000000 --- a/CoreJava_Feb2015/src/AdditionDemo.java +++ /dev/null @@ -1,20 +0,0 @@ - -public class AdditionDemo { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - String operand1 = args[0]; - String operand2 = args[1]; - - int op1 = Integer.parseInt(operand1); - int op2 = Integer.parseInt(operand2); - - int sum = op1 + op2; - - System.out.println("sum = " + sum); - - - } - -} diff --git a/CoreJava_Feb2015/src/ArrayDemo1.java b/CoreJava_Feb2015/src/ArrayDemo1.java deleted file mode 100644 index 41a5997..0000000 --- a/CoreJava_Feb2015/src/ArrayDemo1.java +++ /dev/null @@ -1,34 +0,0 @@ - -public class ArrayDemo1 { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - String[] students = new String[20]; - - students[0] = "Anoop"; - students[1] = "Anteneh"; - students[2] = "Aruna"; - - students[9] = "Satya"; - students[18] = "Ketan"; - - - students[12] = "Uma"; - - /*System.out.println("3rd student is " + students[2]); - System.out.println("2nd student is " + students[1]); - System.out.println("10th student is " + students[19]);*/ - - - for(String student : students) - { - System.out.println(student); - } - - - - - } - -} diff --git a/CoreJava_Feb2015/src/ArrayDemo2.java b/CoreJava_Feb2015/src/ArrayDemo2.java deleted file mode 100644 index c945035..0000000 --- a/CoreJava_Feb2015/src/ArrayDemo2.java +++ /dev/null @@ -1,22 +0,0 @@ -public class ArrayDemo2 { - - public static void main(String[] args) { - - String[] students = new String[20]; - - students[0] = "Anoop"; - students[1] = "Anteneh"; - students[2] = "Aruna"; - - students[9] = "Satya"; - students[18] = "Ketan"; - - System.out.println("Size of the array = " + students.length); - - for(int i=0; i animals) - { - for(Animal animal : animals) - { - animal.eat(); - animal.move(); - } - } -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Bird.java b/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Bird.java deleted file mode 100644 index 847a346..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Bird.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.javatraining.java.core.interfaces; - -public class Bird extends Animal implements Flyable { - - @Override - public void fly() { - System.out.println("Bird is flying"); - } - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Dog.java b/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Dog.java deleted file mode 100644 index 5f52087..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Dog.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.javatraining.java.core.interfaces; - -public class Dog extends Animal { - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Eatable.java b/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Eatable.java deleted file mode 100644 index f601713..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Eatable.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.javatraining.java.core.interfaces; - -public interface Eatable { - - void eat(); - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Flyable.java b/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Flyable.java deleted file mode 100644 index 4ac345c..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Flyable.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.javatraining.java.core.interfaces; - -public interface Flyable { - - void fly(); - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/InterfaceDemo.java b/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/InterfaceDemo.java deleted file mode 100644 index 33f72fc..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/InterfaceDemo.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.javatraining.java.core.interfaces; - -public class InterfaceDemo { - - public static void main(String[] args) { - - Animal a = new Dog(); - - a.eat(); - a.move(); - - - - } - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Movable.java b/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Movable.java deleted file mode 100644 index 719a8c3..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/interfaces/Movable.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.javatraining.java.core.interfaces; - -public interface Movable { - - void move(); - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/Animal.java b/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/Animal.java deleted file mode 100644 index 9f0f39b..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/Animal.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.javatraining.java.core.polymorphism; - -public class Animal { - - public void eat() - { - System.out.println("Animal is eating"); - } - - public void run() - { - System.out.println("Animal is running"); - } - - public void walk() - { - System.out.println("Animal is walking"); - } - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/AnimalFeeder.java b/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/AnimalFeeder.java deleted file mode 100644 index dd289fa..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/AnimalFeeder.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.javatraining.java.core.polymorphism; - -public class AnimalFeeder { - - public void feed(Animal a) - { - a.eat(); - } - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/Dog.java b/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/Dog.java deleted file mode 100644 index 4826dfd..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/Dog.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.javatraining.java.core.polymorphism; - -public class Dog extends Animal { - - @Override - public void eat() { - System.out.println("Dog is eating"); - } - - @Override - public void run() { - System.out.println("Dog hussles differently"); - } - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/PolymorphismDemo.java b/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/PolymorphismDemo.java deleted file mode 100644 index c7f75d3..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/PolymorphismDemo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.javatraining.java.core.polymorphism; - -public class PolymorphismDemo { - - public static void main(String[] args) { - - Animal a1 = new Pug(); - Animal a2 = new Dog(); - - AnimalFeeder af = new AnimalFeeder(); - - af.feed(a1); - af.feed(a2); - - Pug p1 = new Pug(); - - p1.eat(); - p1.run(); - p1.walk(); - - - } - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/Pug.java b/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/Pug.java deleted file mode 100644 index 715e57e..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/Pug.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.javatraining.java.core.polymorphism; - -public class Pug extends Dog { - - @Override - public void eat() { - System.out.println("Pug is eating"); - } - -} diff --git a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/rohit b/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/rohit deleted file mode 100644 index b7ce339..0000000 --- a/CoreJava_Feb2015/src/com/javatraining/java/core/polymorphism/rohit +++ /dev/null @@ -1,20 +0,0 @@ -AnimalCollector - -add(Collection c) -{ - -} - - - -ArrayList al = new ArrayList(); - -al.add(); -al.add(); - -HashSet s1 = new HashSet(); -s1.add(); -s1.add(); - -animalCollector.add(s1) - diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/BadInputException.java b/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/BadInputException.java deleted file mode 100644 index 10ff063..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/BadInputException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.javavenkat.training.core.tdd; - -public class BadInputException extends Exception { - - public BadInputException(String error) { - super(error); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/FibnocciNumbers.java b/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/FibnocciNumbers.java deleted file mode 100644 index f42da0f..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/FibnocciNumbers.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.javavenkat.training.core.tdd; - -import java.util.ArrayList; -import java.util.List; - -public class FibnocciNumbers { - - public Integer[] generate(int input) { - - List result = new ArrayList(); - - for (int i = 0; i < input; i++) { - // first 2 numbers in fib series should be 1,1 - if (i == 0 || i == 1) { - result.add(1); - } else { - - int size = result.size(); - int previousNumber1 = result.get(size-1); - int previousNumber2 = result.get(size-2); - - int sum = previousNumber1+previousNumber2; - result.add(sum); - } - } - - System.out.println(result); - - return result.toArray(new Integer[0]); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/FibnocciNumbersTest.java b/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/FibnocciNumbersTest.java deleted file mode 100644 index a94f54a..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/FibnocciNumbersTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.javavenkat.training.core.tdd; - -import java.util.Map; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class FibnocciNumbersTest { - - private FibnocciNumbers f; - - @Before - public void setup() { - f = new FibnocciNumbers(); - } - - @Test - public void fibnocciShouldWorkForNumbers() { - Assert.assertArrayEquals(new Integer[] { 1, 1 }, f.generate(2)); - Assert.assertArrayEquals(new Integer[] { 1, 1, 2 }, f.generate(3)); - Assert.assertArrayEquals(new Integer[] { 1, 1, 2, 3 }, f.generate(4)); - Assert.assertArrayEquals(new Integer[] { 1, 1, 2, 3, 5}, f.generate(5)); - Assert.assertArrayEquals(new Integer[] { 1, 1, 2, 3, 5, 8}, f.generate(6)); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/SentenceReverser.java b/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/SentenceReverser.java deleted file mode 100644 index d49bcef..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/SentenceReverser.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.javavenkat.training.core.tdd; - -public class SentenceReverser { - - public String reverse(String input) throws BadInputException { - - if (input == null) { - throw new BadInputException("Null input is not allowed"); - } else if (input.trim().isEmpty()) { - throw new BadInputException("Empty input is not allowed"); - } - - String[] words = input.split(" "); - - if (words.length == 1) { - return input; - } else { - - return reverse(words); - } - } - - private String reverse(String[] words) { - StringBuilder reversedString = new StringBuilder(); - for (int i = words.length - 1; i >= 0; i--) { - String word = words[i]; - - reversedString.append(word); - - if (i != 0) { - reversedString.append(" "); - } - } - - return reversedString.toString(); - } -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/SentenceReverserTest.java b/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/SentenceReverserTest.java deleted file mode 100644 index 1ccff6e..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/SentenceReverserTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.javavenkat.training.core.tdd; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class SentenceReverserTest { - - private SentenceReverser reverser; - - @Before - public void setup() { - reverser = new SentenceReverser(); - } - - @Test - public void oneWordInputShouldReturnTheSameWord() throws BadInputException { - String output = reverser.reverse("Hello"); - Assert.assertEquals("Hello", output); - } - - @Test - public void sentenceWithTwoWordsShouldBeReversed() throws BadInputException { - String output = reverser.reverse("Hello World"); - Assert.assertEquals("World Hello", output); - } - - @Test - public void sentenceWithMoreThanTwoWordsShouldBeReversed() - throws BadInputException { - String output = reverser.reverse("How are you doing"); - Assert.assertEquals("doing you are How", output); - } - - @Test(expected = BadInputException.class) - public void nullInputShouldThrowException() throws BadInputException { - reverser.reverse(null); - } - - @Test(expected = BadInputException.class) - public void emptyInputShouldThrowException() throws BadInputException { - reverser.reverse(" "); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/StringTrimDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/StringTrimDemo.java deleted file mode 100644 index cea2497..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/core/tdd/StringTrimDemo.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.javavenkat.training.core.tdd; - -public class StringTrimDemo { - - public static void main(String[] args) { - - String str = " 65 "; - - System.out.println("str = -->" + str.trim() + "<--"); - str = str.trim(); - - System.out.println("Length = " + str.length()); - - System.out.println(str.isEmpty()); - - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/design/Car.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/design/Car.java deleted file mode 100644 index 95a831e..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/design/Car.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.javavenkat.training.java.core.design; - -public class Car { - - private String make; - private String model; - private String vin; - - private boolean started; - private int currentSpeed; - private boolean buckled; - private boolean seatBeltIndicator; - - private Engine engine; - private SparkPlug sparkPlug; - - private int maximumSpeed = 140; - - public Car(String make, String model, String vin) { - super(); - this.make = make; - this.model = model; - this.vin = vin; - } - - public void start() { - System.out.println(make + " " + model + " is starting"); - - engine.start(sparkPlug); - - started = true; - } - - public void stop() - { - started = false; - currentSpeed = 0; - seatBeltIndicator = false; - } - - public void buckleUp() - { - buckled = true; - seatBeltIndicator = false; - } - - public int accelerate(int byHowMuch) - { - int desiredSpeed = currentSpeed + byHowMuch; - - if(desiredSpeed > 0 && !buckled) - { - seatBeltIndicator = true; - currentSpeed = 0; - } else { - seatBeltIndicator = false; - - if(desiredSpeed > maximumSpeed) - { - currentSpeed = maximumSpeed; - } else { - currentSpeed = desiredSpeed; - } - } - - return currentSpeed; - } - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public String getVin() { - return vin; - } - - public int getCurrentSpeed() { - return currentSpeed; - } - - public boolean isBuckled() { - return buckled; - } - - public boolean isSeatBeltOn() { - return seatBeltIndicator; - } - - public boolean isStarted() { - return started; - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/design/CarDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/design/CarDemo.java deleted file mode 100644 index d45c42f..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/design/CarDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.javavenkat.training.java.core.design; - -public class CarDemo { - - public static void main(String[] args) { - - Car car = new Car("Porsche", "Cayanee", "987654321"); - - car.start(); - int currentSpeed = car.accelerate(20); - - System.out.println("My current speed = " + currentSpeed); - System.out.println("Seat belt indicator = " + car.isSeatBeltOn()); - - car.buckleUp(); - - int newCurrentSpeed = car.accelerate(20); - System.out.println("My current speed = " + newCurrentSpeed); - System.out.println("Seat belt indicator = " + car.isSeatBeltOn()); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/design/requirements b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/design/requirements deleted file mode 100644 index 6e2ed90..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/design/requirements +++ /dev/null @@ -1,7 +0,0 @@ -Design a Car with a seat belt. - -If car is moving, the seat belt is required. If seat belt is not clicked, indicator should go on.. -If car is started and not moving, seat belt is not required -When car is stopped, the indicator should be off - -if car is in start mode, and seat belt is \ No newline at end of file diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Animal.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Animal.java deleted file mode 100644 index 18b0a32..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Animal.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.javavenkat.training.java.core.inheritance; - -public class Animal { - - private String name; - private int age; - private double height; - private int numberOfLegs; - private String color; - - public Animal(String name, int age, double height, int numberOfLegs) { - super(); - this.name = name; - this.age = age; - this.height = height; - this.numberOfLegs = numberOfLegs; - } - - public void walk() { - System.out.println(name + " is walking"); - } - - public void eat() { - System.out.println(name + " is eating"); - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public double getHeight() { - return height; - } - - public int getNumberOfLegs() { - return numberOfLegs; - } - - public String getColor() { - return color; - } - - protected void setColor(String color) { - this.color = color; - } -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/AnimalPrinter.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/AnimalPrinter.java deleted file mode 100644 index 2e33ced..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/AnimalPrinter.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.javavenkat.training.java.core.inheritance; - -public class AnimalPrinter { - - public void print(Animal a) - { - a.eat(); - a.walk(); - } -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Cat.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Cat.java deleted file mode 100644 index 9d29333..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Cat.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.javavenkat.training.java.core.inheritance; - -public class Cat extends Animal { - - public Cat(String name, int age, double height, int numberOfLegs) { - super(name, age, height, numberOfLegs); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Cow.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Cow.java deleted file mode 100644 index 04b0e69..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Cow.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.javavenkat.training.java.core.inheritance; - -public class Cow extends Animal { - - public Cow(String name, int age, double height, int numberOfLegs) { - super(name, age, height, numberOfLegs); - } - - public void milk() - { - System.out.println("Cow is milking"); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Dog.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Dog.java deleted file mode 100644 index 2c2902f..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Dog.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.javavenkat.training.java.core.inheritance; - -public class Dog extends Animal { - - private String breed; - - public Dog(String name, int age, double height, int numberOfLegs, - String breed) { - super(name, age, height, numberOfLegs); - this.breed = breed; - } - - public String getBreed() { - return breed; - } - - @Override - public void eat() { - System.out.println("Dog eats differntly..so I am overriding"); - } - - @Override - public void walk(){ - System.out.println("Dog walks differently.."); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Goat.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Goat.java deleted file mode 100644 index 7c51b79..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/Goat.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.javavenkat.training.java.core.inheritance; - -public class Goat extends Animal { - - public Goat(String name, int age, double height, int numberOfLegs) { - super(name, age, height, numberOfLegs); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/InheritanceDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/InheritanceDemo.java deleted file mode 100644 index 10d0b32..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/InheritanceDemo.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.javavenkat.training.java.core.inheritance; - -public class InheritanceDemo { - - public static void main(String[] args) { - - Dog dog = new Dog("Tommy", 5, 1.5, 4, "pitbul"); - - dog.eat(); - dog.walk(); - dog.setColor("blue"); - - Cow cow = new Cow("Cow", 1, 5.6, 4); - - cow.eat(); - cow.walk(); - cow.milk(); - cow.setColor("white"); - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/OverridingDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/OverridingDemo.java deleted file mode 100644 index 8a04d9d..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/core/inheritance/OverridingDemo.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.javavenkat.training.java.core.inheritance; - -public class OverridingDemo { - - public static void main(String[] args) { - - //Animal a = new Dog("Tommy", 5, 1.5, 4, "pitbul"); - Animal a = new Cat("Tommy", 5, 1.5, 4); - - a.walk(); - a.eat(); - a.getAge(); - a.getName(); - - AnimalPrinter printer = new AnimalPrinter(); - printer.print(a); - - } - - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/constructor/Car.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/constructor/Car.java deleted file mode 100644 index 3cdab34..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/constructor/Car.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.javavenkat.training.java.corejava.constructor; - -public class Car { - - private String vin; - private String make; - private String model; - - private int currentGear; - private int currentSpeed; - private int maximumSpeed = 140; - - void start() { - - String name = "12345"; - - System.out.println("starting " + this.vin + " " + make + " " + model); - } - - void stop() { - System.out.println("stopping " + vin + " " + make + " " + model); - } - - public int accelerate(int speed) { - - int desiredSpeed = currentSpeed + speed; - - if (desiredSpeed > maximumSpeed) { - currentSpeed = maximumSpeed; - } else { - currentSpeed = desiredSpeed; - } - - System.out.println("you are now driving at " + currentSpeed); - - return currentSpeed; - } - - public String getVin() { - return vin; - } - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public int getCurrentGear() { - return currentGear; - } - - public int getCurrentSpeed() { - return currentSpeed; - } - - public int getMaximumSpeed() { - return maximumSpeed; - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/constructor/CarDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/constructor/CarDemo.java deleted file mode 100644 index 9680828..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/constructor/CarDemo.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.javavenkat.training.java.corejava.constructor; - -public class CarDemo { - - int numberOfCars; - - public static void main(String[] args) { - - Car c = new Car("123456", "BMW", "X3"); - - c.start(); - - c.accelerate(20); - c.accelerate(50); - c.accelerate(50); - c.accelerate(50); - c.accelerate(510); - - System.out.println("I am " + c.getVin() + " now driving at " + c.getCurrentSpeed()); - } - - public void increaseCount() - { - this.numberOfCars ++; - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/constructor/Laptop.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/constructor/Laptop.java deleted file mode 100644 index a2fe232..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/constructor/Laptop.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.javavenkat.training.java.corejava.constructor; - -public class Laptop { - - private String make; - private String model; - private String serialNumber; - private int displaySize; - - public Laptop(String make, String model, String serialNumber, - int displaySize) { - super(); - this.make = make; - this.model = model; - this.serialNumber = serialNumber; - this.displaySize = displaySize; - } - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public String getSerialNumber() { - return serialNumber; - } - - public int getDisplaySize() { - return displaySize; - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/Car.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/Car.java deleted file mode 100644 index 5f91b57..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/Car.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.javavenkat.training.java.corejava.controlflow; - -public class Car { - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo.java deleted file mode 100644 index 4752970..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.javavenkat.training.java.corejava.controlflow; -public class IfElseDemo { - - public static void main(String[] args) { - - int age = 21; - boolean male = false; - - if (age >= 21) { - System.out.println("he/she can drink"); - } else if (male && age >= 20) { - System.out.println("males with the age 20 or more can be sold"); - } else { - System.out.println("he/she can't buy a drink"); - } - - } -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo2.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo2.java deleted file mode 100644 index 85556e5..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo2.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.javavenkat.training.java.corejava.controlflow; - -public class IfElseDemo2 { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - int score = 75; - - String grade = "initial value"; - - if(score == 95) - { - grade = "A"; - } else if(score == 90) - { - grade = "A-"; - } else if(score == 85) - { - grade = "B+"; - } else if(score == 80) - { - grade = "B-"; - } else if(score == 75) - { - grade = "C+"; - } else if(score == 70) - { - grade = "C-"; - } else { - grade = "Fail"; - } - - System.out.println("Your score is " + score + " so your grade is " + grade); - - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo3.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo3.java deleted file mode 100644 index a7d866d..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo3.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.javavenkat.training.java.corejava.controlflow; - -public class IfElseDemo3 { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - String name = "John"; - int age = 46; - - System.out.println("Initial value of name = " + name); - - if(age == 21) - { - name = "Joe"; - } else if(age > 65) - { - name = "Mike"; - } - - System.out.println("Name = " + name); - - - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo4.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo4.java deleted file mode 100644 index a2a30f3..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/IfElseDemo4.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.javavenkat.training.java.corejava.controlflow; - -import com.javavenkat.training.java.corejava.loops.WhileDemo; - -public class IfElseDemo4 { - - public static void main(String[] args) { - - String sex = "male"; - - int age = 20; - - if (age >= 21 || (age == 20 && sex.equals("male"))) { - System.out.println(" you can buy the drink"); - } else { - System.out.println(" you can not buy the drink"); - } - - WhileDemo whileDemo = new WhileDemo(); - - - - - } -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/SwitchCaseDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/SwitchCaseDemo.java deleted file mode 100644 index 4ebf326..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/controlflow/SwitchCaseDemo.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.javavenkat.training.java.corejava.controlflow; -public class SwitchCaseDemo { - - public static void main(String[] args) { - - int score = 60; - - String grade = ""; - - switch (score) { - case 95: - grade = "A"; - break; - - case 90: - grade = "A-"; - break; - - case 85: - grade = "B+"; - break; - - case 80: - grade = "B-"; - break; - - case 75: - grade = "C+"; - break; - - case 70: - grade = "C-"; - break; - - default: - grade = "Fail"; - break; - } - - System.out.println("Your score is " + score + " so your grade is " + grade); - - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/loops/DoWhileDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/loops/DoWhileDemo.java deleted file mode 100644 index d5da3c7..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/loops/DoWhileDemo.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.javavenkat.training.java.corejava.loops; - -public class DoWhileDemo { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - int i = 101; - - do { - - System.out.println("i = " + i); - i++; - - } while (i <= 100); - - - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/loops/ForDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/loops/ForDemo.java deleted file mode 100644 index 96e3317..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/loops/ForDemo.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.javavenkat.training.java.corejava.loops; - -public class ForDemo { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - for(int i=1; i<=100; i = i+2) - { - System.out.println("i = " + i); - } - - for(;;) - { - System.out.println("Hello"); - } - - } - -} diff --git a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/loops/WhileDemo.java b/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/loops/WhileDemo.java deleted file mode 100644 index d77e70a..0000000 --- a/CoreJava_Feb2015/src/com/javavenkat/training/java/corejava/loops/WhileDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.javavenkat.training.java.corejava.loops; -public class WhileDemo { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - int i = 101; - - while (i <= 100) { - System.out.println("i = " + i); - - i++; - } - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/ArrayListDemo.java b/CoreJava_Feb2015/src/com/training/java/core/collections/ArrayListDemo.java deleted file mode 100644 index 6c7cad5..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/ArrayListDemo.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.java.core.collections; - -import java.util.ArrayList; -import java.util.Iterator; - -public class ArrayListDemo { - - public static void main(String[] args) { - - ArrayList names = new ArrayList(); - - names.add("Anoop"); - names.add("Aruna"); - names.add("Deshikan"); - names.add("Jyothy"); - names.add("Anoop"); - - for(String name : names) - { - System.out.println(name); - } - - System.out.println("**************"); - names.remove(3); - - String studentAtPosition3 = names.get(3); - System.out.println("Student at position 3 = " + studentAtPosition3); - - Iterator ite = names.iterator(); - - while(ite.hasNext()) - { - String name = ite.next(); - System.out.println(name); - } - - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/ArrayListDemo2.java b/CoreJava_Feb2015/src/com/training/java/core/collections/ArrayListDemo2.java deleted file mode 100644 index 49cec69..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/ArrayListDemo2.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.core.collections; - -import java.util.ArrayList; -import java.util.List; - -import com.javatraining.java.core.interfaces.Animal; -import com.javatraining.java.core.interfaces.AnimalFeeder; -import com.javatraining.java.core.interfaces.Bird; -import com.javatraining.java.core.interfaces.Dog; - -public class ArrayListDemo2 { - - public static void main(String[] args) { - - List animals = new ArrayList(); - - Animal a1 = new Dog(); - Animal a2 = new Bird(); - - animals.add(a1); - animals.add(a2); - - AnimalFeeder af = new AnimalFeeder(); - af.feed(animals); - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/LinkedListDemo.java b/CoreJava_Feb2015/src/com/training/java/core/collections/LinkedListDemo.java deleted file mode 100644 index 1133658..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/LinkedListDemo.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.java.core.collections; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -public class LinkedListDemo { - - public static void main(String[] args) { - - List names = new LinkedList(); - - names.add("Anoop"); - names.add("Aruna"); - names.add("Deshikan"); - names.add("Jyothy"); - names.add("Anoop"); - - for(String name : names) - { - System.out.println(name); - } - - System.out.println("**************"); - names.remove(3); - - String studentAtPosition3 = names.get(3); - System.out.println("Student at position 3 = " + studentAtPosition3); - - Iterator ite = names.iterator(); - - while(ite.hasNext()) - { - String name = ite.next(); - System.out.println(name); - } - - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/StudentPrinter.java b/CoreJava_Feb2015/src/com/training/java/core/collections/StudentPrinter.java deleted file mode 100644 index 2b414b7..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/StudentPrinter.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.core.collections; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -public class StudentPrinter { - - public void print(List students) - { - for(String student : students) - { - System.out.println("Name = " + student); - } - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/map/HashMapDemo1.java b/CoreJava_Feb2015/src/com/training/java/core/collections/map/HashMapDemo1.java deleted file mode 100644 index 4454d61..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/map/HashMapDemo1.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.training.java.core.collections.map; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -public class HashMapDemo1 { - - public static void main(String[] args) { - - Map phoneBook = new HashMap(); - - phoneBook.put("Anoop", "123-456-8790"); - phoneBook.put("Leena", "456-879-1234"); - phoneBook.put("Venkat", "8790-123-6754"); - phoneBook.put("Ravi", "123-879-1230"); - - //scenario1 : if you know key, you can get the value - String ravisNo = phoneBook.get("Ravi"); - System.out.println("Ravi's number = " + ravisNo); - - String leenaNo = phoneBook.get("Leena"); - System.out.println("Leena's number = " + leenaNo); - - //scenario2 : Get all the keys from Map - Set keys = phoneBook.keySet(); - - for(String key : keys) - { - System.out.println("Key = " + key); - System.out.println("value = " + phoneBook.get(key)); - } - - //scenario3 : get all the entries from Map - Set> entries = phoneBook.entrySet(); - - for(Entry entry : entries) - { - System.out.println("key = " + entry.getKey()); - System.out.println("Value = " + entry.getValue()); - } - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/map/HashMapDemo3.java b/CoreJava_Feb2015/src/com/training/java/core/collections/map/HashMapDemo3.java deleted file mode 100644 index 37f813e..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/map/HashMapDemo3.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.core.collections.map; - -import java.util.HashMap; -import java.util.Map; - -import com.training.java.core.collections.set.Student; - -public class HashMapDemo3 { - - public static void main(String[] args) { - - Student student1 = new Student(5, "Aruna", "D.C", "MD", "12345"); - Student student2 = new Student(1, "Yuri", "Novi", "MI", "54321"); - Student student3 = new Student(4, "Jyothy", "Rochester", "MI", "56789"); - Student student4 = new Student(3, "Kal", "Troy", "MI", "98765"); - - Map students = new HashMap(); - - students.put(5, student1); - students.put(1, student2); - students.put(4, student3); - students.put(3, student4); - - Student s = students.get(4); - - System.out.println(s); - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/map/HashMapDempo2.java b/CoreJava_Feb2015/src/com/training/java/core/collections/map/HashMapDempo2.java deleted file mode 100644 index 9a86251..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/map/HashMapDempo2.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.java.core.collections.map; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class HashMapDempo2 { - - public static void main(String[] args) { - - Map> phoneBook = new HashMap>(); - - List yurisPhoneNumbers = phoneBook.get("Yuri"); - - if(yurisPhoneNumbers == null) - { - yurisPhoneNumbers = new ArrayList(); - - yurisPhoneNumbers.add("1234"); - } else { - yurisPhoneNumbers.add("1234"); - } - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/map/LinkedHashMapDemo.java b/CoreJava_Feb2015/src/com/training/java/core/collections/map/LinkedHashMapDemo.java deleted file mode 100644 index 7c70b97..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/map/LinkedHashMapDemo.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.core.collections.map; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -public class LinkedHashMapDemo { - - public static void main(String[] args) { - Map phoneBook = new LinkedHashMap(); - - phoneBook.put("Anoop", "123-456-8790"); - phoneBook.put("Leena", "456-879-1234"); - phoneBook.put("Venkat", "8790-123-6754"); - phoneBook.put("Ravi", "123-879-1230"); - - Set keys = phoneBook.keySet(); - - for (String key : keys) { - System.out.println("Key = " + key); - System.out.println("value = " + phoneBook.get(key)); - } - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/map/TreeMapDemo.java b/CoreJava_Feb2015/src/com/training/java/core/collections/map/TreeMapDemo.java deleted file mode 100644 index f8a7fe5..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/map/TreeMapDemo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.core.collections.map; - -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -public class TreeMapDemo { - - public static void main(String[] args) { - - Map phoneBook = new TreeMap(); - - phoneBook.put("Venkat", "8790-123-6754"); - phoneBook.put("Ravi", "123-879-1230"); - phoneBook.put("Anoop", "123-456-8790"); - phoneBook.put("Leena", "456-879-1234"); - - Set keys = phoneBook.keySet(); - - for (String key : keys) { - System.out.println("Key = " + key); - System.out.println("value = " + phoneBook.get(key)); - } - - - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/set/HashSetDemo2.java b/CoreJava_Feb2015/src/com/training/java/core/collections/set/HashSetDemo2.java deleted file mode 100644 index e2daf1b..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/set/HashSetDemo2.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.HashSet; -import java.util.Set; - -public class HashSetDemo2 { - - public static void main(String[] args) { - Set students = new HashSet(); - - Student student1 = new Student(1, "Yuri", "D.C", "MD", "12345"); - Student student2 = new Student(2, "Venkat", "Novi", "MI", "54321"); - Student student3 = new Student(3, "Uma", "Rochester", "MI", "56789"); - Student student4 = new Student(1, "Venkat", "Troy", "MI", "98765"); - - System.out.println("Hashcode1 = " + student1.hashCode()); - System.out.println("Hashcode2 = " + student2.hashCode()); - System.out.println("Hashcode3 = " + student3.hashCode()); - System.out.println("Hashcode4 = " + student4.hashCode()); - - students.add(student1); - students.add(student2); - students.add(student3); - students.add(student4); - - StudentPrinter printer = new StudentPrinter(); - printer.print(students); - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/set/HashsetDemo.java b/CoreJava_Feb2015/src/com/training/java/core/collections/set/HashsetDemo.java deleted file mode 100644 index 1c28dbe..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/set/HashsetDemo.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.HashSet; -import java.util.Set; - -public class HashsetDemo { - - public static void main(String[] args) { - - Set names = new HashSet(); - - names.add("Yuri"); - names.add("Venkat"); - names.add("Uma"); - names.add("Sekhar"); - names.add("Yuri"); - - for(String name : names) - { - System.out.println("Name = " + name); - } - - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/set/LinkedHashSetDemo.java b/CoreJava_Feb2015/src/com/training/java/core/collections/set/LinkedHashSetDemo.java deleted file mode 100644 index 9bf9c3a..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/set/LinkedHashSetDemo.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.Set; - -public class LinkedHashSetDemo { - - public static void main(String[] args) { - - Set names = new LinkedHashSet(); - - names.add("Yuri"); - names.add("Venkat"); - names.add("Uma"); - names.add("Sekhar"); - names.add("Yuri"); - - for (String name : names) { - System.out.println("Name = " + name); - } - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/set/Student.java b/CoreJava_Feb2015/src/com/training/java/core/collections/set/Student.java deleted file mode 100644 index d36c0f3..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/set/Student.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java.core.collections.set; - -public class Student implements Comparable { - - private long id; - private String name; - private String city; - private String state; - private String zip; - - public Student(long id, String name, String city, String state, String zip) { - super(); - this.id = id; - this.name = name; - this.city = city; - this.state = state; - this.zip = zip; - } - - public long getId() { - return id; - } - - public String getName() { - return name; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - @Override - public boolean equals(Object obj) { - - if(!(obj instanceof Student)) - { - return false; - } - - Student student = (Student) obj; - - return this.id == student.getId(); - } - - @Override - public int hashCode() { - - return (int) this.id; - - } - - @Override - public int compareTo(Student that) { - - return this.name.compareTo(that.getName()); - - } - - @Override - public String toString() { - - return "id = " + id + " : Name = " + name + " : city = " + city; - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/set/StudentPrinter.java b/CoreJava_Feb2015/src/com/training/java/core/collections/set/StudentPrinter.java deleted file mode 100644 index 5102b7f..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/set/StudentPrinter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.Set; - -public class StudentPrinter { - - public void print(Set students) - { - for(Student student : students) - { - System.out.println("Student id " + student.getId() + " name " + student.getName()); - } - } -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/set/TreeSetDemo.java b/CoreJava_Feb2015/src/com/training/java/core/collections/set/TreeSetDemo.java deleted file mode 100644 index 731266d..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/set/TreeSetDemo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.Set; -import java.util.TreeSet; - -public class TreeSetDemo { - - public static void main(String[] args) { - - Set students = new TreeSet(); - - students.add("Yuri"); - students.add("Anteneh"); - students.add("Sailaja"); - students.add("Aruna"); - - for(String student : students) - { - System.out.println("Name = " + student); - } - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/collections/set/TreeSetDemo2.java b/CoreJava_Feb2015/src/com/training/java/core/collections/set/TreeSetDemo2.java deleted file mode 100644 index 9112486..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/collections/set/TreeSetDemo2.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.core.collections.set; - -import java.util.HashSet; -import java.util.Set; -import java.util.TreeSet; - -public class TreeSetDemo2 { - - public static void main(String[] args) { - - Set students = new TreeSet(); - - Student student1 = new Student(5, "Aruna", "D.C", "MD", "12345"); - Student student2 = new Student(1, "Yuri", "Novi", "MI", "54321"); - Student student3 = new Student(4, "Jyothy", "Rochester", "MI", "56789"); - Student student4 = new Student(3, "Kal", "Troy", "MI", "98765"); - - students.add(student1); - students.add(student2); - students.add(student3); - students.add(student4); - - StudentPrinter printer = new StudentPrinter(); - printer.print(students); - - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/date/DateDemo1.java b/CoreJava_Feb2015/src/com/training/java/core/date/DateDemo1.java deleted file mode 100644 index a1a6ee5..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/date/DateDemo1.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.java.core.date; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -public class DateDemo1 { - - public static void main(String[] args) throws ParseException { - - Date now = new Date(); - - SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy/HH-mm-ss a"); - String nowInString = sdf.format(now); - - //Date jan1st = sdf.parse("01-01-2015"); - - //System.out.println(jan1st); - - //System.out.println(now); - System.out.println(nowInString); - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/date/DateDemo2.java b/CoreJava_Feb2015/src/com/training/java/core/date/DateDemo2.java deleted file mode 100644 index ff682f1..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/date/DateDemo2.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.core.date; - -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; - -public class DateDemo2 { - - public static void main(String[] args) { - - Calendar now = new GregorianCalendar(); - - int year = now.get(Calendar.YEAR); - int month = now.get(Calendar.MONTH); - int minutes = now.get(Calendar.MINUTE); - - System.out.println("hours = " + minutes); - System.out.println("minutes = " + minutes); - - System.out.println("year = " + year); - System.out.println("month = " + month); - - Date nowDate = now.getTime(); - - System.out.println("Date = " + nowDate); - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/date/DateDemo3.java b/CoreJava_Feb2015/src/com/training/java/core/date/DateDemo3.java deleted file mode 100644 index 70077dc..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/date/DateDemo3.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.training.java.core.date; - -import java.util.Calendar; -import java.util.GregorianCalendar; - -public class DateDemo3 { - - public static void main(String[] args) { - - Calendar jan1_2015 = new GregorianCalendar(2015, 0, 1); - Calendar jan14_2015 = new GregorianCalendar(2015, 0, 14); - - //jan1_2015.add(Calendar.MONTH, 1); - - System.out.println("date1 = " + jan1_2015.getTime()); - System.out.println("date2 = " + jan14_2015.getTime()); - - long date1Millis = jan1_2015.getTimeInMillis(); - long date2Millis = jan14_2015.getTimeInMillis(); - - long differenceInMillis = date2Millis - date1Millis; - long diffInSec = differenceInMillis/1000; - long diffInMin = diffInSec/60; - long diffInHours = diffInMin/60; - long diffInDays = diffInHours/24; - - System.out.println("Diff in days = " + diffInDays); - - - System.out.println(jan1_2015.before(jan14_2015)); - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/date/DateUtil.java b/CoreJava_Feb2015/src/com/training/java/core/date/DateUtil.java deleted file mode 100644 index 85060f7..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/date/DateUtil.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.core.date; - -import java.util.Calendar; - -public class DateUtil { - - public long getDiffInDays(Calendar date1, Calendar date2) - { - long date1Millis = date1.getTimeInMillis(); - long date2Millis = date2.getTimeInMillis(); - - long differenceInMillis = date2Millis - date1Millis; - long diffInSec = differenceInMillis/1000; - long diffInMin = diffInSec/60; - long diffInHours = diffInMin/60; - long diffInDays = diffInHours/24; - - return diffInDays; - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringBufferDemo.java b/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringBufferDemo.java deleted file mode 100644 index 579992a..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringBufferDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.core.stringbuffer; - -public class StringBufferDemo { - - public static void main(String[] args) { - - StringBuffer name = new StringBuffer(); - - name.append("abc"); - name.append("def"); - name.append("ghi"); - - System.out.println(name); - - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringDemo.java b/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringDemo.java deleted file mode 100644 index 2c68bcd..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringDemo.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.core.stringbuffer; - -public class StringDemo { - - public static void main(String[] args) { - - String s = "abc"; - - System.out.println("s = " + s); - - s = s.replace('a', 'z'); - - System.out.println("s = " + s); - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringDemo2.java b/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringDemo2.java deleted file mode 100644 index eeca4c2..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringDemo2.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.core.stringbuffer; - -public class StringDemo2 { - - public static void main(String[] args) { - - String name = new String(); - - name = name.concat("abc"); - name = name.concat("def"); - name = name.concat("ghi"); - - System.out.println(name); - } - -} diff --git a/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringQuestion.java b/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringQuestion.java deleted file mode 100644 index cf55f66..0000000 --- a/CoreJava_Feb2015/src/com/training/java/core/stringbuffer/StringQuestion.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.training.java.core.stringbuffer; - -public class StringQuestion { - - public static void main(String[] args) { - - //Given a sentence of words separated by spaces, reverse the words. - //Example1 : "World is beautiful" should return "beautiful is World" - //Example2 : "Pen is mightier than sword" should return "sword than mightier is Pen" - - //Get the arraof words separated by space - - String str = "Pen is mightier than sword"; - - String[] words = str.split(" "); - System.out.println(words.length); - - int length = words.length; - - StringBuffer reversedString = new StringBuffer(); - for(int i = length-1; i>=0; i--) - { - reversedString.append(words[i]); - - if(i != 0) - { - reversedString.append(" "); - } - } - - System.out.println(reversedString.toString()); - } - -} diff --git a/CoreJava_Jan2014/.classpath b/CoreJava_Jan2014/.classpath deleted file mode 100644 index 91ee9a5..0000000 --- a/CoreJava_Jan2014/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/CoreJava_Jan2014/.project b/CoreJava_Jan2014/.project deleted file mode 100644 index bc2ad78..0000000 --- a/CoreJava_Jan2014/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - CoreJava_Jan2014 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/CoreJava_Jan2014/.settings/org.eclipse.jdt.core.prefs b/CoreJava_Jan2014/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 838bd9d..0000000 --- a/CoreJava_Jan2014/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/CoreJava_Jan2014/src/ArrayDemo.java b/CoreJava_Jan2014/src/ArrayDemo.java deleted file mode 100644 index 5251bcd..0000000 --- a/CoreJava_Jan2014/src/ArrayDemo.java +++ /dev/null @@ -1,32 +0,0 @@ -public class ArrayDemo { - - public static void main(String[] args) { - - // Declared and created - int[] ages = new int[10]; - - // Assign some values - ages[0] = 23; - ages[1] = 34; - ages[2] = 51; - ages[3] = 65; - - // Reading the values from an array - System.out.println("Size of the array = " + ages.length); - System.out.println("1st value " + ages[0]); - System.out.println("3rd value " + ages[2]); - System.out.println("Last value " + ages[9]); - - // Read all the values of an array - for (int i = 0; i < ages.length; i++) { - System.out.println("Value at index " + i + " is " + ages[i]); - } - - // for each loop - for (int age : ages) { - System.out.println("Age = " + age); - } - - } - -} diff --git a/CoreJava_Jan2014/src/ArrayDemo2.java b/CoreJava_Jan2014/src/ArrayDemo2.java deleted file mode 100644 index 58a1f88..0000000 --- a/CoreJava_Jan2014/src/ArrayDemo2.java +++ /dev/null @@ -1,31 +0,0 @@ - -public class ArrayDemo2 { - - public static void main(String[] args) { - - Car[] cars = new Car[3]; - - Car car1 = new Car(); - car1.make = "Ford"; - car1.model = "Mustang"; - - Car car2 = new Car(); - car2.make = "Chevy"; - car2.model = "Corvette"; - - Car car3 = new Car(); - car3.make = "Chrysler"; - car3.model = "Town & Country"; - - cars[0] = car1; - cars[1] = car2; - cars[2] = car3; - - for (Car c : cars) { - System.out.println("Make of car = " + c.make); - System.out.println("Model of car = " + c.model); - } - - } - -} diff --git a/CoreJava_Jan2014/src/ArrayDemo3.java b/CoreJava_Jan2014/src/ArrayDemo3.java deleted file mode 100644 index 400a417..0000000 --- a/CoreJava_Jan2014/src/ArrayDemo3.java +++ /dev/null @@ -1,22 +0,0 @@ -public class ArrayDemo3 { - - public static void main(String[] arguments) { - - // Create and assign values to an array at the same time - String[] names = { "Henry", "Jaya", "Manisha", "Mira" }; - - System.out.println("5th name = " + names[3]); - - // for loop - for (int i = 0; i < names.length; i++) { - String name = names[i]; - System.out.println("Name = " + name); - } - - // for each loop - for (String name : names) { - System.out.println("Name = " + name); - } - } - -} diff --git a/CoreJava_Jan2014/src/CalculatorDemo.java b/CoreJava_Jan2014/src/CalculatorDemo.java deleted file mode 100644 index 975d6c5..0000000 --- a/CoreJava_Jan2014/src/CalculatorDemo.java +++ /dev/null @@ -1,26 +0,0 @@ -public class CalculatorDemo { - - public static void main(String[] args) { - - // 2 + 3 - - String operand1 = args[0]; - String operaor = args[1]; - String operand2 = args[2]; - - System.out.println("operand1 = " + operand1); - System.out.println("operaor = " + operaor); - System.out.println("operand2 = " + operand2); - - int op1 = Integer.parseInt(operand1); - int op2 = Integer.parseInt(operand2); - - if (operaor.equals("+")) { - System.out.println("Result = " + (op1 + op2)); - } else if (operaor.equals("-")) { - System.out.println("Result = " + (op1 - op2)); - } - - } - -} diff --git a/CoreJava_Jan2014/src/Car.java b/CoreJava_Jan2014/src/Car.java deleted file mode 100644 index be8936d..0000000 --- a/CoreJava_Jan2014/src/Car.java +++ /dev/null @@ -1,33 +0,0 @@ -public class Car { - - String make; - String model; - int year; - int maximumSpeed; - int currentSpeed; - String color; - boolean hasStarted; - - void start() { - System.out.println("I am starting the car"); - hasStarted = true; - - currentSpeed = 0; - } - - void stop() { - System.out.println("Stopping the car"); - hasStarted = false; - currentSpeed = 0; - } - - void changeColor(String newColor) { - color = newColor; - } - - int accelerate(int howMuch) { - currentSpeed = currentSpeed + howMuch; - return currentSpeed; - } - -} diff --git a/CoreJava_Jan2014/src/ConcatenationDemo.java b/CoreJava_Jan2014/src/ConcatenationDemo.java deleted file mode 100644 index 1566390..0000000 --- a/CoreJava_Jan2014/src/ConcatenationDemo.java +++ /dev/null @@ -1,20 +0,0 @@ -public class ConcatenationDemo { - - public static void main(String[] args) { - - String oneString = "1"; - String twoString = "2"; - - int one = Integer.parseInt(oneString); - int two = Integer.parseInt(twoString); - - String speed1 = "123.56"; - String speed2 = "75.87"; - - System.out.println(one + two); - System.out.println(Double.parseDouble(speed1) - + Double.parseDouble(speed2)); - - } - -} diff --git a/CoreJava_Jan2014/src/DoWhileDemo1.java b/CoreJava_Jan2014/src/DoWhileDemo1.java deleted file mode 100644 index 14f2b20..0000000 --- a/CoreJava_Jan2014/src/DoWhileDemo1.java +++ /dev/null @@ -1,17 +0,0 @@ -public class DoWhileDemo1 { - - public static void main(String[] args) { - - int i = 11; - - do { - - System.out.println("i = " + i); - - i++; - - } while (i < 11); - - } - -} diff --git a/CoreJava_Jan2014/src/Driver.java b/CoreJava_Jan2014/src/Driver.java deleted file mode 100644 index 931fd45..0000000 --- a/CoreJava_Jan2014/src/Driver.java +++ /dev/null @@ -1,27 +0,0 @@ -public class Driver { - - public static void main(String[] args) { - - Car volt = new Car(); - - volt.changeColor("Black"); - System.out.println("Color now is " + volt.color); - - volt.start(); - - volt.changeColor("Blue"); - - System.out.println("Current speed = " + volt.currentSpeed); - volt.accelerate(20); - volt.accelerate(30); - volt.accelerate(60); - - System.out.println("Color now is " + volt.color); - System.out.println("Current speed = " + volt.currentSpeed); - - volt.stop(); - - System.out.println("Current speed = " + volt.currentSpeed); - } - -} diff --git a/CoreJava_Jan2014/src/ForLoopDemo1.java b/CoreJava_Jan2014/src/ForLoopDemo1.java deleted file mode 100644 index ae73ce8..0000000 --- a/CoreJava_Jan2014/src/ForLoopDemo1.java +++ /dev/null @@ -1,16 +0,0 @@ -public class ForLoopDemo1 { - - public static void main(String[] args) { - - for (int i = 1; i < 11; i++) { - - if (i == 5) { - break; - } - - System.out.println("Counter = " + i); - } - - } - -} diff --git a/CoreJava_Jan2014/src/HelloWorld.java b/CoreJava_Jan2014/src/HelloWorld.java deleted file mode 100644 index ee8e7e5..0000000 --- a/CoreJava_Jan2014/src/HelloWorld.java +++ /dev/null @@ -1,10 +0,0 @@ -public class HelloWorld { - - public static void main(String[] args) { - - System.out.println("Hello students, how are you doing?"); - System.out.println("3 times 2 = " + 3 * 2); - - } - -} diff --git a/CoreJava_Jan2014/src/HelloWorldWithArgument.java b/CoreJava_Jan2014/src/HelloWorldWithArgument.java deleted file mode 100644 index fabfdb3..0000000 --- a/CoreJava_Jan2014/src/HelloWorldWithArgument.java +++ /dev/null @@ -1,16 +0,0 @@ -public class HelloWorldWithArgument { - - public static void main(String[] args) { - - System.out.println("Array length = " + args.length); - String name = args[0]; - String secondName = args[1]; - String thirdName = args[2]; - - System.out.println("Hello " + name); - System.out.println("Hello " + secondName); - System.out.println("Hello " + thirdName); - - } - -} diff --git a/CoreJava_Jan2014/src/IfElseExample.java b/CoreJava_Jan2014/src/IfElseExample.java deleted file mode 100644 index 3ff2d86..0000000 --- a/CoreJava_Jan2014/src/IfElseExample.java +++ /dev/null @@ -1,9 +0,0 @@ -public class IfElseExample { - - public static void main(String[] args) { - - int age = 40; - - } - -} diff --git a/CoreJava_Jan2014/src/MedicareEligibilityCalculator.java b/CoreJava_Jan2014/src/MedicareEligibilityCalculator.java deleted file mode 100644 index 4859eb9..0000000 --- a/CoreJava_Jan2014/src/MedicareEligibilityCalculator.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * - * - * @author Venkata - * - */ -public class MedicareEligibilityCalculator { - - /** - * if age is 65 or above, he is eligible irrespective of state and sex if - * he/she has preexisting condition, he is eligible if age more than 45 and - * state is Texas or Hawai, he is eligible.. - * - * @param age - * @param hasPreExistingCondition - * @param state - * @return - */ - public boolean isEligible(int age, boolean hasPreExistingCondition, - String state) { - // If age is above 65, he/she is eligible for medicare because.. - if (age >= 65) { - return true; - } else if (hasPreExistingCondition) { - return true; - } else if ((age > 45) && (state.equals("TX") || state.equals("HI"))) { - return true; - } else { - return false; - } - } - -} diff --git a/CoreJava_Jan2014/src/MedicareEligibilityCalculatorDemo.java b/CoreJava_Jan2014/src/MedicareEligibilityCalculatorDemo.java deleted file mode 100644 index f9d58aa..0000000 --- a/CoreJava_Jan2014/src/MedicareEligibilityCalculatorDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -public class MedicareEligibilityCalculatorDemo { - - public static void main(String[] args) { - - MedicareEligibilityCalculator calculator = new MedicareEligibilityCalculator(); - - boolean isEligibleFor25MaleInMI = calculator.isEligible(25, true, "MI"); - System.out - .println("Am I eligible with 25 with pre existing in Michigan " - + isEligibleFor25MaleInMI); - - boolean isEligibleFor45InTX = calculator.isEligible(45, false, "TX"); - System.out.println("Am I eligible with 45 with no pre existing in TX " - + isEligibleFor45InTX); - - boolean isEligibleFor65InHI = calculator.isEligible(65, false, "HI"); - System.out.println("Am I eligible with 65 with no pre existing in HI " - + isEligibleFor65InHI); - - } - -} diff --git a/CoreJava_Jan2014/src/MonthDescriber.java b/CoreJava_Jan2014/src/MonthDescriber.java deleted file mode 100644 index 0b22d83..0000000 --- a/CoreJava_Jan2014/src/MonthDescriber.java +++ /dev/null @@ -1,30 +0,0 @@ -public class MonthDescriber { - - String describe(int numberOfMonth, String country) { - String monthDescription = "Outside of USA..sorry, I can't calculate.."; - - if (country.equals("USA")) { - switch (numberOfMonth) { - - case 1: - monthDescription = "January"; - break; - - case 2: - monthDescription = "February"; - break; - - case 3: - monthDescription = "March"; - break; - - default: - monthDescription = "invalid month provided"; - break; - } - } - - return monthDescription; - } - -} diff --git a/CoreJava_Jan2014/src/MonthDescriberDemo.java b/CoreJava_Jan2014/src/MonthDescriberDemo.java deleted file mode 100644 index 2db48a3..0000000 --- a/CoreJava_Jan2014/src/MonthDescriberDemo.java +++ /dev/null @@ -1,13 +0,0 @@ -public class MonthDescriberDemo { - - public static void main(String[] args) { - - MonthDescriber describer = new MonthDescriber(); - - String description = describer.describe(13, "INDIA"); - - System.out.println("Description = " + description); - - } - -} diff --git a/CoreJava_Jan2014/src/PostfixOperatorDemo.java b/CoreJava_Jan2014/src/PostfixOperatorDemo.java deleted file mode 100644 index 2073dc8..0000000 --- a/CoreJava_Jan2014/src/PostfixOperatorDemo.java +++ /dev/null @@ -1,12 +0,0 @@ -public class PostfixOperatorDemo { - - public static void main(String[] args) { - - int i = 1; - - System.out.println("i = " + i--); - System.out.println("i = " + i); - - } - -} diff --git a/CoreJava_Jan2014/src/Test.java b/CoreJava_Jan2014/src/Test.java deleted file mode 100644 index 928becc..0000000 --- a/CoreJava_Jan2014/src/Test.java +++ /dev/null @@ -1,15 +0,0 @@ -public class Test { - - public static void main(String[] args) { - - int age = 6; - do { - System.out.println("Age = " + age++); - } while (age < 10); - - String name = (age == 6) ? "Venkat" : "Hari"; - System.out.println("Name = " + name); - - } - -} diff --git a/CoreJava_Jan2014/src/WhileLoopDemo1.java b/CoreJava_Jan2014/src/WhileLoopDemo1.java deleted file mode 100644 index 83ee573..0000000 --- a/CoreJava_Jan2014/src/WhileLoopDemo1.java +++ /dev/null @@ -1,17 +0,0 @@ -public class WhileLoopDemo1 { - - public static void main(String[] args) { - - int i = 11; - - while (i < 11) { - System.out.println("i = " + i); - - i++; - } - - System.out.println("After while loop"); - - } - -} diff --git a/CoreJava_Jan2014/src/com/google/docs/excel/admin/Customer.java b/CoreJava_Jan2014/src/com/google/docs/excel/admin/Customer.java deleted file mode 100644 index fe0403b..0000000 --- a/CoreJava_Jan2014/src/com/google/docs/excel/admin/Customer.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.google.docs.excel.admin; - -import inheritance.Car; - -public class Customer { - - public static void main(String[] args) { - Car car = new Car(); - } - -} diff --git a/CoreJava_Jan2014/src/com/google/docs/excel/admin/PoliceCar.java b/CoreJava_Jan2014/src/com/google/docs/excel/admin/PoliceCar.java deleted file mode 100644 index 556847d..0000000 --- a/CoreJava_Jan2014/src/com/google/docs/excel/admin/PoliceCar.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.google.docs.excel.admin; - -import inheritance.Car; - -public class PoliceCar extends Car { - - protected void changeColor(String newColor) { - System.out.println("This is overridden method behavior in PoliceCar.."); - } - -} diff --git a/CoreJava_Jan2014/src/com/google/docs/excel/admin/PoliceCarDemo.java b/CoreJava_Jan2014/src/com/google/docs/excel/admin/PoliceCarDemo.java deleted file mode 100644 index b4498b8..0000000 --- a/CoreJava_Jan2014/src/com/google/docs/excel/admin/PoliceCarDemo.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.google.docs.excel.admin; - -public class PoliceCarDemo { - - public static void main(String[] args) { - - PoliceCar pc = new PoliceCar(); - pc.changeColor("Red"); - - } - -} diff --git a/CoreJava_Jan2014/src/com/google/docs/word/admin/Customer.java b/CoreJava_Jan2014/src/com/google/docs/word/admin/Customer.java deleted file mode 100644 index f468ed9..0000000 --- a/CoreJava_Jan2014/src/com/google/docs/word/admin/Customer.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.google.docs.word.admin; - -public class Customer { - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/abstraction/Car.java b/CoreJava_Jan2014/src/com/training/java/core/abstraction/Car.java deleted file mode 100644 index 58eb8c6..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/abstraction/Car.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.training.java.core.abstraction; - -public abstract class Car { - - private String make; - private String model; - private int year; - public final int maximumSpeed = 140; - private int currentSpeed; - private String color; - private boolean started; - - public Car() { - } - - Car(String make, String model, int year) { - this.model = model; - this.make = make; - this.year = year; - } - - Car(String make, String model, int year, String color) { - this.model = model; - this.make = make; - this.year = year; - this.color = color; - } - - void start() { - System.out.println("I am starting the car"); - started = true; - - currentSpeed = 0; - } - - void stop() { - System.out.println("Stopping the car"); - started = false; - currentSpeed = 0; - } - - protected void changeColor(String newColor) { - color = newColor; - } - - public abstract int accelerate(int howMuch); - - // ************ - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public int getYear() { - return year; - } - - public int getMaximumSpeed() { - return maximumSpeed; - } - - public int getCurrentSpeed() { - return currentSpeed; - } - - public void setCurrentSpeed(int currentSpeed) { - this.currentSpeed = currentSpeed; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public boolean isStarted() { - return started; - } - - public void setStarted(boolean started) { - this.started = started; - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/abstraction/Driver.java b/CoreJava_Jan2014/src/com/training/java/core/abstraction/Driver.java deleted file mode 100644 index 928214e..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/abstraction/Driver.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.core.abstraction; - -public class Driver { - - private Car car; - - public Driver(Car car) - { - this.car = car; - } - - public void drive() - { - car.start(); - car.accelerate(50); - - System.out.println("Current speed = " + car.getCurrentSpeed()); - - car.stop(); - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/abstraction/DriverDemo.java b/CoreJava_Jan2014/src/com/training/java/core/abstraction/DriverDemo.java deleted file mode 100644 index 531877b..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/abstraction/DriverDemo.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.core.abstraction; - -public class DriverDemo { - - public static void main(String[] args) { - - Car raceCar = new RaceCar(); - - Driver driver = new Driver(raceCar); - driver.drive(); - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/abstraction/PoliceCar.java b/CoreJava_Jan2014/src/com/training/java/core/abstraction/PoliceCar.java deleted file mode 100644 index b7f3849..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/abstraction/PoliceCar.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.abstraction; - -public class PoliceCar extends Car { - - void start() { - System.out.println("I am starting my PoliceCar...I am different!!"); - } - - @Override - public int accelerate(int howMuch) { - - int wishfulCurrentSpeed = getCurrentSpeed() + howMuch; - - if (wishfulCurrentSpeed > getMaximumSpeed()) { - setCurrentSpeed(getMaximumSpeed()); - } else { - setCurrentSpeed(wishfulCurrentSpeed); - } - - return getCurrentSpeed(); - } - - public void chase() { - System.out.println("Policecar is chasing..."); - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/abstraction/RaceCar.java b/CoreJava_Jan2014/src/com/training/java/core/abstraction/RaceCar.java deleted file mode 100644 index 93f5130..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/abstraction/RaceCar.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.java.core.abstraction; - -public class RaceCar extends Car { - - private boolean nitro; - - public RaceCar() { - super(); - } - - RaceCar(int year, String make, String model, boolean nitro) { - super(make, model, year); - - this.nitro = nitro; - } - - void race() { - System.out.println("I am racing"); - accelerate(getMaximumSpeed()); - - } - - @Override - void start() { - System.out.println("I am starting my RaceCar...rumm..!!"); - } - - @Override - public int accelerate(int howMuch) { - - int wishfulCurrentSpeed = getCurrentSpeed() + howMuch + 50; - - if (wishfulCurrentSpeed > getMaximumSpeed()) { - setCurrentSpeed(getMaximumSpeed()); - } else { - setCurrentSpeed(wishfulCurrentSpeed); - } - - return getCurrentSpeed(); - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/finalexample/Bus.java b/CoreJava_Jan2014/src/com/training/java/core/finalexample/Bus.java deleted file mode 100644 index bc48a56..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/finalexample/Bus.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.java.core.finalexample; - -public class Bus implements Vehicle { - - private int currentSpeed; - - @Override - public void start() { - - System.out.println("Bus is starting"); - - } - - @Override - public int accelerate(int howMuch) { - currentSpeed += howMuch; - - return currentSpeed; - } - - @Override - public void stop() { - System.out.println("Bus is stopping"); - } - - @Override - public int getCurrentSpeed() { - return currentSpeed; - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/finalexample/Driver.java b/CoreJava_Jan2014/src/com/training/java/core/finalexample/Driver.java deleted file mode 100644 index 969ce13..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/finalexample/Driver.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.core.finalexample; - -public class Driver { - - private Vehicle vehicle; - - public Driver(Vehicle car) - { - this.vehicle = car; - } - - public void drive() - { - vehicle.start(); - vehicle.accelerate(50); - - System.out.println("Current speed = " + vehicle.getCurrentSpeed()); - - vehicle.stop(); - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/finalexample/InterfaceDemo.java b/CoreJava_Jan2014/src/com/training/java/core/finalexample/InterfaceDemo.java deleted file mode 100644 index aec2096..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/finalexample/InterfaceDemo.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.core.finalexample; - -public class InterfaceDemo { - - public static void main(String[] args) { - - Vehicle v = new Truck(); - - Driver driver = new Driver(v); - driver.drive(); - - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/finalexample/Truck.java b/CoreJava_Jan2014/src/com/training/java/core/finalexample/Truck.java deleted file mode 100644 index 4f7a4c6..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/finalexample/Truck.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.java.core.finalexample; - -public class Truck implements Vehicle { - - private int currentSpeed; - - @Override - public void start() { - System.out.println("My truck is starting.."); - - } - - @Override - public int accelerate(int howMuch) { - currentSpeed = currentSpeed + howMuch; - - return currentSpeed; - } - - @Override - public void stop() { - System.out.println("My truck is stopping.."); - } - - @Override - public int getCurrentSpeed() { - return currentSpeed; - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/finalexample/Vehicle.java b/CoreJava_Jan2014/src/com/training/java/core/finalexample/Vehicle.java deleted file mode 100644 index 511abe6..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/finalexample/Vehicle.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.training.java.core.finalexample; - -public interface Vehicle { - - void start(); - int accelerate(int howMuch); - void stop(); - - int getCurrentSpeed(); - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/immutability/Car.java b/CoreJava_Jan2014/src/com/training/java/core/immutability/Car.java deleted file mode 100644 index 4990ac5..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/immutability/Car.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.core.immutability; - -public class Car { - - private String make = "Ford"; - private String model = "Focus"; - private int year = 2014; - - public Car(String make, String model, int year) { - super(); - this.make = make; - this.model = model; - this.year = year; - } - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public int getYear() { - return year; - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/immutability/ImmutabilityDemo.java b/CoreJava_Jan2014/src/com/training/java/core/immutability/ImmutabilityDemo.java deleted file mode 100644 index 0cd9a58..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/immutability/ImmutabilityDemo.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.core.immutability; - -public class ImmutabilityDemo { - - public static void main(String[] args) { - - Car focus = new Car("Ford", "Focus", 2014); - Car accord = new Car("Honda", "Accord", 2014); - Car volt = new Car("Chevy", "Volt", 2014); - Car camry = new Car("Toyota", "Camry", 2014); - - focus.getMake(); - focus.getModel(); - focus.getYear(); - - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/overriding/Car.java b/CoreJava_Jan2014/src/com/training/java/core/overriding/Car.java deleted file mode 100644 index b43021d..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/overriding/Car.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.java.core.overriding; - -public class Car { - - private String make; - private String model; - private int year; - private int maximumSpeed = 140; - private int currentSpeed; - private String color; - private boolean started; - - public Car() { - - } - - Car(String make, String model, int year) { - this.model = model; - this.make = make; - this.year = year; - } - - Car(String make, String model, int year, String color) { - this.model = model; - this.make = make; - this.year = year; - this.color = color; - } - - void start() { - System.out.println("I am starting the car"); - started = true; - - currentSpeed = 0; - } - - void stop() { - System.out.println("Stopping the car"); - started = false; - currentSpeed = 0; - } - - protected void changeColor(String newColor) { - color = newColor; - } - - int accelerate(int howMuch) { - - int wishfulCurrentSpeed = currentSpeed + howMuch; - - if (wishfulCurrentSpeed > maximumSpeed) { - currentSpeed = maximumSpeed; - } else { - currentSpeed = wishfulCurrentSpeed; - } - - return currentSpeed; - } - - // ************ - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public int getYear() { - return year; - } - - public int getMaximumSpeed() { - return maximumSpeed; - } - - public int getCurrentSpeed() { - return currentSpeed; - } - - public void setCurrentSpeed(int currentSpeed) { - this.currentSpeed = currentSpeed; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public boolean isStarted() { - return started; - } - - public void setStarted(boolean started) { - this.started = started; - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/overriding/PoliceCar.java b/CoreJava_Jan2014/src/com/training/java/core/overriding/PoliceCar.java deleted file mode 100644 index 2d76336..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/overriding/PoliceCar.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.core.overriding; - -/** - * @author Venkata - * - */ -public class PoliceCar extends Car { - - /* (non-Javadoc) - * @see com.training.java.core.overriding.Car#start() - */ - @Override - void start() { - - super.accelerate(20); - - System.out.println("I am starting my PoliceCar...I am different!!"); - } - - @Override - int accelerate(int howMuch) { - return 1; - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/overriding/PoliceCarDemo.java b/CoreJava_Jan2014/src/com/training/java/core/overriding/PoliceCarDemo.java deleted file mode 100644 index 57ebbdf..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/overriding/PoliceCarDemo.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.core.overriding; - -public class PoliceCarDemo { - - public static void main(String[] args) { - - PoliceCar policeCar = new PoliceCar(); - - policeCar.start(); - - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/Car.java b/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/Car.java deleted file mode 100644 index f56aea0..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/Car.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.java.core.polymorphysm; - -public class Car { - - private String make; - private String model; - private int year; - private final int maximumSpeed = 140; - private int currentSpeed; - private String color; - private boolean started; - - public Car() { - - } - - Car(String make, String model, int year) { - this.model = model; - this.make = make; - this.year = year; - } - - Car(String make, String model, int year, String color) { - this.model = model; - this.make = make; - this.year = year; - this.color = color; - } - - void start() { - System.out.println("I am starting the car"); - started = true; - - currentSpeed = 0; - } - - void stop() { - System.out.println("Stopping the car"); - started = false; - currentSpeed = 0; - } - - protected void changeColor(String newColor) { - color = newColor; - } - - int accelerate(int howMuch) { - - int wishfulCurrentSpeed = currentSpeed + howMuch; - - if (wishfulCurrentSpeed > maximumSpeed) { - currentSpeed = maximumSpeed; - } else { - currentSpeed = wishfulCurrentSpeed; - } - - return currentSpeed; - } - - // ************ - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public int getYear() { - return year; - } - - public int getMaximumSpeed() { - return maximumSpeed; - } - - public int getCurrentSpeed() { - return currentSpeed; - } - - public void setCurrentSpeed(int currentSpeed) { - this.currentSpeed = currentSpeed; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public boolean isStarted() { - return started; - } - - public void setStarted(boolean started) { - this.started = started; - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/PoliceCar.java b/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/PoliceCar.java deleted file mode 100644 index 997a35d..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/PoliceCar.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.java.core.polymorphysm; - -public class PoliceCar extends Car { - - void start() { - System.out.println("I am starting my PoliceCar...I am different!!"); - } - - @Override - int accelerate(int howMuch) { - - return super.accelerate(getMaximumSpeed()); - } - - public void chase() { - System.out.println("Policecar is chasing..."); - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/PolymorphismDemo.java b/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/PolymorphismDemo.java deleted file mode 100644 index 69b9867..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/PolymorphismDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.core.polymorphysm; - -public class PolymorphismDemo { - - public static void main(String[] args) { - - PoliceCar policeCar = new PoliceCar(); - RaceCar raceCar = new RaceCar(); - - execute(policeCar); - execute(raceCar); - - } - - public static void execute(Car car) { - car.start(); - car.accelerate(30); - - System.out.println("Current speed = " + car.getCurrentSpeed()); - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/RaceCar.java b/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/RaceCar.java deleted file mode 100644 index 0448654..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/polymorphysm/RaceCar.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.polymorphysm; - -public class RaceCar extends Car { - - private boolean nitro; - - public RaceCar() { - super(); - } - - RaceCar(int year, String make, String model, boolean nitro) { - super(make, model, year); - - this.nitro = nitro; - } - - void race() { - System.out.println("I am racing"); - accelerate(getMaximumSpeed()); - - } - - void start() { - System.out.println("I am starting my RaceCar...rumm..!!"); - } - - int accelerate(int howMuch) { - - return super.accelerate(howMuch + 50); - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/string/StringBufferDemo.java b/CoreJava_Jan2014/src/com/training/java/core/string/StringBufferDemo.java deleted file mode 100644 index 7e69337..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/string/StringBufferDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.core.string; - -public class StringBufferDemo { - - public static void main(String[] args) { - - StringBuffer sb = new StringBuffer("JavaTraining"); - - for(int i=0; i<100; i++) - { - sb.append(" By Venkat Hari"); - System.out.println("str = " + sb.toString()); - } - - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/string/StringDemo.java b/CoreJava_Jan2014/src/com/training/java/core/string/StringDemo.java deleted file mode 100644 index 3418eda..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/string/StringDemo.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.java.core.string; - -/** - * This class demonstrates how String is an immutable object. For example, - * - * every single time you call concat method, you are creating a brand new object. - * - * - * @author Venkata - * - */ -public class StringDemo { - - /** - * - * - * @param args - */ - public static void main(String[] args) { - - //String str = new String("JavaTraining"); - String str = "JavaTraining"; - - for(int i=0; i<100; i++) - { - str = str.concat(" By Venkat Hari"); - System.out.println("str = " + str); - } - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/threading/Thread2.java b/CoreJava_Jan2014/src/com/training/java/core/threading/Thread2.java deleted file mode 100644 index 0991833..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/threading/Thread2.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.core.threading; - -public class Thread2 extends Thread { - - @Override - public void run() { - - for(int i=0; i<1000; i++) - { - System.out.println("In.." + Thread.currentThread().getName() + "i = " + i); - } - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/threading/Thread2Runnable.java b/CoreJava_Jan2014/src/com/training/java/core/threading/Thread2Runnable.java deleted file mode 100644 index 9413bf3..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/threading/Thread2Runnable.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.core.threading; - -public class Thread2Runnable implements Runnable { - - @Override - public void run() { - - for (int i = 0; i < 1000; i++) { - System.out.println("In.." + Thread.currentThread().getName() - + "i = " + i); - } - } - -} diff --git a/CoreJava_Jan2014/src/com/training/java/core/threading/ThreadDemo.java b/CoreJava_Jan2014/src/com/training/java/core/threading/ThreadDemo.java deleted file mode 100644 index 729c01e..0000000 --- a/CoreJava_Jan2014/src/com/training/java/core/threading/ThreadDemo.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.core.threading; - -public class ThreadDemo { - - public static void main(String[] args) throws InterruptedException { - - System.out.println("In.." + Thread.currentThread().getName()); - - new Thread(new Thread2Runnable()).start(); - - System.out.println("Before main thread sleeps"); - Thread.sleep(1000); - System.out.println("After main thread sleeps"); - - for(int j=0; j<1000; j++) - { - System.out.println("In.." + Thread.currentThread().getName() + "j = " + j); - } - } - -} diff --git a/CoreJava_Jan2014/src/constructor/Car.java b/CoreJava_Jan2014/src/constructor/Car.java deleted file mode 100644 index 005af44..0000000 --- a/CoreJava_Jan2014/src/constructor/Car.java +++ /dev/null @@ -1,52 +0,0 @@ -package constructor; - -public class Car { - - String make; - String model; - int year; - int maximumSpeed; - int currentSpeed; - String color; - boolean hasStarted; - - Car() { - - } - - Car(String newMake, String newModel) { - make = newMake; - model = newModel; - } - - Car(String newMake) { - make = newMake; - } - - Car(String newModel, String newMake, int year) { - - } - - void start() { - System.out.println("I am starting the car"); - hasStarted = true; - - currentSpeed = 0; - } - - void stop() { - System.out.println("Stopping the car"); - hasStarted = false; - currentSpeed = 0; - } - - void changeColor(String newColor) { - color = newColor; - } - - int accelerate(int howMuch) { - currentSpeed = currentSpeed + howMuch; - return currentSpeed; - } - -} diff --git a/CoreJava_Jan2014/src/constructor/CarDemo.java b/CoreJava_Jan2014/src/constructor/CarDemo.java deleted file mode 100644 index fa75724..0000000 --- a/CoreJava_Jan2014/src/constructor/CarDemo.java +++ /dev/null @@ -1,15 +0,0 @@ -package constructor; - -public class CarDemo { - - public static void main(String[] args) { - - // Car focus = new Car("Ford", "Focus"); - - Car focus = new Car("Ford", "Focus"); - - System.out.println("Make of the car = " + focus.make); - - } - -} diff --git a/CoreJava_Jan2014/src/encapsulation/Car.java b/CoreJava_Jan2014/src/encapsulation/Car.java deleted file mode 100644 index beda8b4..0000000 --- a/CoreJava_Jan2014/src/encapsulation/Car.java +++ /dev/null @@ -1,102 +0,0 @@ -package encapsulation; - -public class Car { - - private String make; - private String model; - private int year; - private int maximumSpeed = 140; - private int currentSpeed; - private String color; - private boolean started; - - Car(String make, String model, int year) { - this.model = model; - this.make = make; - this.year = year; - } - - Car(String make, String model, int year, String color) { - this.model = model; - this.make = make; - this.year = year; - this.color = color; - } - - void start() { - System.out.println("I am starting the car"); - started = true; - - currentSpeed = 0; - } - - void stop() { - System.out.println("Stopping the car"); - started = false; - currentSpeed = 0; - } - - void changeColor(String newColor) { - color = newColor; - } - - int accelerate(int howMuch) { - - int wishfulCurrentSpeed = currentSpeed + howMuch; - - if (wishfulCurrentSpeed > maximumSpeed) { - currentSpeed = maximumSpeed; - } else { - currentSpeed = wishfulCurrentSpeed; - } - - return currentSpeed; - } - - // ************ - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public int getYear() { - return year; - } - - public int getMaximumSpeed() { - return maximumSpeed; - } - - public void setMaximumSpeed(int maximumSpeed) { - this.maximumSpeed = maximumSpeed; - } - - public int getCurrentSpeed() { - return currentSpeed; - } - - public void setCurrentSpeed(int currentSpeed) { - this.currentSpeed = currentSpeed; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public boolean isStarted() { - return started; - } - - public void setStarted(boolean started) { - this.started = started; - } - -} diff --git a/CoreJava_Jan2014/src/encapsulation/CarDemo.java b/CoreJava_Jan2014/src/encapsulation/CarDemo.java deleted file mode 100644 index 75c899f..0000000 --- a/CoreJava_Jan2014/src/encapsulation/CarDemo.java +++ /dev/null @@ -1,21 +0,0 @@ -package encapsulation; - -public class CarDemo { - - public static void main(String[] args) { - - // Car focus = new Car("Ford", "Focus"); - - Car focus = new Car("Ford", "Focus", 2013, "black"); - - focus.setColor("red"); - - focus.accelerate(45734756); - - System.out.println("Make of the car = " + focus.getMake()); - System.out.println("current speed = " + focus.getCurrentSpeed()); - System.out.println("Color of the car = " + focus.getColor()); - - } - -} diff --git a/CoreJava_Jan2014/src/inheritance/Car.java b/CoreJava_Jan2014/src/inheritance/Car.java deleted file mode 100644 index 349cd96..0000000 --- a/CoreJava_Jan2014/src/inheritance/Car.java +++ /dev/null @@ -1,101 +0,0 @@ -package inheritance; - -public class Car { - - private String make; - private String model; - private int year; - private int maximumSpeed = 140; - private int currentSpeed; - private String color; - private boolean started; - - public Car() { - - } - - Car(String make, String model, int year) { - this.model = model; - this.make = make; - this.year = year; - } - - Car(String make, String model, int year, String color) { - this.model = model; - this.make = make; - this.year = year; - this.color = color; - } - - void start() { - System.out.println("I am starting the car"); - started = true; - - currentSpeed = 0; - } - - void stop() { - System.out.println("Stopping the car"); - started = false; - currentSpeed = 0; - } - - protected void changeColor(String newColor) { - color = newColor; - } - - int accelerate(int howMuch) { - - int wishfulCurrentSpeed = currentSpeed + howMuch; - - if (wishfulCurrentSpeed > maximumSpeed) { - currentSpeed = maximumSpeed; - } else { - currentSpeed = wishfulCurrentSpeed; - } - - return currentSpeed; - } - - // ************ - - public String getMake() { - return make; - } - - public String getModel() { - return model; - } - - public int getYear() { - return year; - } - - public int getMaximumSpeed() { - return maximumSpeed; - } - - public int getCurrentSpeed() { - return currentSpeed; - } - - public void setCurrentSpeed(int currentSpeed) { - this.currentSpeed = currentSpeed; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public boolean isStarted() { - return started; - } - - public void setStarted(boolean started) { - this.started = started; - } -} diff --git a/CoreJava_Jan2014/src/inheritance/Driver.java b/CoreJava_Jan2014/src/inheritance/Driver.java deleted file mode 100644 index 89e4beb..0000000 --- a/CoreJava_Jan2014/src/inheritance/Driver.java +++ /dev/null @@ -1,11 +0,0 @@ -package inheritance; - -public class Driver { - - public static void main(String[] args) { - - Car car = new Car(); - - } - -} diff --git a/CoreJava_Jan2014/src/inheritance/RaceCar.java b/CoreJava_Jan2014/src/inheritance/RaceCar.java deleted file mode 100644 index 57a1fa5..0000000 --- a/CoreJava_Jan2014/src/inheritance/RaceCar.java +++ /dev/null @@ -1,19 +0,0 @@ -package inheritance; - -public class RaceCar extends Car { - - private boolean nitro; - - RaceCar(int year, String make, String model, boolean nitro) { - super(make, model, year); - - this.nitro = nitro; - } - - void race() { - System.out.println("I am racing"); - accelerate(getMaximumSpeed()); - - } - -} diff --git a/CoreJava_Jan2014/src/inheritance/RaceCarDemo.java b/CoreJava_Jan2014/src/inheritance/RaceCarDemo.java deleted file mode 100644 index 2849e8d..0000000 --- a/CoreJava_Jan2014/src/inheritance/RaceCarDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package inheritance; - -import com.google.docs.excel.admin.Customer; - -public class RaceCarDemo { - - public static void main(String[] args) { - - RaceCar raceCar = new RaceCar(2011, "Ford", "Focus", false); - - raceCar.start(); - raceCar.race(); - - int currentSpeed = raceCar.getCurrentSpeed(); - System.out.println("Current speed = " + currentSpeed); - - System.out.println(raceCar.toString()); - - Customer customer = new Customer(); - } - -} diff --git a/CoreJava_Venkat/.classpath b/CoreJava_Venkat/.classpath deleted file mode 100644 index 91ee9a5..0000000 --- a/CoreJava_Venkat/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/CoreJava_Venkat/.project b/CoreJava_Venkat/.project deleted file mode 100644 index 752d9a0..0000000 --- a/CoreJava_Venkat/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - CoreJava_Venkat - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/CoreJava_Venkat/.settings/org.eclipse.jdt.core.prefs b/CoreJava_Venkat/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 838bd9d..0000000 --- a/CoreJava_Venkat/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/CoreJava_Venkat/doc/allclasses-frame.html b/CoreJava_Venkat/doc/allclasses-frame.html deleted file mode 100644 index e3877e1..0000000 --- a/CoreJava_Venkat/doc/allclasses-frame.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - -All Classes - - - - -

All Classes

- - - diff --git a/CoreJava_Venkat/doc/allclasses-noframe.html b/CoreJava_Venkat/doc/allclasses-noframe.html deleted file mode 100644 index 7913dc0..0000000 --- a/CoreJava_Venkat/doc/allclasses-noframe.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - -All Classes - - - - -

All Classes

- - - diff --git a/CoreJava_Venkat/doc/com/suneetha/ArrayDemo.html b/CoreJava_Venkat/doc/com/suneetha/ArrayDemo.html deleted file mode 100644 index 83a8b94..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/ArrayDemo.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - - -ArrayDemo - - - - - - - - - - - -
-
com.suneetha
-

Class ArrayDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.suneetha.ArrayDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ArrayDemo
    -extends java.lang.Object
    -
    This example shows how to use Arrays.
    -
    Author:
    -
    Hari
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      ArrayDemo() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ArrayDemo

        -
        public ArrayDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/CalculatorDemo.html b/CoreJava_Venkat/doc/com/suneetha/CalculatorDemo.html deleted file mode 100644 index 42f42a1..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/CalculatorDemo.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -CalculatorDemo - - - - - - - - - - - -
-
com.suneetha
-

Class CalculatorDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.suneetha.CalculatorDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class CalculatorDemo
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      CalculatorDemo() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CalculatorDemo

        -
        public CalculatorDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/Car.html b/CoreJava_Venkat/doc/com/suneetha/Car.html deleted file mode 100644 index da0ec8c..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/Car.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - -Car - - - - - - - - - - - -
-
com.suneetha
-

Class Car

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.suneetha.Car
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class Car
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Car() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Car

        -
        public Car()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/CarDemo.html b/CoreJava_Venkat/doc/com/suneetha/CarDemo.html deleted file mode 100644 index 73126c8..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/CarDemo.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -CarDemo - - - - - - - - - - - -
-
com.suneetha
-

Class CarDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.suneetha.CarDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class CarDemo
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      CarDemo() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CarDemo

        -
        public CarDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/HelloWorld.html b/CoreJava_Venkat/doc/com/suneetha/HelloWorld.html deleted file mode 100644 index 9fb8104..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/HelloWorld.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -HelloWorld - - - - - - - - - - - -
-
com.suneetha
-

Class HelloWorld

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.suneetha.HelloWorld
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class HelloWorld
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      HelloWorld() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HelloWorld

        -
        public HelloWorld()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/class-use/ArrayDemo.html b/CoreJava_Venkat/doc/com/suneetha/class-use/ArrayDemo.html deleted file mode 100644 index 4b38ec7..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/class-use/ArrayDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.suneetha.ArrayDemo - - - - - - - - - - -
-

Uses of Class
com.suneetha.ArrayDemo

-
-
No usage of com.suneetha.ArrayDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/class-use/CalculatorDemo.html b/CoreJava_Venkat/doc/com/suneetha/class-use/CalculatorDemo.html deleted file mode 100644 index 75ea17a..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/class-use/CalculatorDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.suneetha.CalculatorDemo - - - - - - - - - - -
-

Uses of Class
com.suneetha.CalculatorDemo

-
-
No usage of com.suneetha.CalculatorDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/class-use/Car.html b/CoreJava_Venkat/doc/com/suneetha/class-use/Car.html deleted file mode 100644 index 71cfb8b..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/class-use/Car.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.suneetha.Car - - - - - - - - - - -
-

Uses of Class
com.suneetha.Car

-
-
No usage of com.suneetha.Car
- - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/class-use/CarDemo.html b/CoreJava_Venkat/doc/com/suneetha/class-use/CarDemo.html deleted file mode 100644 index 24d76aa..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/class-use/CarDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.suneetha.CarDemo - - - - - - - - - - -
-

Uses of Class
com.suneetha.CarDemo

-
-
No usage of com.suneetha.CarDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/class-use/HelloWorld.html b/CoreJava_Venkat/doc/com/suneetha/class-use/HelloWorld.html deleted file mode 100644 index 6700f01..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/class-use/HelloWorld.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.suneetha.HelloWorld - - - - - - - - - - -
-

Uses of Class
com.suneetha.HelloWorld

-
-
No usage of com.suneetha.HelloWorld
- - - - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/package-frame.html b/CoreJava_Venkat/doc/com/suneetha/package-frame.html deleted file mode 100644 index d067d9d..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/package-frame.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -com.suneetha - - - - -

com.suneetha

- - - diff --git a/CoreJava_Venkat/doc/com/suneetha/package-summary.html b/CoreJava_Venkat/doc/com/suneetha/package-summary.html deleted file mode 100644 index 3c20a9a..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/package-summary.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - -com.suneetha - - - - - - - -
- - - - - -
- - -
-

Package com.suneetha

-
-
- -
Author:
-
Hari
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/package-tree.html b/CoreJava_Venkat/doc/com/suneetha/package-tree.html deleted file mode 100644 index c171d68..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/package-tree.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - -com.suneetha Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package com.suneetha

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/suneetha/package-use.html b/CoreJava_Venkat/doc/com/suneetha/package-use.html deleted file mode 100644 index 429dcf0..0000000 --- a/CoreJava_Venkat/doc/com/suneetha/package-use.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Package com.suneetha - - - - - - - - - - -
-

Uses of Package
com.suneetha

-
-
No usage of com.suneetha
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/AbstractionDemo.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/AbstractionDemo.html deleted file mode 100644 index c8e086b..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/AbstractionDemo.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -AbstractionDemo - - - - - - - - - - - -
-
com.training.java.core.abstraction
-

Class AbstractionDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.abstraction.AbstractionDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class AbstractionDemo
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      AbstractionDemo() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        AbstractionDemo

        -
        public AbstractionDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/Car.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/Car.html deleted file mode 100644 index 7e3c5ff..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/Car.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - -Car - - - - - - - - - - - -
-
com.training.java.core.abstraction
-

Class Car

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.abstraction.Car
    • -
    -
  • -
-
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    PoliceCar, RaceCar
    -
    -
    -
    -
    public abstract class Car
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Car() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      abstract voidaccelerate(int increaseMiles) 
      voidapplyBrakes(int decreaseMiles) 
      intgetCurrentSpeed() 
      voidprintInformation() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Car

        -
        public Car()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        accelerate

        -
        public abstract void accelerate(int increaseMiles)
        -
      • -
      - - - -
        -
      • -

        applyBrakes

        -
        public void applyBrakes(int decreaseMiles)
        -
      • -
      - - - -
        -
      • -

        getCurrentSpeed

        -
        public int getCurrentSpeed()
        -
      • -
      - - - -
        -
      • -

        printInformation

        -
        public void printInformation()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/ItalianRaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/ItalianRaceCar.html deleted file mode 100644 index 0493640..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/ItalianRaceCar.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - - -ItalianRaceCar - - - - - - - - - - - -
-
com.training.java.core.abstraction
-

Class ItalianRaceCar

-
-
- -
-
    -
  • -
    -
    -
    public class ItalianRaceCar
    -extends RaceCar
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      ItalianRaceCar() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidaccelerate(int increaseMiles) 
      -
        -
      • - - -

        Methods inherited from class com.training.java.core.abstraction.RaceCar

        -nitro
      • -
      - -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ItalianRaceCar

        -
        public ItalianRaceCar()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        accelerate

        -
        public void accelerate(int increaseMiles)
        -
        -
        Specified by:
        -
        accelerate in class Car
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/PoliceCar.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/PoliceCar.html deleted file mode 100644 index c011392..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/PoliceCar.html +++ /dev/null @@ -1,298 +0,0 @@ - - - - - -PoliceCar - - - - - - - - - - - -
-
com.training.java.core.abstraction
-

Class PoliceCar

-
-
- -
-
    -
  • -
    -
    -
    public class PoliceCar
    -extends Car
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PoliceCar(java.lang.String color) 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidaccelerate(int increaseMiles) 
      voidchase() 
      voidturnOnLights() 
      - -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PoliceCar

        -
        public PoliceCar(java.lang.String color)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        chase

        -
        public void chase()
        -
      • -
      - - - -
        -
      • -

        turnOnLights

        -
        public void turnOnLights()
        -
      • -
      - - - -
        -
      • -

        accelerate

        -
        public void accelerate(int increaseMiles)
        -
        -
        Specified by:
        -
        accelerate in class Car
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/RaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/RaceCar.html deleted file mode 100644 index eba4faa..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/RaceCar.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - -RaceCar - - - - - - - - - - - -
-
com.training.java.core.abstraction
-

Class RaceCar

-
-
- -
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    ItalianRaceCar
    -
    -
    -
    -
    public abstract class RaceCar
    -extends Car
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      RaceCar() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidnitro() 
      - -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        RaceCar

        -
        public RaceCar()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        nitro

        -
        public void nitro()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/AbstractionDemo.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/AbstractionDemo.html deleted file mode 100644 index 7f496f5..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/AbstractionDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.abstraction.AbstractionDemo - - - - - - - - - - -
-

Uses of Class
com.training.java.core.abstraction.AbstractionDemo

-
-
No usage of com.training.java.core.abstraction.AbstractionDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/Car.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/Car.html deleted file mode 100644 index 324ed81..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/Car.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - -Uses of Class com.training.java.core.abstraction.Car - - - - - - - - - - -
-

Uses of Class
com.training.java.core.abstraction.Car

-
-
- -
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/ItalianRaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/ItalianRaceCar.html deleted file mode 100644 index eacb17a..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/ItalianRaceCar.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.abstraction.ItalianRaceCar - - - - - - - - - - -
-

Uses of Class
com.training.java.core.abstraction.ItalianRaceCar

-
-
No usage of com.training.java.core.abstraction.ItalianRaceCar
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/PoliceCar.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/PoliceCar.html deleted file mode 100644 index 57d9ae4..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/PoliceCar.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.abstraction.PoliceCar - - - - - - - - - - -
-

Uses of Class
com.training.java.core.abstraction.PoliceCar

-
-
No usage of com.training.java.core.abstraction.PoliceCar
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/RaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/RaceCar.html deleted file mode 100644 index b007802..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/class-use/RaceCar.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - -Uses of Class com.training.java.core.abstraction.RaceCar - - - - - - - - - - -
-

Uses of Class
com.training.java.core.abstraction.RaceCar

-
-
- -
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-frame.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-frame.html deleted file mode 100644 index 715fb2a..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-frame.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -com.training.java.core.abstraction - - - - -

com.training.java.core.abstraction

- - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-summary.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-summary.html deleted file mode 100644 index f5d4022..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-summary.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - -com.training.java.core.abstraction - - - - - - - -
- - - - - -
- - -
-

Package com.training.java.core.abstraction

-
-
- -
Author:
-
Hari
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-tree.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-tree.html deleted file mode 100644 index c5e4aa1..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-tree.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - -com.training.java.core.abstraction Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package com.training.java.core.abstraction

-Package Hierarchies: - -
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • com.training.java.core.abstraction.AbstractionDemo
    • -
    • com.training.java.core.abstraction.Car - -
    • -
    -
  • -
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-use.html b/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-use.html deleted file mode 100644 index eb067e0..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/abstraction/package-use.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - -Uses of Package com.training.java.core.abstraction - - - - - - - - - - -
-

Uses of Package
com.training.java.core.abstraction

-
-
- -
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/doc/package-frame.html b/CoreJava_Venkat/doc/com/training/java/core/doc/package-frame.html deleted file mode 100644 index 3b10c5c..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/doc/package-frame.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - -com.training.java.core.doc - - - - -

com.training.java.core.doc

- - diff --git a/CoreJava_Venkat/doc/com/training/java/core/doc/package-summary.html b/CoreJava_Venkat/doc/com/training/java/core/doc/package-summary.html deleted file mode 100644 index 1cdf4dd..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/doc/package-summary.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - -com.training.java.core.doc - - - - - - - -
- - - - - -
- - -
-

Package com.training.java.core.doc

-
-
-
Author:
-
Hari
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/doc/package-tree.html b/CoreJava_Venkat/doc/com/training/java/core/doc/package-tree.html deleted file mode 100644 index 139cf64..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/doc/package-tree.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - -com.training.java.core.doc Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package com.training.java.core.doc

-Package Hierarchies: - -
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/doc/package-use.html b/CoreJava_Venkat/doc/com/training/java/core/doc/package-use.html deleted file mode 100644 index dee95a8..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/doc/package-use.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Package com.training.java.core.doc - - - - - - - - - - -
-

Uses of Package
com.training.java.core.doc

-
-
No usage of com.training.java.core.doc
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/Car.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/Car.html deleted file mode 100644 index d9eaeb4..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/Car.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - -Car - - - - - - - - - - - -
-
com.training.java.core.inheritence
-

Class Car

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.inheritence.Car
    • -
    -
  • -
-
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    PoliceCar, RaceCar
    -
    -
    -
    -
    public class Car
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Car() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidaccelerate(int increaseMiles) 
      voidapplyBrakes(int decreaseMiles) 
      voidprintInformation() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Car

        -
        public Car()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        accelerate

        -
        public void accelerate(int increaseMiles)
        -
      • -
      - - - -
        -
      • -

        applyBrakes

        -
        public void applyBrakes(int decreaseMiles)
        -
      • -
      - - - -
        -
      • -

        printInformation

        -
        public void printInformation()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/InheritenceDemo.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/InheritenceDemo.html deleted file mode 100644 index 068ad67..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/InheritenceDemo.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -InheritenceDemo - - - - - - - - - - - -
-
com.training.java.core.inheritence
-

Class InheritenceDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.inheritence.InheritenceDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class InheritenceDemo
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      InheritenceDemo() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        InheritenceDemo

        -
        public InheritenceDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/PoliceCar.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/PoliceCar.html deleted file mode 100644 index 3526104..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/PoliceCar.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -PoliceCar - - - - - - - - - - - -
-
com.training.java.core.inheritence
-

Class PoliceCar

-
-
- -
-
    -
  • -
    -
    -
    public final class PoliceCar
    -extends Car
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PoliceCar(java.lang.String color) 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidchase() 
      voidturnOnLights() 
      - -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PoliceCar

        -
        public PoliceCar(java.lang.String color)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        chase

        -
        public void chase()
        -
      • -
      - - - -
        -
      • -

        turnOnLights

        -
        public void turnOnLights()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/RaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/RaceCar.html deleted file mode 100644 index 40e153b..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/RaceCar.html +++ /dev/null @@ -1,268 +0,0 @@ - - - - - -RaceCar - - - - - - - - - - - -
-
com.training.java.core.inheritence
-

Class RaceCar

-
-
- -
-
    -
  • -
    -
    -
    public class RaceCar
    -extends Car
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      RaceCar() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidnitro() 
      - -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        RaceCar

        -
        public RaceCar()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        nitro

        -
        public void nitro()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/Car.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/Car.html deleted file mode 100644 index 03965ab..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/Car.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - -Uses of Class com.training.java.core.inheritence.Car - - - - - - - - - - -
-

Uses of Class
com.training.java.core.inheritence.Car

-
-
- -
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/InheritenceDemo.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/InheritenceDemo.html deleted file mode 100644 index 2b2cfd8..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/InheritenceDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.inheritence.InheritenceDemo - - - - - - - - - - -
-

Uses of Class
com.training.java.core.inheritence.InheritenceDemo

-
-
No usage of com.training.java.core.inheritence.InheritenceDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/PoliceCar.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/PoliceCar.html deleted file mode 100644 index 6d5074d..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/PoliceCar.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.inheritence.PoliceCar - - - - - - - - - - -
-

Uses of Class
com.training.java.core.inheritence.PoliceCar

-
-
No usage of com.training.java.core.inheritence.PoliceCar
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/RaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/RaceCar.html deleted file mode 100644 index 5659b4a..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/class-use/RaceCar.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.inheritence.RaceCar - - - - - - - - - - -
-

Uses of Class
com.training.java.core.inheritence.RaceCar

-
-
No usage of com.training.java.core.inheritence.RaceCar
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-frame.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-frame.html deleted file mode 100644 index 4253dc4..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-frame.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -com.training.java.core.inheritence - - - - -

com.training.java.core.inheritence

-
-

Classes

- -
- - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-summary.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-summary.html deleted file mode 100644 index 13c8312..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-summary.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - -com.training.java.core.inheritence - - - - - - - -
- - - - - -
- - -
-

Package com.training.java.core.inheritence

-
-
- -
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-tree.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-tree.html deleted file mode 100644 index 457be9d..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-tree.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - -com.training.java.core.inheritence Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package com.training.java.core.inheritence

-Package Hierarchies: - -
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • com.training.java.core.inheritence.Car -
        -
      • com.training.java.core.inheritence.PoliceCar
      • -
      • com.training.java.core.inheritence.RaceCar
      • -
      -
    • -
    • com.training.java.core.inheritence.InheritenceDemo
    • -
    -
  • -
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-use.html b/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-use.html deleted file mode 100644 index f7b0869..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/inheritence/package-use.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - -Uses of Package com.training.java.core.inheritence - - - - - - - - - - -
-

Uses of Package
com.training.java.core.inheritence

-
-
- -
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/Car.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/Car.html deleted file mode 100644 index 4e21096..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/Car.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - -Car - - - - - - - - - - - -
-
com.training.java.core.interfaces
-

Interface Car

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    PoliceCar, RaceCar
    -
    -
    -
    -
    public interface Car
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidaccelerate(int increaseMiles) 
      voidprintInformation() 
      voidstart() 
      voidstop() 
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        start

        -
        void start()
        -
      • -
      - - - -
        -
      • -

        stop

        -
        void stop()
        -
      • -
      - - - -
        -
      • -

        accelerate

        -
        void accelerate(int increaseMiles)
        -
      • -
      - - - -
        -
      • -

        printInformation

        -
        void printInformation()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/ConsolePrinter.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/ConsolePrinter.html deleted file mode 100644 index cc6246e..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/ConsolePrinter.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - -ConsolePrinter - - - - - - - - - - - -
-
com.training.java.core.interfaces
-

Class ConsolePrinter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.interfaces.ConsolePrinter
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ConsolePrinter
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      ConsolePrinter() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidprint(java.lang.String message) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ConsolePrinter

        -
        public ConsolePrinter()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        print

        -
        public void print(java.lang.String message)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/InterfaceDemo.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/InterfaceDemo.html deleted file mode 100644 index f50b043..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/InterfaceDemo.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -InterfaceDemo - - - - - - - - - - - -
-
com.training.java.core.interfaces
-

Class InterfaceDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.interfaces.InterfaceDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class InterfaceDemo
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      InterfaceDemo() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        InterfaceDemo

        -
        public InterfaceDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/PoliceCar.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/PoliceCar.html deleted file mode 100644 index 469dcea..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/PoliceCar.html +++ /dev/null @@ -1,316 +0,0 @@ - - - - - -PoliceCar - - - - - - - - - - - -
-
com.training.java.core.interfaces
-

Class PoliceCar

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.interfaces.PoliceCar
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Car
    -
    -
    -
    -
    public class PoliceCar
    -extends java.lang.Object
    -implements Car
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PoliceCar() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidaccelerate(int increaseMiles) 
      voidprintInformation() 
      voidstart() 
      voidstop() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PoliceCar

        -
        public PoliceCar()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        start

        -
        public void start()
        -
        -
        Specified by:
        -
        start in interface Car
        -
        -
      • -
      - - - -
        -
      • -

        stop

        -
        public void stop()
        -
        -
        Specified by:
        -
        stop in interface Car
        -
        -
      • -
      - - - -
        -
      • -

        accelerate

        -
        public void accelerate(int increaseMiles)
        -
        -
        Specified by:
        -
        accelerate in interface Car
        -
        -
      • -
      - - - -
        -
      • -

        printInformation

        -
        public void printInformation()
        -
        -
        Specified by:
        -
        printInformation in interface Car
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/RaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/RaceCar.html deleted file mode 100644 index 4e0efea..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/RaceCar.html +++ /dev/null @@ -1,316 +0,0 @@ - - - - - -RaceCar - - - - - - - - - - - -
-
com.training.java.core.interfaces
-

Class RaceCar

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.interfaces.RaceCar
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Car
    -
    -
    -
    -
    public class RaceCar
    -extends java.lang.Object
    -implements Car
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      RaceCar() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidaccelerate(int increaseMiles) 
      voidprintInformation() 
      voidstart() 
      voidstop() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        RaceCar

        -
        public RaceCar()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        start

        -
        public void start()
        -
        -
        Specified by:
        -
        start in interface Car
        -
        -
      • -
      - - - -
        -
      • -

        stop

        -
        public void stop()
        -
        -
        Specified by:
        -
        stop in interface Car
        -
        -
      • -
      - - - -
        -
      • -

        accelerate

        -
        public void accelerate(int increaseMiles)
        -
        -
        Specified by:
        -
        accelerate in interface Car
        -
        -
      • -
      - - - -
        -
      • -

        printInformation

        -
        public void printInformation()
        -
        -
        Specified by:
        -
        printInformation in interface Car
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/Car.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/Car.html deleted file mode 100644 index 4f7f3b7..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/Car.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - -Uses of Interface com.training.java.core.interfaces.Car - - - - - - - - - - -
-

Uses of Interface
com.training.java.core.interfaces.Car

-
-
- -
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/ConsolePrinter.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/ConsolePrinter.html deleted file mode 100644 index 81e752a..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/ConsolePrinter.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.interfaces.ConsolePrinter - - - - - - - - - - -
-

Uses of Class
com.training.java.core.interfaces.ConsolePrinter

-
-
No usage of com.training.java.core.interfaces.ConsolePrinter
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/InterfaceDemo.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/InterfaceDemo.html deleted file mode 100644 index 119ec5b..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/InterfaceDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.interfaces.InterfaceDemo - - - - - - - - - - -
-

Uses of Class
com.training.java.core.interfaces.InterfaceDemo

-
-
No usage of com.training.java.core.interfaces.InterfaceDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/PoliceCar.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/PoliceCar.html deleted file mode 100644 index d4bb68e..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/PoliceCar.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.interfaces.PoliceCar - - - - - - - - - - -
-

Uses of Class
com.training.java.core.interfaces.PoliceCar

-
-
No usage of com.training.java.core.interfaces.PoliceCar
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/RaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/RaceCar.html deleted file mode 100644 index d20235f..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/class-use/RaceCar.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.interfaces.RaceCar - - - - - - - - - - -
-

Uses of Class
com.training.java.core.interfaces.RaceCar

-
-
No usage of com.training.java.core.interfaces.RaceCar
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-frame.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-frame.html deleted file mode 100644 index 585f208..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-frame.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - -com.training.java.core.interfaces - - - - -

com.training.java.core.interfaces

-
-

Interfaces

- -

Classes

- -
- - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-summary.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-summary.html deleted file mode 100644 index 46a73cd..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-summary.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - -com.training.java.core.interfaces - - - - - - - -
- - - - - -
- - -
-

Package com.training.java.core.interfaces

-
-
- -
Author:
-
Hari
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-tree.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-tree.html deleted file mode 100644 index 5e3c5d1..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-tree.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - -com.training.java.core.interfaces Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package com.training.java.core.interfaces

-Package Hierarchies: - -
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • com.training.java.core.interfaces.ConsolePrinter
    • -
    • com.training.java.core.interfaces.InterfaceDemo
    • -
    • com.training.java.core.interfaces.PoliceCar (implements com.training.java.core.interfaces.Car)
    • -
    • com.training.java.core.interfaces.RaceCar (implements com.training.java.core.interfaces.Car)
    • -
    -
  • -
-

Interface Hierarchy

-
    -
  • com.training.java.core.interfaces.Car
  • -
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-use.html b/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-use.html deleted file mode 100644 index 7a4dac3..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/interfaces/package-use.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - -Uses of Package com.training.java.core.interfaces - - - - - - - - - - -
-

Uses of Package
com.training.java.core.interfaces

-
-
- -
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/Address.html b/CoreJava_Venkat/doc/com/training/java/core/objects/Address.html deleted file mode 100644 index aede8ba..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/Address.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - -Address - - - - - - - - - - - -
-
com.training.java.core.objects
-

Class Address

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.objects.Address
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class Address
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Address(java.lang.String street, - java.lang.String city, - java.lang.String state, - java.lang.String zip, - java.lang.String country) 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Address

        -
        public Address(java.lang.String street,
        -       java.lang.String city,
        -       java.lang.String state,
        -       java.lang.String zip,
        -       java.lang.String country)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/ObjectsDemo.html b/CoreJava_Venkat/doc/com/training/java/core/objects/ObjectsDemo.html deleted file mode 100644 index 4fb3fe1..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/ObjectsDemo.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -ObjectsDemo - - - - - - - - - - - -
-
com.training.java.core.objects
-

Class ObjectsDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.objects.ObjectsDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ObjectsDemo
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      ObjectsDemo() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ObjectsDemo

        -
        public ObjectsDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/Person.html b/CoreJava_Venkat/doc/com/training/java/core/objects/Person.html deleted file mode 100644 index e7443d3..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/Person.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - -Person - - - - - - - - - - - -
-
com.training.java.core.objects
-

Class Person

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.objects.Person
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class Person
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Person() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Person

        -
        public Person()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/PhoneNumer.html b/CoreJava_Venkat/doc/com/training/java/core/objects/PhoneNumer.html deleted file mode 100644 index bc1c1c4..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/PhoneNumer.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - -PhoneNumer - - - - - - - - - - - -
-
com.training.java.core.objects
-

Class PhoneNumer

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.objects.PhoneNumer
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class PhoneNumer
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PhoneNumer() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PhoneNumer

        -
        public PhoneNumer()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/Address.html b/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/Address.html deleted file mode 100644 index cdb4411..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/Address.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.objects.Address - - - - - - - - - - -
-

Uses of Class
com.training.java.core.objects.Address

-
-
No usage of com.training.java.core.objects.Address
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/ObjectsDemo.html b/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/ObjectsDemo.html deleted file mode 100644 index 2ca69ff..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/ObjectsDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.objects.ObjectsDemo - - - - - - - - - - -
-

Uses of Class
com.training.java.core.objects.ObjectsDemo

-
-
No usage of com.training.java.core.objects.ObjectsDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/Person.html b/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/Person.html deleted file mode 100644 index 6e66d77..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/Person.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.objects.Person - - - - - - - - - - -
-

Uses of Class
com.training.java.core.objects.Person

-
-
No usage of com.training.java.core.objects.Person
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/PhoneNumer.html b/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/PhoneNumer.html deleted file mode 100644 index ab4292e..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/class-use/PhoneNumer.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.objects.PhoneNumer - - - - - - - - - - -
-

Uses of Class
com.training.java.core.objects.PhoneNumer

-
-
No usage of com.training.java.core.objects.PhoneNumer
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/package-frame.html b/CoreJava_Venkat/doc/com/training/java/core/objects/package-frame.html deleted file mode 100644 index 53aa16a..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/package-frame.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - -com.training.java.core.objects - - - - -

com.training.java.core.objects

-
-

Classes

- -
- - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/package-summary.html b/CoreJava_Venkat/doc/com/training/java/core/objects/package-summary.html deleted file mode 100644 index 24b2ef9..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/package-summary.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - -com.training.java.core.objects - - - - - - - -
- - - - - -
- - -
-

Package com.training.java.core.objects

-
-
- -
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/package-tree.html b/CoreJava_Venkat/doc/com/training/java/core/objects/package-tree.html deleted file mode 100644 index 178114c..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/package-tree.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - -com.training.java.core.objects Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package com.training.java.core.objects

-Package Hierarchies: - -
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • com.training.java.core.objects.Address
    • -
    • com.training.java.core.objects.Person
    • -
    • com.training.java.core.objects.PhoneNumer
    • -
    -
  • -
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/objects/package-use.html b/CoreJava_Venkat/doc/com/training/java/core/objects/package-use.html deleted file mode 100644 index 2f44635..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/objects/package-use.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Package com.training.java.core.objects - - - - - - - - - - -
-

Uses of Package
com.training.java.core.objects

-
-
No usage of com.training.java.core.objects
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/Car.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/Car.html deleted file mode 100644 index 80c65cc..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/Car.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - -Car - - - - - - - - - - - -
-
com.training.java.core.overriding
-

Class Car

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.overriding.Car
    • -
    -
  • -
-
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    PoliceCar, RaceCar
    -
    -
    -
    -
    public class Car
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Car() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidaccelerate(int increaseMiles) 
      voidapplyBrakes(int decreaseMiles) 
      intgetCurrentSpeed() 
      voidprintInformation() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Car

        -
        public Car()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        accelerate

        -
        public void accelerate(int increaseMiles)
        -
      • -
      - - - -
        -
      • -

        applyBrakes

        -
        public void applyBrakes(int decreaseMiles)
        -
      • -
      - - - -
        -
      • -

        getCurrentSpeed

        -
        public int getCurrentSpeed()
        -
      • -
      - - - -
        -
      • -

        printInformation

        -
        public void printInformation()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/Driver.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/Driver.html deleted file mode 100644 index a381b16..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/Driver.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - -Driver - - - - - - - - - - - -
-
com.training.java.core.overriding
-

Class Driver

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.overriding.Driver
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class Driver
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Driver(Car car) 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voiddrive() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Driver

        -
        public Driver(Car car)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        drive

        -
        public void drive()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/OverridingDemo.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/OverridingDemo.html deleted file mode 100644 index 3f7a55f..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/OverridingDemo.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -OverridingDemo - - - - - - - - - - - -
-
com.training.java.core.overriding
-

Class OverridingDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.overriding.OverridingDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class OverridingDemo
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      OverridingDemo() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        OverridingDemo

        -
        public OverridingDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/PoliceCar.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/PoliceCar.html deleted file mode 100644 index 7dde9aa..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/PoliceCar.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -PoliceCar - - - - - - - - - - - -
-
com.training.java.core.overriding
-

Class PoliceCar

-
-
- -
-
    -
  • -
    -
    -
    public class PoliceCar
    -extends Car
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PoliceCar(java.lang.String color) 
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PoliceCar

        -
        public PoliceCar(java.lang.String color)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        chase

        -
        public void chase()
        -
      • -
      - - - -
        -
      • -

        turnOnLights

        -
        public void turnOnLights()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/RaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/RaceCar.html deleted file mode 100644 index 31be615..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/RaceCar.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - -RaceCar - - - - - - - - - - - -
-
com.training.java.core.overriding
-

Class RaceCar

-
-
- -
-
    -
  • -
    -
    -
    public class RaceCar
    -extends Car
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      RaceCar() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidaccelerate(int increaseMiles) 
      voidnitro() 
      - -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        RaceCar

        -
        public RaceCar()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        nitro

        -
        public void nitro()
        -
      • -
      - - - -
        -
      • -

        accelerate

        -
        public void accelerate(int increaseMiles)
        -
        -
        Overrides:
        -
        accelerate in class Car
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/Car.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/Car.html deleted file mode 100644 index cb1eb90..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/Car.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - -Uses of Class com.training.java.core.overriding.Car - - - - - - - - - - -
-

Uses of Class
com.training.java.core.overriding.Car

-
-
- -
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/Driver.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/Driver.html deleted file mode 100644 index b4c5a3e..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/Driver.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.overriding.Driver - - - - - - - - - - -
-

Uses of Class
com.training.java.core.overriding.Driver

-
-
No usage of com.training.java.core.overriding.Driver
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/OverridingDemo.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/OverridingDemo.html deleted file mode 100644 index 780da55..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/OverridingDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.overriding.OverridingDemo - - - - - - - - - - -
-

Uses of Class
com.training.java.core.overriding.OverridingDemo

-
-
No usage of com.training.java.core.overriding.OverridingDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/PoliceCar.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/PoliceCar.html deleted file mode 100644 index a7116b8..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/PoliceCar.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.overriding.PoliceCar - - - - - - - - - - -
-

Uses of Class
com.training.java.core.overriding.PoliceCar

-
-
No usage of com.training.java.core.overriding.PoliceCar
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/RaceCar.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/RaceCar.html deleted file mode 100644 index 551d661..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/class-use/RaceCar.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.overriding.RaceCar - - - - - - - - - - -
-

Uses of Class
com.training.java.core.overriding.RaceCar

-
-
No usage of com.training.java.core.overriding.RaceCar
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/package-frame.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/package-frame.html deleted file mode 100644 index 03d164a..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/package-frame.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -com.training.java.core.overriding - - - - -

com.training.java.core.overriding

- - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/package-summary.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/package-summary.html deleted file mode 100644 index 6d2a218..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/package-summary.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -com.training.java.core.overriding - - - - - - - -
- - - - - -
- - -
-

Package com.training.java.core.overriding

-
-
- -
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/package-tree.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/package-tree.html deleted file mode 100644 index e49f586..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/package-tree.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - -com.training.java.core.overriding Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package com.training.java.core.overriding

-Package Hierarchies: - -
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • com.training.java.core.overriding.Car -
        -
      • com.training.java.core.overriding.PoliceCar
      • -
      • com.training.java.core.overriding.RaceCar
      • -
      -
    • -
    • com.training.java.core.overriding.Driver
    • -
    • com.training.java.core.overriding.OverridingDemo
    • -
    -
  • -
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/overriding/package-use.html b/CoreJava_Venkat/doc/com/training/java/core/overriding/package-use.html deleted file mode 100644 index 4c46339..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/overriding/package-use.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - -Uses of Package com.training.java.core.overriding - - - - - - - - - - -
-

Uses of Package
com.training.java.core.overriding

-
-
- -
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/Car.html b/CoreJava_Venkat/doc/com/training/java/core/statickeyword/Car.html deleted file mode 100644 index 138c254..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/Car.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - -Car - - - - - - - - - - - -
-
com.training.java.core.statickeyword
-

Class Car

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.statickeyword.Car
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class Car
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Car(java.lang.String make, - java.lang.String model) 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Car

        -
        public Car(java.lang.String make,
        -   java.lang.String model)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/NonStaticDemo.html b/CoreJava_Venkat/doc/com/training/java/core/statickeyword/NonStaticDemo.html deleted file mode 100644 index e17f3cb..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/NonStaticDemo.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -NonStaticDemo - - - - - - - - - - - -
-
com.training.java.core.statickeyword
-

Class NonStaticDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.statickeyword.NonStaticDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class NonStaticDemo
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      NonStaticDemo() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        NonStaticDemo

        -
        public NonStaticDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/class-use/Car.html b/CoreJava_Venkat/doc/com/training/java/core/statickeyword/class-use/Car.html deleted file mode 100644 index cc9091f..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/class-use/Car.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.statickeyword.Car - - - - - - - - - - -
-

Uses of Class
com.training.java.core.statickeyword.Car

-
-
No usage of com.training.java.core.statickeyword.Car
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/class-use/NonStaticDemo.html b/CoreJava_Venkat/doc/com/training/java/core/statickeyword/class-use/NonStaticDemo.html deleted file mode 100644 index 5254cea..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/class-use/NonStaticDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.statickeyword.NonStaticDemo - - - - - - - - - - -
-

Uses of Class
com.training.java.core.statickeyword.NonStaticDemo

-
-
No usage of com.training.java.core.statickeyword.NonStaticDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-frame.html b/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-frame.html deleted file mode 100644 index e9cc17c..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-frame.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - -com.training.java.core.statickeyword - - - - -

com.training.java.core.statickeyword

-
-

Classes

- -
- - diff --git a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-summary.html b/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-summary.html deleted file mode 100644 index e903a57..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-summary.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - -com.training.java.core.statickeyword - - - - - - - -
- - - - - -
- - -
-

Package com.training.java.core.statickeyword

-
-
This package has all the classes related to static keyword.
-
-

See: Description

-
-
-
    -
  • - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    Car 
    NonStaticDemo 
    -
  • -
- - - -

Package com.training.java.core.statickeyword Description

-
This package has all the classes related to static keyword.
-
Author:
-
Hari
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-tree.html b/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-tree.html deleted file mode 100644 index ca873af..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-tree.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - -com.training.java.core.statickeyword Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package com.training.java.core.statickeyword

-Package Hierarchies: - -
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • com.training.java.core.statickeyword.Car
    • -
    • com.training.java.core.statickeyword.NonStaticDemo
    • -
    -
  • -
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-use.html b/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-use.html deleted file mode 100644 index 9677623..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/statickeyword/package-use.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Package com.training.java.core.statickeyword - - - - - - - - - - -
-

Uses of Package
com.training.java.core.statickeyword

-
-
No usage of com.training.java.core.statickeyword
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/string/StringStringBufferDemo.html b/CoreJava_Venkat/doc/com/training/java/core/string/StringStringBufferDemo.html deleted file mode 100644 index 054c094..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/string/StringStringBufferDemo.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -StringStringBufferDemo - - - - - - - - - - - -
-
com.training.java.core.string
-

Class StringStringBufferDemo

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.training.java.core.string.StringStringBufferDemo
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class StringStringBufferDemo
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static voidmain(java.lang.String[] args) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringStringBufferDemo

        -
        public StringStringBufferDemo()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(java.lang.String[] args)
        -
        Parameters:
        args -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/string/class-use/StringStringBufferDemo.html b/CoreJava_Venkat/doc/com/training/java/core/string/class-use/StringStringBufferDemo.html deleted file mode 100644 index 719e43d..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/string/class-use/StringStringBufferDemo.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Class com.training.java.core.string.StringStringBufferDemo - - - - - - - - - - -
-

Uses of Class
com.training.java.core.string.StringStringBufferDemo

-
-
No usage of com.training.java.core.string.StringStringBufferDemo
- - - - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/string/package-frame.html b/CoreJava_Venkat/doc/com/training/java/core/string/package-frame.html deleted file mode 100644 index 0369e1b..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/string/package-frame.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - -com.training.java.core.string - - - - -

com.training.java.core.string

-
-

Classes

- -
- - diff --git a/CoreJava_Venkat/doc/com/training/java/core/string/package-summary.html b/CoreJava_Venkat/doc/com/training/java/core/string/package-summary.html deleted file mode 100644 index 7ebc03a..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/string/package-summary.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - -com.training.java.core.string - - - - - - - -
- - - - - -
- - -
-

Package com.training.java.core.string

-
-
- -
Author:
-
Hari
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/string/package-tree.html b/CoreJava_Venkat/doc/com/training/java/core/string/package-tree.html deleted file mode 100644 index f703dce..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/string/package-tree.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - -com.training.java.core.string Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package com.training.java.core.string

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/com/training/java/core/string/package-use.html b/CoreJava_Venkat/doc/com/training/java/core/string/package-use.html deleted file mode 100644 index 87eaf63..0000000 --- a/CoreJava_Venkat/doc/com/training/java/core/string/package-use.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Uses of Package com.training.java.core.string - - - - - - - - - - -
-

Uses of Package
com.training.java.core.string

-
-
No usage of com.training.java.core.string
- - - - - - diff --git a/CoreJava_Venkat/doc/constant-values.html b/CoreJava_Venkat/doc/constant-values.html deleted file mode 100644 index a463b05..0000000 --- a/CoreJava_Venkat/doc/constant-values.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Constant Field Values - - - - - - - -
- - - - - -
- - -
-

Constant Field Values

-

Contents

-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/deprecated-list.html b/CoreJava_Venkat/doc/deprecated-list.html deleted file mode 100644 index 3faedb9..0000000 --- a/CoreJava_Venkat/doc/deprecated-list.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Deprecated List - - - - - - - -
- - - - - -
- - -
-

Deprecated API

-

Contents

-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/help-doc.html b/CoreJava_Venkat/doc/help-doc.html deleted file mode 100644 index 5cd2f46..0000000 --- a/CoreJava_Venkat/doc/help-doc.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - -API Help - - - - - - - -
- - - - - -
- - -
-

How This API Document Is Organized

-
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
-
-
-
    -
  • -

    Overview

    -

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    -
  • -
  • -

    Package

    -

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    -
      -
    • Interfaces (italic)
    • -
    • Classes
    • -
    • Enums
    • -
    • Exceptions
    • -
    • Errors
    • -
    • Annotation Types
    • -
    -
  • -
  • -

    Class/Interface

    -

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    -
      -
    • Class inheritance diagram
    • -
    • Direct Subclasses
    • -
    • All Known Subinterfaces
    • -
    • All Known Implementing Classes
    • -
    • Class/interface declaration
    • -
    • Class/interface description
    • -
    -
      -
    • Nested Class Summary
    • -
    • Field Summary
    • -
    • Constructor Summary
    • -
    • Method Summary
    • -
    -
      -
    • Field Detail
    • -
    • Constructor Detail
    • -
    • Method Detail
    • -
    -

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    -
  • -
  • -

    Annotation Type

    -

    Each annotation type has its own separate page with the following sections:

    -
      -
    • Annotation Type declaration
    • -
    • Annotation Type description
    • -
    • Required Element Summary
    • -
    • Optional Element Summary
    • -
    • Element Detail
    • -
    -
  • -
  • -

    Enum

    -

    Each enum has its own separate page with the following sections:

    -
      -
    • Enum declaration
    • -
    • Enum description
    • -
    • Enum Constant Summary
    • -
    • Enum Constant Detail
    • -
    -
  • -
  • -

    Use

    -

    Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.

    -
  • -
  • -

    Tree (Class Hierarchy)

    -

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    -
      -
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • -
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • -
    -
  • -
  • -

    Deprecated API

    -

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    -
  • -
  • -

    Index

    -

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    -
  • -
  • -

    Prev/Next

    -

    These links take you to the next or previous class, interface, package, or related page.

    -
  • -
  • -

    Frames/No Frames

    -

    These links show and hide the HTML frames. All pages are available with or without frames.

    -
  • -
  • -

    All Classes

    -

    The All Classes link shows all classes and interfaces except non-static nested types.

    -
  • -
  • -

    Serialized Form

    -

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    -
  • -
  • -

    Constant Field Values

    -

    The Constant Field Values page lists the static final fields and their values.

    -
  • -
-This help file applies to API documentation generated using the standard doclet.
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-1.html b/CoreJava_Venkat/doc/index-files/index-1.html deleted file mode 100644 index 3a6284b..0000000 --- a/CoreJava_Venkat/doc/index-files/index-1.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - -A-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

A

-
-
AbstractionDemo - Class in com.training.java.core.abstraction
-
 
-
AbstractionDemo() - Constructor for class com.training.java.core.abstraction.AbstractionDemo
-
 
-
accelerate(int) - Method in class com.training.java.core.abstraction.Car
-
 
-
accelerate(int) - Method in class com.training.java.core.abstraction.ItalianRaceCar
-
 
-
accelerate(int) - Method in class com.training.java.core.abstraction.PoliceCar
-
 
-
accelerate(int) - Method in class com.training.java.core.inheritence.Car
-
 
-
accelerate(int) - Method in interface com.training.java.core.interfaces.Car
-
 
-
accelerate(int) - Method in class com.training.java.core.interfaces.PoliceCar
-
 
-
accelerate(int) - Method in class com.training.java.core.interfaces.RaceCar
-
 
-
accelerate(int) - Method in class com.training.java.core.overriding.Car
-
 
-
accelerate(int) - Method in class com.training.java.core.overriding.RaceCar
-
 
-
Address - Class in com.training.java.core.objects
-
 
-
Address(String, String, String, String, String) - Constructor for class com.training.java.core.objects.Address
-
 
-
applyBrakes(int) - Method in class com.training.java.core.abstraction.Car
-
 
-
applyBrakes(int) - Method in class com.training.java.core.inheritence.Car
-
 
-
applyBrakes(int) - Method in class com.training.java.core.overriding.Car
-
 
-
ArrayDemo - Class in com.suneetha
-
-
This example shows how to use Arrays.
-
-
ArrayDemo() - Constructor for class com.suneetha.ArrayDemo
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-10.html b/CoreJava_Venkat/doc/index-files/index-10.html deleted file mode 100644 index 6216e08..0000000 --- a/CoreJava_Venkat/doc/index-files/index-10.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - -P-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

P

-
-
Person - Class in com.training.java.core.objects
-
 
-
Person() - Constructor for class com.training.java.core.objects.Person
-
 
-
PhoneNumer - Class in com.training.java.core.objects
-
 
-
PhoneNumer() - Constructor for class com.training.java.core.objects.PhoneNumer
-
 
-
PoliceCar - Class in com.training.java.core.abstraction
-
 
-
PoliceCar(String) - Constructor for class com.training.java.core.abstraction.PoliceCar
-
 
-
PoliceCar - Class in com.training.java.core.inheritence
-
 
-
PoliceCar(String) - Constructor for class com.training.java.core.inheritence.PoliceCar
-
 
-
PoliceCar - Class in com.training.java.core.interfaces
-
 
-
PoliceCar() - Constructor for class com.training.java.core.interfaces.PoliceCar
-
 
-
PoliceCar - Class in com.training.java.core.overriding
-
 
-
PoliceCar(String) - Constructor for class com.training.java.core.overriding.PoliceCar
-
 
-
print(String) - Method in class com.training.java.core.interfaces.ConsolePrinter
-
 
-
printInformation() - Method in class com.training.java.core.abstraction.Car
-
 
-
printInformation() - Method in class com.training.java.core.inheritence.Car
-
 
-
printInformation() - Method in interface com.training.java.core.interfaces.Car
-
 
-
printInformation() - Method in class com.training.java.core.interfaces.PoliceCar
-
 
-
printInformation() - Method in class com.training.java.core.interfaces.RaceCar
-
 
-
printInformation() - Method in class com.training.java.core.overriding.Car
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-11.html b/CoreJava_Venkat/doc/index-files/index-11.html deleted file mode 100644 index 733d280..0000000 --- a/CoreJava_Venkat/doc/index-files/index-11.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - -R-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

R

-
-
RaceCar - Class in com.training.java.core.abstraction
-
 
-
RaceCar() - Constructor for class com.training.java.core.abstraction.RaceCar
-
 
-
RaceCar - Class in com.training.java.core.inheritence
-
 
-
RaceCar() - Constructor for class com.training.java.core.inheritence.RaceCar
-
 
-
RaceCar - Class in com.training.java.core.interfaces
-
 
-
RaceCar() - Constructor for class com.training.java.core.interfaces.RaceCar
-
 
-
RaceCar - Class in com.training.java.core.overriding
-
 
-
RaceCar() - Constructor for class com.training.java.core.overriding.RaceCar
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-12.html b/CoreJava_Venkat/doc/index-files/index-12.html deleted file mode 100644 index a2713be..0000000 --- a/CoreJava_Venkat/doc/index-files/index-12.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - -S-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

S

-
-
start() - Method in interface com.training.java.core.interfaces.Car
-
 
-
start() - Method in class com.training.java.core.interfaces.PoliceCar
-
 
-
start() - Method in class com.training.java.core.interfaces.RaceCar
-
 
-
stop() - Method in interface com.training.java.core.interfaces.Car
-
 
-
stop() - Method in class com.training.java.core.interfaces.PoliceCar
-
 
-
stop() - Method in class com.training.java.core.interfaces.RaceCar
-
 
-
StringStringBufferDemo - Class in com.training.java.core.string
-
 
-
StringStringBufferDemo() - Constructor for class com.training.java.core.string.StringStringBufferDemo
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-13.html b/CoreJava_Venkat/doc/index-files/index-13.html deleted file mode 100644 index 3e8c7d4..0000000 --- a/CoreJava_Venkat/doc/index-files/index-13.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - -T-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

T

-
-
turnOnLights() - Method in class com.training.java.core.abstraction.PoliceCar
-
 
-
turnOnLights() - Method in class com.training.java.core.inheritence.PoliceCar
-
 
-
turnOnLights() - Method in class com.training.java.core.overriding.PoliceCar
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-2.html b/CoreJava_Venkat/doc/index-files/index-2.html deleted file mode 100644 index 5723ff0..0000000 --- a/CoreJava_Venkat/doc/index-files/index-2.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - -C-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

C

-
-
CalculatorDemo - Class in com.suneetha
-
 
-
CalculatorDemo() - Constructor for class com.suneetha.CalculatorDemo
-
 
-
Car - Class in com.suneetha
-
 
-
Car() - Constructor for class com.suneetha.Car
-
 
-
Car - Class in com.training.java.core.abstraction
-
 
-
Car() - Constructor for class com.training.java.core.abstraction.Car
-
 
-
Car - Class in com.training.java.core.inheritence
-
 
-
Car() - Constructor for class com.training.java.core.inheritence.Car
-
 
-
Car - Interface in com.training.java.core.interfaces
-
 
-
Car - Class in com.training.java.core.overriding
-
 
-
Car() - Constructor for class com.training.java.core.overriding.Car
-
 
-
Car - Class in com.training.java.core.statickeyword
-
 
-
Car(String, String) - Constructor for class com.training.java.core.statickeyword.Car
-
 
-
CarDemo - Class in com.suneetha
-
 
-
CarDemo() - Constructor for class com.suneetha.CarDemo
-
 
-
chase() - Method in class com.training.java.core.abstraction.PoliceCar
-
 
-
chase() - Method in class com.training.java.core.inheritence.PoliceCar
-
 
-
chase() - Method in class com.training.java.core.overriding.PoliceCar
-
 
-
com.suneetha - package com.suneetha
-
 
-
com.training.java.core.abstraction - package com.training.java.core.abstraction
-
 
-
com.training.java.core.doc - package com.training.java.core.doc
-
 
-
com.training.java.core.inheritence - package com.training.java.core.inheritence
-
 
-
com.training.java.core.interfaces - package com.training.java.core.interfaces
-
 
-
com.training.java.core.objects - package com.training.java.core.objects
-
 
-
com.training.java.core.overriding - package com.training.java.core.overriding
-
 
-
com.training.java.core.statickeyword - package com.training.java.core.statickeyword
-
-
This package has all the classes related to static keyword.
-
-
com.training.java.core.string - package com.training.java.core.string
-
 
-
ConsolePrinter - Class in com.training.java.core.interfaces
-
 
-
ConsolePrinter() - Constructor for class com.training.java.core.interfaces.ConsolePrinter
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-3.html b/CoreJava_Venkat/doc/index-files/index-3.html deleted file mode 100644 index 6dc4ed7..0000000 --- a/CoreJava_Venkat/doc/index-files/index-3.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - -D-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

D

-
-
drive() - Method in class com.training.java.core.overriding.Driver
-
 
-
Driver - Class in com.training.java.core.overriding
-
 
-
Driver(Car) - Constructor for class com.training.java.core.overriding.Driver
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-4.html b/CoreJava_Venkat/doc/index-files/index-4.html deleted file mode 100644 index 2b5279b..0000000 --- a/CoreJava_Venkat/doc/index-files/index-4.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -G-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

G

-
-
getCurrentSpeed() - Method in class com.training.java.core.abstraction.Car
-
 
-
getCurrentSpeed() - Method in class com.training.java.core.overriding.Car
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-5.html b/CoreJava_Venkat/doc/index-files/index-5.html deleted file mode 100644 index 7e7beeb..0000000 --- a/CoreJava_Venkat/doc/index-files/index-5.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -H-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

H

-
-
HelloWorld - Class in com.suneetha
-
 
-
HelloWorld() - Constructor for class com.suneetha.HelloWorld
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-6.html b/CoreJava_Venkat/doc/index-files/index-6.html deleted file mode 100644 index 7bf4dd9..0000000 --- a/CoreJava_Venkat/doc/index-files/index-6.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - -I-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

I

-
-
InheritenceDemo - Class in com.training.java.core.inheritence
-
 
-
InheritenceDemo() - Constructor for class com.training.java.core.inheritence.InheritenceDemo
-
 
-
InterfaceDemo - Class in com.training.java.core.interfaces
-
 
-
InterfaceDemo() - Constructor for class com.training.java.core.interfaces.InterfaceDemo
-
 
-
ItalianRaceCar - Class in com.training.java.core.abstraction
-
 
-
ItalianRaceCar() - Constructor for class com.training.java.core.abstraction.ItalianRaceCar
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-7.html b/CoreJava_Venkat/doc/index-files/index-7.html deleted file mode 100644 index 94b38aa..0000000 --- a/CoreJava_Venkat/doc/index-files/index-7.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - -M-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

M

-
-
main(String[]) - Static method in class com.suneetha.ArrayDemo
-
 
-
main(String[]) - Static method in class com.suneetha.CalculatorDemo
-
 
-
main(String[]) - Static method in class com.suneetha.CarDemo
-
 
-
main(String[]) - Static method in class com.suneetha.HelloWorld
-
 
-
main(String[]) - Static method in class com.training.java.core.abstraction.AbstractionDemo
-
 
-
main(String[]) - Static method in class com.training.java.core.inheritence.InheritenceDemo
-
 
-
main(String[]) - Static method in class com.training.java.core.interfaces.InterfaceDemo
-
 
-
main(String[]) - Static method in class com.training.java.core.overriding.OverridingDemo
-
 
-
main(String[]) - Static method in class com.training.java.core.statickeyword.NonStaticDemo
-
 
-
main(String[]) - Static method in class com.training.java.core.string.StringStringBufferDemo
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-8.html b/CoreJava_Venkat/doc/index-files/index-8.html deleted file mode 100644 index d9a1089..0000000 --- a/CoreJava_Venkat/doc/index-files/index-8.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - -N-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

N

-
-
nitro() - Method in class com.training.java.core.abstraction.RaceCar
-
 
-
nitro() - Method in class com.training.java.core.inheritence.RaceCar
-
 
-
nitro() - Method in class com.training.java.core.overriding.RaceCar
-
 
-
NonStaticDemo - Class in com.training.java.core.statickeyword
-
 
-
NonStaticDemo() - Constructor for class com.training.java.core.statickeyword.NonStaticDemo
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index-files/index-9.html b/CoreJava_Venkat/doc/index-files/index-9.html deleted file mode 100644 index f7f6c5d..0000000 --- a/CoreJava_Venkat/doc/index-files/index-9.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -O-Index - - - - - - - -
- - - - - -
- - -
A C D G H I M N O P R S T  - - -

O

-
-
OverridingDemo - Class in com.training.java.core.overriding
-
 
-
OverridingDemo() - Constructor for class com.training.java.core.overriding.OverridingDemo
-
 
-
-A C D G H I M N O P R S T 
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/index.html b/CoreJava_Venkat/doc/index.html deleted file mode 100644 index d700c15..0000000 --- a/CoreJava_Venkat/doc/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -Generated Documentation (Untitled) - - - - - - - - - -<noscript> -<div>JavaScript is disabled on your browser.</div> -</noscript> -<h2>Frame Alert</h2> -<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> - - - diff --git a/CoreJava_Venkat/doc/overview-frame.html b/CoreJava_Venkat/doc/overview-frame.html deleted file mode 100644 index 9aa17da..0000000 --- a/CoreJava_Venkat/doc/overview-frame.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - -Overview List - - - - - - -

 

- - diff --git a/CoreJava_Venkat/doc/overview-summary.html b/CoreJava_Venkat/doc/overview-summary.html deleted file mode 100644 index 087de70..0000000 --- a/CoreJava_Venkat/doc/overview-summary.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - -Overview - - - - - - - -
- - - - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Packages 
PackageDescription
com.suneetha 
com.training.java.core.abstraction 
com.training.java.core.doc 
com.training.java.core.inheritence 
com.training.java.core.interfaces 
com.training.java.core.objects 
com.training.java.core.overriding 
com.training.java.core.statickeyword -
This package has all the classes related to static keyword.
-
com.training.java.core.string 
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/overview-tree.html b/CoreJava_Venkat/doc/overview-tree.html deleted file mode 100644 index 5262b8f..0000000 --- a/CoreJava_Venkat/doc/overview-tree.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - -Class Hierarchy - - - - - - - -
- - - - - -
- - - -
-

Class Hierarchy

- -

Interface Hierarchy

-
    -
  • com.training.java.core.interfaces.Car
  • -
-
- -
- - - - - -
- - - - diff --git a/CoreJava_Venkat/doc/package-list b/CoreJava_Venkat/doc/package-list deleted file mode 100644 index 0fe3e3d..0000000 --- a/CoreJava_Venkat/doc/package-list +++ /dev/null @@ -1,9 +0,0 @@ -com.suneetha -com.training.java.core.abstraction -com.training.java.core.doc -com.training.java.core.inheritence -com.training.java.core.interfaces -com.training.java.core.objects -com.training.java.core.overriding -com.training.java.core.statickeyword -com.training.java.core.string diff --git a/CoreJava_Venkat/doc/resources/background.gif b/CoreJava_Venkat/doc/resources/background.gif deleted file mode 100644 index f471940..0000000 Binary files a/CoreJava_Venkat/doc/resources/background.gif and /dev/null differ diff --git a/CoreJava_Venkat/doc/resources/tab.gif b/CoreJava_Venkat/doc/resources/tab.gif deleted file mode 100644 index 1a73a83..0000000 Binary files a/CoreJava_Venkat/doc/resources/tab.gif and /dev/null differ diff --git a/CoreJava_Venkat/doc/resources/titlebar.gif b/CoreJava_Venkat/doc/resources/titlebar.gif deleted file mode 100644 index 17443b3..0000000 Binary files a/CoreJava_Venkat/doc/resources/titlebar.gif and /dev/null differ diff --git a/CoreJava_Venkat/doc/resources/titlebar_end.gif b/CoreJava_Venkat/doc/resources/titlebar_end.gif deleted file mode 100644 index 3ad78d4..0000000 Binary files a/CoreJava_Venkat/doc/resources/titlebar_end.gif and /dev/null differ diff --git a/CoreJava_Venkat/doc/stylesheet.css b/CoreJava_Venkat/doc/stylesheet.css deleted file mode 100644 index 0e0d70c..0000000 --- a/CoreJava_Venkat/doc/stylesheet.css +++ /dev/null @@ -1,474 +0,0 @@ -/* Javadoc style sheet */ -/* -Overall document style -*/ -body { - background-color:#ffffff; - color:#353833; - font-family:Arial, Helvetica, sans-serif; - font-size:76%; - margin:0; -} -a:link, a:visited { - text-decoration:none; - color:#4c6b87; -} -a:hover, a:focus { - text-decoration:none; - color:#bb7a2a; -} -a:active { - text-decoration:none; - color:#4c6b87; -} -a[name] { - color:#353833; -} -a[name]:hover { - text-decoration:none; - color:#353833; -} -pre { - font-size:1.3em; -} -h1 { - font-size:1.8em; -} -h2 { - font-size:1.5em; -} -h3 { - font-size:1.4em; -} -h4 { - font-size:1.3em; -} -h5 { - font-size:1.2em; -} -h6 { - font-size:1.1em; -} -ul { - list-style-type:disc; -} -code, tt { - font-size:1.2em; -} -dt code { - font-size:1.2em; -} -table tr td dt code { - font-size:1.2em; - vertical-align:top; -} -sup { - font-size:.6em; -} -/* -Document title and Copyright styles -*/ -.clear { - clear:both; - height:0px; - overflow:hidden; -} -.aboutLanguage { - float:right; - padding:0px 21px; - font-size:.8em; - z-index:200; - margin-top:-7px; -} -.legalCopy { - margin-left:.5em; -} -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; - text-decoration:none; -} -.bar a:hover, .bar a:focus { - color:#bb7a2a; -} -.tab { - background-color:#0066FF; - background-image:url(resources/titlebar.gif); - background-position:left top; - background-repeat:no-repeat; - color:#ffffff; - padding:8px; - width:5em; - font-weight:bold; -} -/* -Navigation bar styles -*/ -.bar { - background-image:url(resources/background.gif); - background-repeat:repeat-x; - color:#FFFFFF; - padding:.8em .5em .4em .8em; - height:auto;/*height:1.8em;*/ - font-size:1em; - margin:0; -} -.topNav { - background-image:url(resources/background.gif); - background-repeat:repeat-x; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; -} -.bottomNav { - margin-top:10px; - background-image:url(resources/background.gif); - background-repeat:repeat-x; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; -} -.subNav { - background-color:#dee3e9; - border-bottom:1px solid #9eadc0; - float:left; - width:100%; - overflow:hidden; -} -.subNav div { - clear:left; - float:left; - padding:0 0 5px 6px; -} -ul.navList, ul.subNavList { - float:left; - margin:0 25px 0 0; - padding:0; -} -ul.navList li{ - list-style:none; - float:left; - padding:3px 6px; -} -ul.subNavList li{ - list-style:none; - float:left; - font-size:90%; -} -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; - text-decoration:none; -} -.topNav a:hover, .bottomNav a:hover { - text-decoration:none; - color:#bb7a2a; -} -.navBarCell1Rev { - background-image:url(resources/tab.gif); - background-color:#a88834; - color:#FFFFFF; - margin: auto 5px; - border:1px solid #c9aa44; -} -/* -Page header and footer styles -*/ -.header, .footer { - clear:both; - margin:0 20px; - padding:5px 0 0 0; -} -.indexHeader { - margin:10px; - position:relative; -} -.indexHeader h1 { - font-size:1.3em; -} -.title { - color:#2c4557; - margin:10px 0; -} -.subTitle { - margin:5px 0 0 0; -} -.header ul { - margin:0 0 25px 0; - padding:0; -} -.footer ul { - margin:20px 0 5px 0; -} -.header ul li, .footer ul li { - list-style:none; - font-size:1.2em; -} -/* -Heading styles -*/ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; - margin:0 0 6px -8px; - padding:2px 5px; -} -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; - margin:0 0 6px -8px; - padding:2px 5px; -} -ul.blockList ul.blockList li.blockList h3 { - padding:0; - margin:15px 0; -} -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} -/* -Page layout container styles -*/ -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear:both; - padding:10px 20px; - position:relative; -} -.indexContainer { - margin:10px; - position:relative; - font-size:1.0em; -} -.indexContainer h2 { - font-size:1.1em; - padding:0 0 3px 0; -} -.indexContainer ul { - margin:0; - padding:0; -} -.indexContainer ul li { - list-style:none; -} -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size:1.1em; - font-weight:bold; - margin:10px 0 0 0; - color:#4E4E4E; -} -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin:10px 0 10px 20px; -} -.serializedFormContainer dl.nameValue dt { - margin-left:1px; - font-size:1.1em; - display:inline; - font-weight:bold; -} -.serializedFormContainer dl.nameValue dd { - margin:0 0 0 1px; - font-size:1.1em; - display:inline; -} -/* -List styles -*/ -ul.horizontal li { - display:inline; - font-size:0.9em; -} -ul.inheritance { - margin:0; - padding:0; -} -ul.inheritance li { - display:inline; - list-style:none; -} -ul.inheritance li ul.inheritance { - margin-left:15px; - padding-left:15px; - padding-top:1px; -} -ul.blockList, ul.blockListLast { - margin:10px 0 10px 0; - padding:0; -} -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style:none; - margin-bottom:25px; -} -ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - padding:0px 20px 5px 10px; - border:1px solid #9eadc0; - background-color:#f9f9f9; -} -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding:0 0 5px 8px; - background-color:#ffffff; - border:1px solid #9eadc0; - border-top:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left:0; - padding-left:0; - padding-bottom:15px; - border:none; - border-bottom:1px solid #9eadc0; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style:none; - border-bottom:none; - padding-bottom:0; -} -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top:0; - margin-bottom:1px; -} -/* -Table styles -*/ -.contentContainer table, .classUseContainer table, .constantValuesContainer table { - border-bottom:1px solid #9eadc0; - width:100%; -} -.contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table { - width:100%; -} -.contentContainer .description table, .contentContainer .details table { - border-bottom:none; -} -.contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td{ - vertical-align:top; - padding-right:20px; -} -.contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast, -.contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast, -.contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne, -.contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne { - padding-right:3px; -} -.overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption { - position:relative; - text-align:left; - background-repeat:no-repeat; - color:#FFFFFF; - font-weight:bold; - clear:none; - overflow:hidden; - padding:0px; - margin:0px; -} -caption a:link, caption a:hover, caption a:active, caption a:visited { - color:#FFFFFF; -} -.overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { - white-space:nowrap; - padding-top:8px; - padding-left:8px; - display:block; - float:left; - background-image:url(resources/titlebar.gif); - height:18px; -} -.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { - width:10px; - background-image:url(resources/titlebar_end.gif); - background-repeat:no-repeat; - background-position:top right; - position:relative; - float:left; -} -ul.blockList ul.blockList li.blockList table { - margin:0 0 12px 0px; - width:100%; -} -.tableSubHeadingColor { - background-color: #EEEEFF; -} -.altColor { - background-color:#eeeeef; -} -.rowColor { - background-color:#ffffff; -} -.overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td { - text-align:left; - padding:3px 3px 3px 7px; -} -th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { - background:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; - text-align:left; - padding:3px 3px 3px 7px; -} -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} -td.colFirst, th.colFirst { - border-left:1px solid #9eadc0; - white-space:nowrap; -} -td.colLast, th.colLast { - border-right:1px solid #9eadc0; -} -td.colOne, th.colOne { - border-right:1px solid #9eadc0; - border-left:1px solid #9eadc0; -} -table.overviewSummary { - padding:0px; - margin-left:0px; -} -table.overviewSummary td.colFirst, table.overviewSummary th.colFirst, -table.overviewSummary td.colOne, table.overviewSummary th.colOne { - width:25%; - vertical-align:middle; -} -table.packageSummary td.colFirst, table.overviewSummary th.colFirst { - width:25%; - vertical-align:middle; -} -/* -Content styles -*/ -.description pre { - margin-top:0; -} -.deprecatedContent { - margin:0; - padding:10px 0; -} -.docSummary { - padding:0; -} -/* -Formatting effect styles -*/ -.sourceLineNo { - color:green; - padding:0 30px 0 0; -} -h1.hidden { - visibility:hidden; - overflow:hidden; - font-size:.9em; -} -.block { - display:block; - margin:3px 0 0 0; -} -.strong { - font-weight:bold; -} diff --git a/CoreJava_Venkat/src/com/suneetha/ArrayDemo.java b/CoreJava_Venkat/src/com/suneetha/ArrayDemo.java deleted file mode 100644 index a60fc46..0000000 --- a/CoreJava_Venkat/src/com/suneetha/ArrayDemo.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.suneetha; - -/** - * This example shows how to use Arrays. - * - * @author Hari - * - */ -public class ArrayDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - /* - String[] students = new String[4]; - - students[0] = "Vasu"; - students[1] = "Suneetha"; - students[2] = "Sirisha"; - students[3] = "Sekhar"; - */ - - - /* - String[] students = {"Vasu", "Suneetha", "Sirisha", "Sekhar"}; - - //Third student from Array - String thirdStudent = students[2]; - System.out.println("Third student = " + thirdStudent); - */ - - String firstStudent = args[0]; - String secondStudent = args[1]; - String thirdStudent = args[2]; - - System.out.println("First student = " + firstStudent); - System.out.println("Second student = " + secondStudent); - System.out.println("Third student = " + thirdStudent); - - } - -} diff --git a/CoreJava_Venkat/src/com/suneetha/Calculator.java b/CoreJava_Venkat/src/com/suneetha/Calculator.java deleted file mode 100644 index 838b4e9..0000000 --- a/CoreJava_Venkat/src/com/suneetha/Calculator.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.suneetha; - -class Calculator { - - int add(int firstNumber, int secondNumber) - { - return firstNumber + secondNumber; - } - -} diff --git a/CoreJava_Venkat/src/com/suneetha/CalculatorDemo.java b/CoreJava_Venkat/src/com/suneetha/CalculatorDemo.java deleted file mode 100644 index 6d9be31..0000000 --- a/CoreJava_Venkat/src/com/suneetha/CalculatorDemo.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.suneetha; - -public class CalculatorDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Calculator calc = new Calculator(); - - String firstNumber = args[0]; - String secondNumber = args[1]; - - int fn = Integer.parseInt(firstNumber); - int sn = Integer.parseInt(secondNumber); - - int result = calc.add(fn, sn); - - System.out.println("Result = " + result); - } - -} diff --git a/CoreJava_Venkat/src/com/suneetha/Car.java b/CoreJava_Venkat/src/com/suneetha/Car.java deleted file mode 100644 index a83e628..0000000 --- a/CoreJava_Venkat/src/com/suneetha/Car.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.suneetha; - -public class Car { - - //instance variables - String color = "red"; - String vinNumber; - int age; - boolean isRaceCar; - - void start() - { - color = "blue"; - - //method level variables or local variables - String model = "Focus"; - - - - System.out.println("Car started"); - System.out.println("And the color = " + color); - } - - - -} diff --git a/CoreJava_Venkat/src/com/suneetha/CarDemo.java b/CoreJava_Venkat/src/com/suneetha/CarDemo.java deleted file mode 100644 index f41f159..0000000 --- a/CoreJava_Venkat/src/com/suneetha/CarDemo.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.suneetha; - -public class CarDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - //Instantiation - Car focus = new Car(); - - focus.vinNumber = "12345"; - - Car camry = new Car(); - - focus.start(); - camry.start(); - - System.out.println("Camry's vin number = " + camry.vinNumber); - System.out.println("Camry's age = " + camry.age); - System.out.println("Camry's isRaceCar = " + camry.isRaceCar); - - int age = 25; - - } - -} diff --git a/CoreJava_Venkat/src/com/suneetha/HelloWorld.java b/CoreJava_Venkat/src/com/suneetha/HelloWorld.java deleted file mode 100644 index c5459c1..0000000 --- a/CoreJava_Venkat/src/com/suneetha/HelloWorld.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.suneetha; - -public class HelloWorld { - - /** - * @param args - */ - public static void main(String[] args) { - - System.out.println("Hello again!!"); - } - -} diff --git a/CoreJava_Venkat/src/com/suneetha/package-info.java b/CoreJava_Venkat/src/com/suneetha/package-info.java deleted file mode 100644 index e919d88..0000000 --- a/CoreJava_Venkat/src/com/suneetha/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This is a new package. - */ -/** - * @author Hari - * - */ -package com.suneetha; \ No newline at end of file diff --git a/CoreJava_Venkat/src/com/training/java/core/abstraction/AbstractionDemo.java b/CoreJava_Venkat/src/com/training/java/core/abstraction/AbstractionDemo.java deleted file mode 100644 index 6a0dc71..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/abstraction/AbstractionDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.core.abstraction; - -public class AbstractionDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Car car = new ItalianRaceCar(); - - car.start(); - car.accelerate(20); - car.printInformation(); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/abstraction/Car.java b/CoreJava_Venkat/src/com/training/java/core/abstraction/Car.java deleted file mode 100644 index cee4a82..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/abstraction/Car.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.training.java.core.abstraction; - -public abstract class Car { - - int currentSpeed; - boolean started; - String color; - - - protected void start() - { - System.out.println("Car is starting"); - started = true; - } - - protected void stop() - { - System.out.println("Car is stopping"); - started = false; - } - - public abstract void accelerate(int increaseMiles); - - public void applyBrakes(int decreaseMiles) - { - currentSpeed -= decreaseMiles; - } - - public int getCurrentSpeed() { - return currentSpeed; - } - - public void printInformation() - { - System.out.println("The color is " + color); - System.out.println("The started flag is " + started); - System.out.println("Current speed = " + currentSpeed); - } - - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/abstraction/ItalianRaceCar.java b/CoreJava_Venkat/src/com/training/java/core/abstraction/ItalianRaceCar.java deleted file mode 100644 index 802cbbd..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/abstraction/ItalianRaceCar.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.java.core.abstraction; - -public class ItalianRaceCar extends RaceCar { - - @Override - public void accelerate(int increaseMiles) { - currentSpeed = currentSpeed + (10*increaseMiles); - } - - - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/abstraction/PoliceCar.java b/CoreJava_Venkat/src/com/training/java/core/abstraction/PoliceCar.java deleted file mode 100644 index ae9cf89..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/abstraction/PoliceCar.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.core.abstraction; - -public class PoliceCar extends Car { - - public PoliceCar(String color) - { - super.color = color; - } - - public void chase() - { - System.out.println("Police car is chasing.."); - } - - public void turnOnLights() - { - super.start(); - System.out.println("Turned on LED lights"); - super.stop(); - } - - @Override - public void accelerate(int increaseMiles) { - currentSpeed = currentSpeed + (2*increaseMiles); - } - - - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/abstraction/RaceCar.java b/CoreJava_Venkat/src/com/training/java/core/abstraction/RaceCar.java deleted file mode 100644 index 468310b..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/abstraction/RaceCar.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.core.abstraction; - -public abstract class RaceCar extends Car { - - public void nitro() - { - System.out.println("Nitro is on, I am zooming..."); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/abstraction/package-info.java b/CoreJava_Venkat/src/com/training/java/core/abstraction/package-info.java deleted file mode 100644 index e86e58c..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/abstraction/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.core.abstraction; \ No newline at end of file diff --git a/CoreJava_Venkat/src/com/training/java/core/collections/ArrayListDemo.java b/CoreJava_Venkat/src/com/training/java/core/collections/ArrayListDemo.java deleted file mode 100644 index f3aa5df..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/collections/ArrayListDemo.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.training.java.core.collections; - -import java.util.ArrayList; -import java.util.List; - -public class ArrayListDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - ImmutableBook book1 = new ImmutableBook("Head First Java", "Kathy Sierra", "1234"); - ImmutableBook book2 = new ImmutableBook("Spring in Action", "Craig Walls", "4321"); - ImmutableBook book3 = new ImmutableBook("Java persistance with Hibernate", "Gavin King", "9876"); - ImmutableBook book4 = new ImmutableBook("The pragmatic programmer", "Dave Thomas", "9876"); - - List books = new ArrayList(); - - books.add(book1); - books.add(book2); - books.add(book3); - books.add(book4); - - for(ImmutableBook book : books) - { - System.out.println("Title = " + book.getTitle()); - System.out.println("Author = " + book.getAuthor()); - System.out.println("Isbn = " + book.getIsbn()); - } - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/collections/ArrayListDemo1.java b/CoreJava_Venkat/src/com/training/java/core/collections/ArrayListDemo1.java deleted file mode 100644 index ce21e99..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/collections/ArrayListDemo1.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.java.core.collections; - -import java.util.ArrayList; -import java.util.List; - -public class ArrayListDemo1 { - - /** - * @param args - */ - public static void main(String[] args) { - - List names = new ArrayList(); - - names.add("Vasu"); - names.add("Vasu"); - names.add("Sirisha"); - names.add("Sirisha"); - names.add("Kranthi"); - names.add("Rajani"); - names.add("Rajani"); - names.add(null); - names.add("Davuluri"); - names.add("Chaitra"); - names.add("Gayathri"); - names.add("Geetha"); - names.add("Irfaan"); - names.add("Irfaan"); - names.add("Sekhar"); - names.add("Sunitha"); - names.add(null); - names.add("Sunitha"); - - for(String name : names) - { - System.out.println("Name = " + name); - } - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/collections/ArrayListDemo14.java b/CoreJava_Venkat/src/com/training/java/core/collections/ArrayListDemo14.java deleted file mode 100644 index b444eab..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/collections/ArrayListDemo14.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.java.core.collections; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -public class ArrayListDemo14 { - - /** - * @param args - */ - public static void main(String[] args) { - - List books = new LinkedList(); - - ImmutableBook book1 = new ImmutableBook("Head First Java", "Kathy Sierra", "1234"); - ImmutableBook book2 = new ImmutableBook("Spring in Action", "Craig Walls", "4321"); - ImmutableBook book3 = new ImmutableBook("Java persistance with Hibernate", "Gavin King", "9876"); - ImmutableBook book4 = new ImmutableBook("The pragmatic programmer", "Dave Thomas", "9876"); - - books.add(book1); - books.add(book2); - books.add(book3); - books.add(book4); - - //Lets read from the List - Iterator ite = books.iterator(); - - while(ite.hasNext()) - { - ImmutableBook book = (ImmutableBook) ite.next(); - - System.out.println("Title = " + book.getTitle()); - System.out.println("Author = " + book.getAuthor()); - System.out.println("Isbn = " + book.getIsbn()); - } - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/collections/Book.java b/CoreJava_Venkat/src/com/training/java/core/collections/Book.java deleted file mode 100644 index 0d12aa6..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/collections/Book.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.core.collections; - -public class Book { - - private String title; - private String author; - private String isbn; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } -} diff --git a/CoreJava_Venkat/src/com/training/java/core/collections/ImmutableBook.java b/CoreJava_Venkat/src/com/training/java/core/collections/ImmutableBook.java deleted file mode 100644 index c8961e2..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/collections/ImmutableBook.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.collections; - -public class ImmutableBook { - - private String title; - private String author; - private String isbn; - - public ImmutableBook(String title, String author, String isbn) - { - this.title = title; - this.author = author; - this.isbn = isbn; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } -} diff --git a/CoreJava_Venkat/src/com/training/java/core/collections/package-info.java b/CoreJava_Venkat/src/com/training/java/core/collections/package-info.java deleted file mode 100644 index 9bef661..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/collections/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.core.collections; \ No newline at end of file diff --git a/CoreJava_Venkat/src/com/training/java/core/doc/package-info.java b/CoreJava_Venkat/src/com/training/java/core/doc/package-info.java deleted file mode 100644 index 2452018..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/doc/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This is a new package. - */ -/** - * @author Hari - * - */ -package com.training.java.core.doc; \ No newline at end of file diff --git a/CoreJava_Venkat/src/com/training/java/core/exceptions/ExceptionDemo1.java b/CoreJava_Venkat/src/com/training/java/core/exceptions/ExceptionDemo1.java deleted file mode 100644 index 975cd68..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/exceptions/ExceptionDemo1.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.java.core.exceptions; - -public class ExceptionDemo1 { - - /** - * @param args - */ - public static void main(String[] args) { - - try - { - String firstName = args[0]; - - String lastName = args[1]; - - System.out.println("Hello " + firstName + " " + lastName); - } - catch(ArrayIndexOutOfBoundsException ex) - { - System.out.println("Looks like there are no elements in that array"); - } - - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/exceptions/FileWriterDemo.java b/CoreJava_Venkat/src/com/training/java/core/exceptions/FileWriterDemo.java deleted file mode 100644 index e3f3034..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/exceptions/FileWriterDemo.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.java.core.exceptions; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -public class FileWriterDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - FileWriter fw = null; - PrintWriter out = null; - try { - fw = new FileWriter("D:\\students.txt"); - - out = new PrintWriter(fw); - - out.println("Chaitra"); - out.println("Davuluri"); - out.println("Gayathri"); - - } catch (IOException e) { - e.printStackTrace(); - } - finally - { - if(out != null) - { - out.close(); - } - } - - System.out.println("I am after catch block"); - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/exceptions/FileWriterDemo2.java b/CoreJava_Venkat/src/com/training/java/core/exceptions/FileWriterDemo2.java deleted file mode 100644 index 1181543..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/exceptions/FileWriterDemo2.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.core.exceptions; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -public class FileWriterDemo2 { - - /** - * @param args - */ - public static void main(String[] args) throws IOException { - - FileWriter fw = new FileWriter("D:\\students.txt"); - - PrintWriter out = new PrintWriter(fw); - - out.println("Chaitra"); - out.println("Davuluri"); - out.println("Gayathri"); - - out.close(); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/exceptions/package-info.java b/CoreJava_Venkat/src/com/training/java/core/exceptions/package-info.java deleted file mode 100644 index e84bf97..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/exceptions/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.core.exceptions; \ No newline at end of file diff --git a/CoreJava_Venkat/src/com/training/java/core/inheritence/Car.java b/CoreJava_Venkat/src/com/training/java/core/inheritence/Car.java deleted file mode 100644 index 11da328..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/inheritence/Car.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.training.java.core.inheritence; - -public class Car { - - int currentSpeed; - boolean started; - String color; - - protected void start() - { - System.out.println("Car is starting"); - started = true; - } - - protected void stop() - { - System.out.println("Car is stopping"); - started = false; - } - - public void accelerate(int increaseMiles) - { - currentSpeed += increaseMiles; - } - - public void applyBrakes(int decreaseMiles) - { - currentSpeed -= decreaseMiles; - } - - public void printInformation() - { - System.out.println("The color is " + color); - System.out.println("The started flag is " + started); - System.out.println("Current speed = " + currentSpeed); - } - - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/inheritence/InheritenceDemo.java b/CoreJava_Venkat/src/com/training/java/core/inheritence/InheritenceDemo.java deleted file mode 100644 index 700e20c..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/inheritence/InheritenceDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.core.inheritence; - -public class InheritenceDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - - PoliceCar policeCar = new PoliceCar("Red"); - - policeCar.start(); - policeCar.accelerate(20); - policeCar.applyBrakes(10); - policeCar.turnOnLights(); - policeCar.chase(); - policeCar.printInformation(); - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/inheritence/PoliceCar.java b/CoreJava_Venkat/src/com/training/java/core/inheritence/PoliceCar.java deleted file mode 100644 index d9b14f0..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/inheritence/PoliceCar.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.core.inheritence; - -public final class PoliceCar extends Car { - - public PoliceCar(String color) - { - super.color = color; - } - - public void chase() - { - System.out.println("Police car is chasing.."); - } - - public void turnOnLights() - { - super.start(); - System.out.println("Turned on LED lights"); - super.stop(); - } -} diff --git a/CoreJava_Venkat/src/com/training/java/core/inheritence/RaceCar.java b/CoreJava_Venkat/src/com/training/java/core/inheritence/RaceCar.java deleted file mode 100644 index 7d665df..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/inheritence/RaceCar.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.core.inheritence; - -public class RaceCar extends Car { - - public void nitro() - { - System.out.println("Nitro is on, I am zooming..."); - } -} diff --git a/CoreJava_Venkat/src/com/training/java/core/interfaces/Car.java b/CoreJava_Venkat/src/com/training/java/core/interfaces/Car.java deleted file mode 100644 index d3c812d..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/interfaces/Car.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.core.interfaces; - -public interface Car { - - void start(); - void stop(); - void accelerate(int increaseMiles); - - void printInformation(); -} diff --git a/CoreJava_Venkat/src/com/training/java/core/interfaces/ConsolePrinter.java b/CoreJava_Venkat/src/com/training/java/core/interfaces/ConsolePrinter.java deleted file mode 100644 index d7192af..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/interfaces/ConsolePrinter.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.core.interfaces; - -public class ConsolePrinter { - - public void print(String message) - { - System.out.println(message); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/interfaces/InterfaceDemo.java b/CoreJava_Venkat/src/com/training/java/core/interfaces/InterfaceDemo.java deleted file mode 100644 index 14be583..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/interfaces/InterfaceDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.core.interfaces; - -public class InterfaceDemo { - - /** - * @param args - */ - public static void main(String[] args) { - Car car = new RaceCar(); - - car.start(); - car.accelerate(20); - car.printInformation(); - car.stop(); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/interfaces/PoliceCar.java b/CoreJava_Venkat/src/com/training/java/core/interfaces/PoliceCar.java deleted file mode 100644 index 2ad8d4a..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/interfaces/PoliceCar.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.core.interfaces; - - -public class PoliceCar implements Car { - - private int currentSpeed; - - @Override - public void start() { - System.out.println("PoliceCar starting"); - } - - @Override - public void stop() { - System.out.println("PoliceCar stopping"); - } - - @Override - public void accelerate(int increaseMiles) { - currentSpeed = currentSpeed + (2*increaseMiles); - } - - @Override - public void printInformation() { - new ConsolePrinter().print("Current speed = " + currentSpeed); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/interfaces/RaceCar.java b/CoreJava_Venkat/src/com/training/java/core/interfaces/RaceCar.java deleted file mode 100644 index 52eb04d..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/interfaces/RaceCar.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.interfaces; - -public class RaceCar implements Car { - - private int currentSpeed; - - @Override - public void start() { - System.out.println("RaceCar starting"); - } - - @Override - public void stop() { - System.out.println("RaceCar stopping"); - } - - @Override - public void accelerate(int increaseMiles) { - currentSpeed = currentSpeed + (4*increaseMiles); - } - - @Override - public void printInformation() { - new ConsolePrinter().print("Current speed = " + currentSpeed); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/interfaces/package-info.java b/CoreJava_Venkat/src/com/training/java/core/interfaces/package-info.java deleted file mode 100644 index 741d68c..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/interfaces/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.core.interfaces; \ No newline at end of file diff --git a/CoreJava_Venkat/src/com/training/java/core/objects/Address.java b/CoreJava_Venkat/src/com/training/java/core/objects/Address.java deleted file mode 100644 index ce683eb..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/objects/Address.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.training.java.core.objects; - -public class Address { - - String street; - String city; - String state; - String zip; - String country; - - public Address(String street, String city, String state, String zip, - String country) { - this.street = street; - this.city = city; - this.state = state; - this.zip = zip; - this.country = country; - } - - String getStreet() { - return street; - } - - String getCity() { - return city; - } - - String getState() { - return state; - } - - String getZip() { - return zip; - } - - String getCountry() { - return country; - } - - @Override - public String toString() { - - StringBuffer address = new StringBuffer(); - - address.append(street); - address.append("\n"); - address.append(city + " "); - address.append(state + " "); - address.append(zip); - - return address.toString(); - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/objects/ObjectsDemo.java b/CoreJava_Venkat/src/com/training/java/core/objects/ObjectsDemo.java deleted file mode 100644 index 57ce684..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/objects/ObjectsDemo.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.core.objects; - -public class ObjectsDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Address address = new Address("8652 Test Dr", "Troy", "MI", "48084", "USA"); - - Person sirisha = new Person(); - - sirisha.setFirstName("Sirisha"); - sirisha.setLastName("Last name"); - sirisha.setAddress(address); - - System.out.println("Sirisha = " + sirisha); - - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/objects/Person.java b/CoreJava_Venkat/src/com/training/java/core/objects/Person.java deleted file mode 100644 index b50c25e..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/objects/Person.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.training.java.core.objects; - -public class Person { - - String firstName; - String lastName; - - Address address; - - int id; - PhoneNumer phoneNumber; - - String email; - - String getFirstName() { - return firstName; - } - - void setFirstName(String firstName) { - this.firstName = firstName; - } - - String getLastName() { - return lastName; - } - - void setLastName(String lastName) { - this.lastName = lastName; - } - - Address getAddress() { - return address; - } - - void setAddress(Address address) { - this.address = address; - } - - int getId() { - return id; - } - - void setId(int id) { - this.id = id; - } - - PhoneNumer getPhoneNumber() { - return phoneNumber; - } - - void setPhoneNumber(PhoneNumer phoneNumber) { - this.phoneNumber = phoneNumber; - } - - String getEmail() { - return email; - } - - void setEmail(String email) { - this.email = email; - } - - @Override - public String toString() { - - StringBuilder person = new StringBuilder(); - - person.append(firstName); - person.append(" "); - person.append(lastName + "\n"); - person.append(address.toString()); - - return person.toString(); - - } - - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/objects/PhoneNumer.java b/CoreJava_Venkat/src/com/training/java/core/objects/PhoneNumer.java deleted file mode 100644 index 7e5715e..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/objects/PhoneNumer.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.training.java.core.objects; - -public class PhoneNumer { - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/overriding/Car.java b/CoreJava_Venkat/src/com/training/java/core/overriding/Car.java deleted file mode 100644 index 0d5056d..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/overriding/Car.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.java.core.overriding; - -public class Car { - - int currentSpeed; - boolean started; - String color; - - - protected void start() - { - System.out.println("Car is starting"); - started = true; - } - - protected void stop() - { - System.out.println("Car is stopping"); - started = false; - } - - public void accelerate(int increaseMiles) - { - currentSpeed += increaseMiles; - } - - public void applyBrakes(int decreaseMiles) - { - currentSpeed -= decreaseMiles; - } - - public int getCurrentSpeed() { - return currentSpeed; - } - - public void printInformation() - { - System.out.println("The color is " + color); - System.out.println("The started flag is " + started); - System.out.println("Current speed = " + currentSpeed); - } - - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/overriding/Driver.java b/CoreJava_Venkat/src/com/training/java/core/overriding/Driver.java deleted file mode 100644 index 6c5be91..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/overriding/Driver.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.core.overriding; - -public class Driver { - - private Car car; - - public Driver(Car car) - { - this.car = car; - } - - public void drive() - { - car.start(); - car.accelerate(20); - - System.out.println("Current speed = " + car.getCurrentSpeed()); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/overriding/OverridingDemo.java b/CoreJava_Venkat/src/com/training/java/core/overriding/OverridingDemo.java deleted file mode 100644 index 7dbe460..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/overriding/OverridingDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.core.overriding; - -public class OverridingDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Car car = new PoliceCar("Blue"); - - Driver kalpana = new Driver(car); - kalpana.drive(); - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/overriding/PoliceCar.java b/CoreJava_Venkat/src/com/training/java/core/overriding/PoliceCar.java deleted file mode 100644 index aef3b7d..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/overriding/PoliceCar.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.core.overriding; - -public class PoliceCar extends Car { - - public PoliceCar(String color) - { - super.color = color; - } - - public void chase() - { - System.out.println("Police car is chasing.."); - } - - public void turnOnLights() - { - super.start(); - System.out.println("Turned on LED lights"); - super.stop(); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/overriding/RaceCar.java b/CoreJava_Venkat/src/com/training/java/core/overriding/RaceCar.java deleted file mode 100644 index 7b9c333..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/overriding/RaceCar.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.core.overriding; - -public class RaceCar extends Car { - - public void nitro() - { - System.out.println("Nitro is on, I am zooming..."); - } - - @Override - public void accelerate(int increaseMiles) - { - currentSpeed = currentSpeed + (4*increaseMiles); - } -} diff --git a/CoreJava_Venkat/src/com/training/java/core/statickeyword/Car.java b/CoreJava_Venkat/src/com/training/java/core/statickeyword/Car.java deleted file mode 100644 index 928b510..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/statickeyword/Car.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.java.core.statickeyword; - -public class Car { - - private String make; - private String model; - private int currentSpeed; - - private static int numberOfCarsCreated; - - public Car(String make, String model) { - super(); - this.make = make; - this.model = model; - - currentSpeed++; - numberOfCarsCreated++; - - System.out.println("Current speed = " + currentSpeed); - System.out.println("number of cars created = " + numberOfCarsCreated); - } - - String getMake() { - return make; - } - - String getModel() { - return model; - } - - static int getNumberOfCarsCreated() - { - return numberOfCarsCreated; - } -} diff --git a/CoreJava_Venkat/src/com/training/java/core/statickeyword/NonStaticDemo.java b/CoreJava_Venkat/src/com/training/java/core/statickeyword/NonStaticDemo.java deleted file mode 100644 index dccf087..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/statickeyword/NonStaticDemo.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.java.core.statickeyword; - -/** - * - * - * @author Hari - * - */ -public class NonStaticDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Car focus = new Car("Ford", "Focus"); - Car twoHundred = new Car("Chrysler", "200"); - Car malibu = new Car("Chevy", "Malibu"); - Car accord = new Car("Honda", "Accord"); - - System.out.println("No of cars created.." + Car.getNumberOfCarsCreated()); - - } - -} - diff --git a/CoreJava_Venkat/src/com/training/java/core/statickeyword/package-info.java b/CoreJava_Venkat/src/com/training/java/core/statickeyword/package-info.java deleted file mode 100644 index 7480cbb..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/statickeyword/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * - */ -/** - * This package has all the classes related to static keyword. - * - * - * @author Hari - * - */ -package com.training.java.core.statickeyword; \ No newline at end of file diff --git a/CoreJava_Venkat/src/com/training/java/core/string/StringStringBufferDemo.java b/CoreJava_Venkat/src/com/training/java/core/string/StringStringBufferDemo.java deleted file mode 100644 index 0f02c46..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/string/StringStringBufferDemo.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.core.string; - -public class StringStringBufferDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - String name = "Gayathri "; - name = name.trim(); - - System.out.println("Name = -->" + name + "<--"); - //System.out.println("Trimmed Name = -->" + trimmedName + "<--"); - - StringBuffer sbName = new StringBuffer("Chaitra"); - sbName.append(":Davuluri:"); - sbName.append(":Gayathri:"); - - System.out.println("sbName = " + sbName); - - //String name = new String("Venkat"); - - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/string/package-info.java b/CoreJava_Venkat/src/com/training/java/core/string/package-info.java deleted file mode 100644 index 36b8563..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/string/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.core.string; \ No newline at end of file diff --git a/CoreJava_Venkat/src/com/training/java/core/thread/ConsolePrinter.java b/CoreJava_Venkat/src/com/training/java/core/thread/ConsolePrinter.java deleted file mode 100644 index 61a7a6c..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/thread/ConsolePrinter.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.core.thread; - -public class ConsolePrinter extends Thread { - - private String printerName; - private String printerCompany; - - public void print() { - new Thread(this).start(); - - } - - @Override - public void run() { - for (int i = 0; i < 10000; i++) { - System.out.println(Thread.currentThread().getName() + "<--> i = " - + i); - } - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/thread/ThreadDemo.java b/CoreJava_Venkat/src/com/training/java/core/thread/ThreadDemo.java deleted file mode 100644 index 7300371..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/thread/ThreadDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.core.thread; - -public class ThreadDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - ConsolePrinter printer = new ConsolePrinter(); - - System.out.println("1st print is going to start"); - printer.print(); - System.out.println("1st print is done"); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/core/thread/package-info.java b/CoreJava_Venkat/src/com/training/java/core/thread/package-info.java deleted file mode 100644 index 85f00e2..0000000 --- a/CoreJava_Venkat/src/com/training/java/core/thread/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.core.thread; \ No newline at end of file diff --git a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/DAOException.java b/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/DAOException.java deleted file mode 100644 index bb9f8b4..0000000 --- a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.jdbc.teamdao.television; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - public DAOException(Throwable cause) - { - super(cause); - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/Television.java b/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/Television.java deleted file mode 100644 index a938f90..0000000 --- a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/Television.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.training.java.jdbc.teamdao.television; - -public class Television { - - - private int tvId ; - private String company; - private String type; - private boolean enable3d; - private double price; - - public Television (int tvId, String company, String type,boolean enable3d, double price) { - super(); - this.tvId = tvId; - this.company = company; - this.type = type; - this.enable3d = enable3d; - this.price = price; - } - - int getTvId() { - return tvId; - } - String getCompany() { - return company; - } - String getType() { - return type; - } - boolean isEnable3d() { - return enable3d; - } - double getPrice() { - return price; - } -} diff --git a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/TelevisionDAO.java b/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/TelevisionDAO.java deleted file mode 100644 index 9fcb27b..0000000 --- a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/TelevisionDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.jdbc.teamdao.television; - -import java.util.List; - -public interface TelevisionDAO { - - List getAllTelevision() throws DAOException ; - -} diff --git a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/TelevisionDAOImpl.java b/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/TelevisionDAOImpl.java deleted file mode 100644 index d8dc794..0000000 --- a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/TelevisionDAOImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.training.java.jdbc.teamdao.television; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class TelevisionDAOImpl implements TelevisionDAO{ - private String jdbcUrl; - private String userName; - private String password; - - public TelevisionDAOImpl(String jdbcurl, String username,String password) - { - this.jdbcUrl = jdbcurl; - this.userName = username; - this.password = password; - } - - @Override - public List getAllTelevision() throws DAOException { - Connection connection=null; - Statement statement=null; - ResultSet resultSet=null; - List tel = new ArrayList(); - - try{ - connection=getConnection(); - statement = connection.createStatement(); - resultSet= statement.executeQuery("select * from television "); - - while (resultSet.next()) - { - int id = resultSet.getInt("tv_id"); - String company =resultSet.getString("company"); - String type = resultSet.getString("type"); - - String enable3DStr = resultSet.getString("enable_3d"); - String priceStr=resultSet.getString("price"); - - double price=Double.parseDouble(priceStr); - Television television=new Television(id, company, type, "Y".equals(enable3DStr), price); - tel.add(television); - } - - return tel; - } - catch(SQLException e ) - { - throw new DAOException(e); - } - finally - { - closeResource(resultSet,statement,connection); - } - } - - private Connection getConnection() throws DAOException { - try { - - Class.forName("oracle.jdbc.driver.OracleDriver"); - - return DriverManager.getConnection(jdbcUrl, userName, password); - - } catch (ClassNotFoundException e) { - //e.printStackTrace(); - throw new DAOException(e); - - }catch(SQLException ex) - { - throw new DAOException(ex); - } - - - } - private void closeResource(ResultSet resultSet, Statement statement, Connection connection) - - { - if(resultSet!=null) - { - try - { - resultSet.close(); - } - catch(SQLException e) - { - e.printStackTrace(); - - } - - - } - if(statement!=null) - { - try - { - statement.close(); - } - catch(SQLException e) - { - e.printStackTrace(); - - } - - - } - if(connection!=null) - { - try - { - connection.close(); - } - catch(SQLException e) - { - e.printStackTrace(); - - } - - - } - } -} diff --git a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/TelevisionDaoTest.java b/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/TelevisionDaoTest.java deleted file mode 100644 index 829907b..0000000 --- a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/TelevisionDaoTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.jdbc.teamdao.television; - -import java.util.List; - -import junit.framework.Assert; - -import org.junit.Test; - -public class TelevisionDaoTest { - @Test - public void testgetTelevision() throws DAOException{ - TelevisionDAO dao=new TelevisionDAOImpl("jdbc:oracle:thin:@localhost:1521:XE", "television", "password"); - List televisions=dao.getAllTelevision(); - Assert.assertNotNull(televisions); - - } - -} diff --git a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/package-info.java b/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/package-info.java deleted file mode 100644 index 820ed8f..0000000 --- a/CoreJava_Venkat/src/com/training/java/jdbc/teamdao/television/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.jdbc.teamdao.television; \ No newline at end of file diff --git a/CurrentBatchStruts1/.classpath b/CurrentBatchStruts1/.classpath deleted file mode 100644 index 1fb4891..0000000 --- a/CurrentBatchStruts1/.classpath +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CurrentBatchStruts1/.project b/CurrentBatchStruts1/.project deleted file mode 100644 index a81833b..0000000 --- a/CurrentBatchStruts1/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - CurrentBatchStruts1 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/CurrentBatchStruts1/.settings/.jsdtscope b/CurrentBatchStruts1/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/CurrentBatchStruts1/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/CurrentBatchStruts1/.settings/org.eclipse.jdt.core.prefs b/CurrentBatchStruts1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/CurrentBatchStruts1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/CurrentBatchStruts1/.settings/org.eclipse.wst.common.component b/CurrentBatchStruts1/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 02b2011..0000000 --- a/CurrentBatchStruts1/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/CurrentBatchStruts1/.settings/org.eclipse.wst.common.project.facet.core.xml b/CurrentBatchStruts1/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 416c37e..0000000 --- a/CurrentBatchStruts1/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/CurrentBatchStruts1/.settings/org.eclipse.wst.jsdt.ui.superType.container b/CurrentBatchStruts1/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/CurrentBatchStruts1/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/CurrentBatchStruts1/.settings/org.eclipse.wst.jsdt.ui.superType.name b/CurrentBatchStruts1/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/CurrentBatchStruts1/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/CurrentBatchStruts1/WebContent/META-INF/MANIFEST.MF b/CurrentBatchStruts1/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/CurrentBatchStruts1/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-io-1.1.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/oro-2.0.8.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/standard-1.0.6.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/CurrentBatchStruts1/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/struts-config.xml b/CurrentBatchStruts1/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index 79a2d90..0000000 --- a/CurrentBatchStruts1/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/views/HelloWorld.jsp b/CurrentBatchStruts1/WebContent/WEB-INF/views/HelloWorld.jsp deleted file mode 100644 index 6d268ed..0000000 --- a/CurrentBatchStruts1/WebContent/WEB-INF/views/HelloWorld.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - I got the message from Action class.. - - ${requestScope.Message} - - - \ No newline at end of file diff --git a/CurrentBatchStruts1/WebContent/WEB-INF/web.xml b/CurrentBatchStruts1/WebContent/WEB-INF/web.xml deleted file mode 100644 index 7ffad64..0000000 --- a/CurrentBatchStruts1/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - CurrentBatchStruts1 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - ActionServlet - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts-config.xml - - - - ActionServlet - / - - \ No newline at end of file diff --git a/CurrentBatchStruts1/src/com/training/java/struts/HelloAction.java b/CurrentBatchStruts1/src/com/training/java/struts/HelloAction.java deleted file mode 100644 index 0fac603..0000000 --- a/CurrentBatchStruts1/src/com/training/java/struts/HelloAction.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.struts; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class HelloAction extends Action { - - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - request.setAttribute("Message", "How are you doing?"); - - //TODO we should call our DAO or service class - - return mapping.findForward("hello"); - } - - - -} diff --git a/CurrentBatchStruts1/src/com/training/java/struts/package-info.java b/CurrentBatchStruts1/src/com/training/java/struts/package-info.java deleted file mode 100644 index fb60897..0000000 --- a/CurrentBatchStruts1/src/com/training/java/struts/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.struts; \ No newline at end of file diff --git a/CurrentBatchStruts2/.classpath b/CurrentBatchStruts2/.classpath deleted file mode 100644 index c859448..0000000 --- a/CurrentBatchStruts2/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/CurrentBatchStruts2/.project b/CurrentBatchStruts2/.project deleted file mode 100644 index b649236..0000000 --- a/CurrentBatchStruts2/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - CurrentBatchStruts2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/CurrentBatchStruts2/.settings/.jsdtscope b/CurrentBatchStruts2/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/CurrentBatchStruts2/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/CurrentBatchStruts2/.settings/org.eclipse.jdt.core.prefs b/CurrentBatchStruts2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/CurrentBatchStruts2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/CurrentBatchStruts2/.settings/org.eclipse.wst.common.component b/CurrentBatchStruts2/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 2da2c24..0000000 --- a/CurrentBatchStruts2/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/CurrentBatchStruts2/.settings/org.eclipse.wst.common.project.facet.core.xml b/CurrentBatchStruts2/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 13db573..0000000 --- a/CurrentBatchStruts2/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/CurrentBatchStruts2/.settings/org.eclipse.wst.jsdt.ui.superType.container b/CurrentBatchStruts2/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/CurrentBatchStruts2/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/CurrentBatchStruts2/.settings/org.eclipse.wst.jsdt.ui.superType.name b/CurrentBatchStruts2/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/CurrentBatchStruts2/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/CurrentBatchStruts2/WebContent/META-INF/MANIFEST.MF b/CurrentBatchStruts2/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/CurrentBatchStruts2/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-io-1.1.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/jstl-api-1.2.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/jstl-api-1.2.jar deleted file mode 100644 index 183ed63..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/jstl-api-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/jstl-impl-1.2.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/jstl-impl-1.2.jar deleted file mode 100644 index 110ca51..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/jstl-impl-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/ojdbc6.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/oro-2.0.8.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/standard-1.0.6.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/CurrentBatchStruts2/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/struts-config.xml b/CurrentBatchStruts2/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index 4aaecf4..0000000 --- a/CurrentBatchStruts2/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/views/ListBooks.jsp b/CurrentBatchStruts2/WebContent/WEB-INF/views/ListBooks.jsp deleted file mode 100644 index 7b7b098..0000000 --- a/CurrentBatchStruts2/WebContent/WEB-INF/views/ListBooks.jsp +++ /dev/null @@ -1,32 +0,0 @@ -<%@page import="com.training.java.struts.domain.Book"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - - -Insert title here - - - - - - - - - - - - - - - - -
TitleAuthorISBN
${aBook.title}${aBook.author}${aBook.isbn}
- - - \ No newline at end of file diff --git a/CurrentBatchStruts2/WebContent/WEB-INF/web.xml b/CurrentBatchStruts2/WebContent/WEB-INF/web.xml deleted file mode 100644 index 9d7d2a8..0000000 --- a/CurrentBatchStruts2/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - struts1 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - ActionServlet - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts-config.xml - - - - ActionServlet - / - - \ No newline at end of file diff --git a/CurrentBatchStruts2/src/com/training/java/struts/domain/Book.java b/CurrentBatchStruts2/src/com/training/java/struts/domain/Book.java deleted file mode 100644 index b9fe0e3..0000000 --- a/CurrentBatchStruts2/src/com/training/java/struts/domain/Book.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.java.struts.domain; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - public void init() - { - - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } - - public int getPages() { - return pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - -} diff --git a/CurrentBatchStruts2/src/com/training/java/struts/domain/BookDAO.java b/CurrentBatchStruts2/src/com/training/java/struts/domain/BookDAO.java deleted file mode 100644 index 62031f4..0000000 --- a/CurrentBatchStruts2/src/com/training/java/struts/domain/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/CurrentBatchStruts2/src/com/training/java/struts/domain/BookDAOJDBCImpl.java b/CurrentBatchStruts2/src/com/training/java/struts/domain/BookDAOJDBCImpl.java deleted file mode 100644 index 4cf0cff..0000000 --- a/CurrentBatchStruts2/src/com/training/java/struts/domain/BookDAOJDBCImpl.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.training.java.struts.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class BookDAOJDBCImpl implements BookDAO { - - private String jdbcURL; - private String username; - private String password; - - public BookDAOJDBCImpl(String jdbcURL, String username, String password) - { - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(book_id_seq.nextval, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - statement.setInt(6, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } - - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/CurrentBatchStruts2/src/com/training/java/struts/domain/DAOException.java b/CurrentBatchStruts2/src/com/training/java/struts/domain/DAOException.java deleted file mode 100644 index acb3f75..0000000 --- a/CurrentBatchStruts2/src/com/training/java/struts/domain/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.struts.domain; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/CurrentBatchStruts2/src/com/training/java/struts/domain/package-info.java b/CurrentBatchStruts2/src/com/training/java/struts/domain/package-info.java deleted file mode 100644 index 51a5e92..0000000 --- a/CurrentBatchStruts2/src/com/training/java/struts/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.struts.domain; \ No newline at end of file diff --git a/CurrentBatchStruts2/src/com/training/java/struts/web/ListBooksAction.java b/CurrentBatchStruts2/src/com/training/java/struts/web/ListBooksAction.java deleted file mode 100644 index d709734..0000000 --- a/CurrentBatchStruts2/src/com/training/java/struts/web/ListBooksAction.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.java.struts.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookDAO; -import com.training.java.struts.domain.BookDAOJDBCImpl; -import com.training.java.struts.domain.DAOException; - -public class ListBooksAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - List books = null; - - try { - books = dao.getAllBooks(); - } catch (DAOException e) { - e.printStackTrace(); - } - - request.setAttribute("books", books); - - return mapping.findForward("ListBooks"); - } - -} diff --git a/CurrentBatchStruts2/src/com/training/java/struts/web/package-info.java b/CurrentBatchStruts2/src/com/training/java/struts/web/package-info.java deleted file mode 100644 index 341c1c2..0000000 --- a/CurrentBatchStruts2/src/com/training/java/struts/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.struts.web; \ No newline at end of file diff --git a/CurrentBatchStruts4/.classpath b/CurrentBatchStruts4/.classpath deleted file mode 100644 index 07b2c3a..0000000 --- a/CurrentBatchStruts4/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/CurrentBatchStruts4/.project b/CurrentBatchStruts4/.project deleted file mode 100644 index 0843efc..0000000 --- a/CurrentBatchStruts4/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - CurrentBatchStruts5 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/CurrentBatchStruts4/.settings/.jsdtscope b/CurrentBatchStruts4/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/CurrentBatchStruts4/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/CurrentBatchStruts4/.settings/org.eclipse.jdt.core.prefs b/CurrentBatchStruts4/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/CurrentBatchStruts4/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/CurrentBatchStruts4/.settings/org.eclipse.wst.common.component b/CurrentBatchStruts4/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 6d54b1a..0000000 --- a/CurrentBatchStruts4/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/CurrentBatchStruts4/.settings/org.eclipse.wst.common.project.facet.core.xml b/CurrentBatchStruts4/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 416c37e..0000000 --- a/CurrentBatchStruts4/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/CurrentBatchStruts4/.settings/org.eclipse.wst.jsdt.ui.superType.container b/CurrentBatchStruts4/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/CurrentBatchStruts4/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/CurrentBatchStruts4/.settings/org.eclipse.wst.jsdt.ui.superType.name b/CurrentBatchStruts4/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/CurrentBatchStruts4/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/CurrentBatchStruts4/WebContent/META-INF/MANIFEST.MF b/CurrentBatchStruts4/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/CurrentBatchStruts4/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-io-1.1.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-lang-2.6.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-lang-2.6.jar deleted file mode 100644 index 98467d3..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-lang-2.6.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/jstl-api-1.2.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/jstl-api-1.2.jar deleted file mode 100644 index 183ed63..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/jstl-api-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/jstl-impl-1.2.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/jstl-impl-1.2.jar deleted file mode 100644 index 110ca51..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/jstl-impl-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/ojdbc6.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/oro-2.0.8.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/standard-1.0.6.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/CurrentBatchStruts4/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/struts-config.xml b/CurrentBatchStruts4/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index b2e6101..0000000 --- a/CurrentBatchStruts4/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/views/Acknowledgement.jsp b/CurrentBatchStruts4/WebContent/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 94a47c4..0000000 --- a/CurrentBatchStruts4/WebContent/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

Your details have been saved.

- - - - \ No newline at end of file diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/views/AddBook.jsp b/CurrentBatchStruts4/WebContent/WEB-INF/views/AddBook.jsp deleted file mode 100644 index 1f09932..0000000 --- a/CurrentBatchStruts4/WebContent/WEB-INF/views/AddBook.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - -Insert title here - - - - - - - - - - : - - - - - -
- : - - - - -
- :
- :
- - - -
- - - - - - - \ No newline at end of file diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/views/Index.jsp b/CurrentBatchStruts4/WebContent/WEB-INF/views/Index.jsp deleted file mode 100644 index b3dbbce..0000000 --- a/CurrentBatchStruts4/WebContent/WEB-INF/views/Index.jsp +++ /dev/null @@ -1,18 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

Welcome to our Bookstore application!!

- - If you want to add a book, please click here
- For list of existing books, please click here
- - - - \ No newline at end of file diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/views/ListBooks.jsp b/CurrentBatchStruts4/WebContent/WEB-INF/views/ListBooks.jsp deleted file mode 100644 index 11f93d4..0000000 --- a/CurrentBatchStruts4/WebContent/WEB-INF/views/ListBooks.jsp +++ /dev/null @@ -1,38 +0,0 @@ -<%@page import="java.lang.reflect.Method"%> -<%@page import="com.training.java.struts.domain.Book"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> - - - - - - -Insert title here - - - - - - - - - - - - - - - - - - -
TitleAuthorISBNUpdate/Delete Link
${aBook.title}${aBook.author}${aBook.isbn} - Update - Delete -
- - - \ No newline at end of file diff --git a/CurrentBatchStruts4/WebContent/WEB-INF/web.xml b/CurrentBatchStruts4/WebContent/WEB-INF/web.xml deleted file mode 100644 index 9d7d2a8..0000000 --- a/CurrentBatchStruts4/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - struts1 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - ActionServlet - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts-config.xml - - - - ActionServlet - / - - \ No newline at end of file diff --git a/CurrentBatchStruts4/src/BookStore.properties b/CurrentBatchStruts4/src/BookStore.properties deleted file mode 100644 index dd33f5f..0000000 --- a/CurrentBatchStruts4/src/BookStore.properties +++ /dev/null @@ -1,20 +0,0 @@ -display.title=Title -display.author=Author -display.pubDate=Pub. Date -display.isbn=ISBN -display.pages=No of Pages - -error.title.required=Title is mandatory -error.isbn.required=ISBN is mandatory -error.author.required=Author is mandatory - -errors.header=

Validation Errors

    -errors.prefix=
  1. -errors.suffix=
  2. -errors.footer=
- - - - - - diff --git a/CurrentBatchStruts4/src/BookStore_de.properties b/CurrentBatchStruts4/src/BookStore_de.properties deleted file mode 100644 index 091ad60..0000000 --- a/CurrentBatchStruts4/src/BookStore_de.properties +++ /dev/null @@ -1,5 +0,0 @@ -display.title=Titel -display.author=Autor -display.pubDate=Publisher Datum -display.isbn=ISBN -display.pages=No of Pages diff --git a/CurrentBatchStruts4/src/com/training/java/struts/domain/Book.java b/CurrentBatchStruts4/src/com/training/java/struts/domain/Book.java deleted file mode 100644 index b9fe0e3..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/domain/Book.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.java.struts.domain; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - public void init() - { - - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } - - public int getPages() { - return pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/domain/BookDAO.java b/CurrentBatchStruts4/src/com/training/java/struts/domain/BookDAO.java deleted file mode 100644 index 62031f4..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/domain/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/domain/BookDAOJDBCImpl.java b/CurrentBatchStruts4/src/com/training/java/struts/domain/BookDAOJDBCImpl.java deleted file mode 100644 index 9c5d0ec..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/domain/BookDAOJDBCImpl.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.training.java.struts.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -class BookDAOJDBCImpl implements BookDAO { - - private String jdbcURL; - private String username; - private String password; - - public BookDAOJDBCImpl(String jdbcURL, String username, String password) - { - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(book_id_seq.nextval, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - statement.setInt(6, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } - - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/domain/BookService.java b/CurrentBatchStruts4/src/com/training/java/struts/domain/BookService.java deleted file mode 100644 index c1f928c..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/domain/BookService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -public interface BookService { - - List getAllBooks() throws ServiceException; - - void addBook(Book book) throws ServiceException; - - Book getById(int id) throws ServiceException; - - void update(Book book) throws ServiceException; - - void delete(int id) throws ServiceException; - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/domain/BookServiceImpl.java b/CurrentBatchStruts4/src/com/training/java/struts/domain/BookServiceImpl.java deleted file mode 100644 index 40c6299..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/domain/BookServiceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -public class BookServiceImpl implements BookService { - - @Override - public List getAllBooks() throws ServiceException { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - return dao.getAllBooks(); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public void addBook(Book book) throws ServiceException { - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - dao.addBook(book); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public Book getById(int id) throws ServiceException { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - return dao.findByPrimaryKey(id); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - - } - - @Override - public void update(Book book) throws ServiceException { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - dao.updateBook(book); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public void delete(int id) throws ServiceException { - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - dao.deleteBook(id); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/domain/DAOException.java b/CurrentBatchStruts4/src/com/training/java/struts/domain/DAOException.java deleted file mode 100644 index acb3f75..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/domain/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.struts.domain; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/domain/ServiceException.java b/CurrentBatchStruts4/src/com/training/java/struts/domain/ServiceException.java deleted file mode 100644 index b1b34e9..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/domain/ServiceException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.struts.domain; - -public class ServiceException extends Exception { - - public ServiceException(Throwable ex) - { - super(ex); - } - - public ServiceException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/domain/package-info.java b/CurrentBatchStruts4/src/com/training/java/struts/domain/package-info.java deleted file mode 100644 index 51a5e92..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.struts.domain; \ No newline at end of file diff --git a/CurrentBatchStruts4/src/com/training/java/struts/web/AddBooksAction.java b/CurrentBatchStruts4/src/com/training/java/struts/web/AddBooksAction.java deleted file mode 100644 index 472eb1c..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/web/AddBooksAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddBooksAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("AddBook"); - } - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/web/BookForm.java b/CurrentBatchStruts4/src/com/training/java/struts/web/BookForm.java deleted file mode 100644 index 92e4885..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/web/BookForm.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class BookForm extends ActionForm { - - private String title; - private String author; - private String isbn; - private int pages; - private int id; - private boolean updateFlag; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public boolean isUpdateFlag() { - return updateFlag; - } - - public void setUpdateFlag(boolean updateFlag) { - this.updateFlag = updateFlag; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { - - ActionErrors errors = new ActionErrors(); - - if (StringUtils.isBlank(this.title)) { - errors.add("title.missing", new ActionMessage( - "error.title.required")); - } - if (StringUtils.isBlank(this.author)) { - errors.add("author.missing", new ActionMessage( - "error.author.required")); - } - if (StringUtils.isBlank(this.isbn)) { - errors.add("isbn.errors", new ActionMessage("error.isbn.required")); - } - - return errors; - } - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/web/DeleteBookAction.java b/CurrentBatchStruts4/src/com/training/java/struts/web/DeleteBookAction.java deleted file mode 100644 index 311d513..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/web/DeleteBookAction.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.domain.BookService; -import com.training.java.struts.domain.BookServiceImpl; - -public class DeleteBookAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - String idStr = request.getParameter("id"); - int id = Integer.parseInt(idStr); - - BookService service = new BookServiceImpl(); - service.delete(id); - - return mapping.findForward("List"); - } -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/web/HomeAction.java b/CurrentBatchStruts4/src/com/training/java/struts/web/HomeAction.java deleted file mode 100644 index 2859bec..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/web/HomeAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class HomeAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("Home"); - } - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/web/ListBooksAction.java b/CurrentBatchStruts4/src/com/training/java/struts/web/ListBooksAction.java deleted file mode 100644 index 7c5828a..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/web/ListBooksAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.struts.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookService; -import com.training.java.struts.domain.BookServiceImpl; - -public class ListBooksAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - BookService service = new BookServiceImpl(); - List books = service.getAllBooks(); - - request.setAttribute("venkat", books); - - return mapping.findForward("ListBooks"); - } - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/web/SaveBooksAction.java b/CurrentBatchStruts4/src/com/training/java/struts/web/SaveBooksAction.java deleted file mode 100644 index ea15128..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/web/SaveBooksAction.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.training.java.struts.web; - -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookService; -import com.training.java.struts.domain.BookServiceImpl; - -public class SaveBooksAction extends Action { - - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - BookForm bookForm = (BookForm) form; - - //Convert BookForm into Book object - Book book = new Book(bookForm.getId(), bookForm.getTitle(), bookForm.getAuthor(), bookForm.getIsbn(), bookForm.getPages(), new Date()); - - //Call BookService and save the details - BookService service = new BookServiceImpl(); - - if(bookForm.isUpdateFlag()) - { - service.update(book); - } - else - { - service.addBook(book); - } - - //Send acknowledgement - return mapping.findForward("Acknowledgement"); - - } - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/web/UpdateBookAction.java b/CurrentBatchStruts4/src/com/training/java/struts/web/UpdateBookAction.java deleted file mode 100644 index 2285581..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/web/UpdateBookAction.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookService; -import com.training.java.struts.domain.BookServiceImpl; - -public class UpdateBookAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - BookForm bookForm = (BookForm) form; - - BookService service = new BookServiceImpl(); - Book book = service.getById(bookForm.getId()); - - bookForm.setAuthor(book.getAuthor()); - bookForm.setIsbn(book.getIsbn()); - bookForm.setPages(book.getPages()); - bookForm.setTitle(book.getTitle()); - bookForm.setUpdateFlag(true); - - return mapping.findForward("UpdateBook"); - - } - -} diff --git a/CurrentBatchStruts4/src/com/training/java/struts/web/package-info.java b/CurrentBatchStruts4/src/com/training/java/struts/web/package-info.java deleted file mode 100644 index 341c1c2..0000000 --- a/CurrentBatchStruts4/src/com/training/java/struts/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.struts.web; \ No newline at end of file diff --git a/CurrentBatchStruts5/.classpath b/CurrentBatchStruts5/.classpath deleted file mode 100644 index 07b2c3a..0000000 --- a/CurrentBatchStruts5/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/CurrentBatchStruts5/.project b/CurrentBatchStruts5/.project deleted file mode 100644 index 0843efc..0000000 --- a/CurrentBatchStruts5/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - CurrentBatchStruts5 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/CurrentBatchStruts5/.settings/.jsdtscope b/CurrentBatchStruts5/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/CurrentBatchStruts5/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/CurrentBatchStruts5/.settings/org.eclipse.jdt.core.prefs b/CurrentBatchStruts5/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/CurrentBatchStruts5/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/CurrentBatchStruts5/.settings/org.eclipse.wst.common.component b/CurrentBatchStruts5/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 6d54b1a..0000000 --- a/CurrentBatchStruts5/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/CurrentBatchStruts5/.settings/org.eclipse.wst.common.project.facet.core.xml b/CurrentBatchStruts5/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 416c37e..0000000 --- a/CurrentBatchStruts5/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/CurrentBatchStruts5/.settings/org.eclipse.wst.jsdt.ui.superType.container b/CurrentBatchStruts5/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/CurrentBatchStruts5/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/CurrentBatchStruts5/.settings/org.eclipse.wst.jsdt.ui.superType.name b/CurrentBatchStruts5/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/CurrentBatchStruts5/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/CurrentBatchStruts5/WebContent/META-INF/MANIFEST.MF b/CurrentBatchStruts5/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/CurrentBatchStruts5/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-io-1.1.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-lang-2.6.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-lang-2.6.jar deleted file mode 100644 index 98467d3..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-lang-2.6.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/jstl-api-1.2.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/jstl-api-1.2.jar deleted file mode 100644 index 183ed63..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/jstl-api-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/jstl-impl-1.2.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/jstl-impl-1.2.jar deleted file mode 100644 index 110ca51..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/jstl-impl-1.2.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/ojdbc6.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/oro-2.0.8.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/standard-1.0.6.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/CurrentBatchStruts5/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/struts-config.xml b/CurrentBatchStruts5/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index b2e6101..0000000 --- a/CurrentBatchStruts5/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/views/Acknowledgement.jsp b/CurrentBatchStruts5/WebContent/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 94a47c4..0000000 --- a/CurrentBatchStruts5/WebContent/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

Your details have been saved.

- - - - \ No newline at end of file diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/views/AddBook.jsp b/CurrentBatchStruts5/WebContent/WEB-INF/views/AddBook.jsp deleted file mode 100644 index 1f09932..0000000 --- a/CurrentBatchStruts5/WebContent/WEB-INF/views/AddBook.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - -Insert title here - - - - - - - - - - : - - - - - -
- : - - - - -
- :
- :
- - - -
- - - - - - - \ No newline at end of file diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/views/Index.jsp b/CurrentBatchStruts5/WebContent/WEB-INF/views/Index.jsp deleted file mode 100644 index b3dbbce..0000000 --- a/CurrentBatchStruts5/WebContent/WEB-INF/views/Index.jsp +++ /dev/null @@ -1,18 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

Welcome to our Bookstore application!!

- - If you want to add a book, please click here
- For list of existing books, please click here
- - - - \ No newline at end of file diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/views/ListBooks.jsp b/CurrentBatchStruts5/WebContent/WEB-INF/views/ListBooks.jsp deleted file mode 100644 index 11f93d4..0000000 --- a/CurrentBatchStruts5/WebContent/WEB-INF/views/ListBooks.jsp +++ /dev/null @@ -1,38 +0,0 @@ -<%@page import="java.lang.reflect.Method"%> -<%@page import="com.training.java.struts.domain.Book"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> - - - - - - -Insert title here - - - - - - - - - - - - - - - - - - -
TitleAuthorISBNUpdate/Delete Link
${aBook.title}${aBook.author}${aBook.isbn} - Update - Delete -
- - - \ No newline at end of file diff --git a/CurrentBatchStruts5/WebContent/WEB-INF/web.xml b/CurrentBatchStruts5/WebContent/WEB-INF/web.xml deleted file mode 100644 index 9d7d2a8..0000000 --- a/CurrentBatchStruts5/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - struts1 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - ActionServlet - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts-config.xml - - - - ActionServlet - / - - \ No newline at end of file diff --git a/CurrentBatchStruts5/src/BookStore.properties b/CurrentBatchStruts5/src/BookStore.properties deleted file mode 100644 index dd33f5f..0000000 --- a/CurrentBatchStruts5/src/BookStore.properties +++ /dev/null @@ -1,20 +0,0 @@ -display.title=Title -display.author=Author -display.pubDate=Pub. Date -display.isbn=ISBN -display.pages=No of Pages - -error.title.required=Title is mandatory -error.isbn.required=ISBN is mandatory -error.author.required=Author is mandatory - -errors.header=

Validation Errors

    -errors.prefix=
  1. -errors.suffix=
  2. -errors.footer=
- - - - - - diff --git a/CurrentBatchStruts5/src/BookStore_de.properties b/CurrentBatchStruts5/src/BookStore_de.properties deleted file mode 100644 index 091ad60..0000000 --- a/CurrentBatchStruts5/src/BookStore_de.properties +++ /dev/null @@ -1,5 +0,0 @@ -display.title=Titel -display.author=Autor -display.pubDate=Publisher Datum -display.isbn=ISBN -display.pages=No of Pages diff --git a/CurrentBatchStruts5/src/com/training/java/struts/domain/Book.java b/CurrentBatchStruts5/src/com/training/java/struts/domain/Book.java deleted file mode 100644 index b9fe0e3..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/domain/Book.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.java.struts.domain; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - public void init() - { - - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } - - public int getPages() { - return pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/domain/BookDAO.java b/CurrentBatchStruts5/src/com/training/java/struts/domain/BookDAO.java deleted file mode 100644 index 62031f4..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/domain/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/domain/BookDAOJDBCImpl.java b/CurrentBatchStruts5/src/com/training/java/struts/domain/BookDAOJDBCImpl.java deleted file mode 100644 index 9c5d0ec..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/domain/BookDAOJDBCImpl.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.training.java.struts.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -class BookDAOJDBCImpl implements BookDAO { - - private String jdbcURL; - private String username; - private String password; - - public BookDAOJDBCImpl(String jdbcURL, String username, String password) - { - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(book_id_seq.nextval, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - statement.setInt(6, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } - - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/domain/BookService.java b/CurrentBatchStruts5/src/com/training/java/struts/domain/BookService.java deleted file mode 100644 index c1f928c..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/domain/BookService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -public interface BookService { - - List getAllBooks() throws ServiceException; - - void addBook(Book book) throws ServiceException; - - Book getById(int id) throws ServiceException; - - void update(Book book) throws ServiceException; - - void delete(int id) throws ServiceException; - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/domain/BookServiceImpl.java b/CurrentBatchStruts5/src/com/training/java/struts/domain/BookServiceImpl.java deleted file mode 100644 index 40c6299..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/domain/BookServiceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -public class BookServiceImpl implements BookService { - - @Override - public List getAllBooks() throws ServiceException { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - return dao.getAllBooks(); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public void addBook(Book book) throws ServiceException { - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - dao.addBook(book); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public Book getById(int id) throws ServiceException { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - return dao.findByPrimaryKey(id); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - - } - - @Override - public void update(Book book) throws ServiceException { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - dao.updateBook(book); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public void delete(int id) throws ServiceException { - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - dao.deleteBook(id); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/domain/DAOException.java b/CurrentBatchStruts5/src/com/training/java/struts/domain/DAOException.java deleted file mode 100644 index acb3f75..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/domain/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.struts.domain; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/domain/ServiceException.java b/CurrentBatchStruts5/src/com/training/java/struts/domain/ServiceException.java deleted file mode 100644 index b1b34e9..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/domain/ServiceException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.struts.domain; - -public class ServiceException extends Exception { - - public ServiceException(Throwable ex) - { - super(ex); - } - - public ServiceException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/domain/package-info.java b/CurrentBatchStruts5/src/com/training/java/struts/domain/package-info.java deleted file mode 100644 index 51a5e92..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.struts.domain; \ No newline at end of file diff --git a/CurrentBatchStruts5/src/com/training/java/struts/web/AddBooksAction.java b/CurrentBatchStruts5/src/com/training/java/struts/web/AddBooksAction.java deleted file mode 100644 index 472eb1c..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/web/AddBooksAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddBooksAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("AddBook"); - } - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/web/BookForm.java b/CurrentBatchStruts5/src/com/training/java/struts/web/BookForm.java deleted file mode 100644 index 92e4885..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/web/BookForm.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class BookForm extends ActionForm { - - private String title; - private String author; - private String isbn; - private int pages; - private int id; - private boolean updateFlag; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public boolean isUpdateFlag() { - return updateFlag; - } - - public void setUpdateFlag(boolean updateFlag) { - this.updateFlag = updateFlag; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { - - ActionErrors errors = new ActionErrors(); - - if (StringUtils.isBlank(this.title)) { - errors.add("title.missing", new ActionMessage( - "error.title.required")); - } - if (StringUtils.isBlank(this.author)) { - errors.add("author.missing", new ActionMessage( - "error.author.required")); - } - if (StringUtils.isBlank(this.isbn)) { - errors.add("isbn.errors", new ActionMessage("error.isbn.required")); - } - - return errors; - } - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/web/DeleteBookAction.java b/CurrentBatchStruts5/src/com/training/java/struts/web/DeleteBookAction.java deleted file mode 100644 index 311d513..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/web/DeleteBookAction.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.domain.BookService; -import com.training.java.struts.domain.BookServiceImpl; - -public class DeleteBookAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - String idStr = request.getParameter("id"); - int id = Integer.parseInt(idStr); - - BookService service = new BookServiceImpl(); - service.delete(id); - - return mapping.findForward("List"); - } -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/web/HomeAction.java b/CurrentBatchStruts5/src/com/training/java/struts/web/HomeAction.java deleted file mode 100644 index 2859bec..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/web/HomeAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class HomeAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("Home"); - } - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/web/ListBooksAction.java b/CurrentBatchStruts5/src/com/training/java/struts/web/ListBooksAction.java deleted file mode 100644 index 7c5828a..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/web/ListBooksAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.struts.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookService; -import com.training.java.struts.domain.BookServiceImpl; - -public class ListBooksAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - BookService service = new BookServiceImpl(); - List books = service.getAllBooks(); - - request.setAttribute("venkat", books); - - return mapping.findForward("ListBooks"); - } - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/web/SaveBooksAction.java b/CurrentBatchStruts5/src/com/training/java/struts/web/SaveBooksAction.java deleted file mode 100644 index ea15128..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/web/SaveBooksAction.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.training.java.struts.web; - -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookService; -import com.training.java.struts.domain.BookServiceImpl; - -public class SaveBooksAction extends Action { - - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - BookForm bookForm = (BookForm) form; - - //Convert BookForm into Book object - Book book = new Book(bookForm.getId(), bookForm.getTitle(), bookForm.getAuthor(), bookForm.getIsbn(), bookForm.getPages(), new Date()); - - //Call BookService and save the details - BookService service = new BookServiceImpl(); - - if(bookForm.isUpdateFlag()) - { - service.update(book); - } - else - { - service.addBook(book); - } - - //Send acknowledgement - return mapping.findForward("Acknowledgement"); - - } - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/web/UpdateBookAction.java b/CurrentBatchStruts5/src/com/training/java/struts/web/UpdateBookAction.java deleted file mode 100644 index 2285581..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/web/UpdateBookAction.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookService; -import com.training.java.struts.domain.BookServiceImpl; - -public class UpdateBookAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - BookForm bookForm = (BookForm) form; - - BookService service = new BookServiceImpl(); - Book book = service.getById(bookForm.getId()); - - bookForm.setAuthor(book.getAuthor()); - bookForm.setIsbn(book.getIsbn()); - bookForm.setPages(book.getPages()); - bookForm.setTitle(book.getTitle()); - bookForm.setUpdateFlag(true); - - return mapping.findForward("UpdateBook"); - - } - -} diff --git a/CurrentBatchStruts5/src/com/training/java/struts/web/package-info.java b/CurrentBatchStruts5/src/com/training/java/struts/web/package-info.java deleted file mode 100644 index 341c1c2..0000000 --- a/CurrentBatchStruts5/src/com/training/java/struts/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.struts.web; \ No newline at end of file diff --git a/FIT/.classpath b/FIT/.classpath deleted file mode 100644 index cd72253..0000000 --- a/FIT/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/FIT/.project b/FIT/.project deleted file mode 100644 index 27d0256..0000000 --- a/FIT/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - FIT - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/FIT/.settings/org.eclipse.jdt.core.prefs b/FIT/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 83c3ccd..0000000 --- a/FIT/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Sat Jul 23 10:16:00 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/FIT/doc/readme.txt b/FIT/doc/readme.txt deleted file mode 100644 index 03a15cf..0000000 --- a/FIT/doc/readme.txt +++ /dev/null @@ -1,8 +0,0 @@ ---> FIT stands for Framework for Integration Testing which helps communicate between business users, testers and the developers - ---> FIT expects the input information being in the HTML tables. Since designing an HTML table by hand can be tedious, draw a table in Micosoft Word and save it as .html file. - Word automatically generates the HTML code for you. Keep this .html file in input folder. This table will have few examples of how the code should behave. - -Q : How to run this example? -A : Go to command prompt and go to src folder of FIT projects (for example "cd C:\projects\FIT\src") and then type the following command - java -classpath ..\lib\fit.jar;..\bin; fit.FileRunner input\payment.html output\results.html \ No newline at end of file diff --git a/FIT/lib/fit.jar b/FIT/lib/fit.jar deleted file mode 100644 index 44e8564..0000000 Binary files a/FIT/lib/fit.jar and /dev/null differ diff --git a/FIT/src/com/training/java/fit/PaymentFixture.java b/FIT/src/com/training/java/fit/PaymentFixture.java deleted file mode 100644 index 191df01..0000000 --- a/FIT/src/com/training/java/fit/PaymentFixture.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.fit; - -import fit.ColumnFixture; - -public class PaymentFixture extends ColumnFixture { - - public double hourlyRate; - public int hoursWorked; - - public double caculatePay() - { - return hourlyRate * hoursWorked; - } - -} diff --git a/FIT/src/input/payment.html b/FIT/src/input/payment.html deleted file mode 100644 index fca671c..0000000 --- a/FIT/src/input/payment.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - -com - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
-

com.training.java.fit.PaymentFixture

-
-

hourlyRate

-
-

hoursWorked

-
-

caculatePay()

-
-

20

-
-

40

-
-

800

-
-

30

-
-

40

-
-

1200

-
-

40

-
-

40

-
-

1600

-
- -

 

- -
- - - - diff --git a/FIT/src/output/results.html b/FIT/src/output/results.html deleted file mode 100644 index 1553c21..0000000 --- a/FIT/src/output/results.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - -com - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
-

com.training.java.fit.PaymentFixture

-
-

hourlyRate

-
-

hoursWorked

-
-

caculatePay()

-
-

20

-
-

40

-
-

800

-
-

30

-
-

40

-
-

1200

-
-

40

-
-

40

-
-

1600

-
- -

 

- -
- - - - diff --git a/HelloWorldApp/.classpath b/HelloWorldApp/.classpath deleted file mode 100644 index 23a27a7..0000000 --- a/HelloWorldApp/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/HelloWorldApp/.project b/HelloWorldApp/.project deleted file mode 100644 index d8c6ef9..0000000 --- a/HelloWorldApp/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - HelloWorldApp - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/HelloWorldApp/.settings/.jsdtscope b/HelloWorldApp/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/HelloWorldApp/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/HelloWorldApp/.settings/org.eclipse.jdt.core.prefs b/HelloWorldApp/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/HelloWorldApp/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/HelloWorldApp/.settings/org.eclipse.wst.common.component b/HelloWorldApp/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 1628389..0000000 --- a/HelloWorldApp/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/HelloWorldApp/.settings/org.eclipse.wst.common.project.facet.core.xml b/HelloWorldApp/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 69b9da3..0000000 --- a/HelloWorldApp/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/HelloWorldApp/.settings/org.eclipse.wst.jsdt.ui.superType.container b/HelloWorldApp/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/HelloWorldApp/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/HelloWorldApp/.settings/org.eclipse.wst.jsdt.ui.superType.name b/HelloWorldApp/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/HelloWorldApp/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/HelloWorldApp/WebContent/Intro.html b/HelloWorldApp/WebContent/Intro.html deleted file mode 100644 index 260ed5b..0000000 --- a/HelloWorldApp/WebContent/Intro.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - -Insert title here - - - -
- - First Name :
- Last Name :
- - - -
- - - - - \ No newline at end of file diff --git a/HelloWorldApp/WebContent/META-INF/MANIFEST.MF b/HelloWorldApp/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/HelloWorldApp/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/HelloWorldApp/WebContent/WEB-INF/web.xml b/HelloWorldApp/WebContent/WEB-INF/web.xml deleted file mode 100644 index a8c3f59..0000000 --- a/HelloWorldApp/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - HelloWorldApp - - index.html - - - - - HelloWorldServlet - HelloWorldServlet - com.training.java.servlet.helloworld.HelloWorldServlet - - - - HelloWorldServlet - /hello - - - \ No newline at end of file diff --git a/HelloWorldApp/WebContent/index.html b/HelloWorldApp/WebContent/index.html deleted file mode 100644 index 9264441..0000000 --- a/HelloWorldApp/WebContent/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - -Insert title here - - - - Welcome to my web application - - - \ No newline at end of file diff --git a/HelloWorldApp/readme.txt b/HelloWorldApp/readme.txt deleted file mode 100644 index 4f96f2d..0000000 --- a/HelloWorldApp/readme.txt +++ /dev/null @@ -1 +0,0 @@ -1st Servlet example.. \ No newline at end of file diff --git a/HelloWorldApp/src/com/training/java/servlet/helloworld/HelloWorldServlet.java b/HelloWorldApp/src/com/training/java/servlet/helloworld/HelloWorldServlet.java deleted file mode 100644 index a40d491..0000000 --- a/HelloWorldApp/src/com/training/java/servlet/helloworld/HelloWorldServlet.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.training.java.servlet.helloworld; - -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class HelloWorldServlet - */ -public class HelloWorldServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - System.out.println("doGet metod has been called"); - - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String city = request.getParameter("city"); - - System.out.println("First name = " + firstName); - System.out.println("lastName = " + lastName); - System.out.println("city = " + city); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println(""); - out.println("

Hello " + firstName + " " + lastName + "

"); - out.println(""); - out.println(""); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - System.out.println("doPost metod has been called"); - - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String city = request.getParameter("city"); - - System.out.println("First name = " + firstName); - System.out.println("lastName = " + lastName); - System.out.println("city = " + city); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println(""); - out.println("

Hello " + firstName + " " + lastName + "

"); - out.println(""); - out.println(""); - - - } - -} diff --git a/HelloWorldServlet/.classpath b/HelloWorldServlet/.classpath deleted file mode 100644 index 700a9c5..0000000 --- a/HelloWorldServlet/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/HelloWorldServlet/.project b/HelloWorldServlet/.project deleted file mode 100644 index 5a13a03..0000000 --- a/HelloWorldServlet/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - HelloWorldServlet - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/HelloWorldServlet/.settings/.jsdtscope b/HelloWorldServlet/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/HelloWorldServlet/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/HelloWorldServlet/.settings/org.eclipse.jdt.core.prefs b/HelloWorldServlet/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index b06a466..0000000 --- a/HelloWorldServlet/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sun Feb 05 08:14:55 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/HelloWorldServlet/.settings/org.eclipse.wst.common.component b/HelloWorldServlet/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 6c5e2c4..0000000 --- a/HelloWorldServlet/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/HelloWorldServlet/.settings/org.eclipse.wst.common.project.facet.core.xml b/HelloWorldServlet/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 0873c6e..0000000 --- a/HelloWorldServlet/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/HelloWorldServlet/.settings/org.eclipse.wst.jsdt.ui.superType.container b/HelloWorldServlet/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/HelloWorldServlet/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/HelloWorldServlet/.settings/org.eclipse.wst.jsdt.ui.superType.name b/HelloWorldServlet/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/HelloWorldServlet/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/HelloWorldServlet/WebContent/META-INF/MANIFEST.MF b/HelloWorldServlet/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/HelloWorldServlet/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/HelloWorldServlet/WebContent/WEB-INF/web.xml b/HelloWorldServlet/WebContent/WEB-INF/web.xml deleted file mode 100644 index 6c90d30..0000000 --- a/HelloWorldServlet/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - HelloWorldServlet - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - HelloWorldServlet - com.training.java.servlet.HelloWorldServlet - - - HelloWorldServlet - /hello - - - - HelloWorld2 - HelloWorld2 - com.training.java.servlet.HelloWorld2 - - - HelloWorld2 - /hello2 - - - - Registration - Registration - com.training.java.servlet.RegistrationServlet - - - Registration - /registration - - \ No newline at end of file diff --git a/HelloWorldServlet/WebContent/index.html b/HelloWorldServlet/WebContent/index.html deleted file mode 100644 index d31d84c..0000000 --- a/HelloWorldServlet/WebContent/index.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - -Insert title here - - - -

Welcome to my first web application!

- - - - - - - - - - - - - -
TitleYearDirector
Cars22011XYZ
- - - \ No newline at end of file diff --git a/HelloWorldServlet/WebContent/registration.html b/HelloWorldServlet/WebContent/registration.html deleted file mode 100644 index 254161d..0000000 --- a/HelloWorldServlet/WebContent/registration.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - -Insert title here - - - -

Please enter your details and click on Submit

-
- - First Name :
- Last Name :
- City :
- State :
- - - -
- - - - \ No newline at end of file diff --git a/HelloWorldServlet/src/com/training/java/servlet/HelloWorld2.java b/HelloWorldServlet/src/com/training/java/servlet/HelloWorld2.java deleted file mode 100644 index a5878de..0000000 --- a/HelloWorldServlet/src/com/training/java/servlet/HelloWorld2.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.servlet; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Date; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class HelloWorld2 - */ -public class HelloWorld2 extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public HelloWorld2() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - - PrintWriter out = response.getWriter(); - - out.print(""); - out.print(""); - out.print("

Welcome to my dynamic App, this is coming from Servlet2!"); - out.print("

Time on my end is " + new Date()); - out.print(""); - out.print(""); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doPost(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/HelloWorldServlet/src/com/training/java/servlet/HelloWorldServlet.java b/HelloWorldServlet/src/com/training/java/servlet/HelloWorldServlet.java deleted file mode 100644 index 5603332..0000000 --- a/HelloWorldServlet/src/com/training/java/servlet/HelloWorldServlet.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.java.servlet; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Date; -import java.util.Enumeration; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class HelloWorldServlet extends HttpServlet { - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - - - Enumeration headers = req.getHeaderNames(); - while(headers.hasMoreElements()) - { - String headerName = headers.nextElement(); - String headerValue = req.getHeader(headerName); - - System.out.println(headerName + " = " + headerValue); - } - - String firstName = req.getParameter("fn"); - String lastName = req.getParameter("ln"); - - PrintWriter out = resp.getWriter(); - - out.print(""); - out.print(""); - out.print("

Welcome to my dynamic App " + lastName + ", " + firstName); - out.print("

Time on my end is " + new Date()); - out.print(""); - out.print(""); - } - -} diff --git a/HelloWorldServlet/src/com/training/java/servlet/RegistrationServlet.java b/HelloWorldServlet/src/com/training/java/servlet/RegistrationServlet.java deleted file mode 100644 index 855f275..0000000 --- a/HelloWorldServlet/src/com/training/java/servlet/RegistrationServlet.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.training.java.servlet; - -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class Registration - */ -public class RegistrationServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public RegistrationServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String city = request.getParameter("city"); - String state = request.getParameter("state"); - - System.out.println("I am in get method"); - System.out.println("first name = " + firstName); - System.out.println("last name = " + lastName); - System.out.println("city = " + city); - System.out.println("state = " + state); - - //TODO This is where you will call data layer to save the details in database - - PrintWriter out = response.getWriter(); - out.print("

We received your details, thank you"); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - doGet(request, response); - } - -} diff --git a/Hibernate/.classpath b/Hibernate/.classpath deleted file mode 100644 index 930c3ed..0000000 --- a/Hibernate/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/Hibernate/.project b/Hibernate/.project deleted file mode 100644 index cc3f711..0000000 --- a/Hibernate/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Hibernate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/Hibernate/.settings/org.eclipse.jdt.core.prefs b/Hibernate/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2ad2171..0000000 --- a/Hibernate/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Sat Jul 23 14:39:21 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/Hibernate/lib/antlr-2.7.6.jar b/Hibernate/lib/antlr-2.7.6.jar deleted file mode 100644 index 3702b64..0000000 Binary files a/Hibernate/lib/antlr-2.7.6.jar and /dev/null differ diff --git a/Hibernate/lib/commons-collections-3.1.jar b/Hibernate/lib/commons-collections-3.1.jar deleted file mode 100644 index 41e230f..0000000 Binary files a/Hibernate/lib/commons-collections-3.1.jar and /dev/null differ diff --git a/Hibernate/lib/dom4j-1.6.1.jar b/Hibernate/lib/dom4j-1.6.1.jar deleted file mode 100644 index c8c4dbb..0000000 Binary files a/Hibernate/lib/dom4j-1.6.1.jar and /dev/null differ diff --git a/Hibernate/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar b/Hibernate/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar deleted file mode 100644 index 1e9f71b..0000000 Binary files a/Hibernate/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar and /dev/null differ diff --git a/Hibernate/lib/hibernate3.jar b/Hibernate/lib/hibernate3.jar deleted file mode 100644 index 27894ef..0000000 Binary files a/Hibernate/lib/hibernate3.jar and /dev/null differ diff --git a/Hibernate/lib/javassist-3.12.0.GA.jar b/Hibernate/lib/javassist-3.12.0.GA.jar deleted file mode 100644 index 8f692f4..0000000 Binary files a/Hibernate/lib/javassist-3.12.0.GA.jar and /dev/null differ diff --git a/Hibernate/lib/jta-1.1.jar b/Hibernate/lib/jta-1.1.jar deleted file mode 100644 index 6d225b7..0000000 Binary files a/Hibernate/lib/jta-1.1.jar and /dev/null differ diff --git a/Hibernate/lib/junit-4.8.2.jar b/Hibernate/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/Hibernate/lib/junit-4.8.2.jar and /dev/null differ diff --git a/Hibernate/lib/mysql-connector-java-5.1.12-bin.jar b/Hibernate/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/Hibernate/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/Hibernate/lib/slf4j-api-1.6.1.jar b/Hibernate/lib/slf4j-api-1.6.1.jar deleted file mode 100644 index f1f4fdd..0000000 Binary files a/Hibernate/lib/slf4j-api-1.6.1.jar and /dev/null differ diff --git a/Hibernate/src/java/com/training/java/hibernate/Book.java b/Hibernate/src/java/com/training/java/hibernate/Book.java deleted file mode 100644 index 863115c..0000000 --- a/Hibernate/src/java/com/training/java/hibernate/Book.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.training.java.hibernate; - -import java.io.Serializable; - -public class Book implements Serializable { - private Integer id; - private String title; - private String author; - private String isbn; - private Integer pages; - private Integer publisherId; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public Integer getPages() { - return pages; - } - - public void setPages(Integer pages) { - this.pages = pages; - } - - public Integer getPublisherId() { - return publisherId; - } - - public void setPublisherId(Integer publisherId) { - this.publisherId = publisherId; - } -} diff --git a/Hibernate/src/java/com/training/java/hibernate/BookDAO.java b/Hibernate/src/java/com/training/java/hibernate/BookDAO.java deleted file mode 100644 index 6202b7e..0000000 --- a/Hibernate/src/java/com/training/java/hibernate/BookDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.java.hibernate; - -import java.util.List; - -public interface BookDAO { - - public void create(Book aNewBook) throws DAOException; - public List getAllBooks() throws DAOException; - public Book findByPrimaryKey(Integer id) throws DAOException; - public void update(Book bookToUpdate) throws DAOException; - public void delete(int id) throws DAOException; -} diff --git a/Hibernate/src/java/com/training/java/hibernate/BookDAOHibernateImpl.java b/Hibernate/src/java/com/training/java/hibernate/BookDAOHibernateImpl.java deleted file mode 100644 index 18bdab5..0000000 --- a/Hibernate/src/java/com/training/java/hibernate/BookDAOHibernateImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.training.java.hibernate; - -import java.util.List; - -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.hibernate.cfg.Configuration; - -public class BookDAOHibernateImpl implements BookDAO { - - private SessionFactory sessionFactory; - - public BookDAOHibernateImpl() { - // A SessionFactory is set up once for an application - sessionFactory = new Configuration().configure() // configures settings from hibernate.cfg.xml - .buildSessionFactory(); - } - - @Override - public void create(Book aNewBook) throws DAOException { - Session session = sessionFactory.openSession(); - - Transaction transaction = session.getTransaction(); - transaction.begin(); - - session.save(aNewBook); - - transaction.commit(); - } - - @Override - public List getAllBooks() throws DAOException { - - Session session = sessionFactory.openSession(); - - return (List) session.createCriteria(Book.class).list(); - } - - @Override - public Book findByPrimaryKey(Integer id) throws DAOException { - - Session session = sessionFactory.openSession(); - return (Book) session.get(Book.class, id); - } - - @Override - public void update(Book bookToUpdate) throws DAOException { - Session session = sessionFactory.openSession(); - Transaction transaction = session.getTransaction(); - - transaction.begin(); - session.update(bookToUpdate); - transaction.commit(); - } - - @Override - public void delete(int id) throws DAOException { - Session session = sessionFactory.openSession(); - Transaction transaction = session.getTransaction(); - - Book bookToDelete = new Book(); - bookToDelete.setId(id); - - transaction.begin(); - session.delete(bookToDelete); - transaction.commit(); - } - -} diff --git a/Hibernate/src/java/com/training/java/hibernate/BookDAOTest.java b/Hibernate/src/java/com/training/java/hibernate/BookDAOTest.java deleted file mode 100644 index fbef3b8..0000000 --- a/Hibernate/src/java/com/training/java/hibernate/BookDAOTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.training.java.hibernate; - - -import static org.junit.Assert.fail; - -import java.util.Iterator; -import java.util.List; - -import org.junit.Test; - -public class BookDAOTest { - - public void getAllBooks() - { - BookDAO dao = new BookDAOHibernateImpl(); - - try - { - List books = dao.getAllBooks(); - Iterator ite = books.iterator(); - while(ite.hasNext()) - { - Book eachBook = ite.next(); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book author = " + eachBook.getAuthor()); - System.out.println("Book title = " + eachBook.getTitle()); - System.out.println("Book ISBN = " + eachBook.getIsbn()); - System.out.println("Book pages = " + eachBook.getPages()); - System.out.println("Book publisher ID = " + eachBook.getPublisherId()); - } - - } catch (DAOException e) - { - e.printStackTrace(); - fail("Error occured while retrieving all books from database"); - } - } - - public void findByPrimaryKey() throws DAOException - { - BookDAO dao = new BookDAOHibernateImpl(); - - Book book = dao.findByPrimaryKey(2); - - System.out.println("Book id = " + book.getId()); - System.out.println("Book author = " + book.getAuthor()); - System.out.println("Book title = " + book.getTitle()); - System.out.println("Book ISBN = " + book.getIsbn()); - System.out.println("Book pages = " + book.getPages()); - System.out.println("Book publisher ID = " + book.getPublisherId()); - } - - public void create() throws DAOException - { - Book book = new Book(); - - book.setAuthor("Venkat"); - book.setIsbn("999999"); - book.setPages(456); - book.setPublisherId(10); - book.setTitle("2 States"); - - BookDAO dao = new BookDAOHibernateImpl(); - - dao.create(book); - } - - - public void update() throws DAOException - { - BookDAO dao = new BookDAOHibernateImpl(); - - Book existingBook = dao.findByPrimaryKey(2); - existingBook.setTitle("3 States"); - dao.update(existingBook); - } - - @Test - public void delete() throws DAOException - { - BookDAO dao = new BookDAOHibernateImpl(); - - dao.delete(1); - } -} diff --git a/Hibernate/src/java/com/training/java/hibernate/DAOException.java b/Hibernate/src/java/com/training/java/hibernate/DAOException.java deleted file mode 100644 index b326ca2..0000000 --- a/Hibernate/src/java/com/training/java/hibernate/DAOException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.hibernate; - -public class DAOException extends Exception { - - public DAOException(Exception cause) - { - super(cause); - } - - public DAOException(String message) - { - super(message); - } - -} diff --git a/Hibernate/src/resources/Book.hbm.xml b/Hibernate/src/resources/Book.hbm.xml deleted file mode 100644 index 544fc75..0000000 --- a/Hibernate/src/resources/Book.hbm.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Hibernate/src/resources/hibernate.cfg.xml b/Hibernate/src/resources/hibernate.cfg.xml deleted file mode 100644 index 081eb7c..0000000 --- a/Hibernate/src/resources/hibernate.cfg.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - com.mysql.jdbc.Driver - jdbc:mysql://localhost/training - root - password - - - 1 - - - org.hibernate.dialect.MySQLDialect - - - org.hibernate.cache.NoCacheProvider - - - true - - - - - - \ No newline at end of file diff --git a/HibernateBasic/.classpath b/HibernateBasic/.classpath deleted file mode 100644 index 96f09f1..0000000 --- a/HibernateBasic/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/HibernateBasic/.project b/HibernateBasic/.project deleted file mode 100644 index f8efe70..0000000 --- a/HibernateBasic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - HibernateBasic - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/HibernateBasic/.settings/org.eclipse.jdt.core.prefs b/HibernateBasic/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 742b757..0000000 --- a/HibernateBasic/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Mon Oct 10 10:13:50 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning diff --git a/HibernateBasic/.settings/org.maven.ide.eclipse.prefs b/HibernateBasic/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index ee72d8b..0000000 --- a/HibernateBasic/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Mon Oct 10 09:58:16 EDT 2011 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/HibernateBasic/pom.xml b/HibernateBasic/pom.xml deleted file mode 100644 index ff8c642..0000000 --- a/HibernateBasic/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - com.venkat - HibernateBasic - 1.0 - - - - org.hibernate - hibernate-core - 3.6.0.Final - - - org.hibernate - hibernate-annotations - 3.5.6-Final - - - junit - junit - 4.10 - - - mysql - mysql-connector-java - 5.1.17 - - - javassist - javassist - 3.6.0.GA - - - \ No newline at end of file diff --git a/HibernateBasic/src/main/java/com/training/java/hibernate/Book.java b/HibernateBasic/src/main/java/com/training/java/hibernate/Book.java deleted file mode 100644 index f88a5e9..0000000 --- a/HibernateBasic/src/main/java/com/training/java/hibernate/Book.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.training.java.hibernate; - -import java.io.Serializable; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Entity -@Table(name = "book") -public class Book implements Serializable { - - @Id - @Column(name = "id") - private int id; - - @Column(name = "title") - private String title; - - @Column(name = "author") - private String author; - - @Column(name = "isbn") - private String isbn; - - @Column(name = "pages") - private int pages; - - @ManyToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER) - @JoinColumn(name="publisher_id") - private Publisher publisher; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public Publisher getPublisher() { - return publisher; - } - - public void setPublisher(Publisher publisher) { - this.publisher = publisher; - } - -} diff --git a/HibernateBasic/src/main/java/com/training/java/hibernate/BookDAO.java b/HibernateBasic/src/main/java/com/training/java/hibernate/BookDAO.java deleted file mode 100644 index c17d70f..0000000 --- a/HibernateBasic/src/main/java/com/training/java/hibernate/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.hibernate; - - -import java.util.List; - -public interface BookDAO { - - public void create(Book aNewBook) throws DAOException; - public List getAllBooks() throws DAOException; - public Book findByPrimaryKey(int id) throws DAOException; - public void update(Book bookToUpdate) throws DAOException; - public void delete(int id) throws DAOException; -} diff --git a/HibernateBasic/src/main/java/com/training/java/hibernate/BookDAOHibernateImpl.java b/HibernateBasic/src/main/java/com/training/java/hibernate/BookDAOHibernateImpl.java deleted file mode 100644 index ca1cc69..0000000 --- a/HibernateBasic/src/main/java/com/training/java/hibernate/BookDAOHibernateImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.training.java.hibernate; - -import java.util.List; - -import org.hibernate.Session; - -public class BookDAOHibernateImpl implements BookDAO { - - @Override - public void create(Book aNewBook) throws DAOException { - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - - session.getTransaction().begin(); - session.save(aNewBook); - session.getTransaction().commit(); - } - - @Override - public List getAllBooks() throws DAOException { - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - - session.getTransaction().begin(); - List books = session.createCriteria(Book.class).list(); - session.getTransaction().commit(); - - return books; - } - - @Override - public Book findByPrimaryKey(int id) throws DAOException { - - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - session.getTransaction().begin(); - Book book = (Book) session.get(Book.class, id); - session.getTransaction().commit(); - - return book; - } - - @Override - public void update(Book bookToUpdate) throws DAOException { - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - session.getTransaction().begin(); - session.update(bookToUpdate); - session.getTransaction().commit(); - } - - @Override - public void delete(int id) throws DAOException { - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - session.getTransaction().begin(); - - Book bookToDelete = new Book(); - bookToDelete.setId(id); - - session.delete(bookToDelete); - session.getTransaction().commit(); - } - -} diff --git a/HibernateBasic/src/main/java/com/training/java/hibernate/DAOException.java b/HibernateBasic/src/main/java/com/training/java/hibernate/DAOException.java deleted file mode 100644 index b326ca2..0000000 --- a/HibernateBasic/src/main/java/com/training/java/hibernate/DAOException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.hibernate; - -public class DAOException extends Exception { - - public DAOException(Exception cause) - { - super(cause); - } - - public DAOException(String message) - { - super(message); - } - -} diff --git a/HibernateBasic/src/main/java/com/training/java/hibernate/HibernateUtil.java b/HibernateBasic/src/main/java/com/training/java/hibernate/HibernateUtil.java deleted file mode 100644 index 5b057b2..0000000 --- a/HibernateBasic/src/main/java/com/training/java/hibernate/HibernateUtil.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.hibernate; - -import org.hibernate.SessionFactory; -import org.hibernate.cfg.Configuration; - -public class HibernateUtil { - private static final SessionFactory sessionFactory; - static { - try { - sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory(); - } catch (Throwable ex) { - ex.printStackTrace(); - throw new ExceptionInInitializerError(ex); - } - } - - public static SessionFactory getSessionFactory() { - return sessionFactory; - } -} diff --git a/HibernateBasic/src/main/java/com/training/java/hibernate/Publisher.java b/HibernateBasic/src/main/java/com/training/java/hibernate/Publisher.java deleted file mode 100644 index d3558eb..0000000 --- a/HibernateBasic/src/main/java/com/training/java/hibernate/Publisher.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.hibernate; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "publisher") -public class Publisher { - @Id - @Column(name = "publisher_id") - private int id; - - @Column(name = "name") - private String name; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/HibernateBasic/src/main/resources/hibernate.cfg.xml b/HibernateBasic/src/main/resources/hibernate.cfg.xml deleted file mode 100644 index 5b42820..0000000 --- a/HibernateBasic/src/main/resources/hibernate.cfg.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - com.mysql.jdbc.Driver - jdbc:mysql://localhost/training - root - password - - - 1 - - - org.hibernate.dialect.MySQLDialect - - - org.hibernate.cache.NoCacheProvider - - - true - org.hibernate.context.ThreadLocalSessionContext - - - - - - - - \ No newline at end of file diff --git a/HibernateBasic/src/test/java/com/training/java/hibernate/BookDAOHibernateImplTest.java b/HibernateBasic/src/test/java/com/training/java/hibernate/BookDAOHibernateImplTest.java deleted file mode 100644 index 9195dcb..0000000 --- a/HibernateBasic/src/test/java/com/training/java/hibernate/BookDAOHibernateImplTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.training.java.hibernate; - -import java.util.List; - -import org.junit.Ignore; -import org.junit.Test; - -public class BookDAOHibernateImplTest { - - @Test - public void testList() throws Exception { - - BookDAO dao = new BookDAOHibernateImpl(); - List books = dao.getAllBooks(); - - for(Book aBook : books) - { - System.out.println("dept name " + aBook.getPublisher().getName()); - } - - - System.out.println("books size = " + books.size()); - } - - @Ignore - public void testFindByPrimaryKey() throws Exception { - - BookDAO dao = new BookDAOHibernateImpl(); - Book book = dao.findByPrimaryKey(1); - - System.out.println("Title = " + book.getTitle()); - System.out.println("Author = " + book.getAuthor()); - System.out.println("ISBN = " + book.getIsbn()); - } - - - @Test - public void testAdd() throws Exception - { - BookDAO dao = new BookDAOHibernateImpl(); - - Book newBook = new Book(); - newBook.setId(5); - newBook.setAuthor("Gavin King"); - newBook.setIsbn("1234"); - newBook.setTitle("Hibernate "); - - Publisher pub = new Publisher(); - pub.setId(5); - pub.setName("ABC"); - - newBook.setPublisher(pub); - - dao.create(newBook); - } - - @Ignore - public void testUpdate() throws Exception - { - BookDAO dao = new BookDAOHibernateImpl(); - Book book = dao.findByPrimaryKey(1); - - book.setAuthor("Venkat"); - - dao.update(book); - } - - @Ignore - public void testDelete() throws Exception - { - BookDAO dao = new BookDAOHibernateImpl(); - dao.delete(1); - } - -} diff --git a/JDBC/.classpath b/JDBC/.classpath deleted file mode 100644 index a590442..0000000 --- a/JDBC/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/JDBC/.project b/JDBC/.project deleted file mode 100644 index 7736b9b..0000000 --- a/JDBC/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - JDBC - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/JDBC/.settings/org.eclipse.jdt.core.prefs b/JDBC/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 78a3928..0000000 --- a/JDBC/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Mon Jun 27 17:06:08 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/JDBC/doc/Bookstore.sql b/JDBC/doc/Bookstore.sql deleted file mode 100644 index abf5167..0000000 --- a/JDBC/doc/Bookstore.sql +++ /dev/null @@ -1,8 +0,0 @@ ---Login as system and execute the following statements -create user bookstore identified by password -grant all privileges to bookstore - ---Now, login as bookstore and execute the following - -create table book(book_id int primary key, title varchar2(30), author varchar2(30), number_of_pages int, isbn varchar2(10), pub_date date); - diff --git a/JDBC/doc/MySQL_Commands b/JDBC/doc/MySQL_Commands deleted file mode 100644 index 3ff9a1f..0000000 --- a/JDBC/doc/MySQL_Commands +++ /dev/null @@ -1,108 +0,0 @@ ---> How to login to MySQL in command prompt : - mysql -p -u root ---> Create a database called "training" - create database training; ---> How to know what database you are in : - select database(); ---> connect to a database : - use training; ---> create a basic table book - create table book(id int, title varchar(30), author varchar(30), isbn varchar(15), pages int); ---> If I want to see all the tables in this database? - show tables; ---> If I want to see all the columns and its lengths, constraints..etc in a particular table - describe book; ---> How to add not null constraint or primary key constraint after table is created? - alter table modify ; - alter table book modify id int primary key; - alter table book modify isbn varchar(20) unique; ---> How to delete table? - drop table book; ---> How to add primary key and not null while creating table? - create table book(id int primary key, title varchar(30) not null, author varchar(30) not null, isbn varchar(15) not null, pages int not null default 100); ---> You can use describe command to see if table definition got reflected - describe book; ---> How to insert some data.. - insert into book values(1, 'Head First Java', 'Cathy', '126657876', 345); ---> How to check whether it has been insered? How to retrieve the data from table? - select * from book; ---> Lets insert more..one more way of inserting rows - insert into book(id, title, author, isbn, pages) values(2, 'Spring in Action', 'Craig Wall', '665789754', 446); ---> Now, lets update a row and add missing information or change some other data - update book set isbn='9999999' where id = 2; ---> Delete a row from a table.. - delete from book where id = 2; ---> Now, lets create another table called publisher - create table publisher(id int primary key, name varchar(30) not null); ---> Now, lets add a new column to book table that joins book and publisher - alter table book add publisher_id int not null; ---> Now, lets add foreign key constraint to book table.. - alter table constraint foreign key () references (foreign_column); - alter table book add constraint fk_publisher foreign key (publisher_id) references publisher(id); ---> Now, try to insert into book table, it does NOT allow, because the corresponding publisher id has to match. - -- The following statement will fail - insert into book(id,title,author,isbn,pages) values(2, 'Spring in Action', 'Venkat','1234',440); ---> So, we need to insert into publisher table first - insert into publisher values(1, 'Orielly'); - insert into publisher values(2, 'Manning'); ---> Now, try to insert a book with appropriate publisher..It will work, no surprise :) - insert into book(id,title,author,isbn,pages,publisher_id) values(2, 'Spring in Action', 'Venkat','1234',440,2); ---> Now, using join (inner join), get all the book and publisher details in one shot..Lets try.. - select b.title, b.author, b.isbn, p.name publisher - from book b, publisher p - where b.id = p.id; ---> We didn't get all publishers, only matching ones..How to get all the publishers, even if they don't have any books published? - Lets use left outer join to achieve this - - select b.title, b.author, b.isbn, p.name publisher - from publisher p left join book b - on p.id = b.id; - ---> We can achieve the same results using right outer join also, just switch the order of tables in the from or where clause.. - There are two basic forms of outer joins. The left outer join and the right outer join. - The only difference between them is the order of the tables they are relating. - In other words, a left outer join can be turned into a right outer join simply by reversing the order of the tables in the FROM or WHERE clause. - As such, the two types of outer join can be used interchangeably, and the decision about which one is used is based purely on convenience. - - select b.title, b.author, b.isbn, p.name publisher - from book b right join publisher p - on p.id = b.id; - ---> Lets insert more books.. - I would like to retrieve all the books from the publisher who published "Java Message Service" book..We use self joins to achieve this.. - - select b2.title, b2.author, b2.publisher_id - from book b1, book b2 - where b1.title = 'Java Message Service' - and b2.publisher_id = b1.publisher_id; - - --If you need publisher name - select b2.title, b2.author, b2.publisher_id, p.name publisher - from book b1, book b2, publisher p - where b1.title = 'Java Message Service' - and b2.publisher_id = b1.publisher_id - and b1.publisher_id = p.publisher_id - and b2.publisher_id = p.publisher_id; - ---> The same result could be achieved withsub queries.. - - select * - from book b - where b.publisher_id = (select publisher_id - from book - where title = 'Java Message Service' - ); - --Its equivalent to the following query..Subquery gets executed first and inserts there.. - select * - from book b - where b.publisher_id = 1; - - - -REFERENCES: ---> http://www.brainbell.com/tutorials/MySQL/Using_Different_Join_Types.htm - - - - - \ No newline at end of file diff --git a/JDBC/doc/My_SQL_Installation.doc b/JDBC/doc/My_SQL_Installation.doc deleted file mode 100644 index 6553f41..0000000 Binary files a/JDBC/doc/My_SQL_Installation.doc and /dev/null differ diff --git a/JDBC/lib/junit-4.8.2.jar b/JDBC/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/JDBC/lib/junit-4.8.2.jar and /dev/null differ diff --git a/JDBC/lib/mysql-connector-java-5.1.12-bin.jar b/JDBC/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/JDBC/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/JDBC/lib/ojdbc6.jar b/JDBC/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/JDBC/lib/ojdbc6.jar and /dev/null differ diff --git a/JDBC/src/com/training/java/jdbc/basic/BasicJDBCClient.java b/JDBC/src/com/training/java/jdbc/basic/BasicJDBCClient.java deleted file mode 100644 index fcf2fe9..0000000 --- a/JDBC/src/com/training/java/jdbc/basic/BasicJDBCClient.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.training.java.jdbc.basic; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BasicJDBCClient { - /** - * @param args - */ - public static void main(String[] args) { - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try - { - //You do NOT have to load driver explicitly in JDK 1.6 - Class.forName("com.mysql.jdbc.Driver"); - - con = DriverManager.getConnection("jdbc:mysql://localhost/training", "root", "password"); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from book"); - - String author = null; - while(rs.next()) - { - author = rs.getString("author"); - System.out.println("author == " + author); - } - } - catch (ClassNotFoundException e) - { - e.printStackTrace(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - finally - { - try - { - if(rs != null) - { - rs.close(); - } - - if(stmt != null) - { - stmt.close(); - } - if(con != null && !con.isClosed()) - { - con.close(); - } - } - catch (SQLException e) - { - e.printStackTrace(); - } - } - } -} diff --git a/JDBC/src/com/training/java/jdbc/basic/BasicJDBCTest.java b/JDBC/src/com/training/java/jdbc/basic/BasicJDBCTest.java deleted file mode 100644 index 6ed9dbc..0000000 --- a/JDBC/src/com/training/java/jdbc/basic/BasicJDBCTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.training.java.jdbc.basic; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.junit.Test; - -public class BasicJDBCTest { - - @Test - public void testSelectStudents() throws ClassNotFoundException { - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - - System.out.println("firstName = " + firstName); - System.out.println("lastName = " + lastName); - System.out.println("city = " + city); - } - } catch (SQLException e) { - e.printStackTrace(); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Test - public void testInsert() throws ClassNotFoundException { - - Connection connection = null; - Statement statement = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - - int rowsAffected = statement - .executeUpdate("insert into students values('Sasi', 'RajKumar', '248-248-2488', 'sasi@gmail.com', 20, 'Troy', 6)"); - if (rowsAffected != 1) { - throw new SQLException("Your record was not inserted"); - } - - } catch (SQLException e) { - e.printStackTrace(); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException, - ClassNotFoundException { - Class.forName("com.mysql.jdbc.Driver"); - return DriverManager.getConnection("jdbc:mysql://localhost/training", - "root", "password"); - } -} diff --git a/JDBC/src/com/training/java/jdbc/basic/two/JDBCDemo.java b/JDBC/src/com/training/java/jdbc/basic/two/JDBCDemo.java deleted file mode 100644 index 56cb040..0000000 --- a/JDBC/src/com/training/java/jdbc/basic/two/JDBCDemo.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.training.java.jdbc.basic.two; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class JDBCDemo { - - /** - * @param args - */ - public static void main(String[] args) { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - - connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int bookId = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int numberPages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - - System.out.println("bookId = " + bookId); - System.out.println("title = " + title); - System.out.println("author = " + author); - System.out.println("numberPages = " + numberPages); - System.out.println("isbn = " + isbn); - - System.out.println("***************************"); - } - - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - } - finally - { - closeResources(connection, statement, resultSet); - } - } - - private static void closeResources(Connection connection, - Statement statement, ResultSet resultSet) { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/JDBC/src/com/training/java/jdbc/basic/two/package-info.java b/JDBC/src/com/training/java/jdbc/basic/two/package-info.java deleted file mode 100644 index 8943431..0000000 --- a/JDBC/src/com/training/java/jdbc/basic/two/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.jdbc.basic.two; \ No newline at end of file diff --git a/JDBC/src/com/training/java/jdbc/dao/Book.java b/JDBC/src/com/training/java/jdbc/dao/Book.java deleted file mode 100644 index 63b6ed0..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/Book.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.training.java.jdbc.dao; - -import java.io.Serializable; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private int publisherId; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public int getPublisherId() { - return publisherId; - } - - public void setPublisherId(int publisherId) { - this.publisherId = publisherId; - } -} diff --git a/JDBC/src/com/training/java/jdbc/dao/BookClient.java b/JDBC/src/com/training/java/jdbc/dao/BookClient.java deleted file mode 100644 index 2160c26..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/BookClient.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.java.jdbc.dao; - -import static org.junit.Assert.fail; - -import java.util.List; - -public class BookClient -{ - - /** - * @param args - */ - public static void main(String[] args) - { - BookDAO dao = new BookDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - try - { - List books = dao.getAllBooks(); - - for(Book eachBook : books) - { - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - } - } catch (DAOException e) - { - e.printStackTrace(); - fail("Error occured while retrieving all books from database"); - } - - - } - -} diff --git a/JDBC/src/com/training/java/jdbc/dao/BookDAO.java b/JDBC/src/com/training/java/jdbc/dao/BookDAO.java deleted file mode 100644 index 06b935f..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/BookDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.java.jdbc.dao; - -import java.util.List; - -public interface BookDAO { - - void create(Book aNewBook) throws DAOException; - List getAllBooks() throws DAOException; - Book findByPrimaryKey(int id) throws DAOException; - void update(Book bookToUpdate) throws DAOException; - void delete(int id) throws DAOException; -} diff --git a/JDBC/src/com/training/java/jdbc/dao/BookDAOJDBCImpl.java b/JDBC/src/com/training/java/jdbc/dao/BookDAOJDBCImpl.java deleted file mode 100644 index def87d9..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/BookDAOJDBCImpl.java +++ /dev/null @@ -1,296 +0,0 @@ -package com.training.java.jdbc.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class BookDAOJDBCImpl implements BookDAO { - String dburl; - String dbusername; - String dbpassword; - - public BookDAOJDBCImpl(String dburl, String dbusername, String dbpassword) { - this.dburl = dburl; - this.dbusername = dbusername; - this.dbpassword = dbpassword; - } - - public void create(Book bookToAdd) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - try { - con = getConnection(); - stmt = con - .prepareStatement("insert into book(id,title,author,isbn,pages,publisher_id) values(?, ?, ?,?,?, ?);"); - - stmt.setInt(1, bookToAdd.getId()); - stmt.setString(2, bookToAdd.getTitle()); - stmt.setString(3, bookToAdd.getAuthor()); - stmt.setString(4, bookToAdd.getIsbn()); - stmt.setInt(5, bookToAdd.getPages()); - stmt.setInt(6, bookToAdd.getPublisherId()); - - int numberOfRowsAffected = stmt.executeUpdate(); - - if (numberOfRowsAffected != 1) { - throw new DAOException( - "Error occured while creating new book.."); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - public List getAllBooks() throws DAOException { - List books = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from book"); - - Book aBook = null; - while (rs.next()) { - // Create a Book object - aBook = new Book(); - - // Retrieve all the book details from database for each record - int id = rs.getInt("id"); - String title = rs.getString("title"); - String author = rs.getString("author"); - String isbn = rs.getString("isbn"); - int pages = rs.getInt("pages"); - int publisherId = rs.getInt("publisher_id"); - - // Populate all the details into Book object - aBook.setId(id); - aBook.setTitle(title); - aBook.setAuthor(author); - aBook.setIsbn(isbn); - aBook.setPages(pages); - aBook.setPublisherId(publisherId); - - // Now, add each book to books List - books.add(aBook); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - return books; - } - - public void update(Book bookToUpdate) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - try { - con = getConnection(); - stmt = con.prepareStatement("update book set title = ?," - + "author = ?," + "isbn = ?," + "pages = ?," - + "publisher_id = ? where id = ?"); - - stmt.setString(1, bookToUpdate.getTitle()); - stmt.setString(2, bookToUpdate.getAuthor()); - stmt.setString(3, bookToUpdate.getIsbn()); - stmt.setInt(4, bookToUpdate.getPages()); - stmt.setInt(5, bookToUpdate.getPublisherId()); - stmt.setInt(6, bookToUpdate.getId()); - - int numberOfRowsAffected = stmt.executeUpdate(); - - if (numberOfRowsAffected != 1) { - throw new DAOException("Error occured while updating book.."); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - public Book findByPrimaryKey(int id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - try { - con = getConnection(); - stmt = con.prepareStatement("select * from book where id = ?"); - - stmt.setInt(1, id); - rs = stmt.executeQuery(); - - // Create a Book object - Book aBook = null; - - while (rs.next()) { - aBook = new Book(); - // Retrieve all the book details from database for each record - String title = rs.getString("title"); - String author = rs.getString("author"); - String isbn = rs.getString("isbn"); - int pages = rs.getInt("pages"); - int publisherId = rs.getInt("publisher_id"); - - // Populate all the details into Book object - aBook.setId(id); - aBook.setTitle(title); - aBook.setAuthor(author); - aBook.setIsbn(isbn); - aBook.setPages(pages); - aBook.setPublisherId(publisherId); - } - - return aBook; - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - public void delete(int id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - try { - con = getConnection(); - stmt = con.prepareStatement("delete from book where id = ?"); - - stmt.setInt(1, id); - int numberOfRowsAffected = stmt.executeUpdate(); - - if (numberOfRowsAffected != 1) { - throw new DAOException("Error occured while updating book.."); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - private Connection getConnection() throws ClassNotFoundException, - SQLException { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbusername, - dbpassword); - return con; - } -} diff --git a/JDBC/src/com/training/java/jdbc/dao/BookDAOTest.java b/JDBC/src/com/training/java/jdbc/dao/BookDAOTest.java deleted file mode 100644 index c1ec354..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/BookDAOTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.training.java.jdbc.dao; - -import static org.junit.Assert.fail; - -import java.util.Iterator; -import java.util.List; - -import org.junit.Test; - -public class BookDAOTest { - - @Test - public void createShouldInsertABookInDB() - { - BookDAO dao = new BookDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - //Create a book - Book newBook = new Book(); - newBook.setId(10); - newBook.setAuthor("Subash"); - newBook.setIsbn("1234567"); - newBook.setPages(344); - newBook.setPublisherId(10); - newBook.setTitle("Hyderabad Blues"); - - //Insert this new book in database - try { - dao.create(newBook); - } catch (DAOException e) { - e.printStackTrace(); - fail("Error occured while creating new book"); - } - } - - @Test - public void getAllBooksMethodsMustReturnAtLeastOneBook() - { - BookDAO dao = new BookDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - try - { - List books = dao.getAllBooks(); - Iterator ite = books.iterator(); - while(ite.hasNext()) - { - Book eachBook = ite.next(); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - System.out.println("Book id = " + eachBook.getId()); - } - - - - } catch (DAOException e) - { - e.printStackTrace(); - fail("Error occured while retrieving all books from database"); - } - } - - @Test - public void updateMethodShouldUpdateBookInDB() - { - BookDAO dao = new BookDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - try - { - Book bookFromDB = dao.findByPrimaryKey(10); - - //Lets change the title now - bookFromDB.setTitle("Detroit Blues"); - - //Now, lets update this back to database - dao.update(bookFromDB); - - } catch (DAOException e1) - { - e1.printStackTrace(); - fail("Error occured while updating book in database"); - } - } - - @Test - public void deleteMethodShouldDeleteBookFromDB() - { - BookDAO dao = new BookDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - try - { - dao.delete(8); - } catch (DAOException e1) - { - e1.printStackTrace(); - fail("Error occured while updating book in database"); - } - } -} diff --git a/JDBC/src/com/training/java/jdbc/dao/DAOException.java b/JDBC/src/com/training/java/jdbc/dao/DAOException.java deleted file mode 100644 index c2db127..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/DAOException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.jdbc.dao; - -public class DAOException extends Exception { - - public DAOException(Exception cause) - { - super(cause); - } - - public DAOException(String message) - { - super(message); - } - -} diff --git a/JDBC/src/com/training/java/jdbc/dao/two/Book.java b/JDBC/src/com/training/java/jdbc/dao/two/Book.java deleted file mode 100644 index 9052b7e..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/two/Book.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.java.jdbc.dao.two; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - int getId() { - return id; - } - - String getTitle() { - return title; - } - - String getAuthor() { - return author; - } - - String getIsbn() { - return isbn; - } - - int getPages() { - return pages; - } - - Date getPublisherDate() { - return publisherDate; - } - - void setAuthor(String author) { - this.author = author; - } - - void setPages(int pages) { - this.pages = pages; - } - -} diff --git a/JDBC/src/com/training/java/jdbc/dao/two/BookDAO.java b/JDBC/src/com/training/java/jdbc/dao/two/BookDAO.java deleted file mode 100644 index 970b7db..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/two/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.jdbc.dao.two; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/JDBC/src/com/training/java/jdbc/dao/two/BookDAOJDBCImpl.java b/JDBC/src/com/training/java/jdbc/dao/two/BookDAOJDBCImpl.java deleted file mode 100644 index 7619584..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/two/BookDAOJDBCImpl.java +++ /dev/null @@ -1,269 +0,0 @@ -package com.training.java.jdbc.dao.two; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class BookDAOJDBCImpl implements BookDAO { - - private String jdbcURL; - private String username; - private String password; - - public BookDAOJDBCImpl(String jdbcURL, String username, String password) - { - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setInt(1, id); - statement.setString(2, title); - statement.setString(3, author); - statement.setInt(4, pages); - statement.setString(5, isbn); - statement.setDate(6, publisherDate); - statement.setInt(7, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } - - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/JDBC/src/com/training/java/jdbc/dao/two/BookDAOJDBCImplTest.java b/JDBC/src/com/training/java/jdbc/dao/two/BookDAOJDBCImplTest.java deleted file mode 100644 index 5b6302c..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/two/BookDAOJDBCImplTest.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.training.java.jdbc.dao.two; - -import java.util.Date; -import java.util.List; - -import junit.framework.TestCase; - -import org.junit.Assert; -import org.junit.Test; - -public class BookDAOJDBCImplTest { - - @Test - public void testGetAllBooks() throws Exception { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - List books = dao.getAllBooks(); - - Assert.assertNotNull(books); - Assert.assertFalse(books.isEmpty()); - - for(Book book : books) - { - System.out.println("Author = " + book.getAuthor()); - System.out.println("Title = " + book.getTitle()); - System.out.println("*************************"); - } - } - - @Test - public void testAddBook() throws DAOException { - - Book book = new Book(1, "Pragmattic Programmer", "Dave Thomas", "9876543", 230, new Date()); - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - dao.addBook(book); - - //verify that this book is added - List books = dao.getAllBooks(); - - Assert.assertNotNull(books); - Assert.assertFalse(books.isEmpty()); - } - - @Test - public void testFindByPrimaryKey() throws DAOException - { - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - Book book = dao.findByPrimaryKey(1); - - Assert.assertNotNull(book); - Assert.assertEquals(1, book.getId()); - Assert.assertEquals("Dave Thomas", book.getAuthor()); - } - - @Test - public void testUpdate() throws DAOException - { - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - Book book = dao.findByPrimaryKey(2); - - book.setAuthor("Venkat"); - - dao.updateBook(book); - - Book updatedBook = dao.findByPrimaryKey(2); - - Assert.assertNotNull(updatedBook); - Assert.assertEquals("Venkat", updatedBook.getAuthor()); - } - - @Test - public void testDelete() - { - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - try { - dao.deleteBook(1); - } catch (DAOException e) { - TestCase.fail("Got DAOException while deleting"); - } - - try { - dao.findByPrimaryKey(1); - TestCase.fail("DAOException is expected here, but not thrown..So, delete must not be successful!!"); - } catch (DAOException e) { - //expected - } - } - -} diff --git a/JDBC/src/com/training/java/jdbc/dao/two/DAOException.java b/JDBC/src/com/training/java/jdbc/dao/two/DAOException.java deleted file mode 100644 index 7e2de2e..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/two/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.jdbc.dao.two; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/JDBC/src/com/training/java/jdbc/dao/two/package-info.java b/JDBC/src/com/training/java/jdbc/dao/two/package-info.java deleted file mode 100644 index ee89873..0000000 --- a/JDBC/src/com/training/java/jdbc/dao/two/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.jdbc.dao.two; \ No newline at end of file diff --git a/JDBC/src/com/training/java/jdbc/movie/Movie.java b/JDBC/src/com/training/java/jdbc/movie/Movie.java deleted file mode 100644 index ff071ce..0000000 --- a/JDBC/src/com/training/java/jdbc/movie/Movie.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.java.jdbc.movie; - -import java.sql.Date; - -public class Movie -{ - private int id; - private String name; - private String rating; - private Date releaseDate; - private String genre; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getRating() - { - return rating; - } - - public void setRating(String rating) - { - this.rating = rating; - } - - public Date getReleaseDate() - { - return releaseDate; - } - - public void setReleaseDate(Date releaseDate) - { - this.releaseDate = releaseDate; - } - - public String getGenre() - { - return genre; - } - - public void setGenre(String genre) - { - this.genre = genre; - } -} diff --git a/JDBC/src/com/training/java/jdbc/movie/MovieDAO.java b/JDBC/src/com/training/java/jdbc/movie/MovieDAO.java deleted file mode 100644 index 3be40b0..0000000 --- a/JDBC/src/com/training/java/jdbc/movie/MovieDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.jdbc.movie; - -import java.util.List; - -public interface MovieDAO -{ - void create(Movie movie); - List getMovies(); -} diff --git a/JDBC/src/com/training/java/jdbc/movie/MovieDAODemo.java b/JDBC/src/com/training/java/jdbc/movie/MovieDAODemo.java deleted file mode 100644 index 39b251e..0000000 --- a/JDBC/src/com/training/java/jdbc/movie/MovieDAODemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.java.jdbc.movie; - -import java.util.List; - -public class MovieDAODemo -{ - /** - * @param args - */ - public static void main(String[] args) - { - /* - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - Movie aMovie = new Movie(); - aMovie.setId(2); - aMovie.setName("Speed2..CC"); - aMovie.setRating("PG-13"); - aMovie.setGenre("Thriller"); - aMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - dao.create(aMovie); - */ - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - List movies = dao.getMovies(); - for(Movie aMovie : movies) - { - System.out.println("Name = " + aMovie.getName()); - System.out.println("Rating = " + aMovie.getRating()); - System.out.println("Genre = " + aMovie.getGenre()); - System.out.println("Release date = " + aMovie.getReleaseDate()); - System.out.println("id = " + aMovie.getId()); - } - } - -} diff --git a/JDBC/src/com/training/java/jdbc/movie/MovieDAOException.java b/JDBC/src/com/training/java/jdbc/movie/MovieDAOException.java deleted file mode 100644 index 16cb73c..0000000 --- a/JDBC/src/com/training/java/jdbc/movie/MovieDAOException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.jdbc.movie; - -public class MovieDAOException extends RuntimeException -{ - MovieDAOException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/JDBC/src/com/training/java/jdbc/movie/MovieDAOJDBCImpl.java b/JDBC/src/com/training/java/jdbc/movie/MovieDAOJDBCImpl.java deleted file mode 100644 index b4fbc7e..0000000 --- a/JDBC/src/com/training/java/jdbc/movie/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.training.java.jdbc.movie; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class MovieDAOJDBCImpl implements MovieDAO -{ - private String dburl; - private String dbuser; - private String dbPassword; - - public MovieDAOJDBCImpl(String dburl, String dbuser, String dbPassWord) - { - this.dburl = dburl; - this.dbuser = dbuser; - this.dbPassword = dbPassWord; - } - - @Override - public void create(Movie movie) - { - try - { - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("insert into movie(id, genre, rating, release_date, name) values(?,?,?,?,?)"); - - stmt.setInt(1, movie.getId()); - stmt.setString(2, movie.getGenre()); - stmt.setString(3, movie.getRating()); - stmt.setDate(4, movie.getReleaseDate()); - stmt.setString(5, movie.getName()); - - stmt.executeUpdate(); - - } catch (SQLException e) - { - throw new MovieDAOException(e.getMessage()); - } - } - - @Override - public List getMovies() - { - List movies = new ArrayList(); - - try - { - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("select * from movie"); - - ResultSet rs = stmt.executeQuery(); - - while(rs.next()) - { - Movie aMovie = new Movie(); - - aMovie.setId(rs.getInt("id")); - aMovie.setName(rs.getString("name")); - aMovie.setRating(rs.getString("rating")); - aMovie.setReleaseDate(rs.getDate("release_date")); - aMovie.setGenre(rs.getString("genre")); - - movies.add(aMovie); - } - } catch (SQLException e) - { - e.printStackTrace(); - } - - return movies; - } -} diff --git a/JDBC/src/com/training/java/jdbc/student/DAOException.java b/JDBC/src/com/training/java/jdbc/student/DAOException.java deleted file mode 100644 index 1cabbe7..0000000 --- a/JDBC/src/com/training/java/jdbc/student/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.jdbc.student; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/JDBC/src/com/training/java/jdbc/student/Student.java b/JDBC/src/com/training/java/jdbc/student/Student.java deleted file mode 100644 index 374b5ec..0000000 --- a/JDBC/src/com/training/java/jdbc/student/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.jdbc.student; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/JDBC/src/com/training/java/jdbc/student/StudentDAO.java b/JDBC/src/com/training/java/jdbc/student/StudentDAO.java deleted file mode 100644 index ead1c85..0000000 --- a/JDBC/src/com/training/java/jdbc/student/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.jdbc.student; - -import java.util.List; - -public interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/JDBC/src/com/training/java/jdbc/student/StudentDAOJDBCImpl.java b/JDBC/src/com/training/java/jdbc/student/StudentDAOJDBCImpl.java deleted file mode 100644 index 2ced06c..0000000 --- a/JDBC/src/com/training/java/jdbc/student/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.training.java.jdbc.student; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - -public class StudentDAOJDBCImpl implements StudentDAO { - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection.prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException{ - try { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection("jdbc:mysql://localhost/training", - "root", "password"); - } - -} diff --git a/JDBC/src/com/training/java/jdbc/student/StudentDAOJDBCImplTest.java b/JDBC/src/com/training/java/jdbc/student/StudentDAOJDBCImplTest.java deleted file mode 100644 index c6fa3d1..0000000 --- a/JDBC/src/com/training/java/jdbc/student/StudentDAOJDBCImplTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.training.java.jdbc.student; - -import java.util.List; - -import org.junit.Test; - -public class StudentDAOJDBCImplTest { - - @Test - public void testGetAllStudents() { - - StudentDAO dao = new StudentDAOJDBCImpl(); - List students = dao.getAllStudents(); - - for(Student current : students) - { - System.out.println(current); - } - } - - @Test - public void testCreateStudent(){ - StudentDAO dao = new StudentDAOJDBCImpl(); - - Student student = new Student(); - student.setAge(20); - student.setCity("Sterling Heights"); - student.setEmail("priya@gmail.com"); - student.setFirstName("Priya"); - student.setId(7); - student.setLastName("Patel"); - student.setPhoneNumber("248-238-9874"); - - dao.create(student); - - //assert that your student is created - - //delete the student that you just created - } - -} diff --git a/JDBCFeb2015/.classpath b/JDBCFeb2015/.classpath deleted file mode 100644 index d0ff9e0..0000000 --- a/JDBCFeb2015/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/JDBCFeb2015/.project b/JDBCFeb2015/.project deleted file mode 100644 index aee4c86..0000000 --- a/JDBCFeb2015/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - JDBCFeb2015 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/JDBCFeb2015/.settings/org.eclipse.jdt.core.prefs b/JDBCFeb2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 838bd9d..0000000 --- a/JDBCFeb2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/JDBCFeb2015/lib/hamcrest-core-1.3.jar b/JDBCFeb2015/lib/hamcrest-core-1.3.jar deleted file mode 100644 index 9d5fe16..0000000 Binary files a/JDBCFeb2015/lib/hamcrest-core-1.3.jar and /dev/null differ diff --git a/JDBCFeb2015/lib/junit-4.12.jar b/JDBCFeb2015/lib/junit-4.12.jar deleted file mode 100644 index 3a7fc26..0000000 Binary files a/JDBCFeb2015/lib/junit-4.12.jar and /dev/null differ diff --git a/JDBCFeb2015/lib/ojdbc6.jar b/JDBCFeb2015/lib/ojdbc6.jar deleted file mode 100644 index 767eba7..0000000 Binary files a/JDBCFeb2015/lib/ojdbc6.jar and /dev/null differ diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCDemo.java b/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCDemo.java deleted file mode 100644 index 404d089..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCDemo.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.javavenkat.jdbc; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class JDBCDemo { - - public static void main(String[] args) { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - try - { - con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customer"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - System.out.println("First name = " + firstName); - System.out.println("Address = " + address); - System.out.println("Zip = " + zip); - } - } catch(SQLException ex) { - ex.printStackTrace(); - } finally { - try - { - rs.close(); - statement.close(); - con.close(); - } catch (SQLException ex){ - - } - } - - //establish the connection - //get handle to Statement - //execute the SQL statement/query - - - } - -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCDemoDelete.java b/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCDemoDelete.java deleted file mode 100644 index d89472a..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCDemoDelete.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.javavenkat.jdbc; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; - -public class JDBCDemoDelete { - - public static void main(String[] args) { - - Connection con = null; - Statement statement = null; - - try - { - con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - statement = con.createStatement(); - - int rowsDeleted = statement.executeUpdate("delete from customer where customer_id = 4"); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - } finally { - try - { - statement.close(); - con.close(); - } catch (SQLException ex){ - - } - } - } - -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCInsertDemo.java b/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCInsertDemo.java deleted file mode 100644 index ea4d3bb..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCInsertDemo.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.javavenkat.jdbc; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; - -public class JDBCInsertDemo { - - public static void main(String[] args) { - - Connection con = null; - Statement statement = null; - - try - { - con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - statement = con.createStatement(); - - StringBuilder sql = new StringBuilder(); - - sql.append("insert into customer values ("); - sql.append("4,"); - sql.append("'Shovan',"); - sql.append("'SL',"); - sql.append("'321 Shovan Dr',"); - sql.append("'NYC',"); - sql.append("'NY',"); - sql.append("'88888')"); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(sql.toString()); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - } finally { - try - { - statement.close(); - con.close(); - } catch (SQLException ex){ - - } - } - } -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCUpdateDemo.java b/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCUpdateDemo.java deleted file mode 100644 index 9f80749..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/JDBCUpdateDemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.javavenkat.jdbc; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; - -public class JDBCUpdateDemo { - - public static void main(String[] args) { - - Connection con = null; - Statement statement = null; - - try - { - con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - statement = con.createStatement(); - - int rowsUpdated = statement.executeUpdate("update customer set first_name = 'Show' where customer_id = 4"); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - } finally { - try - { - statement.close(); - con.close(); - } catch (SQLException ex){ - - } - } - - - } - -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/BaseDAO.java b/JDBCFeb2015/src/com/javavenkat/jdbc/dao/BaseDAO.java deleted file mode 100644 index 7a7dc55..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/BaseDAO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.javavenkat.jdbc.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException{ - return DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - //Nothing to be done, ignore it. - } - } - -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/Customer.java b/JDBCFeb2015/src/com/javavenkat/jdbc/dao/Customer.java deleted file mode 100644 index b27e80b..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/Customer.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.javavenkat.jdbc.dao; - -public class Customer { - - private int id; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAO.java b/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAO.java deleted file mode 100644 index e13e7a9..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.javavenkat.jdbc.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAOJDBCImpl.java b/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 561f644..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.javavenkat.jdbc.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customer"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customer values (?,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, customer.getId()); - statement.setString(2, customer.getFirstName()); - statement.setString(3, customer.getLastName()); - statement.setString(4, customer.getAddress()); - statement.setString(5, customer.getCity()); - statement.setString(6, customer.getState()); - statement.setString(7, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customer " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customer where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAOJDBCImplDemo.java b/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAOJDBCImplDemo.java deleted file mode 100644 index 32868a7..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAOJDBCImplDemo.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.javavenkat.jdbc.dao; - -import java.util.List; - -public class CustomerDAOJDBCImplDemo { - - public static void main(String[] args) throws DAOException { - - CustomerDAO dao = new CustomerDAOJDBCImpl(); - - List customers = dao.getAllCustomers(); - - for(Customer c : customers) - { - System.out.println("First name = " + c.getFirstName()); - } - - /*Customer customer = new Customer(6, "Jyothy", "JL", "123 Jyothy Blvd", "Dullas", "TX", "45123"); - dao.createCustomer(customer);*/ - - /*Customer customer = new Customer(6, "Jyothy", "JL", "999 Plano Dr", "Plano", "TX", "98765"); - dao.updateCustomer(customer);*/ - - dao.deleteCustomer(6); - - } - -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAOJDBCImplTest.java b/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAOJDBCImplTest.java deleted file mode 100644 index 3838e95..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/CustomerDAOJDBCImplTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.javavenkat.jdbc.dao; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class CustomerDAOJDBCImplTest { - - private CustomerDAO dao; - - @Before - public void setup() { - dao = new CustomerDAOJDBCImpl(); - } - - @Test - public void testSelect() throws DAOException { - - List customers = dao.getAllCustomers(); - - Assert.assertFalse(customers.isEmpty()); - Assert.assertTrue(customers.size() > 3); - } -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/DAOException.java b/JDBCFeb2015/src/com/javavenkat/jdbc/dao/DAOException.java deleted file mode 100644 index 41cedd8..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/dao/DAOException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.javavenkat.jdbc.dao; - -public class DAOException extends Exception { - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/preparedstatement/PreparedStatementDeleteDemo.java b/JDBCFeb2015/src/com/javavenkat/jdbc/preparedstatement/PreparedStatementDeleteDemo.java deleted file mode 100644 index b119c15..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/preparedstatement/PreparedStatementDeleteDemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.javavenkat.jdbc.preparedstatement; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public class PreparedStatementDeleteDemo { - - public static void main(String[] args) { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - statement = con.prepareStatement("delete from customer where customer_id = ?"); - - statement.setInt(1, 3); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - } finally { - try - { - statement.close(); - con.close(); - } catch (SQLException ex){ - - } - } - } - -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/preparedstatement/PreparedStatementInsertDemo.java b/JDBCFeb2015/src/com/javavenkat/jdbc/preparedstatement/PreparedStatementInsertDemo.java deleted file mode 100644 index 65a4560..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/preparedstatement/PreparedStatementInsertDemo.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.javavenkat.jdbc.preparedstatement; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public class PreparedStatementInsertDemo { - - public static void main(String[] args) { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - - String sql = "insert into customer values (?,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, 6); - statement.setString(2, "Sekhar"); - statement.setString(3, "SekharLastName"); - statement.setString(4, "999 Sekhar Dr"); - statement.setString(5, "Plano"); - statement.setString(6, "TX"); - statement.setString(7, "54321"); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - } finally { - try - { - statement.close(); - con.close(); - } catch (SQLException ex){ - - } - } - } - -} diff --git a/JDBCFeb2015/src/com/javavenkat/jdbc/preparedstatement/PreparedStatementUpdateDemo.java b/JDBCFeb2015/src/com/javavenkat/jdbc/preparedstatement/PreparedStatementUpdateDemo.java deleted file mode 100644 index a6d5a48..0000000 --- a/JDBCFeb2015/src/com/javavenkat/jdbc/preparedstatement/PreparedStatementUpdateDemo.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.javavenkat.jdbc.preparedstatement; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public class PreparedStatementUpdateDemo { - - public static void main(String[] args) { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - - String sql = "update customer " + - "set first_name = ?, " + - " last_name = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, "RealFirstName"); - statement.setString(2, "SekharName"); - statement.setInt(3, 6); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - } finally { - try - { - statement.close(); - con.close(); - } catch (SQLException ex){ - - } - } - } - -} diff --git a/JSP/.classpath b/JSP/.classpath deleted file mode 100644 index 4a1837d..0000000 --- a/JSP/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/JSP/.project b/JSP/.project deleted file mode 100644 index 0aaf42b..0000000 --- a/JSP/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - JSP - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/JSP/.settings/.jsdtscope b/JSP/.settings/.jsdtscope deleted file mode 100644 index f40dd98..0000000 --- a/JSP/.settings/.jsdtscope +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/JSP/.settings/org.eclipse.jdt.core.prefs b/JSP/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7e8a2f8..0000000 --- a/JSP/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Sat Sep 10 23:13:54 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/JSP/.settings/org.eclipse.wst.common.component b/JSP/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 04ce023..0000000 --- a/JSP/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/JSP/.settings/org.eclipse.wst.common.project.facet.core.xml b/JSP/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 3d1d1d9..0000000 --- a/JSP/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/JSP/.settings/org.eclipse.wst.jsdt.ui.superType.container b/JSP/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/JSP/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/JSP/.settings/org.eclipse.wst.jsdt.ui.superType.name b/JSP/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/JSP/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/JSP/WebContent/AddBook.jsp b/JSP/WebContent/AddBook.jsp deleted file mode 100644 index 350b22c..0000000 --- a/JSP/WebContent/AddBook.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -
-ID :
-Author :
-ISBN :
-Title :
-Pages :
-PublisherID :
- -
- - - \ No newline at end of file diff --git a/JSP/WebContent/AddMovie.jsp b/JSP/WebContent/AddMovie.jsp deleted file mode 100644 index 19d8d59..0000000 --- a/JSP/WebContent/AddMovie.jsp +++ /dev/null @@ -1,27 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -
- - <% - System.out.println("I am in JSP"); - %> - - ID :
- Name :
- Rating :
- Genre :
- - - -
- - - \ No newline at end of file diff --git a/JSP/WebContent/Footer.jsp b/JSP/WebContent/Footer.jsp deleted file mode 100644 index 966fdcc..0000000 --- a/JSP/WebContent/Footer.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

Contact : info@appssolutions.com

- - - \ No newline at end of file diff --git a/JSP/WebContent/Header.jsp b/JSP/WebContent/Header.jsp deleted file mode 100644 index facacf9..0000000 --- a/JSP/WebContent/Header.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

App Solutions, training division..

- - - \ No newline at end of file diff --git a/JSP/WebContent/ListMovies.jsp b/JSP/WebContent/ListMovies.jsp deleted file mode 100644 index 2986c40..0000000 --- a/JSP/WebContent/ListMovies.jsp +++ /dev/null @@ -1,51 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - -<%@page import="com.training.java.servlet.moviestore.domain.MovieDAO"%> -<%@page - import="com.training.java.servlet.moviestore.domain.MovieDAOJDBCImpl"%> -<%@page import="java.util.List"%> -<%@page import="com.training.java.servlet.moviestore.domain.Movie"%> - - -Insert title here - - - -<%@include file="Header.jsp" %> - - - - - - - - - - - - <% -MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", - "root", "password"); -List movies = dao.getMovies(); - -for(Movie aMovie : movies) -{ -%> - - - - - - - -<% } %> - - -
TitleGenreRelease DateRating
<%=aMovie.getName() %><%=aMovie.getGenre() %><%=aMovie.getReleaseDate() %><%=aMovie.getRating() %>
- -<%@include file="Footer.jsp" %> - - - \ No newline at end of file diff --git a/JSP/WebContent/META-INF/MANIFEST.MF b/JSP/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/JSP/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/JSP/WebContent/SaveMovie.jsp b/JSP/WebContent/SaveMovie.jsp deleted file mode 100644 index 511c289..0000000 --- a/JSP/WebContent/SaveMovie.jsp +++ /dev/null @@ -1,40 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - -<%@page import="com.training.java.servlet.moviestore.domain.Movie"%> -<%@page import="java.sql.Date"%> -<%@page import="com.training.java.servlet.moviestore.domain.MovieDAO"%> -<%@page import="com.training.java.servlet.moviestore.domain.MovieDAOJDBCImpl"%> - - - -Insert title here - - - -<% - String id = request.getParameter("id"); - String name = request.getParameter("name"); - String genre = request.getParameter("genre"); - String rating = request.getParameter("rating"); - - Movie newMovie = new Movie(); - - newMovie.setId(Integer.parseInt(id)); - newMovie.setName(name); - newMovie.setGenre(genre); - newMovie.setRating(rating); - newMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", - "root", "password"); - - dao.create(newMovie); -%> - -

Your details have been saved successfully..

- - - - \ No newline at end of file diff --git a/JSP/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/JSP/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/JSP/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/JSP/WebContent/WEB-INF/web.xml b/JSP/WebContent/WEB-INF/web.xml deleted file mode 100644 index 6174761..0000000 --- a/JSP/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - JSP - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - \ No newline at end of file diff --git a/JSP/WebContent/index.html b/JSP/WebContent/index.html deleted file mode 100644 index d99e6d8..0000000 --- a/JSP/WebContent/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - -Movie store - - - -

Welcome to my Movie store




- -
    -
  1. If you want to add a movie please click here
  2. -
  3. To see the movies in our database, please click here
  4. -
- - - - - \ No newline at end of file diff --git a/JSP/src/com/training/java/servlet/moviestore/domain/Movie.java b/JSP/src/com/training/java/servlet/moviestore/domain/Movie.java deleted file mode 100644 index c2cf67c..0000000 --- a/JSP/src/com/training/java/servlet/moviestore/domain/Movie.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.sql.Date; - -public class Movie -{ - private int id; - private String name; - private String rating; - private Date releaseDate; - private String genre; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getRating() - { - return rating; - } - - public void setRating(String rating) - { - this.rating = rating; - } - - public Date getReleaseDate() - { - return releaseDate; - } - - public void setReleaseDate(Date releaseDate) - { - this.releaseDate = releaseDate; - } - - public String getGenre() - { - return genre; - } - - public void setGenre(String genre) - { - this.genre = genre; - } -} diff --git a/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAO.java b/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAO.java deleted file mode 100644 index 8a7aa8a..0000000 --- a/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.util.List; - -public interface MovieDAO -{ - void create(Movie movie); - List getMovies(); -} diff --git a/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java b/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java deleted file mode 100644 index 5bdb998..0000000 --- a/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.util.List; - -public class MovieDAODemo -{ - /** - * @param args - */ - public static void main(String[] args) - { - /* - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - Movie aMovie = new Movie(); - aMovie.setId(2); - aMovie.setName("Speed2..CC"); - aMovie.setRating("PG-13"); - aMovie.setGenre("Thriller"); - aMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - dao.create(aMovie); - */ - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - List movies = dao.getMovies(); - for(Movie aMovie : movies) - { - System.out.println("Name = " + aMovie.getName()); - System.out.println("Rating = " + aMovie.getRating()); - System.out.println("Genre = " + aMovie.getGenre()); - System.out.println("Release date = " + aMovie.getReleaseDate()); - System.out.println("id = " + aMovie.getId()); - } - } - -} diff --git a/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java b/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java deleted file mode 100644 index 3a6bc38..0000000 --- a/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -public class MovieDAOException extends RuntimeException -{ - MovieDAOException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java b/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index c1ce09c..0000000 --- a/JSP/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class MovieDAOJDBCImpl implements MovieDAO -{ - private String dburl; - private String dbuser; - private String dbPassword; - - public MovieDAOJDBCImpl(String dburl, String dbuser, String dbPassWord) - { - this.dburl = dburl; - this.dbuser = dbuser; - this.dbPassword = dbPassWord; - } - - @Override - public void create(Movie movie) - { - try - { - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("insert into movie(id, genre, rating, release_date, name) values(?,?,?,?,?)"); - - stmt.setInt(1, movie.getId()); - stmt.setString(2, movie.getGenre()); - stmt.setString(3, movie.getRating()); - stmt.setDate(4, movie.getReleaseDate()); - stmt.setString(5, movie.getName()); - - stmt.executeUpdate(); - - } catch (SQLException e) - { - throw new MovieDAOException(e.getMessage()); - } - } - - @Override - public List getMovies() - { - List movies = new ArrayList(); - - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("select * from movie"); - - ResultSet rs = stmt.executeQuery(); - - while(rs.next()) - { - Movie aMovie = new Movie(); - - aMovie.setId(rs.getInt("id")); - aMovie.setName(rs.getString("name")); - aMovie.setRating(rs.getString("rating")); - aMovie.setReleaseDate(rs.getDate("release_date")); - aMovie.setGenre(rs.getString("genre")); - - movies.add(aMovie); - } - } - catch(ClassNotFoundException ex) - { - ex.printStackTrace(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - - return movies; - } -} diff --git a/MovieStore/.classpath b/MovieStore/.classpath deleted file mode 100644 index 76da5bc..0000000 --- a/MovieStore/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/MovieStore/.project b/MovieStore/.project deleted file mode 100644 index 06e0c53..0000000 --- a/MovieStore/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - MovieStore - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/MovieStore/.settings/.jsdtscope b/MovieStore/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/MovieStore/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/MovieStore/.settings/org.eclipse.jdt.core.prefs b/MovieStore/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/MovieStore/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/MovieStore/.settings/org.eclipse.wst.common.component b/MovieStore/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 6ecac6c..0000000 --- a/MovieStore/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/MovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml b/MovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index b554271..0000000 --- a/MovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/MovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container b/MovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/MovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/MovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name b/MovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/MovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/MovieStore/WebContent/AddMovie.html b/MovieStore/WebContent/AddMovie.html deleted file mode 100644 index 2408421..0000000 --- a/MovieStore/WebContent/AddMovie.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - -Insert title here - - -
-MovieId:
-Title:
-Type:
-Director:
-ReleaseDate
- -
- - \ No newline at end of file diff --git a/MovieStore/WebContent/META-INF/MANIFEST.MF b/MovieStore/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/MovieStore/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/MovieStore/WebContent/WEB-INF/lib/commons-lang-2.6.jar b/MovieStore/WebContent/WEB-INF/lib/commons-lang-2.6.jar deleted file mode 100644 index 98467d3..0000000 Binary files a/MovieStore/WebContent/WEB-INF/lib/commons-lang-2.6.jar and /dev/null differ diff --git a/MovieStore/WebContent/WEB-INF/lib/ojdbc6.jar b/MovieStore/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/MovieStore/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/MovieStore/WebContent/WEB-INF/web.xml b/MovieStore/WebContent/WEB-INF/web.xml deleted file mode 100644 index 5d42e57..0000000 --- a/MovieStore/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - MovieStore - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ListMoviesServlet - ListMoviesServlet - com.training.java.servlet.movie.web.ListMoviesServlet - - maxNoOfMovies - 3 - - - - - - ListMoviesServlet - /lst - - - - AddServlet - AddServlet - com.training.java.servlet.movie.web.AddServlet - - - AddServlet - /add - - - jdbcUrl - jdbc:oracle:thin:@localhost:1521:XE - - - userName - moviestore - - - password - password - - \ No newline at end of file diff --git a/MovieStore/src/com/training/java/servlet/movie/domain/DAOException.java b/MovieStore/src/com/training/java/servlet/movie/domain/DAOException.java deleted file mode 100644 index 28f7c06..0000000 --- a/MovieStore/src/com/training/java/servlet/movie/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.servlet.movie.domain; - -public class DAOException extends RuntimeException { - - public DAOException(String mess) - { - super(mess); - - } - public DAOException(Throwable e) - { - super(e); - } -} diff --git a/MovieStore/src/com/training/java/servlet/movie/domain/Movie.java b/MovieStore/src/com/training/java/servlet/movie/domain/Movie.java deleted file mode 100644 index 348f0bd..0000000 --- a/MovieStore/src/com/training/java/servlet/movie/domain/Movie.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.training.java.servlet.movie.domain; - -import java.util.Date; - -public class Movie { - - private int movieId; - private String title; - private String type; - private String director; - private Date date; - - - public Movie(int movieId, String title, String type, String director, - Date date) { - super(); - this.movieId = movieId; - this.title = title; - this.type = type; - this.director = director; - this.date = date; - } - public Date getDate() { - return date; - } - public void setDate(Date date) { - this.date = date; - } - public int getMovieId() { - return movieId; - } - public String getTitle() { - return title; - } - public String getType() { - return type; - } - public String getDirector() { - return director; - } - - -} diff --git a/MovieStore/src/com/training/java/servlet/movie/domain/MovieDao.java b/MovieStore/src/com/training/java/servlet/movie/domain/MovieDao.java deleted file mode 100644 index 20d7fe5..0000000 --- a/MovieStore/src/com/training/java/servlet/movie/domain/MovieDao.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.servlet.movie.domain; - -import java.util.List; - -public interface MovieDao { - - List getAllMovies(); - void addMovies(Movie m); - Movie GetById(int movieId); - void update(Movie movie); - void delete(int movieid); - -} diff --git a/MovieStore/src/com/training/java/servlet/movie/domain/MovieDaoImple.java b/MovieStore/src/com/training/java/servlet/movie/domain/MovieDaoImple.java deleted file mode 100644 index c1c8a82..0000000 --- a/MovieStore/src/com/training/java/servlet/movie/domain/MovieDaoImple.java +++ /dev/null @@ -1,266 +0,0 @@ -package com.training.java.servlet.movie.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - - -public class MovieDaoImple implements MovieDao{ - - private String jdbcUrl; - private String username; - private String password; - - - - public MovieDaoImple(String jdbcUrl, String username, String password) { - super(); - this.jdbcUrl = jdbcUrl; - this.username = username; - this.password = password; - } - - - public String getJdbcUrl() { - return jdbcUrl; - } - - - public String getUsername() { - return username; - } - - - public String getPassword() { - return password; - } - - - @Override - public List getAllMovies() { - List< Movie> list=new ArrayList<>(); - Connection con=null; - PreparedStatement ps=null; - ResultSet rs=null; - - try - { - con=getConnection(); - ps=con.prepareStatement("select * from movie"); - rs=ps.executeQuery(); - while(rs.next()) - { - String movieidStr=rs.getString("movieid"); - String title=rs.getString("title"); - String type=rs.getString("type"); - String director=rs.getString("director"); - Date date=rs.getDate("releaseDate"); - int movieId=Integer.parseInt(movieidStr); - - Movie movie=new Movie(movieId, title, type, director, date); - list.add(movie); - } - return list; - }catch(SQLException e) - { - throw new DAOException(e); - }finally - { - closeResource(rs, ps, con); - } - } - - - @Override - public void addMovies(Movie m) { - - Connection con=null; - ResultSet rs=null; - PreparedStatement ps=null; - //Movie movie=null; - try - { - con=getConnection(); - ps=con.prepareStatement("insert into movie values(?,?,?,?,?)"); - int movieid=m.getMovieId(); - String title=m.getTitle(); - String type=m.getType(); - String director=m.getDirector(); - java.sql.Date date=new java.sql.Date(m.getDate().getTime()); - - ps.setInt(1, movieid); - ps.setString(2, title); - ps.setString(3, director); - ps.setString(4, type); - - ps.setDate(5, date); - - int rows= ps.executeUpdate(); - if(rows!=1) - { - throw new DAOException("Addition Failed"); - } - }catch(SQLException e) - { - throw new DAOException(e); - } - - } - - - @Override - public Movie GetById(int movieId) { - Connection con=null; - PreparedStatement ps=null; - ResultSet rs=null; - - try - { - con=getConnection(); - ps=con.prepareStatement("select * from movie where movie_id=?"); - ps.setInt(1, movieId); - rs=ps.executeQuery(); - Movie movie=null; - if(rs.next()) - { - String movieidStr=rs.getString("movie_id"); - String title=rs.getString("title"); - String type=rs.getString("type"); - String director=rs.getString("director"); - Date date=rs.getDate("date1"); - int movieId1=Integer.parseInt(movieidStr); - - movie=new Movie(movieId1, title, type, director, date); - return movie; - - } - - throw new DAOException("Invalid Id "); - - }catch(SQLException e) - { - throw new DAOException(e); - }finally - { - closeResource(rs, ps, con); - } - } - - - @Override - public void update(Movie movie) { - Connection con=null; - ResultSet rs=null; - PreparedStatement ps=null; - //Movie movie=null; - try - { - con=getConnection(); - ps=con.prepareStatement("update movie set title=?, director=? where movie_id=?"); - int movieid=movie.getMovieId(); - String title=movie.getTitle(); - String type=movie.getType(); - String director=movie.getDirector(); - java.sql.Date date=new java.sql.Date(movie.getDate().getTime()); - - - ps.setString(1, title); - ps.setString(2, director); - ps.setInt(3, movieid); - - int rows= ps.executeUpdate(); - if(rows!=1) - { - throw new DAOException("Addition Failed"); - } - }catch(SQLException e) - { - throw new DAOException(e); - } - finally - { - closeResource(rs, ps, con); - } - - } - - - @Override - public void delete(int movieid) { - - - Connection con=null; - ResultSet rs=null; - PreparedStatement ps=null; - try - { - con=getConnection(); - ps=con.prepareStatement("delete from movie where movie_id=?"); - ps.setInt(1, movieid); - int rows=ps.executeUpdate(); - if(rows!=1) - { - throw new DAOException("Delection Failed "); - } - }catch(SQLException e) - { - throw new DAOException(e); - } - - } - private Connection getConnection() - { - try - { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcUrl, username, password); - }catch(ClassNotFoundException ex) - { - throw new DAOException(ex); - } - catch(SQLException e) - { - throw new DAOException(e); - } - } - private void closeResource(ResultSet rs, PreparedStatement ps, Connection con) - { - if(rs!=null) - { - try - { - rs.close(); - }catch(SQLException e) - { - throw new DAOException(e); - } - } - if(ps!=null) - { - try - { - ps.close(); - }catch(SQLException e) - { - throw new DAOException(e); - } - } - if(con!=null) - { - try - { - con.close(); - }catch(SQLException e) - { - throw new DAOException(e); - } - } - } - - -} diff --git a/MovieStore/src/com/training/java/servlet/movie/domain/package-info.java b/MovieStore/src/com/training/java/servlet/movie/domain/package-info.java deleted file mode 100644 index 05b5580..0000000 --- a/MovieStore/src/com/training/java/servlet/movie/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.movie.domain; \ No newline at end of file diff --git a/MovieStore/src/com/training/java/servlet/movie/web/AddServlet.java b/MovieStore/src/com/training/java/servlet/movie/web/AddServlet.java deleted file mode 100644 index 6e561cc..0000000 --- a/MovieStore/src/com/training/java/servlet/movie/web/AddServlet.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.training.java.servlet.movie.web; - -import java.io.IOException; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.movie.domain.Movie; -import com.training.java.servlet.movie.domain.MovieDao; -import com.training.java.servlet.movie.domain.MovieDaoImple; - -/** - * Servlet implementation class AddServlet - */ -public class AddServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public AddServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - String movieIdStr = request.getParameter("movieId"); - String title = request.getParameter("title"); - String director = request.getParameter("director"); - String type = request.getParameter("type"); - String releaseDatestr = request.getParameter("releaseDate"); - DateFormat format = new SimpleDateFormat("mmDDyyyy"); - - Date releaseDate = null; - try { - releaseDate= format.parse(releaseDatestr); - } catch (ParseException e) { - e.printStackTrace(); - } - - int movieId = Integer.parseInt(movieIdStr); - - String jdbcUrl = getServletContext().getInitParameter("jdbcUrl"); - String userName = getServletContext().getInitParameter("userName"); - String password = getServletContext().getInitParameter("password"); - - - Movie movie = new Movie(movieId, title, type, director, releaseDate); - MovieDao dao = new MovieDaoImple(jdbcUrl,userName,password); - dao.addMovies(movie); - - response.sendRedirect("/MovieStore/lst"); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - doGet(request, response); - } - -} diff --git a/MovieStore/src/com/training/java/servlet/movie/web/ListMoviesServlet.java b/MovieStore/src/com/training/java/servlet/movie/web/ListMoviesServlet.java deleted file mode 100644 index 750ba93..0000000 --- a/MovieStore/src/com/training/java/servlet/movie/web/ListMoviesServlet.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.training.java.servlet.movie.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.movie.domain.Movie; -import com.training.java.servlet.movie.domain.MovieDao; -import com.training.java.servlet.movie.domain.MovieDaoImple; - -/** - * Servlet implementation class ListMoviesServlet - */ -public class ListMoviesServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListMoviesServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - String jdbcUrl = getServletContext().getInitParameter("jdbcUrl"); - String userName = getServletContext().getInitParameter("userName"); - String password = getServletContext().getInitParameter("password"); - - int maxMovies = Integer.parseInt((getServletConfig().getInitParameter("maxNoOfMovies"))); - MovieDao dao = new MovieDaoImple(jdbcUrl,userName,password); - - List movies= dao.getAllMovies(); - - PrintWriter out = response.getWriter(); - - out.println(""); - - out.println(""); - out.println(""); - - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(" movies.size()){ - - maxMovies = movies.size(); - } - - for(int i=0; i"); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - } - out.println("
TitleDirectorTypeRelease_Date"+movie.getTitle()+""+movie.getDirector()+""+movie.getType()+""+movie.getDate()+"
"); - out.println(""); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/MovieStore/src/com/training/java/servlet/movie/web/package-info.java b/MovieStore/src/com/training/java/servlet/movie/web/package-info.java deleted file mode 100644 index 89c0f95..0000000 --- a/MovieStore/src/com/training/java/servlet/movie/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.movie.web; \ No newline at end of file diff --git a/MovieStoreCoreJava/.classpath b/MovieStoreCoreJava/.classpath deleted file mode 100644 index a7357b7..0000000 --- a/MovieStoreCoreJava/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/MovieStoreCoreJava/.project b/MovieStoreCoreJava/.project deleted file mode 100644 index 4eb4db9..0000000 --- a/MovieStoreCoreJava/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - MovieStoreCoreJava - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/MovieStoreCoreJava/.settings/org.eclipse.jdt.core.prefs b/MovieStoreCoreJava/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 838bd9d..0000000 --- a/MovieStoreCoreJava/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/MovieStoreCoreJava/lib/junit-4.8.2.jar b/MovieStoreCoreJava/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/MovieStoreCoreJava/lib/junit-4.8.2.jar and /dev/null differ diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/DateDemo.java b/MovieStoreCoreJava/src/com/training/corejava/movie/DateDemo.java deleted file mode 100644 index fe2caec..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/DateDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.corejava.movie; - -import java.util.Calendar; -import java.util.Date; - -public class DateDemo { - - public static void main(String[] args) { - - Date now = new Date(); - - Calendar cal = Calendar.getInstance(); - cal.set(2014, Calendar.APRIL, 30); - - Date apr30 = cal.getTime(); - - System.out.println(apr30.after(now)); - - System.out.println("Now = " + now); - } - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/IntegerDemo.java b/MovieStoreCoreJava/src/com/training/corejava/movie/IntegerDemo.java deleted file mode 100644 index e8ffee4..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/IntegerDemo.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.corejava.movie; - -public class IntegerDemo { - - public static void main(String[] args) { - - double percentage = 20; - double percentageDouble = percentage/100; - - System.out.println("Percentage = " + percentageDouble); - - } - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/InvalidPromotionException.java b/MovieStoreCoreJava/src/com/training/corejava/movie/InvalidPromotionException.java deleted file mode 100644 index 8f64ad6..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/InvalidPromotionException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.corejava.movie; - -public class InvalidPromotionException extends Exception { - - public InvalidPromotionException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/InvoiceGenerator.java b/MovieStoreCoreJava/src/com/training/corejava/movie/InvoiceGenerator.java deleted file mode 100644 index b6535f0..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/InvoiceGenerator.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.corejava.movie; - -import java.util.List; - -public class InvoiceGenerator { - - public String generate(List rentals, Promotion promotion) - { - double price = new PriceCalculator().calculate(rentals, promotion); - - StringBuilder invoice = new StringBuilder(); - - invoice.append("*****Invoice for the customer****"); - - for(Rental rental : rentals) - { - invoice.append("You are renting " + rental.getMovie().getTitle() + " for " + rental.getNoOfDays()); - } - - invoice.append("Your bill is : " + price + " due upon receipt."); - - return invoice.toString(); - } - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/Movie.java b/MovieStoreCoreJava/src/com/training/corejava/movie/Movie.java deleted file mode 100644 index e1ce8bd..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/Movie.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.corejava.movie; - -public class Movie { - - private String title; - private MovieType movieType; - - public Movie(String title, - MovieType movieType) { - super(); - this.title = title; - this.movieType = movieType; - } - - - /** - * @return the title - */ - public String getTitle() { - return title; - } - - /** - * @return the movieType - */ - public MovieType getMovieType() { - return movieType; - } -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/MovieLibrary.java b/MovieStoreCoreJava/src/com/training/corejava/movie/MovieLibrary.java deleted file mode 100644 index b3e975e..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/MovieLibrary.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.training.corejava.movie; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class MovieLibrary { - - private static List movies; - - static { - movies = new ArrayList<>(); - - Movie lego1 = new Movie("Lego", MovieType.Blueray); - Movie lego2 = new Movie("Lego", MovieType.Blueray); - Movie lego3 = new Movie("Lego", MovieType.DVD); - - Movie frozen1 = new Movie("Frozen", MovieType.DVD); - Movie frozen2 = new Movie("Frozen", MovieType.Blueray); - Movie frozen3 = new Movie("Frozen", MovieType.Blueray); - - movies.add(lego1); - movies.add(lego2); - movies.add(lego3); - movies.add(frozen1); - movies.add(frozen2); - movies.add(frozen3); - - } - - public boolean inStock(String title) { - - for (Movie movie : movies) { - - if (movie.getTitle().equalsIgnoreCase(title)) { - return true; - } - } - - return false; - } - - public void deleteMovie(String title, MovieType movieType) { - Iterator ite = movies.iterator(); - - while (ite.hasNext()) { - Movie movie = ite.next(); - - if (movie.getTitle().equalsIgnoreCase(title) - && movie.getMovieType().equals(movieType)) { - ite.remove(); - } - } - } - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/MovieLibraryTest.java b/MovieStoreCoreJava/src/com/training/corejava/movie/MovieLibraryTest.java deleted file mode 100644 index 8de4486..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/MovieLibraryTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.corejava.movie; - -import static org.junit.Assert.assertTrue; -import junit.framework.Assert; - -import org.junit.Test; - -public class MovieLibraryTest { - - @Test - public void testInStock() throws Exception { - - - MovieLibrary library = new MovieLibrary(); - - assertTrue(library.inStock("LEGo")); - - } - - @Test - public void testDeleteMovie() - { - MovieLibrary library = new MovieLibrary(); - - library.deleteMovie("Lego", MovieType.DVD); - library.deleteMovie("Lego", MovieType.Blueray); - library.deleteMovie("Lego", MovieType.Blueray); - - Assert.assertFalse(library.inStock("LEGo")); - } -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/MovieStore.java b/MovieStoreCoreJava/src/com/training/corejava/movie/MovieStore.java deleted file mode 100644 index 9f8c738..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/MovieStore.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.training.corejava.movie; - -import java.util.Scanner; - -public class MovieStore { - - public static void main(String[] args) { - - Scanner scanner = new Scanner(System.in); - ShoppingCart cart = new ShoppingCart(); - - System.out.println("Welcome to Blockbuster!!"); - System.out - .println("Please enter your movie name,type (BlueRay/DVD) and number of days to rent in a comma separated way"); - System.out.println("Once you are done, type checkout and enter"); - - while (scanner.hasNextLine()) { - String line = scanner.nextLine(); - - if(line.equalsIgnoreCase("checkout")) - { - break; - } - - String[] tokens = line.split(","); - - if (tokens.length < 3) { - System.out.println("Invalid input provided"); - } else { - String movieTitle = tokens[0]; - String movieType = tokens[1]; - int numberOfDays = Integer.parseInt(tokens[2]); - - MovieLibrary library = new MovieLibrary(); - boolean inStock = library.inStock(movieTitle); - - if (!inStock) { - System.out.println("Sorry, this movie is not available"); - } else { - cart.add(movieTitle, movieType, numberOfDays); - } - - } - - } - - System.out.println("Please enter your promotion code now.."); - - while(scanner.hasNext()) - { - String promotionCode = scanner.next(); - Promotion promotion = null; - - try { - promotion = new Promotions().getPromotion(promotionCode); - } catch (InvalidPromotionException e) { - System.out.println("Sorry, but this promotion code is either not valid or expired."); - System.exit(0); - } - - InvoiceGenerator generator = new InvoiceGenerator(); - - String invoice = generator.generate(cart.getRentals(), promotion); - - System.out.println("Please find below your invoice."); - System.out.println(invoice); - - System.out.println("Have a good day!!"); - System.exit(0); - } - - scanner.close(); - - } - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/MovieType.java b/MovieStoreCoreJava/src/com/training/corejava/movie/MovieType.java deleted file mode 100644 index 8b2ec11..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/MovieType.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.corejava.movie; - -public enum MovieType { - - DVD, Blueray; - -} - - diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/PriceCalculator.java b/MovieStoreCoreJava/src/com/training/corejava/movie/PriceCalculator.java deleted file mode 100644 index 61325f6..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/PriceCalculator.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.corejava.movie; - -import java.util.List; - -public class PriceCalculator { - - public static final double DVD_PERDAY_PRICE = 1.20; - public static final double BLUERAY_PERDAY_PRICE = 1.50; - public static final double TAX_PERCENTAGE = 6.0; - - public double calculate(List rentals, Promotion promotion) { - - double price = 0; - - for (Rental rental : rentals) { - int numberOfDays = rental.getNoOfDays(); - MovieType movieType = rental.getMovie().getMovieType(); - - double perDayPrice = getPerDayPrice(movieType); - - price = price + (perDayPrice * numberOfDays); - } - - double discount = price * (promotion.getDiscountPercentage() / 100); - - double priceAfterDiscount = price - discount; - - double tax = priceAfterDiscount * (TAX_PERCENTAGE / 100); - - return priceAfterDiscount + tax; - } - - private double getPerDayPrice(MovieType movieType) { - - if (movieType.equals(MovieType.DVD)) { - return DVD_PERDAY_PRICE; - } else { - return BLUERAY_PERDAY_PRICE; - } - } - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/Promotion.java b/MovieStoreCoreJava/src/com/training/corejava/movie/Promotion.java deleted file mode 100644 index 8f7dbc8..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/Promotion.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.training.corejava.movie; - -import java.util.Date; - -public class Promotion { - - private String code; - private Date expirationDate; - private double discountPercentage; - - - public Promotion(String code, Date expirationDate, int discountPercentage) { - super(); - this.code = code; - this.expirationDate = expirationDate; - this.discountPercentage = discountPercentage; - } - /** - * @return the code - */ - public String getCode() { - return code; - } - /** - * @return the expirationDate - */ - public Date getExpirationDate() { - return expirationDate; - } - /** - * @return the discountPercentage - */ - public double getDiscountPercentage() { - return discountPercentage; - } - - - - - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/Promotions.java b/MovieStoreCoreJava/src/com/training/corejava/movie/Promotions.java deleted file mode 100644 index afce006..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/Promotions.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.training.corejava.movie; - -import java.util.Calendar; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; - -public class Promotions { - - private static Set promotionSet; - private static final Date today = new Date(); - - static - { - promotionSet = new HashSet<>(); - - Calendar apr30 = Calendar.getInstance(); - apr30.set(2014, Calendar.APRIL, 30); - - Calendar mar15 = Calendar.getInstance(); - mar15.set(2014, Calendar.MARCH, 15); - - Calendar jan10 = Calendar.getInstance(); - jan10.set(2014, Calendar.JANUARY, 10); - - - Promotion promotion1 = new Promotion("20PR", apr30.getTime(), 20); - Promotion promotion2 = new Promotion("25PR", mar15.getTime(), 25); - Promotion promotion3 = new Promotion("30PR", jan10.getTime(), 30); - - promotionSet.add(promotion1); - promotionSet.add(promotion2); - promotionSet.add(promotion3); - - } - - public Promotion getPromotion(String promotionCode) throws InvalidPromotionException - { - for (Promotion pr : promotionSet) { - - if (promotionCode.equals(pr.getCode()) && pr.getExpirationDate().after(today)) { - return pr; - } - } - - throw new InvalidPromotionException("Promotion code " + promotionCode + " is not valid or expired."); - } - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/Rental.java b/MovieStoreCoreJava/src/com/training/corejava/movie/Rental.java deleted file mode 100644 index 89a48a8..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/Rental.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.corejava.movie; - -public class Rental { - - private Movie movie; - private int noOfDays; - - public Rental(Movie movie, int noOfDays) { - super(); - this.movie = movie; - this.noOfDays = noOfDays; - } - - /** - * @return the movie - */ - public Movie getMovie() { - return movie; - } - - /** - * @return the noOfDays - */ - public int getNoOfDays() { - return noOfDays; - } - -} diff --git a/MovieStoreCoreJava/src/com/training/corejava/movie/ShoppingCart.java b/MovieStoreCoreJava/src/com/training/corejava/movie/ShoppingCart.java deleted file mode 100644 index a46c252..0000000 --- a/MovieStoreCoreJava/src/com/training/corejava/movie/ShoppingCart.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.corejava.movie; - -import java.util.ArrayList; -import java.util.List; - -public class ShoppingCart { - - private List rentals = new ArrayList(); - - public void add(String title, String type, int numberOfDays) { - MovieType movieType = MovieType.valueOf(type); - Movie movie = new Movie(title, movieType); - - Rental rental = new Rental(movie, numberOfDays); - - rentals.add(rental); - } - - /** - * @return the rentals - */ - public List getRentals() { - return rentals; - } -} diff --git a/NewJSP1/.classpath b/NewJSP1/.classpath deleted file mode 100644 index f4917a2..0000000 --- a/NewJSP1/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/NewJSP1/.project b/NewJSP1/.project deleted file mode 100644 index 19ead90..0000000 --- a/NewJSP1/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - NewJSP1 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/NewJSP1/.settings/.jsdtscope b/NewJSP1/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/NewJSP1/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/NewJSP1/.settings/org.eclipse.jdt.core.prefs b/NewJSP1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/NewJSP1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/NewJSP1/.settings/org.eclipse.wst.common.component b/NewJSP1/.settings/org.eclipse.wst.common.component deleted file mode 100644 index a86a105..0000000 --- a/NewJSP1/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/NewJSP1/.settings/org.eclipse.wst.common.project.facet.core.xml b/NewJSP1/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index acf76ca..0000000 --- a/NewJSP1/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/NewJSP1/.settings/org.eclipse.wst.jsdt.ui.superType.container b/NewJSP1/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/NewJSP1/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/NewJSP1/.settings/org.eclipse.wst.jsdt.ui.superType.name b/NewJSP1/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/NewJSP1/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/NewJSP1/WebContent/First.jsp b/NewJSP1/WebContent/First.jsp deleted file mode 100644 index c4cefc1..0000000 --- a/NewJSP1/WebContent/First.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@page import="java.io.PrintWriter"%> -<%@page import="java.util.Date"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -Hi, this is my first JSP!!
- -

The date here on server is : - -<%= new Date()%> - -

- - -<% -System.out.println("Hello"); - -%> - -<% - String fn = request.getParameter("firstName"); - String ln = request.getParameter("lastName"); -%> - -First name= : <%=fn %>
-Last name= : <%=ln %> - - -<% - out.println("How are you? "); -%> - - - - - \ No newline at end of file diff --git a/NewJSP1/WebContent/ListBooks.jsp b/NewJSP1/WebContent/ListBooks.jsp deleted file mode 100644 index 643f081..0000000 --- a/NewJSP1/WebContent/ListBooks.jsp +++ /dev/null @@ -1,58 +0,0 @@ -<%@page import="com.training.java.servlet.domain.DAOException"%> -<%@page import="com.training.java.servlet.domain.Book"%> -<%@page import="java.util.List"%> -<%@page import="com.training.java.servlet.domain.BookDAOJDBCImpl"%> -<%@page import="com.training.java.servlet.domain.BookDAO"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -<% - -BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - -List books = null; - -try { - books = dao.getAllBooks(); -} catch (DAOException e) { - e.printStackTrace(); -} - -%> - - - - - - - - -<% - -for(Book aBook : books) -{ - -%> - - - - - - -<% -} -%> - -
TitleAuthorISBN
<%= aBook.getTitle() %><%= aBook.getAuthor() %><%= aBook.getIsbn() %>
- - - - - \ No newline at end of file diff --git a/NewJSP1/WebContent/META-INF/MANIFEST.MF b/NewJSP1/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/NewJSP1/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/NewJSP1/WebContent/WEB-INF/lib/commons-lang-2.6.jar b/NewJSP1/WebContent/WEB-INF/lib/commons-lang-2.6.jar deleted file mode 100644 index 98467d3..0000000 Binary files a/NewJSP1/WebContent/WEB-INF/lib/commons-lang-2.6.jar and /dev/null differ diff --git a/NewJSP1/WebContent/WEB-INF/lib/ojdbc6.jar b/NewJSP1/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/NewJSP1/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/NewJSP1/WebContent/WEB-INF/web.xml b/NewJSP1/WebContent/WEB-INF/web.xml deleted file mode 100644 index 842b459..0000000 --- a/NewJSP1/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - NewJSP1 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - \ No newline at end of file diff --git a/NewJSP1/src/com/training/java/servlet/domain/Book.java b/NewJSP1/src/com/training/java/servlet/domain/Book.java deleted file mode 100644 index 1d30fe0..0000000 --- a/NewJSP1/src/com/training/java/servlet/domain/Book.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.java.servlet.domain; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - public void init() - { - - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } - - public int getPages() { - return pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - -} diff --git a/NewJSP1/src/com/training/java/servlet/domain/BookDAO.java b/NewJSP1/src/com/training/java/servlet/domain/BookDAO.java deleted file mode 100644 index 9827402..0000000 --- a/NewJSP1/src/com/training/java/servlet/domain/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.servlet.domain; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/NewJSP1/src/com/training/java/servlet/domain/BookDAOJDBCImpl.java b/NewJSP1/src/com/training/java/servlet/domain/BookDAOJDBCImpl.java deleted file mode 100644 index b4a20b4..0000000 --- a/NewJSP1/src/com/training/java/servlet/domain/BookDAOJDBCImpl.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.training.java.servlet.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class BookDAOJDBCImpl implements BookDAO { - - private String jdbcURL; - private String username; - private String password; - - public BookDAOJDBCImpl(String jdbcURL, String username, String password) - { - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(book_id_seq.nextval, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - statement.setInt(6, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } - - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/NewJSP1/src/com/training/java/servlet/domain/DAOException.java b/NewJSP1/src/com/training/java/servlet/domain/DAOException.java deleted file mode 100644 index fb0fd0a..0000000 --- a/NewJSP1/src/com/training/java/servlet/domain/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.servlet.domain; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/NewJSP1/src/com/training/java/servlet/domain/package-info.java b/NewJSP1/src/com/training/java/servlet/domain/package-info.java deleted file mode 100644 index 05aa146..0000000 --- a/NewJSP1/src/com/training/java/servlet/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.domain; \ No newline at end of file diff --git a/ProjectHome.md b/ProjectHome.md new file mode 100644 index 0000000..d1831b8 --- /dev/null +++ b/ProjectHome.md @@ -0,0 +1 @@ +Venkat Hari's Java training goes here..Each topic is a separate Eclipse project \ No newline at end of file diff --git a/ReadMeFirst/.classpath b/ReadMeFirst/.classpath deleted file mode 100644 index 07ca123..0000000 --- a/ReadMeFirst/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ReadMeFirst/.project b/ReadMeFirst/.project deleted file mode 100644 index d6f9030..0000000 --- a/ReadMeFirst/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - ReadMeFirst - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/ReadMeFirst/.settings/org.eclipse.jdt.core.prefs b/ReadMeFirst/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index cf001e4..0000000 --- a/ReadMeFirst/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Sat Jun 18 18:13:58 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/ReadMeFirst/documentation/Settingup_SVN b/ReadMeFirst/documentation/Settingup_SVN deleted file mode 100644 index 3721168..0000000 --- a/ReadMeFirst/documentation/Settingup_SVN +++ /dev/null @@ -1,4 +0,0 @@ - How to setup Subversion (SVN) in your Eclipse? - ---> You need an Eclipse plugin called Subclipse to get access to any Subversion repository. ---> If you want to install Subclipse plugin in your project, read the word document "Subclipse Installation.doc" \ No newline at end of file diff --git a/ReadMeFirst/documentation/Subclipse Installation.doc b/ReadMeFirst/documentation/Subclipse Installation.doc deleted file mode 100644 index fbcc0d7..0000000 Binary files a/ReadMeFirst/documentation/Subclipse Installation.doc and /dev/null differ diff --git a/Servlet4/.classpath b/Servlet4/.classpath deleted file mode 100644 index 78413a7..0000000 --- a/Servlet4/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/Servlet4/.project b/Servlet4/.project deleted file mode 100644 index 0a3982e..0000000 --- a/Servlet4/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - Servlet4 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/Servlet4/.settings/.jsdtscope b/Servlet4/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/Servlet4/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/Servlet4/.settings/org.eclipse.jdt.core.prefs b/Servlet4/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 0f0f84f..0000000 --- a/Servlet4/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Feb 09 19:08:23 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/Servlet4/.settings/org.eclipse.wst.common.component b/Servlet4/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 5ceb3c7..0000000 --- a/Servlet4/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Servlet4/.settings/org.eclipse.wst.common.project.facet.core.xml b/Servlet4/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d62d1e5..0000000 --- a/Servlet4/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/Servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.container b/Servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/Servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/Servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.name b/Servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/Servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/Servlet4/WebContent/META-INF/MANIFEST.MF b/Servlet4/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/Servlet4/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/Servlet4/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar b/Servlet4/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar deleted file mode 100644 index cdee6a1..0000000 Binary files a/Servlet4/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar and /dev/null differ diff --git a/Servlet4/WebContent/WEB-INF/web.xml b/Servlet4/WebContent/WEB-INF/web.xml deleted file mode 100644 index 2816fb3..0000000 --- a/Servlet4/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - Servlet4 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ListStudentServlet - ListStudentServlet - com.training.java.servlet4.web.ListStudentServlet - - - ListStudentServlet - /list - - - - ListStudentDisplayServlet - ListStudentDisplayServlet - com.training.java.servlet4.web.ListStudentDisplayServlet - - - ListStudentDisplayServlet - /listDisplay - - \ No newline at end of file diff --git a/Servlet4/lib/junit-4.8.2.jar b/Servlet4/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/Servlet4/lib/junit-4.8.2.jar and /dev/null differ diff --git a/Servlet4/src/com/training/java/servlet4/domain/DAOException.java b/Servlet4/src/com/training/java/servlet4/domain/DAOException.java deleted file mode 100644 index 65ceb1b..0000000 --- a/Servlet4/src/com/training/java/servlet4/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.servlet4.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/Servlet4/src/com/training/java/servlet4/domain/Student.java b/Servlet4/src/com/training/java/servlet4/domain/Student.java deleted file mode 100644 index 3b641b0..0000000 --- a/Servlet4/src/com/training/java/servlet4/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.servlet4.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/Servlet4/src/com/training/java/servlet4/domain/StudentDAO.java b/Servlet4/src/com/training/java/servlet4/domain/StudentDAO.java deleted file mode 100644 index 141da51..0000000 --- a/Servlet4/src/com/training/java/servlet4/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.servlet4.domain; - -import java.util.List; - -public interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/Servlet4/src/com/training/java/servlet4/domain/StudentDAOJDBCImpl.java b/Servlet4/src/com/training/java/servlet4/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index 026f294..0000000 --- a/Servlet4/src/com/training/java/servlet4/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.servlet4.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/Servlet4/src/com/training/java/servlet4/domain/StudentDAOJDBCImplTest.java b/Servlet4/src/com/training/java/servlet4/domain/StudentDAOJDBCImplTest.java deleted file mode 100644 index 5a1f4e5..0000000 --- a/Servlet4/src/com/training/java/servlet4/domain/StudentDAOJDBCImplTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.java.servlet4.domain; - -import java.util.List; - -import org.junit.Ignore; -import org.junit.Test; - -public class StudentDAOJDBCImplTest { - - @Test - public void testGetAllStudents() { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - List students = dao.getAllStudents(); - - for(Student current : students) - { - System.out.println(current); - } - } - - @Ignore - public void testCreateStudent(){ - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - - Student student = new Student(); - student.setAge(20); - student.setCity("Sterling Heights"); - student.setEmail("priya@gmail.com"); - student.setFirstName("Priya"); - student.setId(7); - student.setLastName("Patel"); - student.setPhoneNumber("248-238-9874"); - - dao.create(student); - - //assert that your student is created - - //delete the student that you just created - } - -} diff --git a/Servlet4/src/com/training/java/servlet4/web/ListStudentDisplayServlet.java b/Servlet4/src/com/training/java/servlet4/web/ListStudentDisplayServlet.java deleted file mode 100644 index 94ff14c..0000000 --- a/Servlet4/src/com/training/java/servlet4/web/ListStudentDisplayServlet.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.training.java.servlet4.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet4.domain.Student; - -/** - * Servlet implementation class ListStudentDisplayServlet - */ -public class ListStudentDisplayServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListStudentDisplayServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - List students = (List) request.getAttribute("students"); - - PrintWriter out = response.getWriter(); - - out.print(""); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - - for(Student current : students) - { - out.print(""); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - } - - out.print("
First NameLast NamePhone Number
" + current.getFirstName() + "" + current.getLastName() + "" + current.getPhoneNumber() + "
"); - out.print(""); - out.print(""); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - doGet(request, response); - } - -} diff --git a/Servlet4/src/com/training/java/servlet4/web/ListStudentServlet.java b/Servlet4/src/com/training/java/servlet4/web/ListStudentServlet.java deleted file mode 100644 index fad7050..0000000 --- a/Servlet4/src/com/training/java/servlet4/web/ListStudentServlet.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.training.java.servlet4.web; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet4.domain.Student; -import com.training.java.servlet4.domain.StudentDAO; -import com.training.java.servlet4.domain.StudentDAOJDBCImpl; - -/** - * Servlet implementation class ListStudentServlet - */ -public class ListStudentServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListStudentServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - List students = dao.getAllStudents(); - - request.setAttribute("students", students); - - response.sendRedirect("/Servlet4/listDisplay"); - - /* - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - List students = dao.getAllStudents(); - - request.setAttribute("students", students); - - RequestDispatcher dispatcher = request.getRequestDispatcher("/listDisplay"); - dispatcher.forward(request, response); - */ - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - doGet(request, response); - } - -} diff --git a/ServletBasic/.classpath b/ServletBasic/.classpath deleted file mode 100644 index f9cdf28..0000000 --- a/ServletBasic/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/ServletBasic/.project b/ServletBasic/.project deleted file mode 100644 index 704ed7d..0000000 --- a/ServletBasic/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - ServletBasic - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/ServletBasic/.settings/.jsdtscope b/ServletBasic/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/ServletBasic/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/ServletBasic/.settings/org.eclipse.jdt.core.prefs b/ServletBasic/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c1c4bb6..0000000 --- a/ServletBasic/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Jul 13 22:06:40 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/ServletBasic/.settings/org.eclipse.wst.common.component b/ServletBasic/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 9b71b0c..0000000 --- a/ServletBasic/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ServletBasic/.settings/org.eclipse.wst.common.project.facet.core.xml b/ServletBasic/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index ba495e0..0000000 --- a/ServletBasic/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/ServletBasic/.settings/org.eclipse.wst.jsdt.ui.superType.container b/ServletBasic/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/ServletBasic/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/ServletBasic/.settings/org.eclipse.wst.jsdt.ui.superType.name b/ServletBasic/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/ServletBasic/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/ServletBasic/WebContent/META-INF/MANIFEST.MF b/ServletBasic/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/ServletBasic/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/ServletBasic/WebContent/WEB-INF/web.xml b/ServletBasic/WebContent/WEB-INF/web.xml deleted file mode 100644 index 5cd22d1..0000000 --- a/ServletBasic/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - ServletBasic - - index.html - - - - HelloWorldServlet - HelloWorldServlet - com.training.java.servlet.basic.HelloWorldServlet - - - HelloWorldServlet - /hello - - - - RegistrationServlet - RegistrationServlet - com.training.java.servlet.basic.RegistrationServlet - - - RegistrationServlet - /registration - - \ No newline at end of file diff --git a/ServletBasic/WebContent/index.html b/ServletBasic/WebContent/index.html deleted file mode 100644 index 2a24e81..0000000 --- a/ServletBasic/WebContent/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - -Insert title here - - - Hi, this is my home page. - - \ No newline at end of file diff --git a/ServletBasic/WebContent/registration.html b/ServletBasic/WebContent/registration.html deleted file mode 100644 index f8dd9dd..0000000 --- a/ServletBasic/WebContent/registration.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - -Insert title here - - - -
- -First Name :
-Last Name :
-SSN :

- - - -
- - - - \ No newline at end of file diff --git a/ServletBasic/src/com/training/java/servlet/basic/HelloWorldServlet.java b/ServletBasic/src/com/training/java/servlet/basic/HelloWorldServlet.java deleted file mode 100644 index d4f0c9b..0000000 --- a/ServletBasic/src/com/training/java/servlet/basic/HelloWorldServlet.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.training.java.servlet.basic; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Date; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class HelloWorldServlet - */ -public class HelloWorldServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public HelloWorldServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println("

"); - out.println("Hello, welcome to my website..
"); - out.println("The current date and time here is : " + new Date()); - out.println("

"); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/ServletBasic/src/com/training/java/servlet/basic/RegistrationServlet.java b/ServletBasic/src/com/training/java/servlet/basic/RegistrationServlet.java deleted file mode 100644 index fee9464..0000000 --- a/ServletBasic/src/com/training/java/servlet/basic/RegistrationServlet.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.java.servlet.basic; - -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class RegistrationServlet - */ -public class RegistrationServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public RegistrationServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String firstName = request.getParameter("fn"); - String lastName = request.getParameter("ln"); - String ssn = request.getParameter("ssn"); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println("

This is the response from doGet()


"); - out.println("Thanks for your information, we will store them in our database..This is what we have got
"); - out.println("First Name = " + firstName + "
"); - out.println("Last Name = " + lastName + "
"); - out.println("SSN = " + ssn); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - String firstName = request.getParameter("fn"); - String lastName = request.getParameter("ln"); - String ssn = request.getParameter("ssn"); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println("

This is the response from doPost()


"); - out.println("Thanks for your information, we will store them in our database..This is what we have got
"); - out.println("First Name = " + firstName + "
"); - out.println("Last Name = " + lastName + "
"); - out.println("SSN = " + ssn); - } - -} diff --git a/ServletMovieStore/.classpath b/ServletMovieStore/.classpath deleted file mode 100644 index 4a1837d..0000000 --- a/ServletMovieStore/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/ServletMovieStore/.project b/ServletMovieStore/.project deleted file mode 100644 index 357ebfc..0000000 --- a/ServletMovieStore/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - ServletMovieStore - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/ServletMovieStore/.settings/.jsdtscope b/ServletMovieStore/.settings/.jsdtscope deleted file mode 100644 index f40dd98..0000000 --- a/ServletMovieStore/.settings/.jsdtscope +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/ServletMovieStore/.settings/org.eclipse.jdt.core.prefs b/ServletMovieStore/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index d125e65..0000000 --- a/ServletMovieStore/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Sat Sep 10 11:07:20 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/ServletMovieStore/.settings/org.eclipse.wst.common.component b/ServletMovieStore/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 2aa78f1..0000000 --- a/ServletMovieStore/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ServletMovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml b/ServletMovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 3d1d1d9..0000000 --- a/ServletMovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ServletMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container b/ServletMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/ServletMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/ServletMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name b/ServletMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/ServletMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/ServletMovieStore/WebContent/AddMovie.html b/ServletMovieStore/WebContent/AddMovie.html deleted file mode 100644 index 5e4cee8..0000000 --- a/ServletMovieStore/WebContent/AddMovie.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - -Insert title here - - - -
- - ID :
- Name :
- Rating :
- Genre :
- - - -
- - - - - \ No newline at end of file diff --git a/ServletMovieStore/WebContent/META-INF/MANIFEST.MF b/ServletMovieStore/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/ServletMovieStore/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/ServletMovieStore/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/ServletMovieStore/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/ServletMovieStore/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/ServletMovieStore/WebContent/WEB-INF/web.xml b/ServletMovieStore/WebContent/WEB-INF/web.xml deleted file mode 100644 index 5b99f8b..0000000 --- a/ServletMovieStore/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - MovieStore - - index.html - - - - ListMovieServlet - ListMovieServlet - com.training.java.servlet.moviestore.web.ListMovieServlet - - - ListMovieServlet - /list - - - - AddMovieServlet - AddMovieServlet - com.training.java.servlet.moviestore.web.AddMovieServlet - - - AddMovieServlet - /add - - \ No newline at end of file diff --git a/ServletMovieStore/WebContent/index.html b/ServletMovieStore/WebContent/index.html deleted file mode 100644 index afd3478..0000000 --- a/ServletMovieStore/WebContent/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - -Movie store - - - -

Welcome to my Movie store




- -
    -
  1. If you want to add a movie please click here
  2. -
  3. To see the movies in our database, please click here
  4. -
- - - - - \ No newline at end of file diff --git a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/Movie.java b/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/Movie.java deleted file mode 100644 index c2cf67c..0000000 --- a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/Movie.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.sql.Date; - -public class Movie -{ - private int id; - private String name; - private String rating; - private Date releaseDate; - private String genre; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getRating() - { - return rating; - } - - public void setRating(String rating) - { - this.rating = rating; - } - - public Date getReleaseDate() - { - return releaseDate; - } - - public void setReleaseDate(Date releaseDate) - { - this.releaseDate = releaseDate; - } - - public String getGenre() - { - return genre; - } - - public void setGenre(String genre) - { - this.genre = genre; - } -} diff --git a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAO.java b/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAO.java deleted file mode 100644 index 8a7aa8a..0000000 --- a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.util.List; - -public interface MovieDAO -{ - void create(Movie movie); - List getMovies(); -} diff --git a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java b/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java deleted file mode 100644 index 5bdb998..0000000 --- a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.util.List; - -public class MovieDAODemo -{ - /** - * @param args - */ - public static void main(String[] args) - { - /* - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - Movie aMovie = new Movie(); - aMovie.setId(2); - aMovie.setName("Speed2..CC"); - aMovie.setRating("PG-13"); - aMovie.setGenre("Thriller"); - aMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - dao.create(aMovie); - */ - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - List movies = dao.getMovies(); - for(Movie aMovie : movies) - { - System.out.println("Name = " + aMovie.getName()); - System.out.println("Rating = " + aMovie.getRating()); - System.out.println("Genre = " + aMovie.getGenre()); - System.out.println("Release date = " + aMovie.getReleaseDate()); - System.out.println("id = " + aMovie.getId()); - } - } - -} diff --git a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java b/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java deleted file mode 100644 index 3a6bc38..0000000 --- a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -public class MovieDAOException extends RuntimeException -{ - MovieDAOException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java b/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index c1ce09c..0000000 --- a/ServletMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class MovieDAOJDBCImpl implements MovieDAO -{ - private String dburl; - private String dbuser; - private String dbPassword; - - public MovieDAOJDBCImpl(String dburl, String dbuser, String dbPassWord) - { - this.dburl = dburl; - this.dbuser = dbuser; - this.dbPassword = dbPassWord; - } - - @Override - public void create(Movie movie) - { - try - { - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("insert into movie(id, genre, rating, release_date, name) values(?,?,?,?,?)"); - - stmt.setInt(1, movie.getId()); - stmt.setString(2, movie.getGenre()); - stmt.setString(3, movie.getRating()); - stmt.setDate(4, movie.getReleaseDate()); - stmt.setString(5, movie.getName()); - - stmt.executeUpdate(); - - } catch (SQLException e) - { - throw new MovieDAOException(e.getMessage()); - } - } - - @Override - public List getMovies() - { - List movies = new ArrayList(); - - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("select * from movie"); - - ResultSet rs = stmt.executeQuery(); - - while(rs.next()) - { - Movie aMovie = new Movie(); - - aMovie.setId(rs.getInt("id")); - aMovie.setName(rs.getString("name")); - aMovie.setRating(rs.getString("rating")); - aMovie.setReleaseDate(rs.getDate("release_date")); - aMovie.setGenre(rs.getString("genre")); - - movies.add(aMovie); - } - } - catch(ClassNotFoundException ex) - { - ex.printStackTrace(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - - return movies; - } -} diff --git a/ServletMovieStore/src/com/training/java/servlet/moviestore/web/AddMovieServlet.java b/ServletMovieStore/src/com/training/java/servlet/moviestore/web/AddMovieServlet.java deleted file mode 100644 index 49205f8..0000000 --- a/ServletMovieStore/src/com/training/java/servlet/moviestore/web/AddMovieServlet.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.training.java.servlet.moviestore.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.Date; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.moviestore.domain.Movie; -import com.training.java.servlet.moviestore.domain.MovieDAO; -import com.training.java.servlet.moviestore.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class AddMovieServlet - */ -public class AddMovieServlet extends HttpServlet -{ - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public AddMovieServlet() - { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException - { - doPost(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doPost(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException - { - - String id = request.getParameter("id"); - String name = request.getParameter("name"); - String rating = request.getParameter("rating"); - String genre = request.getParameter("genre"); - - Movie newMovie = new Movie(); - - newMovie.setId(Integer.parseInt(id)); - newMovie.setName(name); - newMovie.setGenre(genre); - newMovie.setRating(rating); - newMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", - "root", "password"); - - dao.create(newMovie); - - PrintWriter out = response.getWriter(); - out - .println("

your details have been saved successfully

"); - - } - -} diff --git a/ServletMovieStore/src/com/training/java/servlet/moviestore/web/ListMovieServlet.java b/ServletMovieStore/src/com/training/java/servlet/moviestore/web/ListMovieServlet.java deleted file mode 100644 index b302a9b..0000000 --- a/ServletMovieStore/src/com/training/java/servlet/moviestore/web/ListMovieServlet.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.training.java.servlet.moviestore.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.moviestore.domain.Movie; -import com.training.java.servlet.moviestore.domain.MovieDAO; -import com.training.java.servlet.moviestore.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class ListMovieServlet - */ -public class ListMovieServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListMovieServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - - try { - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", - "root", "password"); - List movies = dao.getMovies(); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println(""); - out.println("

These are all the movies we have in our database..

"); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - - for (Movie aMovie : movies) { - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - } - out.println("
TitleGenreRelease DateRating
" + aMovie.getName() + "" + aMovie.getGenre() + "" + aMovie.getReleaseDate() + "" + aMovie.getRating() + "
"); - out.println(""); - out.println(""); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doPost(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/ServletMovieStore/src/com/training/java/servlet/moviestore/web/SaveMovie.jsp b/ServletMovieStore/src/com/training/java/servlet/moviestore/web/SaveMovie.jsp deleted file mode 100644 index e69de29..0000000 diff --git a/ServletMovieStoreAdvanced/.classpath b/ServletMovieStoreAdvanced/.classpath deleted file mode 100644 index 4a1837d..0000000 --- a/ServletMovieStoreAdvanced/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/ServletMovieStoreAdvanced/.project b/ServletMovieStoreAdvanced/.project deleted file mode 100644 index 439bf4e..0000000 --- a/ServletMovieStoreAdvanced/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - ServletMovieStoreAdvanced - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/ServletMovieStoreAdvanced/.settings/.jsdtscope b/ServletMovieStoreAdvanced/.settings/.jsdtscope deleted file mode 100644 index f40dd98..0000000 --- a/ServletMovieStoreAdvanced/.settings/.jsdtscope +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/ServletMovieStoreAdvanced/.settings/org.eclipse.jdt.core.prefs b/ServletMovieStoreAdvanced/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 713520d..0000000 --- a/ServletMovieStoreAdvanced/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Sat Sep 17 11:15:38 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.common.component b/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 1fb7dd0..0000000 --- a/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.common.project.facet.core.xml b/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 3d1d1d9..0000000 --- a/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.container b/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.name b/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/ServletMovieStoreAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/ServletMovieStoreAdvanced/WebContent/AddMovie.html b/ServletMovieStoreAdvanced/WebContent/AddMovie.html deleted file mode 100644 index a261045..0000000 --- a/ServletMovieStoreAdvanced/WebContent/AddMovie.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - -Insert title here - - - -
- - ID :
- Name :
- Rating :
- Genre :
- Checkout :
- - - -
- - - - - \ No newline at end of file diff --git a/ServletMovieStoreAdvanced/WebContent/META-INF/MANIFEST.MF b/ServletMovieStoreAdvanced/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/ServletMovieStoreAdvanced/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/ServletMovieStoreAdvanced/WebContent/SaveMovie.jsp b/ServletMovieStoreAdvanced/WebContent/SaveMovie.jsp deleted file mode 100644 index 476d773..0000000 --- a/ServletMovieStoreAdvanced/WebContent/SaveMovie.jsp +++ /dev/null @@ -1,88 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - -<%@page import="com.training.java.servlet.moviestore.domain.MovieDAO"%> -<%@page - import="com.training.java.servlet.moviestore.domain.MovieDAOJDBCImpl"%> -<%@page import="com.training.java.servlet.moviestore.domain.Movie"%> -<%@page import="java.util.List"%> -<%@page import="java.util.ArrayList"%> - - -Insert title here - - - -<% - Movie newMovie = (Movie) request.getAttribute("VenkatsMovie"); - - HttpSession mySession = request.getSession(); - - //If user comes for the first time - if (mySession.getAttribute("MovieCart") == null) - { - List movies = new ArrayList(); - movies.add(newMovie); - - session.setAttribute("MovieCart", movies); - } else - { - List movies = (List) session - .getAttribute("MovieCart"); - - for (Movie aMovie : movies) - { - System.out.println("Movie title = " + aMovie.getName()); - } - - movies.add(newMovie); - - session.setAttribute("MovieCart", movies); - } - - String checkout = request.getParameter("checkout"); - - if (checkout != null && checkout.equalsIgnoreCase("Y")) - { - String jdbcURL = getServletContext() - .getInitParameter("jdbcURL"); - String username = getServletContext().getInitParameter( - "username"); - String password = getServletContext().getInitParameter( - "password"); - - List moviesFromSession = (List) session - .getAttribute("MovieCart"); - MovieDAO dao = new MovieDAOJDBCImpl(jdbcURL, username, password); - - for (Movie aMovie : moviesFromSession) - { - dao.create(aMovie); - } -%> -

your details have been saved successfully in database

-<% - } else - { - List movies = (List) session - .getAttribute("MovieCart"); -%> - -

your movies have been added to cart..You can do the following..

-Number of movies you added so far to your cart is : -<%= movies.size()%> -<% - } -%> - -

Go back to Add Movie screenhere

- - - - - - - - \ No newline at end of file diff --git a/ServletMovieStoreAdvanced/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/ServletMovieStoreAdvanced/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/ServletMovieStoreAdvanced/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/ServletMovieStoreAdvanced/WebContent/WEB-INF/web.xml b/ServletMovieStoreAdvanced/WebContent/WEB-INF/web.xml deleted file mode 100644 index 036fe08..0000000 --- a/ServletMovieStoreAdvanced/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - MovieStore - - index.html - - - - ListMovieServlet - ListMovieServlet - com.training.java.servlet.moviestore.web.ListMovieServlet - - - numberOfMoviesToBeShown - 100 - - - - ListMovieServlet - /list - - - - AddMovieServlet - AddMovieServlet - com.training.java.servlet.moviestore.web.AddMovieServlet - - - AddMovieServlet - /add - - - - jdbcURL - jdbc:mysql://localhost/training - - - - username - root - - - - password - password - - - \ No newline at end of file diff --git a/ServletMovieStoreAdvanced/WebContent/index.html b/ServletMovieStoreAdvanced/WebContent/index.html deleted file mode 100644 index 6a02650..0000000 --- a/ServletMovieStoreAdvanced/WebContent/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - -Movie store - - - -

Welcome to my Movie store




- -
    -
  1. If you want to add a movie please click here
  2. -
  3. To see the movies in our database, please click here
  4. -
- - - - - \ No newline at end of file diff --git a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/Movie.java b/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/Movie.java deleted file mode 100644 index c2cf67c..0000000 --- a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/Movie.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.sql.Date; - -public class Movie -{ - private int id; - private String name; - private String rating; - private Date releaseDate; - private String genre; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getRating() - { - return rating; - } - - public void setRating(String rating) - { - this.rating = rating; - } - - public Date getReleaseDate() - { - return releaseDate; - } - - public void setReleaseDate(Date releaseDate) - { - this.releaseDate = releaseDate; - } - - public String getGenre() - { - return genre; - } - - public void setGenre(String genre) - { - this.genre = genre; - } -} diff --git a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAO.java b/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAO.java deleted file mode 100644 index 8a7aa8a..0000000 --- a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.util.List; - -public interface MovieDAO -{ - void create(Movie movie); - List getMovies(); -} diff --git a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java b/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java deleted file mode 100644 index 5bdb998..0000000 --- a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.util.List; - -public class MovieDAODemo -{ - /** - * @param args - */ - public static void main(String[] args) - { - /* - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - Movie aMovie = new Movie(); - aMovie.setId(2); - aMovie.setName("Speed2..CC"); - aMovie.setRating("PG-13"); - aMovie.setGenre("Thriller"); - aMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - dao.create(aMovie); - */ - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - List movies = dao.getMovies(); - for(Movie aMovie : movies) - { - System.out.println("Name = " + aMovie.getName()); - System.out.println("Rating = " + aMovie.getRating()); - System.out.println("Genre = " + aMovie.getGenre()); - System.out.println("Release date = " + aMovie.getReleaseDate()); - System.out.println("id = " + aMovie.getId()); - } - } - -} diff --git a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java b/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java deleted file mode 100644 index 3a6bc38..0000000 --- a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -public class MovieDAOException extends RuntimeException -{ - MovieDAOException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java b/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index b1a275d..0000000 --- a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class MovieDAOJDBCImpl implements MovieDAO -{ - private String dburl; - private String dbuser; - private String dbPassword; - - public MovieDAOJDBCImpl(String dburl, String dbuser, String dbPassWord) - { - this.dburl = dburl; - this.dbuser = dbuser; - this.dbPassword = dbPassWord; - } - - @Override - public void create(Movie movie) - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("insert into movie(id, genre, rating, release_date, name) values(?,?,?,?,?)"); - - stmt.setInt(1, movie.getId()); - stmt.setString(2, movie.getGenre()); - stmt.setString(3, movie.getRating()); - stmt.setDate(4, movie.getReleaseDate()); - stmt.setString(5, movie.getName()); - - stmt.executeUpdate(); - - } - catch(ClassNotFoundException e) - { - e.printStackTrace(); - } - catch (SQLException e) - { - throw new MovieDAOException(e.getMessage()); - } - } - - @Override - public List getMovies() - { - List movies = new ArrayList(); - - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("select * from movie"); - - ResultSet rs = stmt.executeQuery(); - - while(rs.next()) - { - Movie aMovie = new Movie(); - - aMovie.setId(rs.getInt("id")); - aMovie.setName(rs.getString("name")); - aMovie.setRating(rs.getString("rating")); - aMovie.setReleaseDate(rs.getDate("release_date")); - aMovie.setGenre(rs.getString("genre")); - - movies.add(aMovie); - } - } - catch(ClassNotFoundException ex) - { - ex.printStackTrace(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - - return movies; - } -} diff --git a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/web/AddMovieServlet.java b/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/web/AddMovieServlet.java deleted file mode 100644 index 74f825b..0000000 --- a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/web/AddMovieServlet.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.training.java.servlet.moviestore.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.Date; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.moviestore.domain.Movie; -import com.training.java.servlet.moviestore.domain.MovieDAO; -import com.training.java.servlet.moviestore.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class AddMovieServlet - */ -public class AddMovieServlet extends HttpServlet -{ - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public AddMovieServlet() - { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException - { - doPost(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doPost(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException - { - String id = request.getParameter("id"); - String name = request.getParameter("name"); - String rating = request.getParameter("rating"); - String genre = request.getParameter("genre"); - - Movie newMovie = new Movie(); - - newMovie.setId(Integer.parseInt(id)); - newMovie.setName(name); - newMovie.setGenre(genre); - newMovie.setRating(rating); - newMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - request.setAttribute("VenkatsMovie", newMovie); - - RequestDispatcher rd = request.getRequestDispatcher("SaveMovie.jsp"); - rd.forward(request, response); - } - -} diff --git a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/web/ListMovieServlet.java b/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/web/ListMovieServlet.java deleted file mode 100644 index 772d9a7..0000000 --- a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/web/ListMovieServlet.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.training.java.servlet.moviestore.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.moviestore.domain.Movie; -import com.training.java.servlet.moviestore.domain.MovieDAO; -import com.training.java.servlet.moviestore.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class ListMovieServlet - */ -public class ListMovieServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListMovieServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - - try { - - String jdbcURL = getServletContext().getInitParameter("jdbcURL"); - String username = getServletContext().getInitParameter("username"); - String password = getServletContext().getInitParameter("password"); - - MovieDAO dao = new MovieDAOJDBCImpl(jdbcURL, username, password); - List movies = dao.getMovies(); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println(""); - out.println("

These are all the movies we have in our database..

"); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - - String numberOfMoviesToBeShown = getServletConfig().getInitParameter("numberOfMoviesToBeShown"); - int maxNumberOfMovies = Integer.parseInt(numberOfMoviesToBeShown); - - System.out.println("maxNumberOfMovies from Servlet config = " + maxNumberOfMovies); - - if(movies.size() < maxNumberOfMovies) - { - maxNumberOfMovies = movies.size(); - } - - for(int i=0; i"); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - } - - out.println("
TitleGenreRelease DateRating
" + aMovie.getName() + "" + aMovie.getGenre() + "" + aMovie.getReleaseDate() + "" + aMovie.getRating() + "
"); - out.println(""); - out.println(""); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doPost(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/web/SaveMovie.jsp b/ServletMovieStoreAdvanced/src/com/training/java/servlet/moviestore/web/SaveMovie.jsp deleted file mode 100644 index e69de29..0000000 diff --git a/ServletStudents/.classpath b/ServletStudents/.classpath deleted file mode 100644 index 3c8c5d8..0000000 --- a/ServletStudents/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ServletStudents/.project b/ServletStudents/.project deleted file mode 100644 index 39ee7bf..0000000 --- a/ServletStudents/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - ServletStudents - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/ServletStudents/.settings/.jsdtscope b/ServletStudents/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/ServletStudents/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/ServletStudents/.settings/org.eclipse.jdt.core.prefs b/ServletStudents/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 1b21ee9..0000000 --- a/ServletStudents/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Tue Feb 07 18:46:41 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/ServletStudents/.settings/org.eclipse.wst.common.component b/ServletStudents/.settings/org.eclipse.wst.common.component deleted file mode 100644 index b1c88d6..0000000 --- a/ServletStudents/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ServletStudents/.settings/org.eclipse.wst.common.project.facet.core.xml b/ServletStudents/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 0873c6e..0000000 --- a/ServletStudents/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/ServletStudents/.settings/org.eclipse.wst.jsdt.ui.superType.container b/ServletStudents/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/ServletStudents/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/ServletStudents/.settings/org.eclipse.wst.jsdt.ui.superType.name b/ServletStudents/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/ServletStudents/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/ServletStudents/WebContent/META-INF/MANIFEST.MF b/ServletStudents/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/ServletStudents/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/ServletStudents/WebContent/WEB-INF/lib/junit-4.8.2.jar b/ServletStudents/WebContent/WEB-INF/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/ServletStudents/WebContent/WEB-INF/lib/junit-4.8.2.jar and /dev/null differ diff --git a/ServletStudents/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar b/ServletStudents/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar deleted file mode 100644 index cdee6a1..0000000 Binary files a/ServletStudents/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar and /dev/null differ diff --git a/ServletStudents/WebContent/WEB-INF/web.xml b/ServletStudents/WebContent/WEB-INF/web.xml deleted file mode 100644 index 7f6ab28..0000000 --- a/ServletStudents/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - ServletStudents - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - driverClassName - com.mysql.jdbc.Driver - - - jdbcURL - jdbc:mysql://localhost/training - - - username - root - - - password - password - - - - ListStudentsServlet - ListStudentsServlet - com.training.java.servlet.college.web.ListStudentsServlet - - - maxResults - 10 - - - - ListStudentsServlet - /list - - - - AddStudentServlet - AddStudentServlet - com.training.java.servlet.college.web.AddStudentServlet - - - AddStudentServlet - /add - - \ No newline at end of file diff --git a/ServletStudents/WebContent/index.html b/ServletStudents/WebContent/index.html deleted file mode 100644 index c9d2d8b..0000000 --- a/ServletStudents/WebContent/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - -Insert title here - - - -

Welcome to College!

- -For list of all students, please click here.
- -To add a new student, please click here.
- -Go to google, click here - - - \ No newline at end of file diff --git a/ServletStudents/WebContent/newstudent.html b/ServletStudents/WebContent/newstudent.html deleted file mode 100644 index 1e96b2a..0000000 --- a/ServletStudents/WebContent/newstudent.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -Insert title here - - - -
- - First Name :
- Last Name :
- Phone :
- Email :
- Age :
- City :
- Id :
- - - -
- - - - \ No newline at end of file diff --git a/ServletStudents/src/com/training/java/servlet/college/domain/DAOException.java b/ServletStudents/src/com/training/java/servlet/college/domain/DAOException.java deleted file mode 100644 index 653baf1..0000000 --- a/ServletStudents/src/com/training/java/servlet/college/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.servlet.college.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/ServletStudents/src/com/training/java/servlet/college/domain/Student.java b/ServletStudents/src/com/training/java/servlet/college/domain/Student.java deleted file mode 100644 index 07ef2f8..0000000 --- a/ServletStudents/src/com/training/java/servlet/college/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.servlet.college.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/ServletStudents/src/com/training/java/servlet/college/domain/StudentDAO.java b/ServletStudents/src/com/training/java/servlet/college/domain/StudentDAO.java deleted file mode 100644 index bb0280d..0000000 --- a/ServletStudents/src/com/training/java/servlet/college/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.servlet.college.domain; - -import java.util.List; - -public interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/ServletStudents/src/com/training/java/servlet/college/domain/StudentDAOJDBCImpl.java b/ServletStudents/src/com/training/java/servlet/college/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index ea5a6b6..0000000 --- a/ServletStudents/src/com/training/java/servlet/college/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.servlet.college.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/ServletStudents/src/com/training/java/servlet/college/domain/StudentDAOJDBCImplTest.java b/ServletStudents/src/com/training/java/servlet/college/domain/StudentDAOJDBCImplTest.java deleted file mode 100644 index 5fe92f6..0000000 --- a/ServletStudents/src/com/training/java/servlet/college/domain/StudentDAOJDBCImplTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.java.servlet.college.domain; - -import java.util.List; - -import org.junit.Ignore; -import org.junit.Test; - -public class StudentDAOJDBCImplTest { - - @Test - public void testGetAllStudents() { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - List students = dao.getAllStudents(); - - for(Student current : students) - { - System.out.println(current); - } - } - - @Ignore - public void testCreateStudent(){ - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - - Student student = new Student(); - student.setAge(20); - student.setCity("Sterling Heights"); - student.setEmail("priya@gmail.com"); - student.setFirstName("Priya"); - student.setId(7); - student.setLastName("Patel"); - student.setPhoneNumber("248-238-9874"); - - dao.create(student); - - //assert that your student is created - - //delete the student that you just created - } - -} diff --git a/ServletStudents/src/com/training/java/servlet/college/web/AddStudentServlet.java b/ServletStudents/src/com/training/java/servlet/college/web/AddStudentServlet.java deleted file mode 100644 index 7da517c..0000000 --- a/ServletStudents/src/com/training/java/servlet/college/web/AddStudentServlet.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.training.java.servlet.college.web; - -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.college.domain.Student; -import com.training.java.servlet.college.domain.StudentDAO; -import com.training.java.servlet.college.domain.StudentDAOJDBCImpl; - -/** - * Servlet implementation class AddStudentServlet - */ -public class AddStudentServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public AddStudentServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - doPost(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String phone = request.getParameter("phone"); - String email = request.getParameter("email"); - String age = request.getParameter("age"); - String city = request.getParameter("city"); - String id = request.getParameter("id"); - - //do the validation here - Student student = new Student(); - student.setFirstName(firstName); - student.setLastName(lastName); - student.setPhoneNumber(phone); - student.setEmail(email); - student.setAge(Integer.parseInt(age)); - student.setCity(city); - student.setId(Integer.parseInt(id)); - - String driverClassName = getServletContext().getInitParameter("driverClassName"); - String jdbcURL = getServletContext().getInitParameter("jdbcURL"); - String username = getServletContext().getInitParameter("username"); - String password = getServletContext().getInitParameter("password"); - - StudentDAO dao = new StudentDAOJDBCImpl(driverClassName, jdbcURL, username, password); - dao.create(student); - - PrintWriter out = response.getWriter(); - - out.print("

Your details have been saved successfully!"); - } - -} diff --git a/ServletStudents/src/com/training/java/servlet/college/web/ListStudentsServlet.java b/ServletStudents/src/com/training/java/servlet/college/web/ListStudentsServlet.java deleted file mode 100644 index 6664011..0000000 --- a/ServletStudents/src/com/training/java/servlet/college/web/ListStudentsServlet.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.training.java.servlet.college.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.college.domain.Student; -import com.training.java.servlet.college.domain.StudentDAO; -import com.training.java.servlet.college.domain.StudentDAOJDBCImpl; - -/** - * Servlet implementation class ListStudentsServlet - */ -public class ListStudentsServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListStudentsServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String maxResultsStr = getServletConfig().getInitParameter("maxResults"); - int maxResults = Integer.parseInt(maxResultsStr); - - String driverClassName = getServletContext().getInitParameter("driverClassName"); - String jdbcURL = getServletContext().getInitParameter("jdbcURL"); - String username = getServletContext().getInitParameter("username"); - String password = getServletContext().getInitParameter("password"); - - StudentDAO dao = new StudentDAOJDBCImpl(driverClassName, jdbcURL, username, password); - List students = dao.getAllStudents(); - - PrintWriter out = response.getWriter(); - - out.print(""); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - - for(int i=0; i"); - out.print(""); - out.print(""); - out.print(""); - out.print(""); - } - - out.print("
First NameLast NamePhone Number
" + current.getFirstName() + "" + current.getLastName() + "" + current.getPhoneNumber() + "
"); - out.print(""); - out.print(""); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/SpringAnnotations/.classpath b/SpringAnnotations/.classpath deleted file mode 100644 index 3ea250f..0000000 --- a/SpringAnnotations/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/SpringAnnotations/.project b/SpringAnnotations/.project deleted file mode 100644 index a087e92..0000000 --- a/SpringAnnotations/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - SpringAnnotations - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/SpringAnnotations/.settings/org.eclipse.jdt.core.prefs b/SpringAnnotations/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2a93a71..0000000 --- a/SpringAnnotations/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Sep 28 23:15:28 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/SpringAnnotations/.settings/org.maven.ide.eclipse.prefs b/SpringAnnotations/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index 2ce8dfa..0000000 --- a/SpringAnnotations/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Sep 28 23:15:28 EDT 2011 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/SpringAnnotations/pom.xml b/SpringAnnotations/pom.xml deleted file mode 100644 index d7884c6..0000000 --- a/SpringAnnotations/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - 4.0.0 - - com.apps - SpringAnnotations - 1.0 - jar - - SpringAnnotations - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 3.8.1 - test - - - org.springframework - spring-context - 3.0.6.RELEASE - - - diff --git a/SpringAnnotations/src/main/java/com/apps/SpringAnnotations/App.java b/SpringAnnotations/src/main/java/com/apps/SpringAnnotations/App.java deleted file mode 100644 index 8f15c9e..0000000 --- a/SpringAnnotations/src/main/java/com/apps/SpringAnnotations/App.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.apps.SpringAnnotations; - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} diff --git a/SpringAnnotations/src/main/java/com/training/java/spring/Boat.java b/SpringAnnotations/src/main/java/com/training/java/spring/Boat.java deleted file mode 100644 index 9a9a008..0000000 --- a/SpringAnnotations/src/main/java/com/training/java/spring/Boat.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Boat implements Vehicle -{ - public void accelerate() - { - System.out.println("Boat is accelerating"); - } - - public void applyBrakes() - { - System.out.println("Boat is applying brakes"); - } - - public void start() - { - System.out.println("Boat is starting"); - } - - public void stop() - { - System.out.println("Boat is stopping"); - } -} diff --git a/SpringAnnotations/src/main/java/com/training/java/spring/Car.java b/SpringAnnotations/src/main/java/com/training/java/spring/Car.java deleted file mode 100644 index 1fa8747..0000000 --- a/SpringAnnotations/src/main/java/com/training/java/spring/Car.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Car implements Vehicle -{ - - public void accelerate() - { - System.out.println("Car is accelerating"); - } - - public void applyBrakes() - { - System.out.println("Car is applying brakes"); - } - - public void start() - { - System.out.println("Car is starting"); - } - - public void stop() - { - System.out.println("Car is stopping"); - } -} diff --git a/SpringAnnotations/src/main/java/com/training/java/spring/DummyVehicle.java b/SpringAnnotations/src/main/java/com/training/java/spring/DummyVehicle.java deleted file mode 100644 index 0080952..0000000 --- a/SpringAnnotations/src/main/java/com/training/java/spring/DummyVehicle.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.spring; - -public class DummyVehicle implements Vehicle -{ - - public void accelerate() - { - System.out.println("Dummy vehicle is accelerating.."); - } - - public void applyBrakes() - { - // TODO Auto-generated method stub - - } - - public void start() - { - // TODO Auto-generated method stub - - } - - public void stop() - { - // TODO Auto-generated method stub - - } - -} diff --git a/SpringAnnotations/src/main/java/com/training/java/spring/Luggage.java b/SpringAnnotations/src/main/java/com/training/java/spring/Luggage.java deleted file mode 100644 index 157388d..0000000 --- a/SpringAnnotations/src/main/java/com/training/java/spring/Luggage.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.java.spring; - -public interface Luggage -{ - String getCompanyName(); - -} diff --git a/SpringAnnotations/src/main/java/com/training/java/spring/SuiteCase.java b/SpringAnnotations/src/main/java/com/training/java/spring/SuiteCase.java deleted file mode 100644 index b298cdc..0000000 --- a/SpringAnnotations/src/main/java/com/training/java/spring/SuiteCase.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.spring; - -import org.springframework.stereotype.Component; - -@Component -public class SuiteCase implements Luggage -{ - - public String getCompanyName() - { - return "VIP"; - } - -} diff --git a/SpringAnnotations/src/main/java/com/training/java/spring/Traveller.java b/SpringAnnotations/src/main/java/com/training/java/spring/Traveller.java deleted file mode 100644 index 6a5bb93..0000000 --- a/SpringAnnotations/src/main/java/com/training/java/spring/Traveller.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.training.java.spring; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -public class Traveller -{ - private Vehicle v; - private Luggage l; - - @Autowired - public Traveller(@Qualifier("car") Vehicle v, Luggage l) - { - this.v = v; - this.l = l; - } - - public void travel() - { - System.out.println("started travelling with " + l.getCompanyName()); - v.start(); - v.accelerate(); - v.applyBrakes(); - v.stop(); - System.out.println("Done with travelling"); - } - - /* Use this for setter injection - public void setVehicle(Vehicle v) - { - this.v = v; - } - */ -} diff --git a/SpringAnnotations/src/main/java/com/training/java/spring/TravellerDemo.java b/SpringAnnotations/src/main/java/com/training/java/spring/TravellerDemo.java deleted file mode 100644 index fdab934..0000000 --- a/SpringAnnotations/src/main/java/com/training/java/spring/TravellerDemo.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.spring; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class TravellerDemo -{ - - /** - * @param args - */ - public static void main(String[] args) - { - /* Dependency Injection by hand - Vehicle v = new Boat(); - Traveller t = new Traveller(v); - //t.setVehicle(v); - - t.travel(); - */ - - BeanFactory factory = new ClassPathXmlApplicationContext("spring-config.xml"); - - Traveller traveller = (Traveller) factory.getBean("traveller"); - traveller.travel(); - } - -} diff --git a/SpringAnnotations/src/main/java/com/training/java/spring/Vehicle.java b/SpringAnnotations/src/main/java/com/training/java/spring/Vehicle.java deleted file mode 100644 index 920bdec..0000000 --- a/SpringAnnotations/src/main/java/com/training/java/spring/Vehicle.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.spring; - -public interface Vehicle -{ - void start(); - void accelerate(); - void applyBrakes(); - void stop(); -} diff --git a/SpringAnnotations/src/main/resources/spring-config.xml b/SpringAnnotations/src/main/resources/spring-config.xml deleted file mode 100644 index c492a71..0000000 --- a/SpringAnnotations/src/main/resources/spring-config.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/SpringAnnotations/src/test/java/com/apps/SpringAnnotations/AppTest.java b/SpringAnnotations/src/test/java/com/apps/SpringAnnotations/AppTest.java deleted file mode 100644 index f5dd834..0000000 --- a/SpringAnnotations/src/test/java/com/apps/SpringAnnotations/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.apps.SpringAnnotations; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/SpringCellStore/.classpath b/SpringCellStore/.classpath deleted file mode 100644 index 76d716f..0000000 --- a/SpringCellStore/.classpath +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/SpringCellStore/.project b/SpringCellStore/.project deleted file mode 100644 index 9fc8e20..0000000 --- a/SpringCellStore/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - SpringCellStore - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/SpringCellStore/.settings/.jsdtscope b/SpringCellStore/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/SpringCellStore/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/SpringCellStore/.settings/org.eclipse.jdt.core.prefs b/SpringCellStore/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 9f55be4..0000000 --- a/SpringCellStore/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sat Oct 01 14:53:50 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/SpringCellStore/.settings/org.eclipse.wst.common.component b/SpringCellStore/.settings/org.eclipse.wst.common.component deleted file mode 100644 index b19db8b..0000000 --- a/SpringCellStore/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/SpringCellStore/.settings/org.eclipse.wst.common.project.facet.core.xml b/SpringCellStore/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 6f361dd..0000000 --- a/SpringCellStore/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/SpringCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.container b/SpringCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/SpringCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/SpringCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.name b/SpringCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/SpringCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/SpringCellStore/.settings/org.maven.ide.eclipse.prefs b/SpringCellStore/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index eb85a57..0000000 --- a/SpringCellStore/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sat Oct 01 13:01:14 EDT 2011 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/SpringCellStore/.springBeans b/SpringCellStore/.springBeans deleted file mode 100644 index dd3589a..0000000 --- a/SpringCellStore/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/cellphone-config.xml - - - - diff --git a/SpringCellStore/pom.xml b/SpringCellStore/pom.xml deleted file mode 100644 index 993ffb9..0000000 --- a/SpringCellStore/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - com.rajashree - RajSpringCellStore - 1.0 - war - - - - - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - - - - junit - junit - 4.9 - - - org.springframework - spring-context - 3.0.6.RELEASE - - - org.springframework - spring-web - 3.0.6.RELEASE - - - mysql - mysql-connector-java - 5.1.17 - - - struts - struts - 1.2.9 - - - javax.servlet - servlet-api - 2.5 - - - \ No newline at end of file diff --git a/SpringCellStore/src/main/java/com/training/cellstore/domain/Cellphone.java b/SpringCellStore/src/main/java/com/training/cellstore/domain/Cellphone.java deleted file mode 100644 index 506a0f6..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/domain/Cellphone.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.cellstore.domain; - -public class Cellphone { - - private int cellid; - private String cellCompanyname; - private String model; - private float price; - public int getCellid() { - return cellid; - } - public void setCellid(int cellid) { - this.cellid = cellid; - } - public String getCellCompanyname() { - return cellCompanyname; - } - public void setCellCompanyname(String cellCompanyname) { - this.cellCompanyname = cellCompanyname; - } - public String getModel() { - return model; - } - public void setModel(String model) { - this.model = model; - } - public float getPrice() { - return price; - } - public void setPrice(float price) { - this.price = price; - } - - -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/domain/CellphoneDAO.java b/SpringCellStore/src/main/java/com/training/cellstore/domain/CellphoneDAO.java deleted file mode 100644 index 17549d6..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/domain/CellphoneDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.cellstore.domain; - -import java.util.List; - -public interface CellphoneDAO { - - void create(Cellphone cp); - - List getcellphones(); - - void Update(Cellphone cp); - Cellphone findByPrimaryKey(int cellid); - void delete(int cellid); - - - -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/domain/CellphoneDAOException.java b/SpringCellStore/src/main/java/com/training/cellstore/domain/CellphoneDAOException.java deleted file mode 100644 index 7031b24..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/domain/CellphoneDAOException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.cellstore.domain; - -public class CellphoneDAOException extends RuntimeException { - - public CellphoneDAOException(String message) - { - super(message); - } -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/domain/CellphoneDAOJDBCImpl.java b/SpringCellStore/src/main/java/com/training/cellstore/domain/CellphoneDAOJDBCImpl.java deleted file mode 100644 index ae2161b..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/domain/CellphoneDAOJDBCImpl.java +++ /dev/null @@ -1,289 +0,0 @@ -package com.training.cellstore.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - - - - - -public class CellphoneDAOJDBCImpl implements CellphoneDAO { - - - private String dbUrl; - private String dbUsername; - private String dbPassword; - - //constructor - public CellphoneDAOJDBCImpl(String dbUrl, String dbUsername, - String dbPassword) { - super(); - this.dbUrl = dbUrl; - this.dbUsername = dbUsername; - this.dbPassword = dbPassword; - } - - private Connection getConnection() throws ClassNotFoundException, SQLException - { - Class.forName("com.mysql.jdbc.Driver"); - System.out.println("Driver is loaded"); - //Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dbUrl, dbUsername, dbPassword); - return con; - } - - @Override - public void create(Cellphone cp) throws CellphoneDAOException { - // TODO Auto-generated method stub - - Connection con=null; - PreparedStatement stmt=null; - try - { - con=getConnection(); - stmt=con.prepareStatement("insert into cellphone(cellid,cellCompanyname,model, price) values (?,?,?,?)"); - stmt.setInt(1,cp.getCellid()); - stmt.setString(2, cp.getCellCompanyname()); - stmt.setString(3, cp.getModel()); - stmt.setFloat(4,cp.getPrice()); - - int rowsAffected=stmt.executeUpdate(); - - if (rowsAffected !=1) - { - System.out.println("Error occured while updating the record"); - } - } - catch (SQLException e) - { - e.printStackTrace(); - } - catch (ClassNotFoundException e) - { - e.printStackTrace(); - } - catch(CellphoneDAOException e1) - { - e1.printStackTrace(); - } - finally - { - if(stmt != null) - try - { - stmt.close(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - if(con !=null) - try - { - con.close(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - } - } - - - //method to getcellphones from db - - public List getcellphones() - { - Connection con =null; - PreparedStatement stmt=null; - ResultSet rs=null; - - List cellphones= new ArrayList(); - try - { - con=getConnection(); - stmt= con.prepareStatement("select * from cellphone"); - rs= stmt.executeQuery(); - - while (rs.next()) - { - Cellphone acp=new Cellphone(); - acp.setCellid(rs.getInt("cellid")); - acp.setCellCompanyname(rs.getString("cellCompanyname")); - acp.setModel(rs.getString("model")); - acp.setPrice(rs.getFloat("price")); - cellphones.add(acp); - } - } - catch(SQLException e) - { e.printStackTrace(); } - catch(ClassNotFoundException e) - { e.printStackTrace(); } - /*finally - { - if (stmt != null) - try - { stmt.close(); } - catch (SQLException e) - { e.printStackTrace(); } - }*/ - return cellphones; - } - - - - - - @Override - public Cellphone findByPrimaryKey(int cellid) { - // TODO Auto-generated method stub - Cellphone a1=null; - Connection con=null; - PreparedStatement stmt=null; - try - { - con=getConnection(); - stmt= con.prepareStatement("Select * from cellphone where cellid =?"); - stmt.setInt(1,cellid); - ResultSet rs=stmt.executeQuery(); - - while(rs.next()) - { - a1=new Cellphone(); - a1.setCellid(rs.getInt("cellid")); - a1.setCellCompanyname(rs.getString("cellCompanyname")); - a1.setModel(rs.getString("model")); - a1.setPrice(rs.getFloat("price")); - - } - - } - catch(SQLException e) - { e.printStackTrace(); } - catch(ClassNotFoundException e) - { e.printStackTrace(); } - /*finally - { - if (stmt != null) - try - { stmt.close(); } - catch (SQLException e) - { e.printStackTrace(); } - }*/ - return a1; - } - - @Override - public void Update(Cellphone cp) { - // TODO Auto-generated method stub - Connection con=null; - PreparedStatement stmt = null; - ResultSet rs= null; - try - { - con=getConnection(); - stmt=con.prepareStatement("update cellphone set cellCompanyname=?," +"model=?," +"price=?"+ "where cellid=?" ); - - stmt.setString(1,cp.getCellCompanyname()); - stmt.setString(2,cp.getModel()); - stmt.setFloat(3,cp.getPrice()); - stmt.setInt(4, cp.getCellid()); - - int noOfRowsAffected=stmt.executeUpdate(); - - if (noOfRowsAffected !=1) - { - throw new CellphoneDAOException("Error has occured while updating record."); - } - } - catch(SQLException e) - { - e.printStackTrace(); - } - catch(ClassNotFoundException e) - { - e.printStackTrace(); - } - finally - { - if (stmt !=null) - try - { stmt.close(); } - catch(SQLException e) - { e.printStackTrace(); } - if (con !=null) - try - { con.close(); } - catch(SQLException e) - { e.printStackTrace(); } - } - - }//end of update method. - - - //Method to delete record from - - public void delete(int cellid) - { - Connection con=null; - PreparedStatement stmt=null; - - try - { - con=getConnection(); - stmt=con.prepareStatement("delete from cellphone where cellid= ?"); - stmt.setInt(1, cellid); - - int noOfRowsAffected=stmt.executeUpdate(); - if (noOfRowsAffected != 1) { - throw new CellphoneDAOException("Error has occured while deleting the record"); - } - } - catch(SQLException e) - { - e.printStackTrace(); - } - catch(ClassNotFoundException e) - { - e.printStackTrace(); - } - finally - { - if (stmt !=null) - try - { stmt.close(); } - catch(SQLException e) - { e.printStackTrace(); } - if (con !=null) - try - { con.close(); } - catch(SQLException e) - { e.printStackTrace(); } - } - - }//end of delete method. - -} - - - - - - - - - - - - - - - - - - diff --git a/SpringCellStore/src/main/java/com/training/cellstore/service/CellPhoneService.java b/SpringCellStore/src/main/java/com/training/cellstore/service/CellPhoneService.java deleted file mode 100644 index 869950b..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/service/CellPhoneService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.cellstore.service; - -import java.util.List; - -import com.training.cellstore.domain.Cellphone; - -public interface CellPhoneService { - - void create(Cellphone cp); - Cellphone getByCellPhoneId(int cellid); - List getcellphones(); - -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/service/CellPhoneServiceImpl.java b/SpringCellStore/src/main/java/com/training/cellstore/service/CellPhoneServiceImpl.java deleted file mode 100644 index c4dcf42..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/service/CellPhoneServiceImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.training.cellstore.service; - -import java.util.List; - -import com.training.cellstore.domain.Cellphone; -import com.training.cellstore.domain.CellphoneDAO; - -public class CellPhoneServiceImpl implements CellPhoneService { - - private CellphoneDAO dao; - - @Override - public void create(Cellphone cp) { - System.out.println("Inside create method of Service impl"); - dao.create(cp); - } - - @Override - public Cellphone getByCellPhoneId(int cellid) - { - System.out.println("Inside getByCellPhoneId method of Service impl"); - return dao.findByPrimaryKey(cellid); - } - - public CellphoneDAO getDao() { - return dao; - } - - public void setDao(CellphoneDAO dao) { - this.dao = dao; - } - - @Override - public List getcellphones() { - System.out.println("Inside getcellphones method of Service impl"); - return dao.getcellphones(); - } - -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/web/AddCellphoneAction.java b/SpringCellStore/src/main/java/com/training/cellstore/web/AddCellphoneAction.java deleted file mode 100644 index 70d73c4..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/web/AddCellphoneAction.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.cellstore.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddCellphoneAction extends Action { - - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - // TODO Auto-generated method stub - return mapping.findForward("addCellphone"); - } - -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/web/CellphoneStore.properties b/SpringCellStore/src/main/java/com/training/cellstore/web/CellphoneStore.properties deleted file mode 100644 index bae7cca..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/web/CellphoneStore.properties +++ /dev/null @@ -1,10 +0,0 @@ -errors.header=

Validation Errors

    -errors.footer=
-errors.prefix=
  • -errors.suffix=
  • - -cellid.required=Cell Id is required -cellCompanyname.required=Company Name is required -cellCompanynamelength.exceed= Cell Company Name exceeds the max limit ie 30 chars. -model.required=Model is required -price.required=Price is required \ No newline at end of file diff --git a/SpringCellStore/src/main/java/com/training/cellstore/web/EditCellphoneAction.java b/SpringCellStore/src/main/java/com/training/cellstore/web/EditCellphoneAction.java deleted file mode 100644 index 9dbf05f..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/web/EditCellphoneAction.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.training.cellstore.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.cellstore.domain.Cellphone; -import com.training.cellstore.domain.CellphoneDAO; -import com.training.cellstore.domain.CellphoneDAOJDBCImpl; - -public class EditCellphoneAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - String id = request.getParameter("id"); - - CellphoneDAO dao= new CellphoneDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "rajashri"); - Cellphone cellPhoneToEdit = dao.findByPrimaryKey(Integer.parseInt(id)); - - cellphoneform cellphForm = (cellphoneform) form; - - cellphForm.setCellCompanyname(cellPhoneToEdit.getCellCompanyname()); - cellphForm.setCellid(cellPhoneToEdit.getCellid()); - cellphForm.setModel(cellPhoneToEdit.getModel()); - cellphForm.setPrice(cellPhoneToEdit.getPrice()); - - return mapping.findForward("editCellphone"); - } - -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/web/ListCellphoneAction.java b/SpringCellStore/src/main/java/com/training/cellstore/web/ListCellphoneAction.java deleted file mode 100644 index 8b8a494..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/web/ListCellphoneAction.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.training.cellstore.web; - -import java.util.List; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.cellstore.domain.Cellphone; -import com.training.cellstore.service.CellPhoneService; - -public class ListCellphoneAction extends Action { - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - - ServletContext servletContext = servlet.getServletContext(); - WebApplicationContext webAppContext = WebApplicationContextUtils - .getWebApplicationContext(servletContext); - CellPhoneService service = webAppContext.getBean(CellPhoneService.class); - - List cellphones = service.getcellphones(); - - request.setAttribute("RajCellphones", cellphones); - - return mapping.findForward("listCellphones"); - } - -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/web/SaveCellphoneAction.java b/SpringCellStore/src/main/java/com/training/cellstore/web/SaveCellphoneAction.java deleted file mode 100644 index 07d005f..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/web/SaveCellphoneAction.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.cellstore.web; - -import javax.servlet.ServletContext; - -import org.apache.struts.action.Action; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.cellstore.domain.Cellphone; -import com.training.cellstore.service.CellPhoneService; - -public class SaveCellphoneAction extends Action { - public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception { - - cellphoneform acellphform = (cellphoneform) form; - - System.out.println("CellId: " +acellphform.getCellid()); - System.out.println("Cell Companyname: " +acellphform.getCellCompanyname()); - System.out.println("Model: " +acellphform.getModel()); - System.out.println("Price: " +acellphform.getPrice()); - - Cellphone bcph= new Cellphone(); - - bcph.setCellid(acellphform.getCellid()); - bcph.setCellCompanyname(acellphform.getCellCompanyname()); - bcph.setModel(acellphform.getModel()); - bcph.setPrice(acellphform.getPrice()); - - ServletContext servletContext = servlet.getServletContext(); - WebApplicationContext webAppContext = WebApplicationContextUtils - .getWebApplicationContext(servletContext); - CellPhoneService service = webAppContext.getBean(CellPhoneService.class); - - service.create(bcph); - - return mapping.findForward("acknowledgement"); - }; -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/web/SaveUpdateCellphoneAction.java b/SpringCellStore/src/main/java/com/training/cellstore/web/SaveUpdateCellphoneAction.java deleted file mode 100644 index db99192..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/web/SaveUpdateCellphoneAction.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.cellstore.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.cellstore.domain.Cellphone; -import com.training.cellstore.domain.CellphoneDAO; -import com.training.cellstore.domain.CellphoneDAOJDBCImpl; - -public class SaveUpdateCellphoneAction extends Action { - - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - cellphoneform acellphform = (cellphoneform) form; - - System.out.println("CellId: " +acellphform.getCellid()); - System.out.println("Cell Companyname: " +acellphform.getCellCompanyname()); - System.out.println("Model: " +acellphform.getModel()); - System.out.println("Price: " +acellphform.getPrice()); - - Cellphone bcph= new Cellphone(); - - bcph.setCellid(acellphform.getCellid()); - bcph.setCellCompanyname(acellphform.getCellCompanyname()); - bcph.setModel(acellphform.getModel()); - bcph.setPrice(acellphform.getPrice()); - - CellphoneDAO dao= new CellphoneDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "rajashri"); - dao.Update(bcph); - - return mapping.findForward("acknowledgement"); - - } - -} diff --git a/SpringCellStore/src/main/java/com/training/cellstore/web/cellphoneform.java b/SpringCellStore/src/main/java/com/training/cellstore/web/cellphoneform.java deleted file mode 100644 index 1f492d9..0000000 --- a/SpringCellStore/src/main/java/com/training/cellstore/web/cellphoneform.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.training.cellstore.web; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class cellphoneform extends ActionForm { - private int cellid; - private String cellCompanyname; - private String model; - private float price; - - public int getCellid() { - return cellid; - } - public void setCellid(int cellid) { - this.cellid = cellid; - } - public String getCellCompanyname() { - return cellCompanyname; - } - public void setCellCompanyname(String cellCompanyname) { - this.cellCompanyname = cellCompanyname; - } - public String getModel() { - return model; - } - public void setModel(String model) { - this.model = model; - } - public float getPrice() { - return price; - } - public void setPrice(float price) { - this.price = price; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { - // TODO Auto-generated method stub - ActionErrors errors = new ActionErrors(); - - if(cellid == 0) - { - errors.add("cellid", new ActionMessage("cellid.required")); - } - if(cellCompanyname == null || cellCompanyname.trim().equals("")) - { - errors.add("cellCompanyname", new ActionMessage("cellCompanyname.required")); - } - - if(cellCompanyname.length() > 30) - { - errors.add("cellCompanyname", new ActionMessage("cellCompanynamelength.exceed")); - } - - if (model == null || model.trim().equals("")) - { - errors.add("model", new ActionMessage("model.required")); - } - if(price == 0) - { - errors.add("price", new ActionMessage("price.required")); - } - - return errors; - } -} diff --git a/SpringCellStore/src/main/resources/cellphone-config.xml b/SpringCellStore/src/main/resources/cellphone-config.xml deleted file mode 100644 index c897e37..0000000 --- a/SpringCellStore/src/main/resources/cellphone-config.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/SpringCellStore/src/main/webapp/META-INF/MANIFEST.MF b/SpringCellStore/src/main/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/SpringCellStore/src/main/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/SpringCellStore/src/main/webapp/WEB-INF/Cellph-struts-config.xml b/SpringCellStore/src/main/webapp/WEB-INF/Cellph-struts-config.xml deleted file mode 100644 index ecc4e5b..0000000 --- a/SpringCellStore/src/main/webapp/WEB-INF/Cellph-struts-config.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SpringCellStore/src/main/webapp/WEB-INF/jsp/Acknowledgement.jsp b/SpringCellStore/src/main/webapp/WEB-INF/jsp/Acknowledgement.jsp deleted file mode 100644 index 18a3e97..0000000 --- a/SpringCellStore/src/main/webapp/WEB-INF/jsp/Acknowledgement.jsp +++ /dev/null @@ -1 +0,0 @@ -

    Your data is added successfully.

    \ No newline at end of file diff --git a/SpringCellStore/src/main/webapp/WEB-INF/jsp/AddCellphones.jsp b/SpringCellStore/src/main/webapp/WEB-INF/jsp/AddCellphones.jsp deleted file mode 100644 index ad3556d..0000000 --- a/SpringCellStore/src/main/webapp/WEB-INF/jsp/AddCellphones.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - - - - - -

    Please enter the details and click Submit.

    - -Cell Id :
    -Cell Companyname:
    -Model :
    -Price :
    - - - -
    \ No newline at end of file diff --git a/SpringCellStore/src/main/webapp/WEB-INF/jsp/EditCellphones.jsp b/SpringCellStore/src/main/webapp/WEB-INF/jsp/EditCellphones.jsp deleted file mode 100644 index b512ee2..0000000 --- a/SpringCellStore/src/main/webapp/WEB-INF/jsp/EditCellphones.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - -

    Please edit the details and click Submit.

    - -Cell Id :
    -Cell Companyname:
    -Model :
    -Price :
    - - - -
    \ No newline at end of file diff --git a/SpringCellStore/src/main/webapp/WEB-INF/jsp/ListCellphones.jsp b/SpringCellStore/src/main/webapp/WEB-INF/jsp/ListCellphones.jsp deleted file mode 100644 index 04b33e7..0000000 --- a/SpringCellStore/src/main/webapp/WEB-INF/jsp/ListCellphones.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@page language="java"%> - -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - - - - - - - - - - - - - - - -
    Cell IdCompanyNameModelPrice Action




    "> click -
    diff --git a/SpringCellStore/src/main/webapp/WEB-INF/web.xml b/SpringCellStore/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index f2bcb12..0000000 --- a/SpringCellStore/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - Raj-CellphonestoreStruts - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - action - org.apache.struts.action.ActionServlet - - config - /WEB-INF/Cellph-struts-config.xml - - 1 - - - action - *.do - - - - AddCellphoneAction - AddCellphoneAction - com.training.cellstore.web.AddCellphoneAction - - - AddCellphoneAction - /AddCellphoneAction - - - contextConfigLocation - classpath:cellphone-config.xml - - - org.springframework.web.context.ContextLoaderListener - - \ No newline at end of file diff --git a/SpringCellStore/src/main/webapp/index.html b/SpringCellStore/src/main/webapp/index.html deleted file mode 100644 index 71e47f1..0000000 --- a/SpringCellStore/src/main/webapp/index.html +++ /dev/null @@ -1,7 +0,0 @@ -

    Welcome to Movie Store

    - -
      -
    1. List of cellphones : list
    2. -
    3. Add a cellphone : add
    4. - -
    \ No newline at end of file diff --git a/SpringCellStore/src/test/java/com/training/cellstore/service/CellPhoneServiceTest.java b/SpringCellStore/src/test/java/com/training/cellstore/service/CellPhoneServiceTest.java deleted file mode 100644 index f348283..0000000 --- a/SpringCellStore/src/test/java/com/training/cellstore/service/CellPhoneServiceTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.training.cellstore.service; - -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.training.cellstore.domain.Cellphone; - -public class CellPhoneServiceTest { - - - @Test - public void testAddCellPhone() throws Exception { - -/* BeanFactory factory = new ClassPathXmlApplicationContext("cellphone-config.xml"); - CellPhoneService service = factory.getBean(CellPhoneService.class); - - Cellphone cp = new Cellphone(); - - cp.setCellCompanyname("Nokia"); - cp.setCellid(150); - cp.setModel("N-91"); - cp.setPrice(421.23f); - - service.create(cp); - - Cellphone newlyCreatedCellPhone = service.getByCellPhoneId(150); - - Assert.assertNotNull("Newly created cell can't be null", newlyCreatedCellPhone); - Assert.assertEquals(150, newlyCreatedCellPhone.getCellid()); - Assert.assertEquals("N-91", newlyCreatedCellPhone.getModel()); - Assert.assertEquals("Nokia", newlyCreatedCellPhone.getCellCompanyname()); -*/ } - -} diff --git a/SpringCellStore/target/RajSpringCellStore-1.0.war b/SpringCellStore/target/RajSpringCellStore-1.0.war deleted file mode 100644 index 5ddcc53..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0.war and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/META-INF/MANIFEST.MF b/SpringCellStore/target/RajSpringCellStore-1.0/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/SpringCellStore/target/RajSpringCellStore-1.0/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/Cellph-struts-config.xml b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/Cellph-struts-config.xml deleted file mode 100644 index ecc4e5b..0000000 --- a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/Cellph-struts-config.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/cellphone-config.xml b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/cellphone-config.xml deleted file mode 100644 index c897e37..0000000 --- a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/cellphone-config.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/Cellphone.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/Cellphone.class deleted file mode 100644 index f42218c..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/Cellphone.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/CellphoneDAO.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/CellphoneDAO.class deleted file mode 100644 index 9208bd3..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/CellphoneDAO.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/CellphoneDAOException.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/CellphoneDAOException.class deleted file mode 100644 index 460b20b..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/CellphoneDAOException.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/CellphoneDAOJDBCImpl.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/CellphoneDAOJDBCImpl.class deleted file mode 100644 index 94ca79a..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/domain/CellphoneDAOJDBCImpl.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/service/CellPhoneService.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/service/CellPhoneService.class deleted file mode 100644 index da57531..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/service/CellPhoneService.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/service/CellPhoneServiceImpl.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/service/CellPhoneServiceImpl.class deleted file mode 100644 index d1612c0..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/service/CellPhoneServiceImpl.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/AddCellphoneAction.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/AddCellphoneAction.class deleted file mode 100644 index 3500bda..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/AddCellphoneAction.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/EditCellphoneAction.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/EditCellphoneAction.class deleted file mode 100644 index ac85889..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/EditCellphoneAction.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/ListCellphoneAction.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/ListCellphoneAction.class deleted file mode 100644 index 94a90bf..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/ListCellphoneAction.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/SaveCellphoneAction.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/SaveCellphoneAction.class deleted file mode 100644 index 7c1bc6f..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/SaveCellphoneAction.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/SaveUpdateCellphoneAction.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/SaveUpdateCellphoneAction.class deleted file mode 100644 index be16832..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/SaveUpdateCellphoneAction.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/cellphoneform.class b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/cellphoneform.class deleted file mode 100644 index 7485703..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/classes/com/training/cellstore/web/cellphoneform.class and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/Acknowledgement.jsp b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/Acknowledgement.jsp deleted file mode 100644 index 18a3e97..0000000 --- a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/Acknowledgement.jsp +++ /dev/null @@ -1 +0,0 @@ -

    Your data is added successfully.

    \ No newline at end of file diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/AddCellphones.jsp b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/AddCellphones.jsp deleted file mode 100644 index ad3556d..0000000 --- a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/AddCellphones.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - - - - - -

    Please enter the details and click Submit.

    - -Cell Id :
    -Cell Companyname:
    -Model :
    -Price :
    - - - -
    \ No newline at end of file diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/EditCellphones.jsp b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/EditCellphones.jsp deleted file mode 100644 index b512ee2..0000000 --- a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/EditCellphones.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - -

    Please edit the details and click Submit.

    - -Cell Id :
    -Cell Companyname:
    -Model :
    -Price :
    - - - -
    \ No newline at end of file diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/ListCellphones.jsp b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/ListCellphones.jsp deleted file mode 100644 index 04b33e7..0000000 --- a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/jsp/ListCellphones.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@page language="java"%> - -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - - - - - - - - - - - - - - - -
    Cell IdCompanyNameModelPrice Action




    "> click -
    diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/antlr-2.7.2.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/aopalliance-1.0.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/aopalliance-1.0.jar deleted file mode 100644 index 578b1a0..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/aopalliance-1.0.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-beanutils-1.7.0.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-beanutils-1.7.0.jar deleted file mode 100644 index b1b89c9..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-beanutils-1.7.0.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-collections-2.1.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-collections-2.1.jar deleted file mode 100644 index f66c6d2..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-collections-2.1.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-digester-1.6.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-digester-1.6.jar deleted file mode 100644 index 9765493..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-digester-1.6.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-fileupload-1.0.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-fileupload-1.0.jar deleted file mode 100644 index 1ca4a9c..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-fileupload-1.0.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-logging-1.0.4.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-validator-1.1.4.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-validator-1.1.4.jar deleted file mode 100644 index bf76e86..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/commons-validator-1.1.4.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/hamcrest-core-1.1.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/hamcrest-core-1.1.jar deleted file mode 100644 index e5149be..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/hamcrest-core-1.1.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/junit-4.9.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/junit-4.9.jar deleted file mode 100644 index 1420815..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/junit-4.9.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/mysql-connector-java-5.1.17.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/mysql-connector-java-5.1.17.jar deleted file mode 100644 index 026dc39..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/mysql-connector-java-5.1.17.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/oro-2.0.7.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/oro-2.0.7.jar deleted file mode 100644 index ed6c60a..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/oro-2.0.7.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/servlet-api-2.5.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/servlet-api-2.5.jar deleted file mode 100644 index fb52493..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/servlet-api-2.5.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar deleted file mode 100644 index 37206d3..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-asm-3.0.6.RELEASE.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-asm-3.0.6.RELEASE.jar deleted file mode 100644 index be6a913..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-asm-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-beans-3.0.6.RELEASE.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-beans-3.0.6.RELEASE.jar deleted file mode 100644 index c4bc850..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-beans-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-context-3.0.6.RELEASE.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-context-3.0.6.RELEASE.jar deleted file mode 100644 index 57f7570..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-context-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-core-3.0.6.RELEASE.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-core-3.0.6.RELEASE.jar deleted file mode 100644 index c65358d..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-core-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-expression-3.0.6.RELEASE.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-expression-3.0.6.RELEASE.jar deleted file mode 100644 index 4064858..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-expression-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-web-3.0.6.RELEASE.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-web-3.0.6.RELEASE.jar deleted file mode 100644 index 761578b..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/spring-web-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/struts-1.2.9.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/struts-1.2.9.jar deleted file mode 100644 index 7815901..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/struts-1.2.9.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/xalan-2.5.1.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/xalan-2.5.1.jar deleted file mode 100644 index 44d4d09..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/xalan-2.5.1.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/xml-apis-1.0.b2.jar b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/xml-apis-1.0.b2.jar deleted file mode 100644 index ad33a5a..0000000 Binary files a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/lib/xml-apis-1.0.b2.jar and /dev/null differ diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/web.xml b/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/web.xml deleted file mode 100644 index 9f6c0d6..0000000 --- a/SpringCellStore/target/RajSpringCellStore-1.0/WEB-INF/web.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - Raj-CellphonestoreStruts - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - action - org.apache.struts.action.ActionServlet - - config - /WEB-INF/Cellph-struts-config.xml - - 1 - - - action - *.do - - - - AddCellphoneAction - AddCellphoneAction - com.training.cellstore.web.AddCellphoneAction - - - AddCellphoneAction - /AddCellphoneAction - - - - contextConfigLocation - cellphone-config.xml - - - - org.springframework.web.context.ContextLoaderListener - - - \ No newline at end of file diff --git a/SpringCellStore/target/RajSpringCellStore-1.0/index.html b/SpringCellStore/target/RajSpringCellStore-1.0/index.html deleted file mode 100644 index 71e47f1..0000000 --- a/SpringCellStore/target/RajSpringCellStore-1.0/index.html +++ /dev/null @@ -1,7 +0,0 @@ -

    Welcome to Movie Store

    - -
      -
    1. List of cellphones : list
    2. -
    3. Add a cellphone : add
    4. - -
    \ No newline at end of file diff --git a/SpringCellStore/target/classes/cellphone-config.xml b/SpringCellStore/target/classes/cellphone-config.xml deleted file mode 100644 index c897e37..0000000 --- a/SpringCellStore/target/classes/cellphone-config.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/SpringCellStore/target/maven-archiver/pom.properties b/SpringCellStore/target/maven-archiver/pom.properties deleted file mode 100644 index 3928f24..0000000 --- a/SpringCellStore/target/maven-archiver/pom.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Generated by Maven -#Sat Oct 01 15:35:07 EDT 2011 -version=1.0 -groupId=com.rajashree -artifactId=RajSpringCellStore diff --git a/SpringCellStore/target/surefire-reports/TEST-com.training.cellstore.service.CellPhoneServiceTest.xml b/SpringCellStore/target/surefire-reports/TEST-com.training.cellstore.service.CellPhoneServiceTest.xml deleted file mode 100644 index fce0d64..0000000 --- a/SpringCellStore/target/surefire-reports/TEST-com.training.cellstore.service.CellPhoneServiceTest.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SpringCellStore/target/surefire-reports/com.training.cellstore.service.CellPhoneServiceTest.txt b/SpringCellStore/target/surefire-reports/com.training.cellstore.service.CellPhoneServiceTest.txt deleted file mode 100644 index 87063b9..0000000 --- a/SpringCellStore/target/surefire-reports/com.training.cellstore.service.CellPhoneServiceTest.txt +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------------------- -Test set: com.training.cellstore.service.CellPhoneServiceTest -------------------------------------------------------------------------------- -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.028 sec diff --git a/SpringCellStore/target/war/work/webapp-cache.xml b/SpringCellStore/target/war/work/webapp-cache.xml deleted file mode 100644 index 329617c..0000000 --- a/SpringCellStore/target/war/work/webapp-cache.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - currentBuild - - - index.html - META-INF/MANIFEST.MF - WEB-INF/Cellph-struts-config.xml - WEB-INF/jsp/Acknowledgement.jsp - WEB-INF/jsp/AddCellphones.jsp - WEB-INF/jsp/EditCellphones.jsp - WEB-INF/jsp/ListCellphones.jsp - WEB-INF/web.xml - WEB-INF/classes/cellphone-config.xml - WEB-INF/classes/com/training/cellstore/domain/Cellphone.class - WEB-INF/classes/com/training/cellstore/domain/CellphoneDAO.class - WEB-INF/classes/com/training/cellstore/domain/CellphoneDAOException.class - WEB-INF/classes/com/training/cellstore/domain/CellphoneDAOJDBCImpl.class - WEB-INF/classes/com/training/cellstore/service/CellPhoneService.class - WEB-INF/classes/com/training/cellstore/service/CellPhoneServiceImpl.class - WEB-INF/classes/com/training/cellstore/web/AddCellphoneAction.class - WEB-INF/classes/com/training/cellstore/web/cellphoneform.class - WEB-INF/classes/com/training/cellstore/web/EditCellphoneAction.class - WEB-INF/classes/com/training/cellstore/web/ListCellphoneAction.class - WEB-INF/classes/com/training/cellstore/web/SaveCellphoneAction.class - WEB-INF/classes/com/training/cellstore/web/SaveUpdateCellphoneAction.class - WEB-INF/lib/junit-4.9.jar - WEB-INF/lib/hamcrest-core-1.1.jar - WEB-INF/lib/spring-context-3.0.6.RELEASE.jar - WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar - WEB-INF/lib/aopalliance-1.0.jar - WEB-INF/lib/spring-asm-3.0.6.RELEASE.jar - WEB-INF/lib/spring-beans-3.0.6.RELEASE.jar - WEB-INF/lib/spring-core-3.0.6.RELEASE.jar - WEB-INF/lib/commons-logging-1.0.4.jar - WEB-INF/lib/spring-expression-3.0.6.RELEASE.jar - WEB-INF/lib/spring-web-3.0.6.RELEASE.jar - WEB-INF/lib/mysql-connector-java-5.1.17.jar - WEB-INF/lib/struts-1.2.9.jar - WEB-INF/lib/commons-beanutils-1.7.0.jar - WEB-INF/lib/commons-digester-1.6.jar - WEB-INF/lib/commons-collections-2.1.jar - WEB-INF/lib/xml-apis-1.0.b2.jar - WEB-INF/lib/commons-fileupload-1.0.jar - WEB-INF/lib/commons-validator-1.1.4.jar - WEB-INF/lib/oro-2.0.7.jar - WEB-INF/lib/antlr-2.7.2.jar - WEB-INF/lib/xalan-2.5.1.jar - WEB-INF/lib/servlet-api-2.5.jar - - - - - - - - junit - junit - 4.9 - jar - compile - - false - - junit-4.9.jar - - - - org.springframework - spring-context - 3.0.6.RELEASE - jar - compile - - false - - spring-context-3.0.6.RELEASE.jar - - - - org.springframework - spring-web - 3.0.6.RELEASE - jar - compile - - false - - spring-web-3.0.6.RELEASE.jar - - - - mysql - mysql-connector-java - 5.1.17 - jar - compile - - false - - mysql-connector-java-5.1.17.jar - - - - struts - struts - 1.2.9 - jar - compile - - false - - struts-1.2.9.jar - - - - javax.servlet - servlet-api - 2.5 - jar - compile - - false - - servlet-api-2.5.jar - - - \ No newline at end of file diff --git a/SpringDayOne/.classpath b/SpringDayOne/.classpath deleted file mode 100644 index 4b1b1b9..0000000 --- a/SpringDayOne/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/SpringDayOne/.project b/SpringDayOne/.project deleted file mode 100644 index 106fef6..0000000 --- a/SpringDayOne/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - SpringDayOne - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/SpringDayOne/.settings/org.eclipse.jdt.core.prefs b/SpringDayOne/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c892b1c..0000000 --- a/SpringDayOne/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Sep 25 10:55:03 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.source=1.3 diff --git a/SpringDayOne/.settings/org.maven.ide.eclipse.prefs b/SpringDayOne/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index c62afb2..0000000 --- a/SpringDayOne/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sun Sep 25 10:55:03 EDT 2011 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -includeModules=false -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/SpringDayOne/.springBeans b/SpringDayOne/.springBeans deleted file mode 100644 index 07a2a57..0000000 --- a/SpringDayOne/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/SpringDayOne/pom.xml b/SpringDayOne/pom.xml deleted file mode 100644 index 61ce946..0000000 --- a/SpringDayOne/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - com.apps - SpringDayOne - jar - 1.0 - SpringDayOne - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - org.springframework - spring-context - 3.0.6.RELEASE - - - diff --git a/SpringDayOne/src/main/java/com/training/java/spring/Boat.java b/SpringDayOne/src/main/java/com/training/java/spring/Boat.java deleted file mode 100644 index 84953fb..0000000 --- a/SpringDayOne/src/main/java/com/training/java/spring/Boat.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.spring; - -public class Boat implements Vehicle -{ - - public void accelerate() - { - System.out.println("Boat is accelerating"); - } - - public void applyBrakes() - { - System.out.println("Boat is applying brakes"); - } - - public void start() - { - System.out.println("Boat is starting"); - } - - public void stop() - { - System.out.println("Boat is stopping"); - } -} diff --git a/SpringDayOne/src/main/java/com/training/java/spring/Car.java b/SpringDayOne/src/main/java/com/training/java/spring/Car.java deleted file mode 100644 index 7e6db76..0000000 --- a/SpringDayOne/src/main/java/com/training/java/spring/Car.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.spring; - -public class Car implements Vehicle -{ - - public void accelerate() - { - System.out.println("Car is accelerating"); - } - - public void applyBrakes() - { - System.out.println("Car is applying brakes"); - } - - public void start() - { - System.out.println("Car is starting"); - } - - public void stop() - { - System.out.println("Car is stopping"); - } -} diff --git a/SpringDayOne/src/main/java/com/training/java/spring/DummyVehicle.java b/SpringDayOne/src/main/java/com/training/java/spring/DummyVehicle.java deleted file mode 100644 index 0080952..0000000 --- a/SpringDayOne/src/main/java/com/training/java/spring/DummyVehicle.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.spring; - -public class DummyVehicle implements Vehicle -{ - - public void accelerate() - { - System.out.println("Dummy vehicle is accelerating.."); - } - - public void applyBrakes() - { - // TODO Auto-generated method stub - - } - - public void start() - { - // TODO Auto-generated method stub - - } - - public void stop() - { - // TODO Auto-generated method stub - - } - -} diff --git a/SpringDayOne/src/main/java/com/training/java/spring/Luggage.java b/SpringDayOne/src/main/java/com/training/java/spring/Luggage.java deleted file mode 100644 index 157388d..0000000 --- a/SpringDayOne/src/main/java/com/training/java/spring/Luggage.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.java.spring; - -public interface Luggage -{ - String getCompanyName(); - -} diff --git a/SpringDayOne/src/main/java/com/training/java/spring/SuiteCase.java b/SpringDayOne/src/main/java/com/training/java/spring/SuiteCase.java deleted file mode 100644 index 3702321..0000000 --- a/SpringDayOne/src/main/java/com/training/java/spring/SuiteCase.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.training.java.spring; - -public class SuiteCase implements Luggage -{ - - public String getCompanyName() - { - return "VIP"; - } - -} diff --git a/SpringDayOne/src/main/java/com/training/java/spring/Traveller.java b/SpringDayOne/src/main/java/com/training/java/spring/Traveller.java deleted file mode 100644 index d75ff1e..0000000 --- a/SpringDayOne/src/main/java/com/training/java/spring/Traveller.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.java.spring; - -public class Traveller -{ - private Vehicle v; - private Luggage l; - - public Traveller(Vehicle v, Luggage l) - { - this.v = v; - this.l = l; - } - - public void travel() - { - System.out.println("started travelling with " + l.getCompanyName()); - v.start(); - v.accelerate(); - v.applyBrakes(); - v.stop(); - System.out.println("Done with travelling"); - } - - /* Use this for setter injection - public void setVehicle(Vehicle v) - { - this.v = v; - } - */ -} diff --git a/SpringDayOne/src/main/java/com/training/java/spring/TravellerDemo.java b/SpringDayOne/src/main/java/com/training/java/spring/TravellerDemo.java deleted file mode 100644 index fdab934..0000000 --- a/SpringDayOne/src/main/java/com/training/java/spring/TravellerDemo.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.spring; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class TravellerDemo -{ - - /** - * @param args - */ - public static void main(String[] args) - { - /* Dependency Injection by hand - Vehicle v = new Boat(); - Traveller t = new Traveller(v); - //t.setVehicle(v); - - t.travel(); - */ - - BeanFactory factory = new ClassPathXmlApplicationContext("spring-config.xml"); - - Traveller traveller = (Traveller) factory.getBean("traveller"); - traveller.travel(); - } - -} diff --git a/SpringDayOne/src/main/java/com/training/java/spring/Vehicle.java b/SpringDayOne/src/main/java/com/training/java/spring/Vehicle.java deleted file mode 100644 index 920bdec..0000000 --- a/SpringDayOne/src/main/java/com/training/java/spring/Vehicle.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.spring; - -public interface Vehicle -{ - void start(); - void accelerate(); - void applyBrakes(); - void stop(); -} diff --git a/SpringDayOne/src/main/resources/spring-config.xml b/SpringDayOne/src/main/resources/spring-config.xml deleted file mode 100644 index 256f180..0000000 --- a/SpringDayOne/src/main/resources/spring-config.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/SpringDayOne/target/SpringDayOne-1.0.jar b/SpringDayOne/target/SpringDayOne-1.0.jar deleted file mode 100644 index 9352af5..0000000 Binary files a/SpringDayOne/target/SpringDayOne-1.0.jar and /dev/null differ diff --git a/SpringDayOne/target/maven-archiver/pom.properties b/SpringDayOne/target/maven-archiver/pom.properties deleted file mode 100644 index c1b61a8..0000000 --- a/SpringDayOne/target/maven-archiver/pom.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Generated by Maven -#Sun Sep 25 11:55:22 EDT 2011 -version=1.0 -groupId=com.apps -artifactId=SpringDayOne diff --git a/SpringMVCCellStore/.classpath b/SpringMVCCellStore/.classpath deleted file mode 100644 index f5f4fda..0000000 --- a/SpringMVCCellStore/.classpath +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/SpringMVCCellStore/.project b/SpringMVCCellStore/.project deleted file mode 100644 index 87cfcfe..0000000 --- a/SpringMVCCellStore/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - SpringMVCCellStore - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/SpringMVCCellStore/.settings/.jsdtscope b/SpringMVCCellStore/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/SpringMVCCellStore/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/SpringMVCCellStore/.settings/org.eclipse.jdt.core.prefs b/SpringMVCCellStore/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index b5f4af1..0000000 --- a/SpringMVCCellStore/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sat Oct 08 13:12:45 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/SpringMVCCellStore/.settings/org.eclipse.wst.common.component b/SpringMVCCellStore/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 384e4eb..0000000 --- a/SpringMVCCellStore/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/SpringMVCCellStore/.settings/org.eclipse.wst.common.project.facet.core.xml b/SpringMVCCellStore/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 5ebd3e4..0000000 --- a/SpringMVCCellStore/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/SpringMVCCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.container b/SpringMVCCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/SpringMVCCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/SpringMVCCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.name b/SpringMVCCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/SpringMVCCellStore/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/SpringMVCCellStore/.settings/org.maven.ide.eclipse.prefs b/SpringMVCCellStore/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index a88ab6b..0000000 --- a/SpringMVCCellStore/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sat Oct 08 13:12:45 EDT 2011 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/SpringMVCCellStore/.springBeans b/SpringMVCCellStore/.springBeans deleted file mode 100644 index 23b09a7..0000000 --- a/SpringMVCCellStore/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/webapp/WEB-INF/cell-servlet.xml - - - - diff --git a/SpringMVCCellStore/pom.xml b/SpringMVCCellStore/pom.xml deleted file mode 100644 index dd6b53d..0000000 --- a/SpringMVCCellStore/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - 4.0.0 - com.venkat - SpringMVCCellStore - 1.0 - war - - - - - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - - - - junit - junit - 4.9 - - - org.springframework - spring-context - 3.0.6.RELEASE - - - org.springframework - spring-web - 3.0.6.RELEASE - - - org.springframework - spring-webmvc - 3.0.6.RELEASE - - - org.springframework - spring-aop - 3.0.6.RELEASE - - - org.aspectj - aspectjrt - 1.6.0 - - - org.aspectj - aspectjweaver - 1.6.0 - - - mysql - mysql-connector-java - 5.1.17 - - - struts - struts - 1.2.9 - - - javax.servlet - servlet-api - 2.5 - - - - javax.servlet - jstl - 1.2 - - - - - - \ No newline at end of file diff --git a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhone.java b/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhone.java deleted file mode 100644 index 34a63e7..0000000 --- a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhone.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.venkat.cellstore.domain; - -public class CellPhone { - - private String name; - private String company; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCompany() { - return company; - } - - public void setCompany(String company) { - this.company = company; - } - -} diff --git a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneDAO.java b/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneDAO.java deleted file mode 100644 index 1e3fd8b..0000000 --- a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.venkat.cellstore.domain; - -import java.util.List; - -public interface CellPhoneDAO { - - List getCells(); - -} diff --git a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneDAOJDBCImpl.java b/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneDAOJDBCImpl.java deleted file mode 100644 index e69e3e8..0000000 --- a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneDAOJDBCImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.venkat.cellstore.domain; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class CellPhoneDAOJDBCImpl implements CellPhoneDAO { - - public List getCells() { - - List cells = new ArrayList(); - - CellPhone one = new CellPhone(); - - one.setCompany("Apple"); - one.setName("iPhone"); - - CellPhone two = new CellPhone(); - - two.setCompany("Google"); - two.setName("Nexus"); - - cells.add(one); - cells.add(two); - - return cells; - } - -} diff --git a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneService.java b/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneService.java deleted file mode 100644 index d72686f..0000000 --- a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.venkat.cellstore.domain; - -import java.util.List; - -public interface CellPhoneService { - - List getCells(); - -} diff --git a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneServiceImpl.java b/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneServiceImpl.java deleted file mode 100644 index a23f74f..0000000 --- a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/CellPhoneServiceImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.venkat.cellstore.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class CellPhoneServiceImpl implements CellPhoneService { - - @Autowired - private CellPhoneDAO dao; - - public List getCells() { - return dao.getCells(); - } - -} diff --git a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/LoggingAspect.java b/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/LoggingAspect.java deleted file mode 100644 index 78e4252..0000000 --- a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/domain/LoggingAspect.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.venkat.cellstore.domain; - -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.AfterThrowing; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.springframework.stereotype.Component; - -@Aspect -@Component -public class LoggingAspect { - - @Pointcut("execution(* com.venkat.cellstore.domain.*.*(..))") - public void loggingPointCut() { - } - - /* - * @Before("loggingPointCut()") public void logBefore(JoinPoint joinPoint) { - * System.out.println(joinPoint.getTarget().getClass().getSimpleName() + - * " Entering.." + joinPoint.getSignature().getName()); } - * - * @After("loggingPointCut()") public void log(JoinPoint joinPoint) { - * System.out.println(joinPoint.getTarget().getClass().getSimpleName() + - * " Leaving.." + joinPoint.getSignature().getName()); } - */ - - @Around("loggingPointCut()") - public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { - System.out.println(joinPoint.getTarget().getClass().getSimpleName() - + joinPoint.getSignature().getName()); - return joinPoint.proceed(); - } -} diff --git a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/web/CellPhoneController.java b/SpringMVCCellStore/src/main/java/com/venkat/cellstore/web/CellPhoneController.java deleted file mode 100644 index 01ad8ea..0000000 --- a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/web/CellPhoneController.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.venkat.cellstore.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.venkat.cellstore.domain.CellPhone; -import com.venkat.cellstore.domain.CellPhoneService; - -@Controller -public class CellPhoneController { - - @Autowired - CellPhoneService service; - - @RequestMapping("/list") - public ModelAndView getCells() - { - ModelAndView mv = new ModelAndView(); - - List cells = service.getCells(); - - mv.addObject("cells", cells); - mv.setViewName("ListCellPhone"); - - return mv; - } - - @RequestMapping("/add") - public String add(Model model) - { - model.addAttribute(new CellPhone()); - - return "Add"; - } - - @RequestMapping(value="/add", method=RequestMethod.POST) - public String save(@ModelAttribute CellPhone cellPhone) - { - System.out.println("name= " + cellPhone.getName()); - System.out.println("company= " + cellPhone.getCompany()); - - return "Acknowledgement"; - } - - -} diff --git a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/web/WelcomeController.java b/SpringMVCCellStore/src/main/java/com/venkat/cellstore/web/WelcomeController.java deleted file mode 100644 index b0605f6..0000000 --- a/SpringMVCCellStore/src/main/java/com/venkat/cellstore/web/WelcomeController.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.venkat.cellstore.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -@Controller -public class WelcomeController { - - @RequestMapping("/welcome") - public ModelAndView welcome() - { - ModelAndView mv = new ModelAndView(); - - mv.addObject("message", "hello"); - mv.setViewName("helloworld"); - - return mv; - } - -} diff --git a/SpringMVCCellStore/src/main/resources/cellphone-config.xml b/SpringMVCCellStore/src/main/resources/cellphone-config.xml deleted file mode 100644 index dab5700..0000000 --- a/SpringMVCCellStore/src/main/resources/cellphone-config.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/SpringMVCCellStore/src/main/webapp/META-INF/MANIFEST.MF b/SpringMVCCellStore/src/main/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/SpringMVCCellStore/src/main/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/SpringMVCCellStore/src/main/webapp/WEB-INF/cell-servlet.xml b/SpringMVCCellStore/src/main/webapp/WEB-INF/cell-servlet.xml deleted file mode 100644 index 98db7d5..0000000 --- a/SpringMVCCellStore/src/main/webapp/WEB-INF/cell-servlet.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - diff --git a/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/Acknowledgement.jsp b/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/Acknowledgement.jsp deleted file mode 100644 index 05c0a28..0000000 --- a/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/Acknowledgement.jsp +++ /dev/null @@ -1 +0,0 @@ -

    saved..

    \ No newline at end of file diff --git a/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/Add.jsp b/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/Add.jsp deleted file mode 100644 index ceec8b6..0000000 --- a/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/Add.jsp +++ /dev/null @@ -1,9 +0,0 @@ -<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form"%> - - - - Name :
    - Company :
    - - -
    \ No newline at end of file diff --git a/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/ListCellPhone.jsp b/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/ListCellPhone.jsp deleted file mode 100644 index b705d3e..0000000 --- a/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/ListCellPhone.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - - - - - - - - - - - -
    Company NamePhone
    - -
    \ No newline at end of file diff --git a/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/helloworld.jsp b/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/helloworld.jsp deleted file mode 100644 index 8b57698..0000000 --- a/SpringMVCCellStore/src/main/webapp/WEB-INF/jsp/helloworld.jsp +++ /dev/null @@ -1,3 +0,0 @@ -

    Hi, welcome to Spring MVC

    - -Message is ${message} \ No newline at end of file diff --git a/SpringMVCCellStore/src/main/webapp/WEB-INF/web.xml b/SpringMVCCellStore/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 985ed4c..0000000 --- a/SpringMVCCellStore/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - Raj-CellphonestoreStruts - - index.html - - - - cell - org.springframework.web.servlet.DispatcherServlet - 1 - - - - cell - / - - - \ No newline at end of file diff --git a/SpringMVCCellStore/target/classes/cellphone-config.xml b/SpringMVCCellStore/target/classes/cellphone-config.xml deleted file mode 100644 index dab5700..0000000 --- a/SpringMVCCellStore/target/classes/cellphone-config.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/SpringMVCMovieStore2/.classpath b/SpringMVCMovieStore2/.classpath deleted file mode 100644 index 5c40e0b..0000000 --- a/SpringMVCMovieStore2/.classpath +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/SpringMVCMovieStore2/.project b/SpringMVCMovieStore2/.project deleted file mode 100644 index 918f255..0000000 --- a/SpringMVCMovieStore2/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - SpringMVCMovieStore2 - - - Servers - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.maven.ide.eclipse.maven2Nature - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.common.modulecore.ModuleCoreNature - - diff --git a/SpringMVCMovieStore2/.settings/com.springsource.server.ide.jdt.core.xml b/SpringMVCMovieStore2/.settings/com.springsource.server.ide.jdt.core.xml deleted file mode 100644 index 0a4413c..0000000 --- a/SpringMVCMovieStore2/.settings/com.springsource.server.ide.jdt.core.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/SpringMVCMovieStore2/.settings/org.eclipse.jst.common.project.facet.core.prefs b/SpringMVCMovieStore2/.settings/org.eclipse.jst.common.project.facet.core.prefs deleted file mode 100644 index 763a150..0000000 --- a/SpringMVCMovieStore2/.settings/org.eclipse.jst.common.project.facet.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Mar 17 09:59:19 EDT 2009 -classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.launching.macosx.MacOSXType\:\:JVM\ 1.5.0\ (MacOS\ X\ Default)/owners=jst.java\:5.0 -eclipse.preferences.version=1 diff --git a/SpringMVCMovieStore2/.settings/org.eclipse.wst.common.component b/SpringMVCMovieStore2/.settings/org.eclipse.wst.common.component deleted file mode 100644 index d8cb9a4..0000000 --- a/SpringMVCMovieStore2/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/SpringMVCMovieStore2/.settings/org.eclipse.wst.common.project.facet.core.xml b/SpringMVCMovieStore2/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d24a733..0000000 --- a/SpringMVCMovieStore2/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/SpringMVCMovieStore2/.settings/org.eclipse.wst.validation.prefs b/SpringMVCMovieStore2/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 75abca5..0000000 --- a/SpringMVCMovieStore2/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Fri Jun 06 17:00:12 BST 2008 -DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator\=org.eclipse.wst.wsdl.validation.internal.eclipse.Validator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator; -USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.jst.jsf.validation.internal.JSPSemanticsValidator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.jst.jsf.validation.internal.appconfig.AppConfigValidator;org.eclipse.jst.jsp.core.internal.validation.JSPBatchValidator;org.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.jst.jsp.core.internal.validation.JSPContentValidator;org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator; -USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.jst.jsf.validation.internal.JSPSemanticsValidator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.jst.jsf.validation.internal.appconfig.AppConfigValidator;org.eclipse.jst.jsp.core.internal.validation.JSPBatchValidator;org.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.jst.jsp.core.internal.validation.JSPContentValidator;org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator; -USER_PREFERENCE=overrideGlobalPreferencesfalse -eclipse.preferences.version=1 diff --git a/SpringMVCMovieStore2/.settings/org.maven.ide.eclipse.prefs b/SpringMVCMovieStore2/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index 0b75108..0000000 --- a/SpringMVCMovieStore2/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Tue Mar 17 14:28:16 EDT 2009 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -includeModules=false -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/SpringMVCMovieStore2/.settings/org.springframework.ide.eclipse.beans.core.prefs b/SpringMVCMovieStore2/.settings/org.springframework.ide.eclipse.beans.core.prefs deleted file mode 100644 index a7eb2b3..0000000 --- a/SpringMVCMovieStore2/.settings/org.springframework.ide.eclipse.beans.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Wed Dec 17 01:09:03 EST 2008 -eclipse.preferences.version=1 -org.springframework.ide.eclipse.beans.core.ignoreMissingNamespaceHandler=false diff --git a/SpringMVCMovieStore2/.settings/org.springframework.ide.eclipse.core.prefs b/SpringMVCMovieStore2/.settings/org.springframework.ide.eclipse.core.prefs deleted file mode 100644 index e096d67..0000000 --- a/SpringMVCMovieStore2/.settings/org.springframework.ide.eclipse.core.prefs +++ /dev/null @@ -1,67 +0,0 @@ -#Tue Mar 17 10:00:21 EDT 2009 -eclipse.preferences.version=1 -org.springframework.ide.eclipse.core.builders.enable.aopreferencemodelbuilder=true -org.springframework.ide.eclipse.core.builders.enable.beanmetadatabuilder=false -org.springframework.ide.eclipse.core.builders.enable.osgibundleupdater=true -org.springframework.ide.eclipse.core.enable.project.preferences=false -org.springframework.ide.eclipse.core.validator.enable.com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.core.springvalidator=false -org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.applicationSymbolicNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.applicationVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleActivationPolicyRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleActivatorRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleManifestVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleSymbolicNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.exportPackageRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.importRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.parsingProblemsRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.requireBundleRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.AvoidDriverManagerDataSource-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ImportElementsAtTopRulee-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ParentBeanSpecifiesAbstractClassRule-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.RefElementRule-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.TooManyBeansInFileRule-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UnnecessaryValueElementRule-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UseBeanInheritance-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.legacyxmlusage.jndiobjectfactory-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importBundleVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importLibraryVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importPackageVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.requireBundleVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanAlias-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanClass-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanConstructorArgument-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinition-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinitionHolder-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanFactory-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanInitDestroyMethod-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanReference-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.methodOverride-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.parsingProblems-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.requiredProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=false -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.core.springClasspath-org.springframework.ide.eclipse.core.springvalidator=false -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.action-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.actionstate-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attribute-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attributemapper-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.beanaction-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationaction-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationresult-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.exceptionhandler-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.import-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.inputattribute-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.mapping-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.outputattribute-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.set-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.state-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.subflowstate-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.transition-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.variable-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.webflowstate-org.springframework.ide.eclipse.webflow.core.validator=true diff --git a/SpringMVCMovieStore2/.springBeans b/SpringMVCMovieStore2/.springBeans deleted file mode 100644 index 06e56e7..0000000 --- a/SpringMVCMovieStore2/.springBeans +++ /dev/null @@ -1,15 +0,0 @@ - - - 1 - - - - - - - src/main/resources/moviestore-domain.xml - src/main/webapp/WEB-INF/moviestore-servlet.xml - - - - diff --git a/SpringMVCMovieStore2/pom.xml b/SpringMVCMovieStore2/pom.xml deleted file mode 100644 index 7865996..0000000 --- a/SpringMVCMovieStore2/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - 4.0.0 - com.training - moviestore - SpringMVCMovieStore2 - war - 1.0.0-SNAPSHOT - - 3.0.6.RELEASE - - - - - javax.servlet - jstl - 1.2 - - - log4j - log4j - 1.2.15 - - - javax.mail - mail - - - javax.jms - jms - - - com.sun.jdmk - jmxtools - - - com.sun.jmx - jmxri - - - - - org.tuckey - urlrewritefilter - 3.1.0 - - - org.springframework - spring-webmvc - ${spring.version} - - - - javax.servlet - servlet-api - 2.5 - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - - junit - junit - 4.7 - test - - - mysql - mysql-connector-java - 5.1.17 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-dependency-plugin - - - install - install - - sources - - - - - - - diff --git a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/Movie.java b/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/Movie.java deleted file mode 100644 index 1b80676..0000000 --- a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/Movie.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.moviestore.domain; - -import java.sql.Date; - -public class Movie -{ - private int id; - private String name; - private String rating; - private Date releaseDate; - private String genre; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getRating() - { - return rating; - } - - public void setRating(String rating) - { - this.rating = rating; - } - - public Date getReleaseDate() - { - return releaseDate; - } - - public void setReleaseDate(Date releaseDate) - { - this.releaseDate = releaseDate; - } - - public String getGenre() - { - return genre; - } - - public void setGenre(String genre) - { - this.genre = genre; - } -} diff --git a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAO.java b/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAO.java deleted file mode 100644 index 96870e0..0000000 --- a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.moviestore.domain; - -import java.util.List; - -public interface MovieDAO -{ - void create(Movie movie); - List getMovies(); - Movie findByPrimaryKey(int id); -} diff --git a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAODemo.java b/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAODemo.java deleted file mode 100644 index dc40418..0000000 --- a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAODemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.moviestore.domain; - -import java.util.List; - -public class MovieDAODemo -{ - /** - * @param args - */ - public static void main(String[] args) - { - /* - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - Movie aMovie = new Movie(); - aMovie.setId(2); - aMovie.setName("Speed2..CC"); - aMovie.setRating("PG-13"); - aMovie.setGenre("Thriller"); - aMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - dao.create(aMovie); - */ - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - List movies = dao.getMovies(); - for(Movie aMovie : movies) - { - System.out.println("Name = " + aMovie.getName()); - System.out.println("Rating = " + aMovie.getRating()); - System.out.println("Genre = " + aMovie.getGenre()); - System.out.println("Release date = " + aMovie.getReleaseDate()); - System.out.println("id = " + aMovie.getId()); - } - } - -} diff --git a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAOException.java b/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAOException.java deleted file mode 100644 index f607277..0000000 --- a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAOException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.moviestore.domain; - -public class MovieDAOException extends RuntimeException -{ - MovieDAOException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAOJDBCImpl.java b/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index 71ccf0a..0000000 --- a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.training.moviestore.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class MovieDAOJDBCImpl implements MovieDAO -{ - private String dburl; - private String dbuser; - private String dbPassword; - - public MovieDAOJDBCImpl(String dburl, String dbuser, String dbPassWord) - { - this.dburl = dburl; - this.dbuser = dbuser; - this.dbPassword = dbPassWord; - } - - @Override - public void create(Movie movie) - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("insert into movie(id, genre, rating, release_date, name) values(?,?,?,?,?)"); - - stmt.setInt(1, movie.getId()); - stmt.setString(2, movie.getGenre()); - stmt.setString(3, movie.getRating()); - stmt.setDate(4, movie.getReleaseDate()); - stmt.setString(5, movie.getName()); - - stmt.executeUpdate(); - - } - catch(ClassNotFoundException e) - { - e.printStackTrace(); - } - catch (SQLException e) - { - throw new MovieDAOException(e.getMessage()); - } - } - - @Override - public List getMovies() - { - List movies = new ArrayList(); - - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("select * from movie"); - - ResultSet rs = stmt.executeQuery(); - - while(rs.next()) - { - Movie aMovie = new Movie(); - - aMovie.setId(rs.getInt("id")); - aMovie.setName(rs.getString("name")); - aMovie.setRating(rs.getString("rating")); - aMovie.setReleaseDate(rs.getDate("release_date")); - aMovie.setGenre(rs.getString("genre")); - - movies.add(aMovie); - } - } - catch(ClassNotFoundException ex) - { - ex.printStackTrace(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - - return movies; - } - - @Override - public Movie findByPrimaryKey(int id) { - Movie movie = null; - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("select * from movie where id = ?"); - - stmt.setInt(1, id); - - ResultSet rs = stmt.executeQuery(); - - if(rs.next()) - { - movie = new Movie(); - - movie.setId(rs.getInt("id")); - movie.setName(rs.getString("name")); - movie.setRating(rs.getString("rating")); - movie.setReleaseDate(rs.getDate("release_date")); - movie.setGenre(rs.getString("genre")); - } - } - catch(ClassNotFoundException ex) - { - ex.printStackTrace(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - - return movie; - } -} diff --git a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieService.java b/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieService.java deleted file mode 100644 index 0cbb1a4..0000000 --- a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.training.moviestore.domain; - -import java.util.List; - - -public interface MovieService -{ - void create(Movie movie); - List getMovies(); - Movie getById(int id); -} diff --git a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieServiceImpl.java b/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieServiceImpl.java deleted file mode 100644 index 59c2868..0000000 --- a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/domain/MovieServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.moviestore.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -@Service -public class MovieServiceImpl implements MovieService -{ - @Autowired - private MovieDAO dao; - - @Override - public void create(Movie movie) - { - dao.create(movie); - } - - @Override - public List getMovies() - { - return dao.getMovies(); - } - - @Override - public Movie getById(int id) { - return dao.findByPrimaryKey(id); - } -} diff --git a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/web/MovieController.java b/SpringMVCMovieStore2/src/main/java/com/training/moviestore/web/MovieController.java deleted file mode 100644 index 7770de0..0000000 --- a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/web/MovieController.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.training.moviestore.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.ModelAttribute; -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.servlet.ModelAndView; - -import com.training.moviestore.domain.Movie; -import com.training.moviestore.domain.MovieService; - -@Controller -public class MovieController { - @Autowired - private MovieService service; - - @RequestMapping("/list") - public ModelAndView getMovies() { - ModelAndView mv = new ModelAndView(); - - List movies = service.getMovies(); - mv.addObject("movies", movies); - mv.setViewName("ListMovies"); - - return mv; - } - - @RequestMapping("/add") - public String add(Model model) { - model.addAttribute("movie", new Movie()); - - return "Add"; - } - - @RequestMapping(value = "/add", method = RequestMethod.POST) - public String save(@ModelAttribute Movie movie) { - service.create(movie); - - return "Acknowledgement"; - } - - @RequestMapping("/edit") - public String edit(Model model, @RequestParam("id") int id) { - Movie movie = service.getById(id); - model.addAttribute("movie", movie); - return "Edit"; - } - - @RequestMapping(method = RequestMethod.POST, value = "/edit") - public String saveEdit(@ModelAttribute Movie movie, - @RequestParam("id") int id) { - System.out.println("rating = " + movie.getRating()); - System.out.println("id = " + id); - movie.setId(id); - - //pass this movie object to DAO to update - - return "Acknowledgement"; - } - -} diff --git a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/web/WelcomeController.java b/SpringMVCMovieStore2/src/main/java/com/training/moviestore/web/WelcomeController.java deleted file mode 100644 index 6caf997..0000000 --- a/SpringMVCMovieStore2/src/main/java/com/training/moviestore/web/WelcomeController.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.moviestore.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -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.servlet.ModelAndView; - -@Controller -public class WelcomeController -{ - @RequestMapping("/") - public String welcome() - { - return "HomePage"; - } - - @RequestMapping("/hello") - public String sayHello() - { - return "Welcome"; - } - - @RequestMapping("/customHello") - public ModelAndView sayCustomHello(@RequestParam("fn") String firstName, - @RequestParam("ln") String lastName) - { - ModelAndView mv = new ModelAndView(); - mv.addObject("customGreeting", "Welcome to my site sir/madam " - + firstName + " " + lastName); - mv.setViewName("CustomGreeting"); - - return mv; - } - - @RequestMapping(method=RequestMethod.GET, value="/movie/{id}") - public ModelAndView getMovie(@PathVariable String id) - { - System.out.println("id I got = " + id); - ModelAndView mv = new ModelAndView(); - - mv.addObject("MovieTitle", "Cars2"); - mv.addObject("Producer", "Disney"); - - mv.setViewName("Movie"); - - return mv; - } - -} diff --git a/SpringMVCMovieStore2/src/main/resources/log4j.xml b/SpringMVCMovieStore2/src/main/resources/log4j.xml deleted file mode 100644 index 24ab640..0000000 --- a/SpringMVCMovieStore2/src/main/resources/log4j.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SpringMVCMovieStore2/src/main/resources/moviestore-domain.xml b/SpringMVCMovieStore2/src/main/resources/moviestore-domain.xml deleted file mode 100644 index 9819acd..0000000 --- a/SpringMVCMovieStore2/src/main/resources/moviestore-domain.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Acknowledgement.jsp b/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Acknowledgement.jsp deleted file mode 100644 index c3fd846..0000000 --- a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Acknowledgement.jsp +++ /dev/null @@ -1 +0,0 @@ -

    Your details have been saved..

    \ No newline at end of file diff --git a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Add.jsp b/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Add.jsp deleted file mode 100644 index d077983..0000000 --- a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Add.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form"%> - - - - id : -
    - name : -
    - rating : -
    - genre : -
    - - -
    \ No newline at end of file diff --git a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/CustomGreeting.jsp b/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/CustomGreeting.jsp deleted file mode 100644 index 657e651..0000000 --- a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/CustomGreeting.jsp +++ /dev/null @@ -1 +0,0 @@ -We have a custom greeting for you :

    ${customGreeting}

    \ No newline at end of file diff --git a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Edit.jsp b/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Edit.jsp deleted file mode 100644 index a46d007..0000000 --- a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Edit.jsp +++ /dev/null @@ -1,13 +0,0 @@ -<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form"%> - - - - name : -
    - rating : -
    - genre : -
    - - -
    \ No newline at end of file diff --git a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/HomePage.jsp b/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/HomePage.jsp deleted file mode 100644 index e61522e..0000000 --- a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/HomePage.jsp +++ /dev/null @@ -1 +0,0 @@ -

    Welcome to our Movie store!!

    \ No newline at end of file diff --git a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/ListMovies.jsp b/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/ListMovies.jsp deleted file mode 100644 index d2ae168..0000000 --- a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/ListMovies.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> - - - - - - - - - - - - - - - - -
    NameRatingRelease dateGenre
    Name :
    Rating :
    Release date : -
    Genre :
    \ No newline at end of file diff --git a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Welcome.jsp b/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Welcome.jsp deleted file mode 100644 index bbe016b..0000000 --- a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/jsp/Welcome.jsp +++ /dev/null @@ -1 +0,0 @@ -

    Welcome to Spring MVC.

    \ No newline at end of file diff --git a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/moviestore-servlet.xml b/SpringMVCMovieStore2/src/main/webapp/WEB-INF/moviestore-servlet.xml deleted file mode 100644 index b6c0aa1..0000000 --- a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/moviestore-servlet.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/web.xml b/SpringMVCMovieStore2/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index ccc94aa..0000000 --- a/SpringMVCMovieStore2/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - moviestore - org.springframework.web.servlet.DispatcherServlet - 1 - - - - - moviestore - / - - - diff --git a/SpringMVCMovieStore2/src/test/resources/log4j.xml b/SpringMVCMovieStore2/src/test/resources/log4j.xml deleted file mode 100644 index 1340787..0000000 --- a/SpringMVCMovieStore2/src/test/resources/log4j.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SpringStrutsMovieStore/.classpath b/SpringStrutsMovieStore/.classpath deleted file mode 100644 index 6337143..0000000 --- a/SpringStrutsMovieStore/.classpath +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SpringStrutsMovieStore/.project b/SpringStrutsMovieStore/.project deleted file mode 100644 index b6a78d6..0000000 --- a/SpringStrutsMovieStore/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - SpringStrutsMovieStore - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/SpringStrutsMovieStore/.settings/.jsdtscope b/SpringStrutsMovieStore/.settings/.jsdtscope deleted file mode 100644 index f40dd98..0000000 --- a/SpringStrutsMovieStore/.settings/.jsdtscope +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/SpringStrutsMovieStore/.settings/org.eclipse.jdt.core.prefs b/SpringStrutsMovieStore/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 861df42..0000000 --- a/SpringStrutsMovieStore/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Thu Sep 29 19:29:12 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/SpringStrutsMovieStore/.settings/org.eclipse.wst.common.component b/SpringStrutsMovieStore/.settings/org.eclipse.wst.common.component deleted file mode 100644 index f5d76a6..0000000 --- a/SpringStrutsMovieStore/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/SpringStrutsMovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml b/SpringStrutsMovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 3d1d1d9..0000000 --- a/SpringStrutsMovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/SpringStrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container b/SpringStrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/SpringStrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/SpringStrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name b/SpringStrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/SpringStrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/SpringStrutsMovieStore/WebContent/META-INF/MANIFEST.MF b/SpringStrutsMovieStore/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/SpringStrutsMovieStore/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/jsp/Acknowledgement.jsp b/SpringStrutsMovieStore/WebContent/WEB-INF/jsp/Acknowledgement.jsp deleted file mode 100644 index 75f67c8..0000000 --- a/SpringStrutsMovieStore/WebContent/WEB-INF/jsp/Acknowledgement.jsp +++ /dev/null @@ -1 +0,0 @@ -

    Your details have been saved successfully.

    \ No newline at end of file diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/jsp/AddMovie.jsp b/SpringStrutsMovieStore/WebContent/WEB-INF/jsp/AddMovie.jsp deleted file mode 100644 index 3d95c28..0000000 --- a/SpringStrutsMovieStore/WebContent/WEB-INF/jsp/AddMovie.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@page language="java"%> - -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - -

    Please enter the details below and click Submit.

    - -Id :
    -Name :
    -Rating :
    -Genre :
    - - - -
    \ No newline at end of file diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/jsp/ListMovies.jsp b/SpringStrutsMovieStore/WebContent/WEB-INF/jsp/ListMovies.jsp deleted file mode 100644 index 000f38f..0000000 --- a/SpringStrutsMovieStore/WebContent/WEB-INF/jsp/ListMovies.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@page language="java"%> - -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> - - - - - - - - - - - - - - - - - - - -
    IdNameRatingRelease DateGenre
    ID :
    Name :
    Rating :
    Release Date :
    Genre :
    - - diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/aopalliance-1.0.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/aopalliance-1.0.jar deleted file mode 100644 index 578b1a0..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/aopalliance-1.0.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-io-1.1.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar deleted file mode 100644 index 1deef14..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/junit-4.8.1.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/junit-4.8.1.jar deleted file mode 100644 index 524cd65..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/junit-4.8.1.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/oro-2.0.8.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar deleted file mode 100644 index 37206d3..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-asm-3.0.6.RELEASE.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-asm-3.0.6.RELEASE.jar deleted file mode 100644 index be6a913..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-asm-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-beans-3.0.6.RELEASE.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-beans-3.0.6.RELEASE.jar deleted file mode 100644 index c4bc850..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-beans-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-context-3.0.6.RELEASE.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-context-3.0.6.RELEASE.jar deleted file mode 100644 index 57f7570..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-context-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-core-3.0.6.RELEASE.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-core-3.0.6.RELEASE.jar deleted file mode 100644 index c65358d..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-core-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-expression-3.0.6.RELEASE.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-expression-3.0.6.RELEASE.jar deleted file mode 100644 index 4064858..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-expression-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-web-3.0.6.RELEASE.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-web-3.0.6.RELEASE.jar deleted file mode 100644 index 761578b..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/spring-web-3.0.6.RELEASE.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/standard-1.0.6.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/SpringStrutsMovieStore/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/spring-config.xml b/SpringStrutsMovieStore/WebContent/WEB-INF/spring-config.xml deleted file mode 100644 index 6c4d656..0000000 --- a/SpringStrutsMovieStore/WebContent/WEB-INF/spring-config.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/struts-config.xml b/SpringStrutsMovieStore/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index 4f2a9f4..0000000 --- a/SpringStrutsMovieStore/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SpringStrutsMovieStore/WebContent/WEB-INF/web.xml b/SpringStrutsMovieStore/WebContent/WEB-INF/web.xml deleted file mode 100644 index ace8f46..0000000 --- a/SpringStrutsMovieStore/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - StrutsMovieStore - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - contextConfigLocation - /WEB-INF/spring-config.xml - - - - org.springframework.web.context.ContextLoaderListener - - - - - action - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts-config.xml - - 1 - - - - - - action - *.do - - - \ No newline at end of file diff --git a/SpringStrutsMovieStore/WebContent/index.html b/SpringStrutsMovieStore/WebContent/index.html deleted file mode 100644 index 56991d0..0000000 --- a/SpringStrutsMovieStore/WebContent/index.html +++ /dev/null @@ -1,7 +0,0 @@ -

    Welcome to Movie Store

    - -
      -
    1. List of movies : list
    2. -
    3. Add a movie : add
    4. - -
    \ No newline at end of file diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/Movie.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/Movie.java deleted file mode 100644 index 3a8d0fb..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/Movie.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.java.moviestore.domain; - -import java.sql.Date; - -public class Movie -{ - private int id; - private String name; - private String rating; - private Date releaseDate; - private String genre; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getRating() - { - return rating; - } - - public void setRating(String rating) - { - this.rating = rating; - } - - public Date getReleaseDate() - { - return releaseDate; - } - - public void setReleaseDate(Date releaseDate) - { - this.releaseDate = releaseDate; - } - - public String getGenre() - { - return genre; - } - - public void setGenre(String genre) - { - this.genre = genre; - } -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAO.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAO.java deleted file mode 100644 index 3f68817..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.moviestore.domain; - -import java.util.List; - -public interface MovieDAO -{ - void create(Movie movie); - List getMovies(); -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAODemo.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAODemo.java deleted file mode 100644 index 2819731..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAODemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.java.moviestore.domain; - -import java.util.List; - -public class MovieDAODemo -{ - /** - * @param args - */ - public static void main(String[] args) - { - /* - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - Movie aMovie = new Movie(); - aMovie.setId(2); - aMovie.setName("Speed2..CC"); - aMovie.setRating("PG-13"); - aMovie.setGenre("Thriller"); - aMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - dao.create(aMovie); - */ - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - List movies = dao.getMovies(); - for(Movie aMovie : movies) - { - System.out.println("Name = " + aMovie.getName()); - System.out.println("Rating = " + aMovie.getRating()); - System.out.println("Genre = " + aMovie.getGenre()); - System.out.println("Release date = " + aMovie.getReleaseDate()); - System.out.println("id = " + aMovie.getId()); - } - } - -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAOException.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAOException.java deleted file mode 100644 index d231f1f..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAOException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.moviestore.domain; - -public class MovieDAOException extends RuntimeException -{ - MovieDAOException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAOJDBCImpl.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index f4db1f9..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.training.java.moviestore.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class MovieDAOJDBCImpl implements MovieDAO -{ - private String dburl; - private String dbuser; - private String dbPassword; - - public MovieDAOJDBCImpl(String dburl, String dbuser, String dbPassWord) - { - this.dburl = dburl; - this.dbuser = dbuser; - this.dbPassword = dbPassWord; - } - - @Override - public void create(Movie movie) - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("insert into movie(id, genre, rating, release_date, name) values(?,?,?,?,?)"); - - stmt.setInt(1, movie.getId()); - stmt.setString(2, movie.getGenre()); - stmt.setString(3, movie.getRating()); - stmt.setDate(4, movie.getReleaseDate()); - stmt.setString(5, movie.getName()); - - stmt.executeUpdate(); - - } - catch(ClassNotFoundException e) - { - e.printStackTrace(); - } - catch (SQLException e) - { - throw new MovieDAOException(e.getMessage()); - } - } - - @Override - public List getMovies() - { - List movies = new ArrayList(); - - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("select * from movie"); - - ResultSet rs = stmt.executeQuery(); - - while(rs.next()) - { - Movie aMovie = new Movie(); - - aMovie.setId(rs.getInt("id")); - aMovie.setName(rs.getString("name")); - aMovie.setRating(rs.getString("rating")); - aMovie.setReleaseDate(rs.getDate("release_date")); - aMovie.setGenre(rs.getString("genre")); - - movies.add(aMovie); - } - } - catch(ClassNotFoundException ex) - { - ex.printStackTrace(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - - return movies; - } -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/service/MovieService.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/service/MovieService.java deleted file mode 100644 index 47fb0b8..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/service/MovieService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.training.java.moviestore.service; - -import java.util.List; - -import com.training.java.moviestore.domain.Movie; - -public interface MovieService -{ - void create(Movie movie); - List getMovies(); -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/service/MovieServiceImpl.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/service/MovieServiceImpl.java deleted file mode 100644 index e79aa7f..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/service/MovieServiceImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.java.moviestore.service; - -import java.util.List; - -import com.training.java.moviestore.domain.Movie; -import com.training.java.moviestore.domain.MovieDAO; - -public class MovieServiceImpl implements MovieService -{ - private MovieDAO dao; - - public MovieServiceImpl(MovieDAO dao) - { - this.dao = dao; - } - - @Override - public void create(Movie movie) - { - dao.create(movie); - } - - @Override - public List getMovies() - { - return dao.getMovies(); - } -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/AddMovieAction.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/web/AddMovieAction.java deleted file mode 100644 index 379e048..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/AddMovieAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.moviestore.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddMovieAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - return mapping.findForward("addMovie"); - } - -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/ListMoviesAction.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/web/ListMoviesAction.java deleted file mode 100644 index 5fef4ed..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/ListMoviesAction.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.java.moviestore.web; - -import java.util.List; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.java.moviestore.domain.Movie; -import com.training.java.moviestore.service.MovieService; - -public class ListMoviesAction extends Action -{ - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - ServletContext servletContext = servlet.getServletContext(); - WebApplicationContext webAppContext = WebApplicationContextUtils - .getWebApplicationContext(servletContext); - MovieService service = (MovieService) webAppContext.getBean("movieService"); - - List movies = service.getMovies(); - request.setAttribute("Movies", movies); - - return mapping.findForward("listMovies"); - } - -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/MovieForm.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/web/MovieForm.java deleted file mode 100644 index ec1cdd9..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/MovieForm.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.training.java.moviestore.web; - -import java.sql.Date; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class MovieForm extends ActionForm -{ - private int id; - private String name; - private String rating; - private Date releaseDate; - private String genre; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getRating() - { - return rating; - } - - public void setRating(String rating) - { - this.rating = rating; - } - - public Date getReleaseDate() - { - return releaseDate; - } - - public void setReleaseDate(Date releaseDate) - { - this.releaseDate = releaseDate; - } - - public String getGenre() - { - return genre; - } - - public void setGenre(String genre) - { - this.genre = genre; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) - { - ActionErrors errors = new ActionErrors(); - - if (id == 0) - { - errors.add("id", new ActionMessage("id.required")); - } - - if(name == null || name.trim().equals("")) - { - errors.add("name", new ActionMessage("name.required")); - } - - if(genre == null || genre.trim().equals("")) - { - errors.add("genre", new ActionMessage("genre.required")); - } - - if(rating == null || rating.trim().equals("")) - { - errors.add("rating", new ActionMessage("rating.required")); - } - - return errors; - } - -} diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/MovieStore.properties b/SpringStrutsMovieStore/src/com/training/java/moviestore/web/MovieStore.properties deleted file mode 100644 index 1e10121..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/MovieStore.properties +++ /dev/null @@ -1,9 +0,0 @@ -errors.header=

    Validation Errors

      -errors.footer=
    -errors.prefix=
  • -errors.suffix=
  • - -name.required=Name is required -id.required=Id is required -rating.required=Rating is required -genre.required=Genre is required \ No newline at end of file diff --git a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/SaveMovieAction.java b/SpringStrutsMovieStore/src/com/training/java/moviestore/web/SaveMovieAction.java deleted file mode 100644 index 161a8f1..0000000 --- a/SpringStrutsMovieStore/src/com/training/java/moviestore/web/SaveMovieAction.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.training.java.moviestore.web; - -import java.sql.Date; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.java.moviestore.domain.Movie; -import com.training.java.moviestore.domain.MovieDAO; -import com.training.java.moviestore.domain.MovieDAOJDBCImpl; -import com.training.java.moviestore.service.MovieService; - -public class SaveMovieAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - MovieForm movieForm = (MovieForm) form; - - System.out.println("Name = " + movieForm.getName()); - System.out.println("Rating = " + movieForm.getRating()); - System.out.println("Genre = " + movieForm.getGenre()); - - Movie newMovie = new Movie(); - - newMovie.setGenre(movieForm.getGenre()); - newMovie.setName(movieForm.getName()); - newMovie.setRating(movieForm.getRating()); - newMovie.setId(movieForm.getId()); - newMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - ServletContext servletContext = servlet.getServletContext(); - WebApplicationContext webAppContext = WebApplicationContextUtils - .getWebApplicationContext(servletContext); - MovieService service = (MovieService) webAppContext.getBean("movieService"); - service.create(newMovie); - - return mapping.findForward("acknowledgement"); - } - -} diff --git a/StrutsBasic/.classpath b/StrutsBasic/.classpath deleted file mode 100644 index f9cdf28..0000000 --- a/StrutsBasic/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/StrutsBasic/.project b/StrutsBasic/.project deleted file mode 100644 index f7279ee..0000000 --- a/StrutsBasic/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - StrutsBasic - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/StrutsBasic/.settings/.jsdtscope b/StrutsBasic/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/StrutsBasic/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/StrutsBasic/.settings/org.eclipse.jdt.core.prefs b/StrutsBasic/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 5de2beb..0000000 --- a/StrutsBasic/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sat Jul 16 08:39:32 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/StrutsBasic/.settings/org.eclipse.wst.common.component b/StrutsBasic/.settings/org.eclipse.wst.common.component deleted file mode 100644 index b73bb0d..0000000 --- a/StrutsBasic/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/StrutsBasic/.settings/org.eclipse.wst.common.project.facet.core.xml b/StrutsBasic/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index b43f689..0000000 --- a/StrutsBasic/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/StrutsBasic/.settings/org.eclipse.wst.jsdt.ui.superType.container b/StrutsBasic/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/StrutsBasic/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/StrutsBasic/.settings/org.eclipse.wst.jsdt.ui.superType.name b/StrutsBasic/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/StrutsBasic/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/StrutsBasic/WebContent/META-INF/MANIFEST.MF b/StrutsBasic/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/StrutsBasic/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/StrutsBasic/WebContent/WEB-INF/jsp/AddBook.jsp b/StrutsBasic/WebContent/WEB-INF/jsp/AddBook.jsp deleted file mode 100644 index b4a0fdf..0000000 --- a/StrutsBasic/WebContent/WEB-INF/jsp/AddBook.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@page language="java"%> - -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - -

    Add Book..

    - - - ID :
    - Title :
    - Author :
    - ISBN :
    - Pages :
    - Publisher Id :
    - -
    -
    \ No newline at end of file diff --git a/StrutsBasic/WebContent/WEB-INF/jsp/SaveBookSuccess.jsp b/StrutsBasic/WebContent/WEB-INF/jsp/SaveBookSuccess.jsp deleted file mode 100644 index c05349b..0000000 --- a/StrutsBasic/WebContent/WEB-INF/jsp/SaveBookSuccess.jsp +++ /dev/null @@ -1 +0,0 @@ -SaveBookSuccess.jsp \ No newline at end of file diff --git a/StrutsBasic/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/StrutsBasic/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/StrutsBasic/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/StrutsBasic/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/StrutsBasic/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/StrutsBasic/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/StrutsBasic/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/commons-io-1.1.jar b/StrutsBasic/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/StrutsBasic/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/StrutsBasic/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/StrutsBasic/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/StrutsBasic/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/oro-2.0.8.jar b/StrutsBasic/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/standard-1.0.6.jar b/StrutsBasic/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/StrutsBasic/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/StrutsBasic/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/StrutsBasic/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/StrutsBasic/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/StrutsBasic/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/StrutsBasic/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/StrutsBasic/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/StrutsBasic/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/StrutsBasic/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/StrutsBasic/WebContent/WEB-INF/struts-config.xml b/StrutsBasic/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index a057b52..0000000 --- a/StrutsBasic/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/StrutsBasic/WebContent/WEB-INF/web.xml b/StrutsBasic/WebContent/WEB-INF/web.xml deleted file mode 100644 index 31b4825..0000000 --- a/StrutsBasic/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - StrutsBasic - - index.html - - - - - action - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts-config.xml - - 2 - - - - - - action - *.do - - - \ No newline at end of file diff --git a/StrutsBasic/src/com/training/java/jdbc/dao/Book.java b/StrutsBasic/src/com/training/java/jdbc/dao/Book.java deleted file mode 100644 index 63b6ed0..0000000 --- a/StrutsBasic/src/com/training/java/jdbc/dao/Book.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.training.java.jdbc.dao; - -import java.io.Serializable; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private int publisherId; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public int getPublisherId() { - return publisherId; - } - - public void setPublisherId(int publisherId) { - this.publisherId = publisherId; - } -} diff --git a/StrutsBasic/src/com/training/java/jdbc/dao/BookDAO.java b/StrutsBasic/src/com/training/java/jdbc/dao/BookDAO.java deleted file mode 100644 index 10f896a..0000000 --- a/StrutsBasic/src/com/training/java/jdbc/dao/BookDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.java.jdbc.dao; - -import java.util.List; - -public interface BookDAO { - - public void create(Book aNewBook) throws DAOException; - public List getAllBooks() throws DAOException; - public Book findByPrimaryKey(int id) throws DAOException; - public void update(Book bookToUpdate) throws DAOException; - public void delete(int id) throws DAOException; -} diff --git a/StrutsBasic/src/com/training/java/jdbc/dao/BookDAOJDBCImpl.java b/StrutsBasic/src/com/training/java/jdbc/dao/BookDAOJDBCImpl.java deleted file mode 100644 index 8bb9dd3..0000000 --- a/StrutsBasic/src/com/training/java/jdbc/dao/BookDAOJDBCImpl.java +++ /dev/null @@ -1,317 +0,0 @@ -package com.training.java.jdbc.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class BookDAOJDBCImpl implements BookDAO { - String dburl; - String dbusername; - String dbpassword; - - public BookDAOJDBCImpl(String dburl, String dbusername, String dbpassword) { - this.dburl = dburl; - this.dbusername = dbusername; - this.dbpassword = dbpassword; - } - - public void create(Book bookToAdd) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - try { - con = getConnection(dburl, dbusername, dbpassword); - // Class.forName("com.mysql.jdbc.Driver"); - // con = - // DriverManager.getConnection("jdbc:mysql://localhost/training", - // "root", ""); - - stmt = con - .prepareStatement("insert into book(id,title,author,isbn,pages,publisher_id) values(?, ?, ?,?,?, ?);"); - - stmt.setInt(1, bookToAdd.getId()); - stmt.setString(2, bookToAdd.getTitle()); - stmt.setString(3, bookToAdd.getAuthor()); - stmt.setString(4, bookToAdd.getIsbn()); - stmt.setInt(5, bookToAdd.getPages()); - stmt.setInt(6, bookToAdd.getPublisherId()); - - int numberOfRowsAffected = stmt.executeUpdate(); - - if (numberOfRowsAffected != 1) { - throw new DAOException( - "Error occured while creating new book.."); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - public List getAllBooks() throws DAOException { - List books = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - try { - con = getConnection(dburl, dbusername, dbpassword); - // Class.forName("com.mysql.jdbc.Driver"); - // con = - // DriverManager.getConnection("jdbc:mysql://localhost/training", - // "root", ""); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from book"); - - Book aBook = null; - while (rs.next()) { - // Create a Book object - aBook = new Book(); - - // Retrieve all the book details from database for each record - int id = rs.getInt("id"); - String title = rs.getString("title"); - String author = rs.getString("author"); - String isbn = rs.getString("isbn"); - int pages = rs.getInt("pages"); - int publisherId = rs.getInt("publisher_id"); - - // Populate all the details into Book object - aBook.setId(id); - aBook.setTitle(title); - aBook.setAuthor(author); - aBook.setIsbn(isbn); - aBook.setPages(pages); - aBook.setPublisherId(publisherId); - - // Now, add each book to books List - books.add(aBook); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - return books; - } - - public void update(Book bookToUpdate) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - try { - con = getConnection(dburl, dbusername, dbpassword); - // Class.forName("com.mysql.jdbc.Driver"); - // con = - // DriverManager.getConnection("jdbc:mysql://localhost/training", - // "root", ""); - stmt = con.prepareStatement("update book set title = ?," - + "author = ?," + "isbn = ?," + "pages = ?," - + "publisher_id = ? where id = ?"); - - stmt.setString(1, bookToUpdate.getTitle()); - stmt.setString(2, bookToUpdate.getAuthor()); - stmt.setString(3, bookToUpdate.getIsbn()); - stmt.setInt(4, bookToUpdate.getPages()); - stmt.setInt(5, bookToUpdate.getPublisherId()); - stmt.setInt(6, bookToUpdate.getId()); - - int numberOfRowsAffected = stmt.executeUpdate(); - - if (numberOfRowsAffected != 1) { - throw new DAOException("Error occured while updating book.."); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - public Book findByPrimaryKey(int id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - try { - con = getConnection(dburl, dbusername, dbpassword); - // Class.forName("com.mysql.jdbc.Driver"); - // con = - // DriverManager.getConnection("jdbc:mysql://localhost/training", - // "root", ""); - stmt = con.prepareStatement("select * from book where id = ?"); - - stmt.setInt(1, id); - rs = stmt.executeQuery(); - - // Create a Book object - Book aBook = null; - - while (rs.next()) { - aBook = new Book(); - // Retrieve all the book details from database for each record - String title = rs.getString("title"); - String author = rs.getString("author"); - String isbn = rs.getString("isbn"); - int pages = rs.getInt("pages"); - int publisherId = rs.getInt("publisher_id"); - - // Populate all the details into Book object - aBook.setId(id); - aBook.setTitle(title); - aBook.setAuthor(author); - aBook.setIsbn(isbn); - aBook.setPages(pages); - aBook.setPublisherId(publisherId); - } - - return aBook; - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - public void delete(int id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - try { - con = getConnection(dburl, dbusername, dbpassword); - // Class.forName("com.mysql.jdbc.Driver"); - // con = - // DriverManager.getConnection("jdbc:mysql://localhost/training", - // "root", ""); - stmt = con.prepareStatement("delete from book where id = ?"); - - stmt.setInt(1, id); - int numberOfRowsAffected = stmt.executeUpdate(); - - if (numberOfRowsAffected != 1) { - throw new DAOException("Error occured while updating book.."); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new DAOException(e); - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - private Connection getConnection(String dburl, String dbusername, - String password) throws ClassNotFoundException, SQLException { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbusername, - password); - return con; - } -} diff --git a/StrutsBasic/src/com/training/java/jdbc/dao/DAOException.java b/StrutsBasic/src/com/training/java/jdbc/dao/DAOException.java deleted file mode 100644 index c2db127..0000000 --- a/StrutsBasic/src/com/training/java/jdbc/dao/DAOException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.jdbc.dao; - -public class DAOException extends Exception { - - public DAOException(Exception cause) - { - super(cause); - } - - public DAOException(String message) - { - super(message); - } - -} diff --git a/StrutsBasic/src/com/training/java/struts/action/AddBookAction.java b/StrutsBasic/src/com/training/java/struts/action/AddBookAction.java deleted file mode 100644 index 5990261..0000000 --- a/StrutsBasic/src/com/training/java/struts/action/AddBookAction.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.struts.action; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddBookAction extends Action -{ - public ActionForward execute( - ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) - throws Exception { - - return mapping.findForward("addBook"); - - } -} diff --git a/StrutsBasic/src/com/training/java/struts/action/BookForm.java b/StrutsBasic/src/com/training/java/struts/action/BookForm.java deleted file mode 100644 index e06958f..0000000 --- a/StrutsBasic/src/com/training/java/struts/action/BookForm.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java.struts.action; - -import org.apache.struts.action.ActionForm; - -public class BookForm extends ActionForm -{ - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private int publisherId; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getTitle() - { - return title; - } - - public void setTitle(String title) - { - this.title = title; - } - - public String getAuthor() - { - return author; - } - - public void setAuthor(String author) - { - this.author = author; - } - - public String getIsbn() - { - return isbn; - } - - public void setIsbn(String isbn) - { - this.isbn = isbn; - } - - public int getPages() - { - return pages; - } - - public void setPages(int pages) - { - this.pages = pages; - } - - public int getPublisherId() - { - return publisherId; - } - - public void setPublisherId(int publisherId) - { - this.publisherId = publisherId; - } -} diff --git a/StrutsBasic/src/com/training/java/struts/action/SaveBookAction.java b/StrutsBasic/src/com/training/java/struts/action/SaveBookAction.java deleted file mode 100644 index 81dd71d..0000000 --- a/StrutsBasic/src/com/training/java/struts/action/SaveBookAction.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.training.java.struts.action; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.jdbc.dao.Book; -import com.training.java.jdbc.dao.BookDAO; -import com.training.java.jdbc.dao.BookDAOJDBCImpl; - -public class SaveBookAction extends Action -{ - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - - BookForm bookForm = (BookForm) form; - System.out.println("bookForm ID " + bookForm.getId()); - System.out.println("bookForm Title " + bookForm.getTitle()); - System.out.println("bookForm Author " + bookForm.getAuthor()); - System.out.println("bookForm ISBN " + bookForm.getIsbn()); - System.out.println("bookForm Pages " + bookForm.getPages()); - System.out - .println("bookForm Publisher Id " + bookForm.getPublisherId()); - - Book book = new Book(); - book.setAuthor(bookForm.getAuthor()); - book.setId(bookForm.getId()); - book.setIsbn(bookForm.getIsbn()); - book.setPages(bookForm.getPages()); - book.setPublisherId(bookForm.getPublisherId()); - book.setTitle(bookForm.getTitle()); - - BookDAO bookDAO = new BookDAOJDBCImpl( - "jdbc:mysql://localhost/training", "root", "password"); - bookDAO.create(book); - - return mapping.findForward("success"); - } -} diff --git a/StrutsHelloWorld/.classpath b/StrutsHelloWorld/.classpath deleted file mode 100644 index 32a11af..0000000 --- a/StrutsHelloWorld/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/StrutsHelloWorld/.project b/StrutsHelloWorld/.project deleted file mode 100644 index 8cc83f4..0000000 --- a/StrutsHelloWorld/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - StrutsHelloWorld - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/StrutsHelloWorld/.settings/.jsdtscope b/StrutsHelloWorld/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/StrutsHelloWorld/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/StrutsHelloWorld/.settings/org.eclipse.jdt.core.prefs b/StrutsHelloWorld/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 943c2eb..0000000 --- a/StrutsHelloWorld/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sun Feb 19 08:59:28 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/StrutsHelloWorld/.settings/org.eclipse.wst.common.component b/StrutsHelloWorld/.settings/org.eclipse.wst.common.component deleted file mode 100644 index e0c714b..0000000 --- a/StrutsHelloWorld/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/StrutsHelloWorld/.settings/org.eclipse.wst.common.project.facet.core.xml b/StrutsHelloWorld/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 0873c6e..0000000 --- a/StrutsHelloWorld/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/StrutsHelloWorld/.settings/org.eclipse.wst.jsdt.ui.superType.container b/StrutsHelloWorld/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/StrutsHelloWorld/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/StrutsHelloWorld/.settings/org.eclipse.wst.jsdt.ui.superType.name b/StrutsHelloWorld/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/StrutsHelloWorld/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/StrutsHelloWorld/WebContent/META-INF/MANIFEST.MF b/StrutsHelloWorld/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/StrutsHelloWorld/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-io-1.1.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/oro-2.0.8.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/standard-1.0.6.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/StrutsHelloWorld/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/StrutsHelloWorld/WebContent/WEB-INF/struts-config.xml b/StrutsHelloWorld/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index e291e27..0000000 --- a/StrutsHelloWorld/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/StrutsHelloWorld/WebContent/WEB-INF/views/HelloWorld.jsp b/StrutsHelloWorld/WebContent/WEB-INF/views/HelloWorld.jsp deleted file mode 100644 index 4c54520..0000000 --- a/StrutsHelloWorld/WebContent/WEB-INF/views/HelloWorld.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

    Hello world from Struts!!

    - - \ No newline at end of file diff --git a/StrutsHelloWorld/WebContent/WEB-INF/web.xml b/StrutsHelloWorld/WebContent/WEB-INF/web.xml deleted file mode 100644 index 136e080..0000000 --- a/StrutsHelloWorld/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - StrutsHelloWorld - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/struts-config.xml - - - - - - ActionServlet - *.do - - - \ No newline at end of file diff --git a/StrutsHelloWorld/src/com/training/java/struts/HelloWorldAction.java b/StrutsHelloWorld/src/com/training/java/struts/HelloWorldAction.java deleted file mode 100644 index 5a3746d..0000000 --- a/StrutsHelloWorld/src/com/training/java/struts/HelloWorldAction.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.struts; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class HelloWorldAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - System.out.println("I am inside execute() of HelloWorldAction"); - return mapping.findForward("hello"); - } - -} diff --git a/StrutsMovieStore/.classpath b/StrutsMovieStore/.classpath deleted file mode 100644 index 4a1837d..0000000 --- a/StrutsMovieStore/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/StrutsMovieStore/.project b/StrutsMovieStore/.project deleted file mode 100644 index ca516bf..0000000 --- a/StrutsMovieStore/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - StrutsMovieStore - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/StrutsMovieStore/.settings/.jsdtscope b/StrutsMovieStore/.settings/.jsdtscope deleted file mode 100644 index f40dd98..0000000 --- a/StrutsMovieStore/.settings/.jsdtscope +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/StrutsMovieStore/.settings/org.eclipse.jdt.core.prefs b/StrutsMovieStore/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7b0ac97..0000000 --- a/StrutsMovieStore/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Tue Sep 20 19:00:30 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/StrutsMovieStore/.settings/org.eclipse.wst.common.component b/StrutsMovieStore/.settings/org.eclipse.wst.common.component deleted file mode 100644 index a5dbe1d..0000000 --- a/StrutsMovieStore/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/StrutsMovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml b/StrutsMovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 3d1d1d9..0000000 --- a/StrutsMovieStore/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/StrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container b/StrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/StrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/StrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name b/StrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/StrutsMovieStore/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/StrutsMovieStore/WebContent/META-INF/MANIFEST.MF b/StrutsMovieStore/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/StrutsMovieStore/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/StrutsMovieStore/WebContent/WEB-INF/jsp/Acknowledgement.jsp b/StrutsMovieStore/WebContent/WEB-INF/jsp/Acknowledgement.jsp deleted file mode 100644 index 75f67c8..0000000 --- a/StrutsMovieStore/WebContent/WEB-INF/jsp/Acknowledgement.jsp +++ /dev/null @@ -1 +0,0 @@ -

    Your details have been saved successfully.

    \ No newline at end of file diff --git a/StrutsMovieStore/WebContent/WEB-INF/jsp/AddMovie.jsp b/StrutsMovieStore/WebContent/WEB-INF/jsp/AddMovie.jsp deleted file mode 100644 index 3d95c28..0000000 --- a/StrutsMovieStore/WebContent/WEB-INF/jsp/AddMovie.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@page language="java"%> - -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - -

    Please enter the details below and click Submit.

    - -Id :
    -Name :
    -Rating :
    -Genre :
    - - - -
    \ No newline at end of file diff --git a/StrutsMovieStore/WebContent/WEB-INF/jsp/ListMovies.jsp b/StrutsMovieStore/WebContent/WEB-INF/jsp/ListMovies.jsp deleted file mode 100644 index 000f38f..0000000 --- a/StrutsMovieStore/WebContent/WEB-INF/jsp/ListMovies.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@page language="java"%> - -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> - - - - - - - - - - - - - - - - - - - -
    IdNameRatingRelease DateGenre
    ID :
    Name :
    Rating :
    Release Date :
    Genre :
    - - diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-io-1.1.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/junit-4.8.1.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/junit-4.8.1.jar deleted file mode 100644 index 524cd65..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/junit-4.8.1.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/oro-2.0.8.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/standard-1.0.6.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/StrutsMovieStore/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/StrutsMovieStore/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/StrutsMovieStore/WebContent/WEB-INF/struts-config.xml b/StrutsMovieStore/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index 1ff4b00..0000000 --- a/StrutsMovieStore/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/StrutsMovieStore/WebContent/WEB-INF/web.xml b/StrutsMovieStore/WebContent/WEB-INF/web.xml deleted file mode 100644 index a8399d3..0000000 --- a/StrutsMovieStore/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - StrutsMovieStore - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - - action - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts-config.xml - - 1 - - - - - - action - *.do - - - \ No newline at end of file diff --git a/StrutsMovieStore/WebContent/index.html b/StrutsMovieStore/WebContent/index.html deleted file mode 100644 index 27c5d4d..0000000 --- a/StrutsMovieStore/WebContent/index.html +++ /dev/null @@ -1,7 +0,0 @@ -

    Welcome to Movie Store

    - -
      -
    1. List of movies : list
    2. -
    3. Add a movie : add
    4. - -
    \ No newline at end of file diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/Movie.java b/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/Movie.java deleted file mode 100644 index c2cf67c..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/Movie.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.sql.Date; - -public class Movie -{ - private int id; - private String name; - private String rating; - private Date releaseDate; - private String genre; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getRating() - { - return rating; - } - - public void setRating(String rating) - { - this.rating = rating; - } - - public Date getReleaseDate() - { - return releaseDate; - } - - public void setReleaseDate(Date releaseDate) - { - this.releaseDate = releaseDate; - } - - public String getGenre() - { - return genre; - } - - public void setGenre(String genre) - { - this.genre = genre; - } -} diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAO.java b/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAO.java deleted file mode 100644 index 8a7aa8a..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.util.List; - -public interface MovieDAO -{ - void create(Movie movie); - List getMovies(); -} diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java b/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java deleted file mode 100644 index 5bdb998..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAODemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.util.List; - -public class MovieDAODemo -{ - /** - * @param args - */ - public static void main(String[] args) - { - /* - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - Movie aMovie = new Movie(); - aMovie.setId(2); - aMovie.setName("Speed2..CC"); - aMovie.setRating("PG-13"); - aMovie.setGenre("Thriller"); - aMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - dao.create(aMovie); - */ - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - - List movies = dao.getMovies(); - for(Movie aMovie : movies) - { - System.out.println("Name = " + aMovie.getName()); - System.out.println("Rating = " + aMovie.getRating()); - System.out.println("Genre = " + aMovie.getGenre()); - System.out.println("Release date = " + aMovie.getReleaseDate()); - System.out.println("id = " + aMovie.getId()); - } - } - -} diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java b/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java deleted file mode 100644 index 3a6bc38..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -public class MovieDAOException extends RuntimeException -{ - MovieDAOException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java b/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index b1a275d..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.training.java.servlet.moviestore.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class MovieDAOJDBCImpl implements MovieDAO -{ - private String dburl; - private String dbuser; - private String dbPassword; - - public MovieDAOJDBCImpl(String dburl, String dbuser, String dbPassWord) - { - this.dburl = dburl; - this.dbuser = dbuser; - this.dbPassword = dbPassWord; - } - - @Override - public void create(Movie movie) - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("insert into movie(id, genre, rating, release_date, name) values(?,?,?,?,?)"); - - stmt.setInt(1, movie.getId()); - stmt.setString(2, movie.getGenre()); - stmt.setString(3, movie.getRating()); - stmt.setDate(4, movie.getReleaseDate()); - stmt.setString(5, movie.getName()); - - stmt.executeUpdate(); - - } - catch(ClassNotFoundException e) - { - e.printStackTrace(); - } - catch (SQLException e) - { - throw new MovieDAOException(e.getMessage()); - } - } - - @Override - public List getMovies() - { - List movies = new ArrayList(); - - try - { - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection(dburl, dbuser, - dbPassword); - PreparedStatement stmt = con - .prepareStatement("select * from movie"); - - ResultSet rs = stmt.executeQuery(); - - while(rs.next()) - { - Movie aMovie = new Movie(); - - aMovie.setId(rs.getInt("id")); - aMovie.setName(rs.getString("name")); - aMovie.setRating(rs.getString("rating")); - aMovie.setReleaseDate(rs.getDate("release_date")); - aMovie.setGenre(rs.getString("genre")); - - movies.add(aMovie); - } - } - catch(ClassNotFoundException ex) - { - ex.printStackTrace(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - - return movies; - } -} diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/AddMovieAction.java b/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/AddMovieAction.java deleted file mode 100644 index 3a6613a..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/AddMovieAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.servlet.moviestore.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddMovieAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - return mapping.findForward("addMovie"); - } - -} diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/ListMoviesAction.java b/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/ListMoviesAction.java deleted file mode 100644 index b76f2b0..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/ListMoviesAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.servlet.moviestore.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.servlet.moviestore.domain.Movie; -import com.training.java.servlet.moviestore.domain.MovieDAO; -import com.training.java.servlet.moviestore.domain.MovieDAOJDBCImpl; - -public class ListMoviesAction extends Action -{ - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - List movies = dao.getMovies(); - request.setAttribute("Movies", movies); - - return mapping.findForward("listMovies"); - } - -} diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/MovieForm.java b/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/MovieForm.java deleted file mode 100644 index 4955f8e..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/MovieForm.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.training.java.servlet.moviestore.web; - -import java.sql.Date; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class MovieForm extends ActionForm -{ - private int id; - private String name; - private String rating; - private Date releaseDate; - private String genre; - - public int getId() - { - return id; - } - - public void setId(int id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getRating() - { - return rating; - } - - public void setRating(String rating) - { - this.rating = rating; - } - - public Date getReleaseDate() - { - return releaseDate; - } - - public void setReleaseDate(Date releaseDate) - { - this.releaseDate = releaseDate; - } - - public String getGenre() - { - return genre; - } - - public void setGenre(String genre) - { - this.genre = genre; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) - { - ActionErrors errors = new ActionErrors(); - - if (id == 0) - { - errors.add("id", new ActionMessage("id.required")); - } - - if(name == null || name.trim().equals("")) - { - errors.add("name", new ActionMessage("name.required")); - } - - if(genre == null || genre.trim().equals("")) - { - errors.add("genre", new ActionMessage("genre.required")); - } - - if(rating == null || rating.trim().equals("")) - { - errors.add("rating", new ActionMessage("rating.required")); - } - - return errors; - } - -} diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/MovieStore.properties b/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/MovieStore.properties deleted file mode 100644 index 1e10121..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/MovieStore.properties +++ /dev/null @@ -1,9 +0,0 @@ -errors.header=

    Validation Errors

      -errors.footer=
    -errors.prefix=
  • -errors.suffix=
  • - -name.required=Name is required -id.required=Id is required -rating.required=Rating is required -genre.required=Genre is required \ No newline at end of file diff --git a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/SaveMovieAction.java b/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/SaveMovieAction.java deleted file mode 100644 index d968800..0000000 --- a/StrutsMovieStore/src/com/training/java/servlet/moviestore/web/SaveMovieAction.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.java.servlet.moviestore.web; - -import java.sql.Date; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.servlet.moviestore.domain.Movie; -import com.training.java.servlet.moviestore.domain.MovieDAO; -import com.training.java.servlet.moviestore.domain.MovieDAOJDBCImpl; - -public class SaveMovieAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - MovieForm movieForm = (MovieForm) form; - - System.out.println("Name = " + movieForm.getName()); - System.out.println("Rating = " + movieForm.getRating()); - System.out.println("Genre = " + movieForm.getGenre()); - - Movie newMovie = new Movie(); - - newMovie.setGenre(movieForm.getGenre()); - newMovie.setName(movieForm.getName()); - newMovie.setRating(movieForm.getRating()); - newMovie.setId(movieForm.getId()); - newMovie.setReleaseDate(new Date(System.currentTimeMillis())); - - MovieDAO dao = new MovieDAOJDBCImpl("jdbc:mysql://localhost/training", "root", "password"); - dao.create(newMovie); - - return mapping.findForward("acknowledgement"); - } - -} diff --git a/StrutsStudents/.classpath b/StrutsStudents/.classpath deleted file mode 100644 index 32a11af..0000000 --- a/StrutsStudents/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/StrutsStudents/.project b/StrutsStudents/.project deleted file mode 100644 index 4afcdd0..0000000 --- a/StrutsStudents/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - StrutsStudents - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/StrutsStudents/.settings/.jsdtscope b/StrutsStudents/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/StrutsStudents/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/StrutsStudents/.settings/org.eclipse.jdt.core.prefs b/StrutsStudents/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 549de22..0000000 --- a/StrutsStudents/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sun Feb 19 10:08:03 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/StrutsStudents/.settings/org.eclipse.wst.common.component b/StrutsStudents/.settings/org.eclipse.wst.common.component deleted file mode 100644 index c1b127d..0000000 --- a/StrutsStudents/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/StrutsStudents/.settings/org.eclipse.wst.common.project.facet.core.xml b/StrutsStudents/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 0873c6e..0000000 --- a/StrutsStudents/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/StrutsStudents/.settings/org.eclipse.wst.jsdt.ui.superType.container b/StrutsStudents/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/StrutsStudents/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/StrutsStudents/.settings/org.eclipse.wst.jsdt.ui.superType.name b/StrutsStudents/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/StrutsStudents/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/StrutsStudents/WebContent/META-INF/MANIFEST.MF b/StrutsStudents/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/StrutsStudents/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/StrutsStudents/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/StrutsStudents/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/StrutsStudents/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/StrutsStudents/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/StrutsStudents/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/StrutsStudents/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/StrutsStudents/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/commons-io-1.1.jar b/StrutsStudents/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/StrutsStudents/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/StrutsStudents/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/StrutsStudents/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar b/StrutsStudents/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar deleted file mode 100644 index cdee6a1..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/oro-2.0.8.jar b/StrutsStudents/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/standard-1.0.6.jar b/StrutsStudents/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/StrutsStudents/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/StrutsStudents/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/StrutsStudents/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/StrutsStudents/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/StrutsStudents/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/StrutsStudents/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/StrutsStudents/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/StrutsStudents/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/StrutsStudents/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/StrutsStudents/WebContent/WEB-INF/struts-config.xml b/StrutsStudents/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index 19aa669..0000000 --- a/StrutsStudents/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/StrutsStudents/WebContent/WEB-INF/views/Acknowledgement.jsp b/StrutsStudents/WebContent/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 6c93bc0..0000000 --- a/StrutsStudents/WebContent/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

    Your details have been saved..

    - - \ No newline at end of file diff --git a/StrutsStudents/WebContent/WEB-INF/views/AddStudent.jsp b/StrutsStudents/WebContent/WEB-INF/views/AddStudent.jsp deleted file mode 100644 index 9f7b5c3..0000000 --- a/StrutsStudents/WebContent/WEB-INF/views/AddStudent.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

    Please fill the details below and press Submit...

    -
    - - Id :
    - First name :
    - Last name :
    - Age :
    - Phone :
    - Email :
    - City :
    - - -
    - - \ No newline at end of file diff --git a/StrutsStudents/WebContent/WEB-INF/views/ListStudents.jsp b/StrutsStudents/WebContent/WEB-INF/views/ListStudents.jsp deleted file mode 100644 index 3bd768f..0000000 --- a/StrutsStudents/WebContent/WEB-INF/views/ListStudents.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - - - - -
    First NameLast NameCityAgePhoneEmail
    - ${aStudent.firstName} - - ${aStudent.lastName} - - ${aStudent.city} - - ${aStudent.age} - - ${aStudent.phoneNumber} - - ${aStudent.email} -
    - - \ No newline at end of file diff --git a/StrutsStudents/WebContent/WEB-INF/web.xml b/StrutsStudents/WebContent/WEB-INF/web.xml deleted file mode 100644 index 136e080..0000000 --- a/StrutsStudents/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - StrutsHelloWorld - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/struts-config.xml - - - - - - ActionServlet - *.do - - - \ No newline at end of file diff --git a/StrutsStudents/src/com/training/java/struts/students/domain/DAOException.java b/StrutsStudents/src/com/training/java/struts/students/domain/DAOException.java deleted file mode 100644 index ad3c3f7..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.struts.students.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/StrutsStudents/src/com/training/java/struts/students/domain/Student.java b/StrutsStudents/src/com/training/java/struts/students/domain/Student.java deleted file mode 100644 index ca60747..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.struts.students.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/StrutsStudents/src/com/training/java/struts/students/domain/StudentDAO.java b/StrutsStudents/src/com/training/java/struts/students/domain/StudentDAO.java deleted file mode 100644 index 98ac085..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.util.List; - -interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/StrutsStudents/src/com/training/java/struts/students/domain/StudentDAOJDBCImpl.java b/StrutsStudents/src/com/training/java/struts/students/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index 7ae6107..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/StrutsStudents/src/com/training/java/struts/students/domain/StudentService.java b/StrutsStudents/src/com/training/java/struts/students/domain/StudentService.java deleted file mode 100644 index 0d233ee..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/domain/StudentService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.util.List; - -public interface StudentService { - - List getAllStudents(); - void addStudent(Student student); - -} diff --git a/StrutsStudents/src/com/training/java/struts/students/domain/StudentServiceImpl.java b/StrutsStudents/src/com/training/java/struts/students/domain/StudentServiceImpl.java deleted file mode 100644 index 22c8017..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/domain/StudentServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.util.List; - -public class StudentServiceImpl implements StudentService { - - @Override - public void addStudent(Student student) { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - dao.create(student); - - } - - @Override - public List getAllStudents() { - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - return dao.getAllStudents(); - } -} diff --git a/StrutsStudents/src/com/training/java/struts/students/web/AddStudentAction.java b/StrutsStudents/src/com/training/java/struts/students/web/AddStudentAction.java deleted file mode 100644 index c061a6a..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/web/AddStudentAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.struts.students.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddStudentAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("add"); - } - -} diff --git a/StrutsStudents/src/com/training/java/struts/students/web/ListStudentAction.java b/StrutsStudents/src/com/training/java/struts/students/web/ListStudentAction.java deleted file mode 100644 index fd30d3c..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/web/ListStudentAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.struts.students.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.students.domain.Student; -import com.training.java.struts.students.domain.StudentService; -import com.training.java.struts.students.domain.StudentServiceImpl; - -public class ListStudentAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - StudentService service = new StudentServiceImpl(); - List students = service.getAllStudents(); - - request.setAttribute("students", students); - - return mapping.findForward("list"); - } - -} diff --git a/StrutsStudents/src/com/training/java/struts/students/web/SaveStudentAction.java b/StrutsStudents/src/com/training/java/struts/students/web/SaveStudentAction.java deleted file mode 100644 index b5ea949..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/web/SaveStudentAction.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.training.java.struts.students.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.students.domain.Student; -import com.training.java.struts.students.domain.StudentService; -import com.training.java.struts.students.domain.StudentServiceImpl; - -public class SaveStudentAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - StudentForm studentForm = (StudentForm) form; - - System.out.println("first name = " + studentForm.getFirstName()); - System.out.println("last name = " + studentForm.getLastName()); - System.out.println("Age = " + studentForm.getAge()); - - Student student = new Student(); - - student.setAge(studentForm.getAge()); - student.setFirstName(studentForm.getFirstName()); - student.setLastName(studentForm.getLastName()); - student.setId(studentForm.getId()); - student.setEmail(studentForm.getEmail()); - student.setCity(studentForm.getCity()); - student.setPhoneNumber(studentForm.getPhone()); - - StudentService service = new StudentServiceImpl(); - service.addStudent(student); - - return mapping.findForward("acknowledgement"); - } -} diff --git a/StrutsStudents/src/com/training/java/struts/students/web/StudentForm.java b/StrutsStudents/src/com/training/java/struts/students/web/StudentForm.java deleted file mode 100644 index 0435df7..0000000 --- a/StrutsStudents/src/com/training/java/struts/students/web/StudentForm.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.training.java.struts.students.web; - -import org.apache.struts.action.ActionForm; - -public class StudentForm extends ActionForm { - - private String firstName; - private String lastName; - private int age; - private int id; - private String phone; - private String email; - private String city; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - -} diff --git a/StrutsStudentsAdvanced/.classpath b/StrutsStudentsAdvanced/.classpath deleted file mode 100644 index 32a11af..0000000 --- a/StrutsStudentsAdvanced/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/StrutsStudentsAdvanced/.project b/StrutsStudentsAdvanced/.project deleted file mode 100644 index 35ecb23..0000000 --- a/StrutsStudentsAdvanced/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - StrutsStudentsAdvanced - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/StrutsStudentsAdvanced/.settings/.jsdtscope b/StrutsStudentsAdvanced/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/StrutsStudentsAdvanced/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/StrutsStudentsAdvanced/.settings/org.eclipse.jdt.core.prefs b/StrutsStudentsAdvanced/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index b29e9d3..0000000 --- a/StrutsStudentsAdvanced/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Tue Feb 21 18:57:19 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/StrutsStudentsAdvanced/.settings/org.eclipse.wst.common.component b/StrutsStudentsAdvanced/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 851509e..0000000 --- a/StrutsStudentsAdvanced/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/StrutsStudentsAdvanced/.settings/org.eclipse.wst.common.project.facet.core.xml b/StrutsStudentsAdvanced/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d62d1e5..0000000 --- a/StrutsStudentsAdvanced/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/StrutsStudentsAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.container b/StrutsStudentsAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/StrutsStudentsAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/StrutsStudentsAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.name b/StrutsStudentsAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/StrutsStudentsAdvanced/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/StrutsStudentsAdvanced/WebContent/META-INF/MANIFEST.MF b/StrutsStudentsAdvanced/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/StrutsStudentsAdvanced/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-io-1.1.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar deleted file mode 100644 index cdee6a1..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/oro-2.0.8.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/standard-1.0.6.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/StrutsStudentsAdvanced/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/struts-config.xml b/StrutsStudentsAdvanced/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index bb6ae15..0000000 --- a/StrutsStudentsAdvanced/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/views/Acknowledgement.jsp b/StrutsStudentsAdvanced/WebContent/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 6c93bc0..0000000 --- a/StrutsStudentsAdvanced/WebContent/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

    Your details have been saved..

    - - \ No newline at end of file diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/views/AddStudent.jsp b/StrutsStudentsAdvanced/WebContent/WEB-INF/views/AddStudent.jsp deleted file mode 100644 index 64fd61c..0000000 --- a/StrutsStudentsAdvanced/WebContent/WEB-INF/views/AddStudent.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %> - - - -Insert title here - - - - - -

    Please fill the details below and press Submit...

    - - Id :
    - First name :
    - Last name :
    - Age :
    - Phone :
    - Email :
    - City :
    - - -
    - - \ No newline at end of file diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/views/ListStudents.jsp b/StrutsStudentsAdvanced/WebContent/WEB-INF/views/ListStudents.jsp deleted file mode 100644 index 19b7b19..0000000 --- a/StrutsStudentsAdvanced/WebContent/WEB-INF/views/ListStudents.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - -
    - - \ No newline at end of file diff --git a/StrutsStudentsAdvanced/WebContent/WEB-INF/web.xml b/StrutsStudentsAdvanced/WebContent/WEB-INF/web.xml deleted file mode 100644 index 136e080..0000000 --- a/StrutsStudentsAdvanced/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - StrutsHelloWorld - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/struts-config.xml - - - - - - ActionServlet - *.do - - - \ No newline at end of file diff --git a/StrutsStudentsAdvanced/src/Students.properties b/StrutsStudentsAdvanced/src/Students.properties deleted file mode 100644 index 99367c4..0000000 --- a/StrutsStudentsAdvanced/src/Students.properties +++ /dev/null @@ -1,16 +0,0 @@ -display.firstName=First Name -display.lastName=Last Name -display.city=City -display.age=Age -display.phoneNumber=Phone Number -display.email=Email - -errors.header=

    Validation Errors

      -errors.footer=
    -errors.prefix=
  • -errors.suffix=
  • - -id.required=ID is required to create a new student -firstName.required=First name is mandatory -lastName.required=Last name is mandatory - diff --git a/StrutsStudentsAdvanced/src/Students_de.properties b/StrutsStudentsAdvanced/src/Students_de.properties deleted file mode 100644 index dd630a4..0000000 --- a/StrutsStudentsAdvanced/src/Students_de.properties +++ /dev/null @@ -1,6 +0,0 @@ -display.firstName=DE First Name -display.lastName=DE Last Name -display.city=DE City -display.age=DE Age -display.phoneNumber=DE Phone Number -display.email=DE Email diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/DAOException.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/DAOException.java deleted file mode 100644 index ad3c3f7..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.struts.students.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/Student.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/Student.java deleted file mode 100644 index ca60747..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.struts.students.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentDAO.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentDAO.java deleted file mode 100644 index 98ac085..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.util.List; - -interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentDAOJDBCImpl.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index 7ae6107..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentService.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentService.java deleted file mode 100644 index 0d233ee..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.util.List; - -public interface StudentService { - - List getAllStudents(); - void addStudent(Student student); - -} diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentServiceImpl.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentServiceImpl.java deleted file mode 100644 index 22c8017..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/domain/StudentServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.util.List; - -public class StudentServiceImpl implements StudentService { - - @Override - public void addStudent(Student student) { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - dao.create(student); - - } - - @Override - public List getAllStudents() { - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - return dao.getAllStudents(); - } -} diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/AddStudentAction.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/AddStudentAction.java deleted file mode 100644 index c061a6a..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/AddStudentAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.struts.students.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddStudentAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("add"); - } - -} diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/ListStudentAction.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/ListStudentAction.java deleted file mode 100644 index fd30d3c..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/ListStudentAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.struts.students.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.students.domain.Student; -import com.training.java.struts.students.domain.StudentService; -import com.training.java.struts.students.domain.StudentServiceImpl; - -public class ListStudentAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - StudentService service = new StudentServiceImpl(); - List students = service.getAllStudents(); - - request.setAttribute("students", students); - - return mapping.findForward("list"); - } - -} diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/SaveStudentAction.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/SaveStudentAction.java deleted file mode 100644 index b5ea949..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/SaveStudentAction.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.training.java.struts.students.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.students.domain.Student; -import com.training.java.struts.students.domain.StudentService; -import com.training.java.struts.students.domain.StudentServiceImpl; - -public class SaveStudentAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - StudentForm studentForm = (StudentForm) form; - - System.out.println("first name = " + studentForm.getFirstName()); - System.out.println("last name = " + studentForm.getLastName()); - System.out.println("Age = " + studentForm.getAge()); - - Student student = new Student(); - - student.setAge(studentForm.getAge()); - student.setFirstName(studentForm.getFirstName()); - student.setLastName(studentForm.getLastName()); - student.setId(studentForm.getId()); - student.setEmail(studentForm.getEmail()); - student.setCity(studentForm.getCity()); - student.setPhoneNumber(studentForm.getPhone()); - - StudentService service = new StudentServiceImpl(); - service.addStudent(student); - - return mapping.findForward("acknowledgement"); - } -} diff --git a/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/StudentForm.java b/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/StudentForm.java deleted file mode 100644 index c4af267..0000000 --- a/StrutsStudentsAdvanced/src/com/training/java/struts/students/web/StudentForm.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.training.java.struts.students.web; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class StudentForm extends ActionForm { - - private String firstName; - private String lastName; - private int age; - private int id; - private String phone; - private String email; - private String city; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { - - ActionErrors errors = new ActionErrors(); - - if(firstName == null || firstName.trim().length() == 0) - { - errors.add("firstNameRequired", new ActionMessage("firstName.required")); - } - - if(lastName == null || lastName.trim().length() == 0) - { - errors.add("lastNameRequired", new ActionMessage("lastName.required")); - } - - if(id == 0) - { - errors.add("idRequired", new ActionMessage("id.required")); - } - - return errors; - } - -} diff --git a/StrutsWelcomeWorld/.classpath b/StrutsWelcomeWorld/.classpath deleted file mode 100644 index 363cbf2..0000000 --- a/StrutsWelcomeWorld/.classpath +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/StrutsWelcomeWorld/.project b/StrutsWelcomeWorld/.project deleted file mode 100644 index 31eeb38..0000000 --- a/StrutsWelcomeWorld/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - StrutsWelcomeWorld - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/StrutsWelcomeWorld/.settings/.jsdtscope b/StrutsWelcomeWorld/.settings/.jsdtscope deleted file mode 100644 index f40dd98..0000000 --- a/StrutsWelcomeWorld/.settings/.jsdtscope +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/StrutsWelcomeWorld/.settings/org.eclipse.jdt.core.prefs b/StrutsWelcomeWorld/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 9e39328..0000000 --- a/StrutsWelcomeWorld/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Sun Sep 18 12:08:29 EDT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/StrutsWelcomeWorld/.settings/org.eclipse.wst.common.component b/StrutsWelcomeWorld/.settings/org.eclipse.wst.common.component deleted file mode 100644 index bf299f8..0000000 --- a/StrutsWelcomeWorld/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/StrutsWelcomeWorld/.settings/org.eclipse.wst.common.project.facet.core.xml b/StrutsWelcomeWorld/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 3d1d1d9..0000000 --- a/StrutsWelcomeWorld/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/StrutsWelcomeWorld/.settings/org.eclipse.wst.jsdt.ui.superType.container b/StrutsWelcomeWorld/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/StrutsWelcomeWorld/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/StrutsWelcomeWorld/.settings/org.eclipse.wst.jsdt.ui.superType.name b/StrutsWelcomeWorld/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/StrutsWelcomeWorld/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/StrutsWelcomeWorld/WebContent/META-INF/MANIFEST.MF b/StrutsWelcomeWorld/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/StrutsWelcomeWorld/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/jsp/HelloWorld.jsp b/StrutsWelcomeWorld/WebContent/WEB-INF/jsp/HelloWorld.jsp deleted file mode 100644 index fc3d9fd..0000000 --- a/StrutsWelcomeWorld/WebContent/WEB-INF/jsp/HelloWorld.jsp +++ /dev/null @@ -1 +0,0 @@ -

    Hello world..

    \ No newline at end of file diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-io-1.1.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/junit-4.8.1.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/junit-4.8.1.jar deleted file mode 100644 index 524cd65..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/junit-4.8.1.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/oro-2.0.8.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/standard-1.0.6.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/StrutsWelcomeWorld/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/struts-config.xml b/StrutsWelcomeWorld/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index 121db72..0000000 --- a/StrutsWelcomeWorld/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/StrutsWelcomeWorld/WebContent/WEB-INF/web.xml b/StrutsWelcomeWorld/WebContent/WEB-INF/web.xml deleted file mode 100644 index 16cd035..0000000 --- a/StrutsWelcomeWorld/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - StrutsWelcomeWorld - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - - action - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts-config.xml - - 1 - - - - - action - *.do - - \ No newline at end of file diff --git a/StrutsWelcomeWorld/src/com/training/struts/helloworld/HelloworldAction.java b/StrutsWelcomeWorld/src/com/training/struts/helloworld/HelloworldAction.java deleted file mode 100644 index 1e8d7f1..0000000 --- a/StrutsWelcomeWorld/src/com/training/struts/helloworld/HelloworldAction.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.struts.helloworld; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class HelloworldAction extends Action -{ - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - - return mapping.findForward("success"); - } -} diff --git a/ajax/.classpath b/ajax/.classpath deleted file mode 100644 index 42119b1..0000000 --- a/ajax/.classpath +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/ajax/.project b/ajax/.project deleted file mode 100644 index 075cba5..0000000 --- a/ajax/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - restfulws - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/ajax/.settings/.jsdtscope b/ajax/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/ajax/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/ajax/.settings/org.eclipse.jdt.core.prefs b/ajax/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 716728f..0000000 --- a/ajax/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sun Mar 18 06:12:30 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/ajax/.settings/org.eclipse.m2e.core.prefs b/ajax/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 017e750..0000000 --- a/ajax/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 18 06:08:05 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/ajax/.settings/org.eclipse.wst.common.component b/ajax/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 5b4171e..0000000 --- a/ajax/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/ajax/.settings/org.eclipse.wst.common.project.facet.core.xml b/ajax/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 6b007af..0000000 --- a/ajax/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ajax/.settings/org.eclipse.wst.jsdt.ui.superType.container b/ajax/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/ajax/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/ajax/.settings/org.eclipse.wst.jsdt.ui.superType.name b/ajax/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/ajax/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/ajax/pom.xml b/ajax/pom.xml deleted file mode 100644 index 2533b0c..0000000 --- a/ajax/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - 4.0.0 - com.training - restfulws - war - 1.0 - - 3.0.6.RELEASE - - - - - javax.servlet - jstl - 1.2 - - - org.springframework - spring-webmvc - 3.0.6.RELEASE - - - org.springframework - spring-jdbc - 3.0.6.RELEASE - - - org.springframework - spring-oxm - 3.0.6.RELEASE - - - mysql - mysql-connector-java - 5.1.17 - - - commons-dbcp - commons-dbcp - 1.4 - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.2.0.Final - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.5 - - - - javax.servlet - servlet-api - 2.5 - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - - - junit - junit - 4.7 - test - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-dependency-plugin - - - install - install - - sources - - - - - - - \ No newline at end of file diff --git a/ajax/src/main/java/com/training/java/springmvc3/web/SearchController.java b/ajax/src/main/java/com/training/java/springmvc3/web/SearchController.java deleted file mode 100644 index d03de53..0000000 --- a/ajax/src/main/java/com/training/java/springmvc3/web/SearchController.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.training.java.springmvc3.web; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class SearchController { - - @RequestMapping("/searchform") - public String searchForm() { - return "Search"; - } - - @RequestMapping("/search") - public List search(@RequestParam String key) { - - System.out.println("Search key = " + key); - - List allProducts = getAllProducts(); - - List result = new ArrayList(); - - for (String product : allProducts) { - if (product.startsWith(key)) { - result.add(product); - } - } - - return result; - } - - private List getAllProducts() { - return Arrays.asList("iPad", "iPhone", "Android Tablet by Samsung", - "Samsung Galaxy Tab 5", "Gone with the wind", - "Pragmatic Programmer", "Apple Watch", "Apple Watch pro", - "Apple watch gold", "Apple watch new"); - } -} \ No newline at end of file diff --git a/ajax/src/main/resources/spring-config.xml b/ajax/src/main/resources/spring-config.xml deleted file mode 100644 index 96e3e5f..0000000 --- a/ajax/src/main/resources/spring-config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/ajax/src/main/webapp/WEB-INF/restfulws-servlet.xml b/ajax/src/main/webapp/WEB-INF/restfulws-servlet.xml deleted file mode 100644 index ee11067..0000000 --- a/ajax/src/main/webapp/WEB-INF/restfulws-servlet.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ajax/src/main/webapp/WEB-INF/views/Search.jsp b/ajax/src/main/webapp/WEB-INF/views/Search.jsp deleted file mode 100644 index bfb0bc1..0000000 --- a/ajax/src/main/webapp/WEB-INF/views/Search.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - - -
    -
    - - -
    - -
    - - - - - - - \ No newline at end of file diff --git a/ajax/src/main/webapp/WEB-INF/web.xml b/ajax/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 8d4cde4..0000000 --- a/ajax/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - restfulws - org.springframework.web.servlet.DispatcherServlet - 1 - - - - restfulws - / - - \ No newline at end of file diff --git a/ajax/src/main/webapp/index.jsp b/ajax/src/main/webapp/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/ajax/src/main/webapp/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ - - -

    Hello World!

    - - diff --git a/ajax/src/main/webapp/js/ajax.js b/ajax/src/main/webapp/js/ajax.js deleted file mode 100644 index c065c85..0000000 --- a/ajax/src/main/webapp/js/ajax.js +++ /dev/null @@ -1,48 +0,0 @@ -$(document).ready(function() { - - $("#productSearch").keyup(function() { - - var searchKey = $("#productSearch").val(); - - //If user didn't enter anything, do not go to server. Just empty the html in the search results div. - if(searchKey == '') { - $("#searchResults").html(""); - return; - } - - var data = {"key" : searchKey}; - - $.getJSON('http://localhost:9090/ajax/search.json', data, function(responseData) { - - var searchResultsHtml = ""; - - var resultsArray = responseData.stringList; - - $.each(resultsArray, function(index, value) { - - var idOfAnchorTag = "searchResult_"+index; - - searchResultsHtml += "" + value + "
    "; - - }); - - //Write the final HTML into search results div - $("#searchResults").html(searchResultsHtml); - - }); - - }); -}); - -function copyIntoSearchBox(id) { - - console.log(id); - - var jQueryId = "#"+id; - console.log(jQueryId); - - var selectedAnchorTagValue = $(jQueryId).text(); - console.log('selectedAnchorTagValue = ' + selectedAnchorTagValue); - - $("#productSearch").val(selectedAnchorTagValue); -} \ No newline at end of file diff --git a/ant/.classpath b/ant/.classpath deleted file mode 100644 index 32a11af..0000000 --- a/ant/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/ant/.project b/ant/.project deleted file mode 100644 index 83b9636..0000000 --- a/ant/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - ant - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/ant/.settings/.jsdtscope b/ant/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/ant/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/ant/.settings/org.eclipse.jdt.core.prefs b/ant/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index eff2049..0000000 --- a/ant/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Apr 11 17:49:34 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/ant/.settings/org.eclipse.wst.common.component b/ant/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 0367f5b..0000000 --- a/ant/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ant/.settings/org.eclipse.wst.common.project.facet.core.xml b/ant/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 456aae9..0000000 --- a/ant/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/ant/.settings/org.eclipse.wst.jsdt.ui.superType.container b/ant/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/ant/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/ant/.settings/org.eclipse.wst.jsdt.ui.superType.name b/ant/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/ant/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/ant/WebContent/META-INF/MANIFEST.MF b/ant/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/ant/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/ant/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/ant/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/ant/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/ant/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/ant/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/ant/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/ant/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/ant/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/ant/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/ant/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/ant/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/ant/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/ant/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/commons-io-1.1.jar b/ant/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/ant/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/ant/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/ant/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/ant/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/ant/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/ant/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/ant/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/ant/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/ant/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/oro-2.0.8.jar b/ant/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/ant/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/standard-1.0.6.jar b/ant/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/ant/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/ant/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/ant/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/ant/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/ant/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/ant/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/ant/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/ant/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/ant/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/ant/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/ant/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/ant/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/ant/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/ant/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/ant/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/ant/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/ant/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/ant/WebContent/WEB-INF/struts-config.xml b/ant/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index 0c2b6cd..0000000 --- a/ant/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ant/WebContent/WEB-INF/views/Acknowledgement.jsp b/ant/WebContent/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 3497979..0000000 --- a/ant/WebContent/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

    Your details have been saved successfully..

    - - \ No newline at end of file diff --git a/ant/WebContent/WEB-INF/views/AddCar.jsp b/ant/WebContent/WEB-INF/views/AddCar.jsp deleted file mode 100644 index b836ee1..0000000 --- a/ant/WebContent/WEB-INF/views/AddCar.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - -Insert title here - - - -

    - -

    Please enter your details here

    - - - - -Type : - Sedan - Coupe - Van
    -Make :
    -Model :
    -Year :
    -Price :
    - - -
    - - - \ No newline at end of file diff --git a/ant/WebContent/WEB-INF/views/ListCars.jsp b/ant/WebContent/WEB-INF/views/ListCars.jsp deleted file mode 100644 index 4078568..0000000 --- a/ant/WebContent/WEB-INF/views/ListCars.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - -
    TypeMakeModelYearPrice
    ${eachCar.type}${eachCar.make}${eachCar.model}${eachCar.year}${eachCar.price}
    - - \ No newline at end of file diff --git a/ant/WebContent/WEB-INF/web.xml b/ant/WebContent/WEB-INF/web.xml deleted file mode 100644 index d430482..0000000 --- a/ant/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - struts2 - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/struts-config.xml - - - - - - ActionServlet - / - - - \ No newline at end of file diff --git a/ant/build.xml b/ant/build.xml deleted file mode 100644 index 5832d7f..0000000 --- a/ant/build.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ant/dist/unclebob/WEB-INF/classes/CarDealership.properties b/ant/dist/unclebob/WEB-INF/classes/CarDealership.properties deleted file mode 100644 index 2c2efe4..0000000 --- a/ant/dist/unclebob/WEB-INF/classes/CarDealership.properties +++ /dev/null @@ -1,12 +0,0 @@ -display.welcome=Welcome to UncleBob's DEALERSHIP!! - -type.required=Car type is required to enter -make.required=Make is required to enter -model.required=Model is required to enter - -errors.header=

    Validation Errors

      -errors.prefix=
    • -errors.suffix= -errors.footer=
    - - diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/Car.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/Car.class deleted file mode 100644 index 61ca69f..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/Car.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarDAO.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarDAO.class deleted file mode 100644 index 9885c66..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarDAO.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarDAOJDBCImpl.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarDAOJDBCImpl.class deleted file mode 100644 index 372064d..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarDAOJDBCImpl.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarService.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarService.class deleted file mode 100644 index ca9e9c2..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarService.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarServiceImpl.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarServiceImpl.class deleted file mode 100644 index 8cb0292..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/CarServiceImpl.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/DAOException.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/DAOException.class deleted file mode 100644 index 0cd3149..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/domain/DAOException.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/AddCarAction.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/AddCarAction.class deleted file mode 100644 index 8ad0b23..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/AddCarAction.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/CarForm.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/CarForm.class deleted file mode 100644 index 168d0cc..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/CarForm.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/ListCarAction.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/ListCarAction.class deleted file mode 100644 index d9c45ac..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/ListCarAction.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/SaveCarAction.class b/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/SaveCarAction.class deleted file mode 100644 index 11cd5e3..0000000 Binary files a/ant/dist/unclebob/WEB-INF/classes/com/training/struts/car/web/SaveCarAction.class and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/antlr-2.7.2.jar b/ant/dist/unclebob/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/bsf-2.3.0.jar b/ant/dist/unclebob/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/commons-beanutils-1.8.0.jar b/ant/dist/unclebob/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/commons-chain-1.2.jar b/ant/dist/unclebob/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/commons-digester-1.8.jar b/ant/dist/unclebob/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/commons-fileupload-1.1.1.jar b/ant/dist/unclebob/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/commons-io-1.1.jar b/ant/dist/unclebob/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/commons-logging-1.0.4.jar b/ant/dist/unclebob/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/commons-validator-1.3.1.jar b/ant/dist/unclebob/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/jstl-1.0.2.jar b/ant/dist/unclebob/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/ant/dist/unclebob/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/oro-2.0.8.jar b/ant/dist/unclebob/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/standard-1.0.6.jar b/ant/dist/unclebob/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/struts-core-1.3.10.jar b/ant/dist/unclebob/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/struts-el-1.3.10.jar b/ant/dist/unclebob/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/struts-extras-1.3.10.jar b/ant/dist/unclebob/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/struts-faces-1.3.10.jar b/ant/dist/unclebob/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/ant/dist/unclebob/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/struts-scripting-1.3.10.jar b/ant/dist/unclebob/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/struts-taglib-1.3.10.jar b/ant/dist/unclebob/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/lib/struts-tiles-1.3.10.jar b/ant/dist/unclebob/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/ant/dist/unclebob/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/ant/dist/unclebob/WEB-INF/struts-config.xml b/ant/dist/unclebob/WEB-INF/struts-config.xml deleted file mode 100644 index 0c2b6cd..0000000 --- a/ant/dist/unclebob/WEB-INF/struts-config.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ant/dist/unclebob/WEB-INF/views/Acknowledgement.jsp b/ant/dist/unclebob/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 3497979..0000000 --- a/ant/dist/unclebob/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

    Your details have been saved successfully..

    - - \ No newline at end of file diff --git a/ant/dist/unclebob/WEB-INF/views/AddCar.jsp b/ant/dist/unclebob/WEB-INF/views/AddCar.jsp deleted file mode 100644 index b836ee1..0000000 --- a/ant/dist/unclebob/WEB-INF/views/AddCar.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - -Insert title here - - - -

    - -

    Please enter your details here

    - - - - -Type : - Sedan - Coupe - Van
    -Make :
    -Model :
    -Year :
    -Price :
    - - -
    - - - \ No newline at end of file diff --git a/ant/dist/unclebob/WEB-INF/views/ListCars.jsp b/ant/dist/unclebob/WEB-INF/views/ListCars.jsp deleted file mode 100644 index 4078568..0000000 --- a/ant/dist/unclebob/WEB-INF/views/ListCars.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - -
    TypeMakeModelYearPrice
    ${eachCar.type}${eachCar.make}${eachCar.model}${eachCar.year}${eachCar.price}
    - - \ No newline at end of file diff --git a/ant/dist/unclebob/WEB-INF/web.xml b/ant/dist/unclebob/WEB-INF/web.xml deleted file mode 100644 index d430482..0000000 --- a/ant/dist/unclebob/WEB-INF/web.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - struts2 - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/struts-config.xml - - - - - - ActionServlet - / - - - \ No newline at end of file diff --git a/ant/dist/unclebob/unclebob.war b/ant/dist/unclebob/unclebob.war deleted file mode 100644 index d3da328..0000000 Binary files a/ant/dist/unclebob/unclebob.war and /dev/null differ diff --git a/ant/properties/CarDealership.properties b/ant/properties/CarDealership.properties deleted file mode 100644 index 2c2efe4..0000000 --- a/ant/properties/CarDealership.properties +++ /dev/null @@ -1,12 +0,0 @@ -display.welcome=Welcome to UncleBob's DEALERSHIP!! - -type.required=Car type is required to enter -make.required=Make is required to enter -model.required=Model is required to enter - -errors.header=

    Validation Errors

      -errors.prefix=
    • -errors.suffix= -errors.footer=
    - - diff --git a/ant/src/com/training/struts/car/domain/Car.java b/ant/src/com/training/struts/car/domain/Car.java deleted file mode 100644 index 9186eda..0000000 --- a/ant/src/com/training/struts/car/domain/Car.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.struts.car.domain; - -public class Car -{ - private int id; - private String type; - private String make; - private String model; - private int year; - private double price; - - public Car(int id, String type, String make, String model, int year, - double price) - { - this(type, make, model, year, price); - this.id = id; - } - - public Car(String type, String make, String model, int year, double price) - { - this.type = type; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - } - - public int getId() - { - return id; - } - - public String getMake() - { - return make; - } - - public String getModel() - { - return model; - } - - public int getYear() - { - return year; - } - - public double getPrice() - { - return price; - } - - public String getType() - { - return type; - } -} diff --git a/ant/src/com/training/struts/car/domain/CarDAO.java b/ant/src/com/training/struts/car/domain/CarDAO.java deleted file mode 100644 index b793bc6..0000000 --- a/ant/src/com/training/struts/car/domain/CarDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.struts.car.domain; - -import java.util.List; - - -interface CarDAO { - void createCar(Car car); - List getAllCars(); - Car getCarById(int id); - void update(Car car); - void delete(int id); -} diff --git a/ant/src/com/training/struts/car/domain/CarDAOJDBCImpl.java b/ant/src/com/training/struts/car/domain/CarDAOJDBCImpl.java deleted file mode 100644 index f61573d..0000000 --- a/ant/src/com/training/struts/car/domain/CarDAOJDBCImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.training.struts.car.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class CarDAOJDBCImpl implements CarDAO -{ - - CarDAOJDBCImpl() - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) - { - throw new DAOException(e); - } - } - - @Override - public List getAllCars() - { - - List cars = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try - { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from car"); - - while (rs.next()) - { - int id = rs.getInt("id"); - - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - Car car = new Car(id, type, make, model, year, price); - cars.add(car); - } - return cars; - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(rs, stmt, con); - } - } - - @Override - public void createCar(Car car) - { - - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("insert into car(type, make, model, year, price) values(?,?,?,?,?)"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - @Override - public Car getCarById(int id) - { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Car car = null; - try - { - con = getConnection(); - stmt = con.prepareStatement("select * from car where id = ?"); - stmt.setInt(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) - { - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - car = new Car(id, type, make, model, year, price); - } - return car; - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - private Connection getConnection() throws SQLException - { - return DriverManager.getConnection("jdbc:mysql://localhost/training", - "root", "password"); - - } - - private void closeResources(ResultSet rs, Statement stmt, Connection con) - { - if (rs != null) - { - try - { - rs.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (stmt != null) - { - try - { - stmt.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (con != null) - { - try - { - con.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - - } - - @Override - public void update(Car car) - { - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("update car set type = ?, make = ?, model= ?, year = ?, price = ? where id = ?"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - stmt.setInt(6, car.getId()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - } - - @Override - public void delete(int id) - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con.prepareStatement("delete from car where id = ?"); - stmt.setInt(1, id); - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } -} diff --git a/ant/src/com/training/struts/car/domain/CarService.java b/ant/src/com/training/struts/car/domain/CarService.java deleted file mode 100644 index c2a84b2..0000000 --- a/ant/src/com/training/struts/car/domain/CarService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.struts.car.domain; - -import java.util.List; - -public interface CarService -{ - void create(Car car); - List getAllCars(); -} diff --git a/ant/src/com/training/struts/car/domain/CarServiceImpl.java b/ant/src/com/training/struts/car/domain/CarServiceImpl.java deleted file mode 100644 index 95c5fa4..0000000 --- a/ant/src/com/training/struts/car/domain/CarServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.struts.car.domain; - -import java.util.List; - -public class CarServiceImpl implements CarService -{ - @Override - public void create(Car car) - { - CarDAO dao = new CarDAOJDBCImpl(); - dao.createCar(car); - } - - @Override - public List getAllCars() - { - CarDAO dao = new CarDAOJDBCImpl(); - return dao.getAllCars(); - } -} diff --git a/ant/src/com/training/struts/car/domain/DAOException.java b/ant/src/com/training/struts/car/domain/DAOException.java deleted file mode 100644 index baeb33b..0000000 --- a/ant/src/com/training/struts/car/domain/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.struts.car.domain; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(Throwable ex) { - super(ex); - } -} diff --git a/ant/src/com/training/struts/car/web/AddCarAction.java b/ant/src/com/training/struts/car/web/AddCarAction.java deleted file mode 100644 index e076a0f..0000000 --- a/ant/src/com/training/struts/car/web/AddCarAction.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.struts.car.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddCarAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - return mapping.findForward("add"); - } -} diff --git a/ant/src/com/training/struts/car/web/CarForm.java b/ant/src/com/training/struts/car/web/CarForm.java deleted file mode 100644 index 67cd17e..0000000 --- a/ant/src/com/training/struts/car/web/CarForm.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.training.struts.car.web; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class CarForm extends ActionForm -{ - private String type; - private String make; - private String model; - private int year; - private double price; - - public String getType() - { - return type; - } - - public void setType(String type) - { - this.type = type; - } - - public String getMake() - { - return make; - } - - public void setMake(String make) - { - this.make = make; - } - - public String getModel() - { - return model; - } - - public void setModel(String model) - { - this.model = model; - } - - public int getYear() - { - return year; - } - - public void setYear(int year) - { - this.year = year; - } - - public double getPrice() - { - return price; - } - - public void setPrice(double price) - { - this.price = price; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) - { - ActionErrors errors = new ActionErrors(); - - if(type == null || type.length() == 0) - { - errors.add("type", new ActionMessage("type.required")); - } - if(make == null || make.length() == 0) - { - errors.add("make", new ActionMessage("make.required")); - } - if(model == null || model.length() == 0) - { - errors.add("model", new ActionMessage("model.required")); - } - - return errors; - } - -} diff --git a/ant/src/com/training/struts/car/web/ListCarAction.java b/ant/src/com/training/struts/car/web/ListCarAction.java deleted file mode 100644 index fca06ce..0000000 --- a/ant/src/com/training/struts/car/web/ListCarAction.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.struts.car.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.struts.car.domain.Car; -import com.training.struts.car.domain.CarService; -import com.training.struts.car.domain.CarServiceImpl; - -public class ListCarAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - CarService service = new CarServiceImpl(); - List cars = service.getAllCars(); - - request.setAttribute("cars", cars); - - return mapping.findForward("list"); - } -} diff --git a/ant/src/com/training/struts/car/web/SaveCarAction.java b/ant/src/com/training/struts/car/web/SaveCarAction.java deleted file mode 100644 index 8f3f77f..0000000 --- a/ant/src/com/training/struts/car/web/SaveCarAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.struts.car.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.struts.car.domain.Car; -import com.training.struts.car.domain.CarService; -import com.training.struts.car.domain.CarServiceImpl; - -public class SaveCarAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - CarForm carForm = (CarForm) form; - - CarService service = new CarServiceImpl(); - Car car = new Car(carForm.getType(), carForm.getMake(), carForm.getModel(), carForm.getYear(), carForm.getPrice()); - - service.create(car); - - return mapping.findForward("acknowledgement"); - - } -} diff --git a/bookstore/.classpath b/bookstore/.classpath deleted file mode 100644 index 32a11af..0000000 --- a/bookstore/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/bookstore/.project b/bookstore/.project deleted file mode 100644 index 72bbe89..0000000 --- a/bookstore/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - bookstore - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/bookstore/.settings/.jsdtscope b/bookstore/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/bookstore/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/bookstore/.settings/org.eclipse.jdt.core.prefs b/bookstore/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 65ffbe6..0000000 --- a/bookstore/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Mar 28 19:52:49 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/bookstore/.settings/org.eclipse.wst.common.component b/bookstore/.settings/org.eclipse.wst.common.component deleted file mode 100644 index f826c05..0000000 --- a/bookstore/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/bookstore/.settings/org.eclipse.wst.common.project.facet.core.xml b/bookstore/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 0873c6e..0000000 --- a/bookstore/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/bookstore/.settings/org.eclipse.wst.jsdt.ui.superType.container b/bookstore/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/bookstore/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/bookstore/.settings/org.eclipse.wst.jsdt.ui.superType.name b/bookstore/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/bookstore/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/bookstore/WebContent/META-INF/MANIFEST.MF b/bookstore/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/bookstore/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/bookstore/WebContent/WEB-INF/web.xml b/bookstore/WebContent/WEB-INF/web.xml deleted file mode 100644 index 87db78a..0000000 --- a/bookstore/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - bookstore - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ShoppingCart - ShoppingCart - com.training.java.servlet.ShoppingCartServlet - - - ShoppingCart - /shoppingcart - - - - SignoutServlet - SignoutServlet - com.training.java.servlet.SignoutServlet - - - SignoutServlet - /signout - - - - 5 - - - \ No newline at end of file diff --git a/bookstore/WebContent/index.html b/bookstore/WebContent/index.html deleted file mode 100644 index ac72e97..0000000 --- a/bookstore/WebContent/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - -Insert title here - - - -
    - Book to buy :
    -
    -
    -
    - - - Sign out - -
    - - - - \ No newline at end of file diff --git a/bookstore/src/com/training/java/servlet/ShoppingCartServlet.java b/bookstore/src/com/training/java/servlet/ShoppingCartServlet.java deleted file mode 100644 index 6ad4d3f..0000000 --- a/bookstore/src/com/training/java/servlet/ShoppingCartServlet.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.training.java.servlet; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -/** - * Servlet implementation class ShoppingCart - */ -public class ShoppingCartServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String bookToBuy = request.getParameter("bookName"); - - HttpSession session = request.getSession(); - - PrintWriter out = response.getWriter(); - - if(session.isNew()) - { - List booksBought = new ArrayList(); - booksBought.add(bookToBuy); - - session.setAttribute("booksBought", booksBought); - - out.println("

    Welcome to our BookStore!!

    "); - out.println("

    You bought " + bookToBuy + "

    "); - out.println("


    "); - out.println("Go back to Main page"); - } - else - { - List booksBought = (List) session.getAttribute("booksBought"); - booksBought.add(bookToBuy); - - out.println("

    Welcome back!!"); - out.println("

    You bought these books so far

    "); - out.println("
      "); - - for(String aBook : booksBought) - { - out.println("
    1. " + aBook + "
    2. "); - } - out.println("
    "); - out.println("


    "); - out.println("Go back to Main page"); - } - } -} diff --git a/bookstore/src/com/training/java/servlet/SignoutServlet.java b/bookstore/src/com/training/java/servlet/SignoutServlet.java deleted file mode 100644 index f5707ec..0000000 --- a/bookstore/src/com/training/java/servlet/SignoutServlet.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.java.servlet; - -import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class SignoutServlet - */ -public class SignoutServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - request.getSession().invalidate(); - - response.sendRedirect("/bookstore"); - } -} diff --git a/callback/.classpath b/callback/.classpath deleted file mode 100644 index 91ee9a5..0000000 --- a/callback/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/callback/.project b/callback/.project deleted file mode 100644 index 6a63fa9..0000000 --- a/callback/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - callback - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/callback/.settings/org.eclipse.jdt.core.prefs b/callback/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 838bd9d..0000000 --- a/callback/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/callback/src/callback/Callback.java b/callback/src/callback/Callback.java deleted file mode 100644 index a35e9ef..0000000 --- a/callback/src/callback/Callback.java +++ /dev/null @@ -1,7 +0,0 @@ -package callback; - -public interface Callback { - - void callMe(); - -} diff --git a/callback/src/callback/Client.java b/callback/src/callback/Client.java deleted file mode 100644 index 7de7b31..0000000 --- a/callback/src/callback/Client.java +++ /dev/null @@ -1,25 +0,0 @@ -package callback; - -public class Client { - - public static void main(String[] args) { - new Client().call(); - } - - public void call() { - MailReceiver receiver = new MailReceiver(); - receiver.execute(new Callback() { - - @Override - public void callMe() { - System.out.println("I have been called"); - - System.out - .println("Since the mail has been given to me, I will go ahead and read the mail"); - } - - }); - } - - -} diff --git a/callback/src/callback/ComparatorClient.java b/callback/src/callback/ComparatorClient.java deleted file mode 100644 index 5059468..0000000 --- a/callback/src/callback/ComparatorClient.java +++ /dev/null @@ -1,24 +0,0 @@ -package callback; - -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -public class ComparatorClient { - - public static void main(String[] args) { - - List names = Arrays.asList("Mounika","Yuri", "Rohit", "Sailaja"); - - Collections.sort(names, new Comparator() { - - @Override - public int compare(String o1, String o2) { - return o2.compareTo(o1); - } - }); - - System.out.println(names); - } -} diff --git a/callback/src/callback/MailReceiver.java b/callback/src/callback/MailReceiver.java deleted file mode 100644 index 1f42eb2..0000000 --- a/callback/src/callback/MailReceiver.java +++ /dev/null @@ -1,19 +0,0 @@ -package callback; - -public class MailReceiver { - - public void execute(Callback callBack) { - - System.out.println("I am going to post office"); - System.out.println("Opneed the mail box"); - System.out.println("Found the mail"); - System.out.println("Took out the mail"); - - callBack.callMe(); - - System.out.println("I am done calling the callback"); - System.out.println("close the mailbox"); - System.out.println("heading back home"); - } - -} diff --git a/carservlet/.classpath b/carservlet/.classpath deleted file mode 100644 index 806be3e..0000000 --- a/carservlet/.classpath +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/carservlet/.project b/carservlet/.project deleted file mode 100644 index 465b86f..0000000 --- a/carservlet/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - carservlet - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/carservlet/.settings/.jsdtscope b/carservlet/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/carservlet/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/carservlet/.settings/org.eclipse.jdt.core.prefs b/carservlet/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 0514f01..0000000 --- a/carservlet/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sat Mar 24 09:12:16 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/carservlet/.settings/org.eclipse.wst.common.component b/carservlet/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 70de6c8..0000000 --- a/carservlet/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/carservlet/.settings/org.eclipse.wst.common.project.facet.core.xml b/carservlet/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 0873c6e..0000000 --- a/carservlet/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/carservlet/.settings/org.eclipse.wst.jsdt.ui.superType.container b/carservlet/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/carservlet/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/carservlet/.settings/org.eclipse.wst.jsdt.ui.superType.name b/carservlet/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/carservlet/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/carservlet/WebContent/META-INF/MANIFEST.MF b/carservlet/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/carservlet/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/carservlet/WebContent/WEB-INF/lib/junit-4.8.2.jar b/carservlet/WebContent/WEB-INF/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/carservlet/WebContent/WEB-INF/lib/junit-4.8.2.jar and /dev/null differ diff --git a/carservlet/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/carservlet/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/carservlet/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/carservlet/WebContent/WEB-INF/web.xml b/carservlet/WebContent/WEB-INF/web.xml deleted file mode 100644 index c1c1044..0000000 --- a/carservlet/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - carservlet - - home.html - - - driverClassName - com.mysql.jdbc.Driver - - - jdbcURL - jdbc:mysql://localhost/training - - - username - root - - - password - password - - - - ListCarServlet - ListCarServlet - com.training.servlet.car.web.ListCarServlet - - maxCarsToDisplay - 5 - - - - ListCarServlet - /list - - - - AddCarServlet - AddCarServlet - com.training.servlet.car.web.AddCarServlet - - - AddCarServlet - /add - - - - DisplayListCarServlet - DisplayListCarServlet - com.training.servlet.car.web.DisplayListCarServlet - - - DisplayListCarServlet - /displayList - - \ No newline at end of file diff --git a/carservlet/WebContent/addcar.html b/carservlet/WebContent/addcar.html deleted file mode 100644 index a2ad3c1..0000000 --- a/carservlet/WebContent/addcar.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - -Insert title here - - - -
    - -Id :
    -Make :
    -Model :
    -Year :
    -Price :
    - -
    -
    - - - -
    - - - - - - \ No newline at end of file diff --git a/carservlet/WebContent/home.html b/carservlet/WebContent/home.html deleted file mode 100644 index cdc773a..0000000 --- a/carservlet/WebContent/home.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - -Insert title here - - - -

    Welcome to Uncle Bob Auto Sale

    - -

    To list all cars click here

    -

    To add a new car, click here

    - - - - \ No newline at end of file diff --git a/carservlet/src/com/training/servlet/car/domain/Car.java b/carservlet/src/com/training/servlet/car/domain/Car.java deleted file mode 100644 index 9f8f9c7..0000000 --- a/carservlet/src/com/training/servlet/car/domain/Car.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.servlet.car.domain; - -public class Car { - private int id; - private String make; - private String model; - private int year; - private double price; - - public Car(int id,String make, String model, int year, double price) { - this.id = id; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - } - public int getId() { - return id; - } - public String getMake() { - return make; - } - public String getModel() { - return model; - } - public int getYear() { - return year; - } - public double getPrice() { - return price; - } -} diff --git a/carservlet/src/com/training/servlet/car/domain/CarDAO.java b/carservlet/src/com/training/servlet/car/domain/CarDAO.java deleted file mode 100644 index 6bf22a2..0000000 --- a/carservlet/src/com/training/servlet/car/domain/CarDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.servlet.car.domain; - -import java.util.List; - - -interface CarDAO { - void createCar(Car car); - List getAllCars(); - Car getCarById(int id); - void update(Car car); - void delete(int id); -} diff --git a/carservlet/src/com/training/servlet/car/domain/CarDAOJDBCImpl.java b/carservlet/src/com/training/servlet/car/domain/CarDAOJDBCImpl.java deleted file mode 100644 index 3e8c986..0000000 --- a/carservlet/src/com/training/servlet/car/domain/CarDAOJDBCImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.training.servlet.car.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class CarDAOJDBCImpl implements CarDAO { - - CarDAOJDBCImpl() { - try { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) { - throw new DAOException(e); - } - } - - @Override - public List getAllCars() { - - List cars = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from car"); - - while(rs.next()) { - int id = rs.getInt("id"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - Car car = new Car(id,make,model,year,price); - cars.add(car); - } - return cars; - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(rs,stmt,con); - } - } - - @Override - public void createCar(Car car) { - - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("insert into car values(?,?,?,?,?)"); - - stmt.setInt(1, car.getId()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(null,stmt,con); - } - } - - @Override - public Car getCarById(int id) { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Car car = null; - try { - con = getConnection(); - stmt = con.prepareStatement("select * from car where id = ?"); - stmt.setInt(1,id); - rs = stmt.executeQuery(); - - if (rs.next()) { - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - car = new Car(id,make,model,year,price); - } - return car; - - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(null,stmt,con); - } - } - - private Connection getConnection() throws SQLException { - return DriverManager.getConnection("jdbc:mysql://localhost/training","root","password"); - - } - - private void closeResources(ResultSet rs, Statement stmt, Connection con) { - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - } - - @Override - public void update(Car car) - { - { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("update car set make = ?, model= ?, year = ?, price = ? where id = ?"); - stmt.setString(1, car.getMake()); - stmt.setString(2, car.getModel()); - stmt.setInt(3, car.getYear()); - stmt.setDouble(4, car.getPrice()); - stmt.setInt(5, car.getId()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(null,stmt,con); - } - } - } - - @Override - public void delete(int id) - { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("delete from car where id = ?"); - stmt.setInt(1, id); - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(null,stmt,con); - } - } -} diff --git a/carservlet/src/com/training/servlet/car/domain/CarDAOJDBCImplTest.java b/carservlet/src/com/training/servlet/car/domain/CarDAOJDBCImplTest.java deleted file mode 100644 index 4be236e..0000000 --- a/carservlet/src/com/training/servlet/car/domain/CarDAOJDBCImplTest.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.servlet.car.domain; - -import static org.junit.Assert.*; - -import java.util.List; - -import org.junit.Test; - -public class CarDAOJDBCImplTest { - @Test - public void testCreateCar() throws Exception { - CarDAO dao = new CarDAOJDBCImpl(); - Car car = new Car(4,"Ford","Focus",2001,15000.00); - dao.createCar(car); - - //Assert that car has been created - - Car carFromDB = dao.getCarById(4); - assertNotNull(carFromDB); - assertEquals(4,carFromDB.getId()); - -} - @Test - public void testGetAllMovies() throws Exception { - - CarDAO dao = new CarDAOJDBCImpl(); - List cars = dao.getAllCars(); - assertFalse(cars.isEmpty()); - - for(Car car: cars){ - System.out.println("Id = " + car.getId()); - System.out.println("Make = " + car.getMake()); - System.out.println("Model = " + car.getModel()); - System.out.println("Year = " + car.getYear()); - System.out.println("Price = " + car.getPrice()); - } - } - - @Test - public void testUpdateCar() throws Exception { - CarDAO dao = new CarDAOJDBCImpl(); - Car car = new Car(3,"Chevy","Tahoe",1998,19222.90); - dao.update(car); - - Car carFromDB = dao.getCarById(3); - assertNotNull(carFromDB); - assertEquals("Chevy",carFromDB.getMake()); - assertEquals("Tahoe",carFromDB.getModel()); - assertEquals(1998,carFromDB.getYear()); - assertEquals(19222.90, carFromDB.getPrice(),0.001); - - } - @Test - public void testDeleteCar() throws Exception { - CarDAO dao = new CarDAOJDBCImpl(); - dao.delete(1); - - Car carFromDB = dao.getCarById(1); - assertNull(carFromDB); - - } -} diff --git a/carservlet/src/com/training/servlet/car/domain/CarService.java b/carservlet/src/com/training/servlet/car/domain/CarService.java deleted file mode 100644 index ea1c767..0000000 --- a/carservlet/src/com/training/servlet/car/domain/CarService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.servlet.car.domain; - -import java.util.List; - -public interface CarService -{ - void create(Car car); - List getAllCars(); -} diff --git a/carservlet/src/com/training/servlet/car/domain/CarServiceImpl.java b/carservlet/src/com/training/servlet/car/domain/CarServiceImpl.java deleted file mode 100644 index 1b2cfaf..0000000 --- a/carservlet/src/com/training/servlet/car/domain/CarServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.servlet.car.domain; - -import java.util.List; - -public class CarServiceImpl implements CarService -{ - @Override - public void create(Car car) - { - CarDAO dao = new CarDAOJDBCImpl(); - dao.createCar(car); - } - - @Override - public List getAllCars() - { - CarDAO dao = new CarDAOJDBCImpl(); - return dao.getAllCars(); - } -} diff --git a/carservlet/src/com/training/servlet/car/domain/DAOException.java b/carservlet/src/com/training/servlet/car/domain/DAOException.java deleted file mode 100644 index 7a71d98..0000000 --- a/carservlet/src/com/training/servlet/car/domain/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.servlet.car.domain; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(Throwable ex) { - super(ex); - } -} diff --git a/carservlet/src/com/training/servlet/car/web/AddCarServlet.java b/carservlet/src/com/training/servlet/car/web/AddCarServlet.java deleted file mode 100644 index 75b74bd..0000000 --- a/carservlet/src/com/training/servlet/car/web/AddCarServlet.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.training.servlet.car.web; - -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.servlet.car.domain.Car; -import com.training.servlet.car.domain.CarService; -import com.training.servlet.car.domain.CarServiceImpl; - -/** - * Servlet implementation class AddCarServlet - */ -public class AddCarServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public AddCarServlet() { - super(); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String idStr = request.getParameter("id"); - String make = request.getParameter("make"); - String model = request.getParameter("model"); - String yearStr = request.getParameter("year"); - String priceStr = request.getParameter("price"); - - int id = Integer.parseInt(idStr); - int year = Integer.parseInt(yearStr); - double price = Double.parseDouble(priceStr); - - Car car = new Car(id, make, model, year, price); - - CarService service = new CarServiceImpl(); - service.create(car); - - response.sendRedirect("/carservlet/list"); - } - -} diff --git a/carservlet/src/com/training/servlet/car/web/DisplayListCarServlet.java b/carservlet/src/com/training/servlet/car/web/DisplayListCarServlet.java deleted file mode 100644 index d69980c..0000000 --- a/carservlet/src/com/training/servlet/car/web/DisplayListCarServlet.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.training.servlet.car.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.servlet.car.domain.Car; - -/** - * Servlet implementation class DisplayListCarServlet - */ -public class DisplayListCarServlet extends HttpServlet { - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - List cars = (List) request.getAttribute("carsToDisplay"); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - - for(Car aCar : cars) - { - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - } - - out.println("
    MakeModelYearPrice
    " + aCar.getMake() + "" + aCar.getModel() + "" + aCar.getYear() + "" + aCar.getPrice() + "
    "); - out.println(""); - } - -} diff --git a/carservlet/src/com/training/servlet/car/web/ListCarServlet.java b/carservlet/src/com/training/servlet/car/web/ListCarServlet.java deleted file mode 100644 index fe656e1..0000000 --- a/carservlet/src/com/training/servlet/car/web/ListCarServlet.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.servlet.car.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.servlet.car.domain.Car; -import com.training.servlet.car.domain.CarService; -import com.training.servlet.car.domain.CarServiceImpl; - -/** - * Servlet implementation class ListCarServlet - */ -public class ListCarServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListCarServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - //Read context parameters - String jdbcURL = getServletContext().getInitParameter("jdbcURL"); - String username = getServletContext().getInitParameter("username"); - String password = getServletContext().getInitParameter("password"); - - System.out.println("jdbcURL = " + jdbcURL); - System.out.println("username = " + username); - System.out.println("password = " + password); - - //Get init param - max cars to display - String maxCarsDisplyStr = getServletConfig().getInitParameter("maxCarsToDisplay"); - int maxCarsToDisplay = Integer.parseInt(maxCarsDisplyStr); - - CarService service = new CarServiceImpl(); - List cars = service.getAllCars(); - - request.setAttribute("carsToDisplay", cars); - - RequestDispatcher dispatcher = request.getRequestDispatcher("/displayList"); - dispatcher.forward(request, response); - } - -} diff --git a/eshop/.classpath b/eshop/.classpath deleted file mode 100644 index 26b8264..0000000 --- a/eshop/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/eshop/.project b/eshop/.project deleted file mode 100644 index 44d322a..0000000 --- a/eshop/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - eshop - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/eshop/.settings/.jsdtscope b/eshop/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/eshop/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/eshop/.settings/org.eclipse.jdt.core.prefs b/eshop/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 295926d..0000000 --- a/eshop/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/eshop/.settings/org.eclipse.wst.common.component b/eshop/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 3b6fd63..0000000 --- a/eshop/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/eshop/.settings/org.eclipse.wst.common.project.facet.core.xml b/eshop/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index a79b42e..0000000 --- a/eshop/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/eshop/.settings/org.eclipse.wst.jsdt.ui.superType.container b/eshop/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/eshop/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/eshop/.settings/org.eclipse.wst.jsdt.ui.superType.name b/eshop/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/eshop/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/eshop/WebContent/META-INF/MANIFEST.MF b/eshop/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/eshop/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/eshop/WebContent/WEB-INF/jsp/Home.jsp b/eshop/WebContent/WEB-INF/jsp/Home.jsp deleted file mode 100644 index 51d8fa6..0000000 --- a/eshop/WebContent/WEB-INF/jsp/Home.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - -

    Welcome to eShop

    - - - - - - - - - - - - - - - - - - - -
    IdNameTypePrice
    ${product.id}${product.name}${product.type}${product.price}Add to Cart
    - - - - \ No newline at end of file diff --git a/eshop/WebContent/WEB-INF/jsp/OrderConfirmation.jsp b/eshop/WebContent/WEB-INF/jsp/OrderConfirmation.jsp deleted file mode 100644 index 5916c10..0000000 --- a/eshop/WebContent/WEB-INF/jsp/OrderConfirmation.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

    Your order has been placed, and your order number is - ${Order.orderNumber}.

    -

    If you have any questions regarding this order, - please reference this order number.

    - -
    Click here to go to home page.
    - - - \ No newline at end of file diff --git a/eshop/WebContent/WEB-INF/jsp/ShoppingCart.jsp b/eshop/WebContent/WEB-INF/jsp/ShoppingCart.jsp deleted file mode 100644 index 80a79ef..0000000 --- a/eshop/WebContent/WEB-INF/jsp/ShoppingCart.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - -

    You have added the following items to the cart.

    - - - - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}Add to - Cart
    - -

    Do you want to shop more?Please click here

    -

    If you are done shopping, please click here

    - - - \ No newline at end of file diff --git a/eshop/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar b/eshop/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar deleted file mode 100644 index a86a365..0000000 Binary files a/eshop/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar and /dev/null differ diff --git a/eshop/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar b/eshop/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar deleted file mode 100644 index 4b3b433..0000000 Binary files a/eshop/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar and /dev/null differ diff --git a/eshop/WebContent/WEB-INF/lib/ojdbc6.jar b/eshop/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 767eba7..0000000 Binary files a/eshop/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/eshop/WebContent/WEB-INF/web.xml b/eshop/WebContent/WEB-INF/web.xml deleted file mode 100644 index 8ff9f5e..0000000 --- a/eshop/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - eshop - - - HomePageServlet - HomePageServlet - com.eshop.web.HomePageServlet - - - HomePageServlet - / - - - - ShoppingCartServlet - ShoppingCartServlet - com.eshop.web.ShoppingCartServlet - - - ShoppingCartServlet - /cart - - - - CheckoutServlet - CheckoutServlet - com.eshop.web.CheckoutServlet - - - CheckoutServlet - /checkout - - \ No newline at end of file diff --git a/eshop/dbscripts/eshop.sql b/eshop/dbscripts/eshop.sql deleted file mode 100644 index 7a6ade5..0000000 --- a/eshop/dbscripts/eshop.sql +++ /dev/null @@ -1,60 +0,0 @@ -drop table order_details; -drop table orders; -drop table products; -drop table customers; - -drop sequence order_details_seq; -drop sequence orders_seq; -drop sequence products_seq; -drop sequence customers_seq; - -CREATE TABLE customers - ( - customer_id number(8) primary key, - first_name varchar2(30), - last_name varchar2(30), - address varchar2(30), - city varchar2(20), - state varchar2(20), - zip char(5) - ); - - create sequence customers_seq start with 1 increment by 1; - - CREATE TABLE orders - ( - order_id number(8) primary key, - customer_id number(8) references customers(customer_id), - order_number varchar2(10), - order_date date, - order_amount number(10,2) - ); - - create sequence orders_seq start with 1 increment by 1; - - create table products - ( - product_id number(8) primary key, - product_type varchar2(20), - product_name varchar2(30), - price number(10,2) - ); - - create sequence products_seq start with 1 increment by 1; - - create table order_details - ( - order_details_id number(8) primary key, - order_id references orders(order_id), - product_id references products(product_id) - ); - -create sequence order_details_seq start with 1 increment by 1; - - insert into products values(products_seq.nextval, 'Books', 'Gone with the wind', '26.72'); - insert into products values(products_seq.nextval, 'Books', 'Spring in Action', '32.29'); - insert into products values(products_seq.nextval, 'Electronics', 'Apple Watch Sports model', '499.00'); - insert into products values(products_seq.nextval, 'Electronics', 'Apple Watch Gold', '7500.00'); - insert into products values(products_seq.nextval, 'Electronics', 'iPhone 6 plus', '799.99'); - - commit; diff --git a/eshop/requirements/Todo.txt b/eshop/requirements/Todo.txt deleted file mode 100644 index 27e0685..0000000 --- a/eshop/requirements/Todo.txt +++ /dev/null @@ -1,40 +0,0 @@ -Implement the methods in ProductDAOJDBCImpl - --> For a given order id, go to order_details and products table (join by order_id) and get the products for this order id - --> Populate all these product information into Product class and add them to a List and return - -Implement the methods in OrderDAOJDBCImpl - --> createOrder takes the customer id and Order object as input. - --> Insert into order table first and then get the order id (first get the sequence (orders_seq) and then insert into orders table) - --> Now, insert into order_details table for each product in the order (use the same order id that we got from above step) - --> getOrdersForCustomers takes customer id as input and then go to orders table (select * from orders where customer_id = ?) - --> For each order, create an order object and populate the order details - - Customers - Orders - Products - -1. Being a new customer, I need to be able to sign up..username, password, first name, last name, city, state, zip -2. As a customer, I need to be able to see all the products.. -3. Customer can add a product to the cart, add another product to cart..etc. -4. When customer clicks on "Check out", we create an order in the database -5. Customer should be able to view all of his orders - -6. Customer should be able to view the order before placing and should be able to delete any item in the cart - - -CustomerRegistrationServlet - /signup - doGET - forwards to a signup JSP (CustomerRegistration.jsp) - doPost - takes the customer details and saves the details in the database - - -HomePageServlet - retrieve all the products from database and display..Every product should have Add to cart image..we will display number of items in the cart - -ShoppingCartServlet - will be able to add products to cart (session) - -CheckoutServlet - save the order in the database - - - - - - - \ No newline at end of file diff --git a/eshop/src/com/eshop/dao/AshopDaoDemo.java b/eshop/src/com/eshop/dao/AshopDaoDemo.java deleted file mode 100644 index e573413..0000000 --- a/eshop/src/com/eshop/dao/AshopDaoDemo.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.eshop.dao; - -public class AshopDaoDemo { - - public static void main(String[] args) { - - - } - -} diff --git a/eshop/src/com/eshop/dao/BaseDAO.java b/eshop/src/com/eshop/dao/BaseDAO.java deleted file mode 100644 index f30749c..0000000 --- a/eshop/src/com/eshop/dao/BaseDAO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException { - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection( - "jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - // Nothing to be done, ignore it. - } - } - - protected int getNextSequenceValue(String sequenceName) throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - try { - con = getConnection(); - - statement = con.createStatement(); - String sql = "select " + sequenceName + ".nextval from dual"; - - rs = statement.executeQuery(sql); - - if (rs.next()) { - return rs.getInt("nextval"); - } - - throw new DAOException("Invalid SQL for sequence next val"); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - } - -} diff --git a/eshop/src/com/eshop/dao/Customer.java b/eshop/src/com/eshop/dao/Customer.java deleted file mode 100644 index b757416..0000000 --- a/eshop/src/com/eshop/dao/Customer.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.eshop.dao; - -import java.util.ArrayList; -import java.util.List; - -public class Customer { - - private int id; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private List orders = new ArrayList(); - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } - - public void addOrder(Order order) { - this.orders.add(order); - } - - public List getOrders() { - return orders; - } -} diff --git a/eshop/src/com/eshop/dao/CustomerDAO.java b/eshop/src/com/eshop/dao/CustomerDAO.java deleted file mode 100644 index f743d87..0000000 --- a/eshop/src/com/eshop/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/eshop/src/com/eshop/dao/CustomerDAOJDBCImpl.java b/eshop/src/com/eshop/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 17c0f3a..0000000 --- a/eshop/src/com/eshop/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customers"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customers values (customers_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customers " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/eshop/src/com/eshop/dao/DAOException.java b/eshop/src/com/eshop/dao/DAOException.java deleted file mode 100644 index 21423ce..0000000 --- a/eshop/src/com/eshop/dao/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage, Throwable ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } -} diff --git a/eshop/src/com/eshop/dao/Order.java b/eshop/src/com/eshop/dao/Order.java deleted file mode 100644 index 2e466e3..0000000 --- a/eshop/src/com/eshop/dao/Order.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.eshop.dao; - -import java.util.Date; -import java.util.List; - -public class Order { - private int id; - private String orderNumber; - private Date orderDate; - private double orderAmount; - - private List products = null; - - public Order(int id, String orderNumber, Date orderDate, - double orderAmount, List products) { - super(); - this.id = id; - this.orderNumber = orderNumber; - this.orderDate = orderDate; - this.orderAmount = orderAmount; - this.products = products; - } - - public int getId() { - return id; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Date getOrderDate() { - return orderDate; - } - - public double getOrderAmount() { - return orderAmount; - } - - public List getProducts() { - return products; - } -} diff --git a/eshop/src/com/eshop/dao/OrdersDAO.java b/eshop/src/com/eshop/dao/OrdersDAO.java deleted file mode 100644 index e32ee11..0000000 --- a/eshop/src/com/eshop/dao/OrdersDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface OrdersDAO { - - void createOrder(int customerId, Order order) throws DAOException; - List getOrdersForCustomer(int customerId) throws DAOException; -} diff --git a/eshop/src/com/eshop/dao/OrdersDAOJDBCImpl.java b/eshop/src/com/eshop/dao/OrdersDAOJDBCImpl.java deleted file mode 100644 index ea143b6..0000000 --- a/eshop/src/com/eshop/dao/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public void createOrder(int customerId, Order order) throws DAOException { - - // step1 : insert into orders table - // step2 : insert into order_details table with the same order id that - // we got from the above step - - Connection con = null; - PreparedStatement statement = null; - - int orderId = 0; - - try { - con = getConnection(); - - String sql = "insert into orders values (?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - orderId = getNextSequenceValue("orders_seq"); - - statement.setInt(1, orderId); - statement.setInt(2, customerId); - statement.setString(3, order.getOrderNumber()); - statement.setDate(4, new Date(order.getOrderDate().getTime())); - statement.setDouble(5, order.getOrderAmount()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating an order", - ex); - } finally { - closeResources(null, statement, con); - } - - insertIntoOrderDetails(orderId, order); - } - - private void insertIntoOrderDetails(int orderId, Order order) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try { - con = getConnection(); - - String sql = "insert into order_details values (order_details_seq.nextval,?,?)"; - - List products = order.getProducts(); - - for (Product product : products) { - statement = con.prepareStatement(sql); - - statement.setInt(1, orderId); - statement.setInt(2, product.getId()); - - statement.executeUpdate(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while inserting the order", - ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public List getOrdersForCustomer(int customerId) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List orders = new ArrayList(); - ProductsDAO dao = new ProductsDAOJDBCImpl(); - - try { - con = getConnection(); - - String sql = "select * from orders where customer_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, customerId); - - rs = statement.executeQuery(sql); - - while (rs.next()) { - int id = rs.getInt("order_id"); - String order_Num = rs.getString("order_number"); - Date order_Date = rs.getDate("order_date"); - double order_amount = rs.getDouble("order_amount"); - List products; - - products = dao.getByOrderId(id); - - Order order = new Order(id, order_Num, order_Date, - order_amount, products); - orders.add(order); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - return orders; - } - -} diff --git a/eshop/src/com/eshop/dao/Product.java b/eshop/src/com/eshop/dao/Product.java deleted file mode 100644 index 866b450..0000000 --- a/eshop/src/com/eshop/dao/Product.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.eshop.dao; - -public class Product { - private int id; - private String type; - private String name; - private double price; - - public Product(int id, String type, String name, double price) { - super(); - this.id = id; - this.type = type; - this.name = name; - this.price = price; - } - - public int getId() { - return id; - } - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - public double getPrice() { - return price; - } -} diff --git a/eshop/src/com/eshop/dao/ProductsDAO.java b/eshop/src/com/eshop/dao/ProductsDAO.java deleted file mode 100644 index fbffb10..0000000 --- a/eshop/src/com/eshop/dao/ProductsDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface ProductsDAO { - - List getByOrderId(int orderId) throws DAOException; - - List getAllProducts() throws DAOException; - - Product findByPrimaryKey(int productId); -} diff --git a/eshop/src/com/eshop/dao/ProductsDAOJDBCImpl.java b/eshop/src/com/eshop/dao/ProductsDAOJDBCImpl.java deleted file mode 100644 index fd4857c..0000000 --- a/eshop/src/com/eshop/dao/ProductsDAOJDBCImpl.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class ProductsDAOJDBCImpl extends BaseDAO implements ProductsDAO { - - @Override - public List getByOrderId(int orderId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select p.product_id pid, p.product_type, p.product_name, p.price " + - "from order_details od, products p " + - "where od.product_id = p.product_id " + - "and od.order_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, orderId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("pid"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public List getAllProducts() throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select * from products"; - - statement = con.prepareStatement(sql); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public Product findByPrimaryKey(int productId) { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try - { - con = getConnection(); - - String sql = "select * from products where product_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, productId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - return product; - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return null; - } -} - diff --git a/eshop/src/com/eshop/web/CheckoutServlet.java b/eshop/src/com/eshop/web/CheckoutServlet.java deleted file mode 100644 index 75133ab..0000000 --- a/eshop/src/com/eshop/web/CheckoutServlet.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; -import com.eshop.dao.OrdersDAOJDBCImpl; -import com.eshop.dao.Product; - -/** - * Servlet implementation class CheckoutServlet - */ -public class CheckoutServlet extends HttpServlet { - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - HttpSession session = request.getSession(); - List products = (List) session.getAttribute("ShoppingCart"); - - double orderAmount = calculateOrderAmount(products); - - String orderNumber = UUID.randomUUID().toString(); - - Order order = new Order(0, orderNumber, new Date(), orderAmount, products); - - OrdersDAO dao = new OrdersDAOJDBCImpl(); - dao.createOrder(1, order); - - session.removeAttribute("ShoppingCart"); - - request.setAttribute("Order", order); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/OrderConfirmation.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - - private double calculateOrderAmount(List products) { - double orderAmount = 0; - - for(Product product : products) { - orderAmount = orderAmount + product.getPrice(); - } - - return orderAmount; - } - -} diff --git a/eshop/src/com/eshop/web/HomePageServlet.java b/eshop/src/com/eshop/web/HomePageServlet.java deleted file mode 100644 index fb25b64..0000000 --- a/eshop/src/com/eshop/web/HomePageServlet.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; -import com.eshop.dao.ProductsDAOJDBCImpl; - -/** - * Servlet implementation class HomePageServlet - */ -public class HomePageServlet extends HttpServlet { - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - ProductsDAO dao = new ProductsDAOJDBCImpl(); - List products = dao.getAllProducts(); - - request.setAttribute("AllProducts", products); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/Home.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/eshop/src/com/eshop/web/ShoppingCartServlet.java b/eshop/src/com/eshop/web/ShoppingCartServlet.java deleted file mode 100644 index 7954c41..0000000 --- a/eshop/src/com/eshop/web/ShoppingCartServlet.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; -import com.eshop.dao.ProductsDAOJDBCImpl; - -/** - * Servlet implementation class ShoppingCartServlet - */ -public class ShoppingCartServlet extends HttpServlet { - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String productIdStr = request.getParameter("productId"); - int productId = Integer.parseInt(productIdStr); - - ProductsDAO dao = new ProductsDAOJDBCImpl(); - Product product = dao.findByPrimaryKey(productId); - - HttpSession session = request.getSession(); - - //any tab exists with this name - if(session.getAttribute("ShoppingCart") == null) { - - //creating a tab - List products = new ArrayList(); - - //Adding this product to the tab - products.add(product); - - //Adding this tab to the session - session.setAttribute("ShoppingCart", products); - } else { - List products = (List) session.getAttribute("ShoppingCart"); - products.add(product); - } - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/ShoppingCart.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/eshop2/.classpath b/eshop2/.classpath deleted file mode 100644 index b80b726..0000000 --- a/eshop2/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eshop2/.project b/eshop2/.project deleted file mode 100644 index 134458a..0000000 --- a/eshop2/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - eshop2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/eshop2/.settings/.jsdtscope b/eshop2/.settings/.jsdtscope deleted file mode 100644 index 585c967..0000000 --- a/eshop2/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eshop2/.settings/org.eclipse.jdt.core.prefs b/eshop2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62a317c..0000000 --- a/eshop2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eshop2/.settings/org.eclipse.m2e.core.prefs b/eshop2/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/eshop2/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/eshop2/.settings/org.eclipse.wst.common.component b/eshop2/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 0bf642f..0000000 --- a/eshop2/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/eshop2/.settings/org.eclipse.wst.common.project.facet.core.xml b/eshop2/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index dac75cc..0000000 --- a/eshop2/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eshop2/.settings/org.eclipse.wst.jsdt.ui.superType.container b/eshop2/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/eshop2/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/eshop2/.settings/org.eclipse.wst.jsdt.ui.superType.name b/eshop2/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/eshop2/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/eshop2/.settings/org.eclipse.wst.validation.prefs b/eshop2/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 6f1cba6..0000000 --- a/eshop2/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/eshop2/pom.xml b/eshop2/pom.xml deleted file mode 100644 index cabb5e4..0000000 --- a/eshop2/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - 4.0.0 - com.training - esho3 - war - 1.0 - eshop2 Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - eshop3 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/eshop2/src/main/java/com/eshop/dao/BaseDAO.java b/eshop2/src/main/java/com/eshop/dao/BaseDAO.java deleted file mode 100644 index f30749c..0000000 --- a/eshop2/src/main/java/com/eshop/dao/BaseDAO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException { - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection( - "jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - // Nothing to be done, ignore it. - } - } - - protected int getNextSequenceValue(String sequenceName) throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - try { - con = getConnection(); - - statement = con.createStatement(); - String sql = "select " + sequenceName + ".nextval from dual"; - - rs = statement.executeQuery(sql); - - if (rs.next()) { - return rs.getInt("nextval"); - } - - throw new DAOException("Invalid SQL for sequence next val"); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - } - -} diff --git a/eshop2/src/main/java/com/eshop/dao/Customer.java b/eshop2/src/main/java/com/eshop/dao/Customer.java deleted file mode 100644 index b757416..0000000 --- a/eshop2/src/main/java/com/eshop/dao/Customer.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.eshop.dao; - -import java.util.ArrayList; -import java.util.List; - -public class Customer { - - private int id; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private List orders = new ArrayList(); - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } - - public void addOrder(Order order) { - this.orders.add(order); - } - - public List getOrders() { - return orders; - } -} diff --git a/eshop2/src/main/java/com/eshop/dao/CustomerDAO.java b/eshop2/src/main/java/com/eshop/dao/CustomerDAO.java deleted file mode 100644 index f743d87..0000000 --- a/eshop2/src/main/java/com/eshop/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/eshop2/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java b/eshop2/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 4cb7af4..0000000 --- a/eshop2/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customers"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customers values (customers_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customers " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/eshop2/src/main/java/com/eshop/dao/DAOException.java b/eshop2/src/main/java/com/eshop/dao/DAOException.java deleted file mode 100644 index 21423ce..0000000 --- a/eshop2/src/main/java/com/eshop/dao/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage, Throwable ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } -} diff --git a/eshop2/src/main/java/com/eshop/dao/Order.java b/eshop2/src/main/java/com/eshop/dao/Order.java deleted file mode 100644 index 2e466e3..0000000 --- a/eshop2/src/main/java/com/eshop/dao/Order.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.eshop.dao; - -import java.util.Date; -import java.util.List; - -public class Order { - private int id; - private String orderNumber; - private Date orderDate; - private double orderAmount; - - private List products = null; - - public Order(int id, String orderNumber, Date orderDate, - double orderAmount, List products) { - super(); - this.id = id; - this.orderNumber = orderNumber; - this.orderDate = orderDate; - this.orderAmount = orderAmount; - this.products = products; - } - - public int getId() { - return id; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Date getOrderDate() { - return orderDate; - } - - public double getOrderAmount() { - return orderAmount; - } - - public List getProducts() { - return products; - } -} diff --git a/eshop2/src/main/java/com/eshop/dao/OrdersDAO.java b/eshop2/src/main/java/com/eshop/dao/OrdersDAO.java deleted file mode 100644 index e32ee11..0000000 --- a/eshop2/src/main/java/com/eshop/dao/OrdersDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface OrdersDAO { - - void createOrder(int customerId, Order order) throws DAOException; - List getOrdersForCustomer(int customerId) throws DAOException; -} diff --git a/eshop2/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java b/eshop2/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java deleted file mode 100644 index 267cca8..0000000 --- a/eshop2/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public void createOrder(int customerId, Order order) throws DAOException { - - // step1 : insert into orders table - // step2 : insert into order_details table with the same order id that - // we got from the above step - - Connection con = null; - PreparedStatement statement = null; - - int orderId = 0; - - try { - con = getConnection(); - - String sql = "insert into orders values (?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - orderId = getNextSequenceValue("orders_seq"); - - statement.setInt(1, orderId); - statement.setInt(2, customerId); - statement.setString(3, order.getOrderNumber()); - statement.setDate(4, new Date(order.getOrderDate().getTime())); - statement.setDouble(5, order.getOrderAmount()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating an order", - ex); - } finally { - closeResources(null, statement, con); - } - - insertIntoOrderDetails(orderId, order); - } - - private void insertIntoOrderDetails(int orderId, Order order) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try { - con = getConnection(); - - String sql = "insert into order_details values (order_details_seq.nextval,?,?)"; - - List products = order.getProducts(); - - for (Product product : products) { - statement = con.prepareStatement(sql); - - statement.setInt(1, orderId); - statement.setInt(2, product.getId()); - - statement.executeUpdate(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while inserting the order", - ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public List getOrdersForCustomer(int customerId) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List orders = new ArrayList(); - ProductsDAO dao = new ProductsDAOJDBCImpl(); - - try { - con = getConnection(); - - String sql = "select * from orders where customer_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, customerId); - - rs = statement.executeQuery(sql); - - while (rs.next()) { - int id = rs.getInt("order_id"); - String order_Num = rs.getString("order_number"); - Date order_Date = rs.getDate("order_date"); - double order_amount = rs.getDouble("order_amount"); - List products; - - products = dao.getByOrderId(id); - - Order order = new Order(id, order_Num, order_Date, - order_amount, products); - orders.add(order); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - return orders; - } - -} diff --git a/eshop2/src/main/java/com/eshop/dao/Product.java b/eshop2/src/main/java/com/eshop/dao/Product.java deleted file mode 100644 index 866b450..0000000 --- a/eshop2/src/main/java/com/eshop/dao/Product.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.eshop.dao; - -public class Product { - private int id; - private String type; - private String name; - private double price; - - public Product(int id, String type, String name, double price) { - super(); - this.id = id; - this.type = type; - this.name = name; - this.price = price; - } - - public int getId() { - return id; - } - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - public double getPrice() { - return price; - } -} diff --git a/eshop2/src/main/java/com/eshop/dao/ProductsDAO.java b/eshop2/src/main/java/com/eshop/dao/ProductsDAO.java deleted file mode 100644 index fbffb10..0000000 --- a/eshop2/src/main/java/com/eshop/dao/ProductsDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface ProductsDAO { - - List getByOrderId(int orderId) throws DAOException; - - List getAllProducts() throws DAOException; - - Product findByPrimaryKey(int productId); -} diff --git a/eshop2/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java b/eshop2/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java deleted file mode 100644 index bdaa84b..0000000 --- a/eshop2/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class ProductsDAOJDBCImpl extends BaseDAO implements ProductsDAO { - - @Override - public List getByOrderId(int orderId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select p.product_id pid, p.product_type, p.product_name, p.price " + - "from order_details od, products p " + - "where od.product_id = p.product_id " + - "and od.order_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, orderId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("pid"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public List getAllProducts() throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select * from products"; - - statement = con.prepareStatement(sql); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public Product findByPrimaryKey(int productId) { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try - { - con = getConnection(); - - String sql = "select * from products where product_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, productId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - return product; - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return null; - } -} - diff --git a/eshop2/src/main/java/com/eshop/service/CustomerService.java b/eshop2/src/main/java/com/eshop/service/CustomerService.java deleted file mode 100644 index 6c0cbd5..0000000 --- a/eshop2/src/main/java/com/eshop/service/CustomerService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Customer; -import com.eshop.dao.CustomerDAO; - -@Service -public class CustomerService { - - @Autowired - private CustomerDAO dao; - - public List getCustomers() { - return dao.getAllCustomers(); - } -} diff --git a/eshop2/src/main/java/com/eshop/service/OrdersService.java b/eshop2/src/main/java/com/eshop/service/OrdersService.java deleted file mode 100644 index 2d159f6..0000000 --- a/eshop2/src/main/java/com/eshop/service/OrdersService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eshop.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; - -@Service -public class OrdersService { - - @Autowired - private OrdersDAO dao; - - public void placeOrder(int customerId, Order order) { - dao.createOrder(customerId, order); - } - - public List getOrders(int customerId) { - return dao.getOrdersForCustomer(customerId); - } - - public List getOrdersForTheMonth(int customerId) { - List orders = dao.getOrdersForCustomer(customerId); - - List ordersForTheMonth = new ArrayList(); - int currentMonth = new Date().getMonth(); - - for (Order order : orders) { - if (order.getOrderDate().getMonth() == currentMonth) { - ordersForTheMonth.add(order); - } - } - - return ordersForTheMonth; - } -} diff --git a/eshop2/src/main/java/com/eshop/service/ProductsService.java b/eshop2/src/main/java/com/eshop/service/ProductsService.java deleted file mode 100644 index 74066ab..0000000 --- a/eshop2/src/main/java/com/eshop/service/ProductsService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; - -@Service -public class ProductsService { - - @Autowired - private ProductsDAO dao; - - public Product getById(int productId) { - return dao.findByPrimaryKey(productId); - } - - public List getAllProducts() { - return dao.getAllProducts(); - } -} diff --git a/eshop2/src/main/java/com/eshop/web/CheckoutServlet.java b/eshop2/src/main/java/com/eshop/web/CheckoutServlet.java deleted file mode 100644 index ae42c6f..0000000 --- a/eshop2/src/main/java/com/eshop/web/CheckoutServlet.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; -import com.eshop.dao.OrdersDAOJDBCImpl; -import com.eshop.dao.Product; -import com.eshop.service.OrdersService; - -/** - * Servlet implementation class CheckoutServlet - */ -public class CheckoutServlet extends HttpServlet { - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - HttpSession session = request.getSession(); - List products = (List) session.getAttribute("ShoppingCart"); - - double orderAmount = calculateOrderAmount(products); - - String orderNumber = UUID.randomUUID().toString(); - - Order order = new Order(0, orderNumber, new Date(), orderAmount, products); - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - OrdersService service = context.getBean(OrdersService.class); - - service.placeOrder(1, order); - - session.removeAttribute("ShoppingCart"); - - request.setAttribute("Order", order); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/OrderConfirmation.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - - private double calculateOrderAmount(List products) { - double orderAmount = 0; - - for(Product product : products) { - orderAmount = orderAmount + product.getPrice(); - } - - return orderAmount; - } - -} diff --git a/eshop2/src/main/java/com/eshop/web/HomePageServlet.java b/eshop2/src/main/java/com/eshop/web/HomePageServlet.java deleted file mode 100644 index 909168c..0000000 --- a/eshop2/src/main/java/com/eshop/web/HomePageServlet.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - -/** - * Servlet implementation class HomePageServlet - */ -public class HomePageServlet extends HttpServlet { - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - ProductsService service = context.getBean(ProductsService.class); - - List products = service.getAllProducts(); - - request.setAttribute("AllProducts", products); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/Home.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/eshop2/src/main/java/com/eshop/web/ShoppingCartServlet.java b/eshop2/src/main/java/com/eshop/web/ShoppingCartServlet.java deleted file mode 100644 index dc46a2f..0000000 --- a/eshop2/src/main/java/com/eshop/web/ShoppingCartServlet.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - -/** - * Servlet implementation class ShoppingCartServlet - */ -public class ShoppingCartServlet extends HttpServlet { - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String productIdStr = request.getParameter("productId"); - int productId = Integer.parseInt(productIdStr); - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - ProductsService service = context.getBean(ProductsService.class); - - Product product = service.getById(productId); - - HttpSession session = request.getSession(); - - //any tab exists with this name - if(session.getAttribute("ShoppingCart") == null) { - - //creating a tab - List products = new ArrayList(); - - //Adding this product to the tab - products.add(product); - - //Adding this tab to the session - session.setAttribute("ShoppingCart", products); - } else { - List products = (List) session.getAttribute("ShoppingCart"); - products.add(product); - } - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/ShoppingCart.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/eshop2/src/main/resources/spring-config.xml b/eshop2/src/main/resources/spring-config.xml deleted file mode 100644 index 194c280..0000000 --- a/eshop2/src/main/resources/spring-config.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/eshop2/src/main/webapp/WEB-INF/jsp/Home.jsp b/eshop2/src/main/webapp/WEB-INF/jsp/Home.jsp deleted file mode 100644 index ac5f8c1..0000000 --- a/eshop2/src/main/webapp/WEB-INF/jsp/Home.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - -

    Welcome to eShop

    - - - - - - - - - - - - - - - - - - - -
    IdNameTypePrice
    ${product.id}${product.name}${product.type}${product.price}Add to Cart
    - - - - \ No newline at end of file diff --git a/eshop2/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp b/eshop2/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp deleted file mode 100644 index f614fb2..0000000 --- a/eshop2/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

    Your order has been placed, and your order number is - ${Order.orderNumber}.

    -

    If you have any questions regarding this order, - please reference this order number.

    - -
    Click here to go to home page.
    - - - \ No newline at end of file diff --git a/eshop2/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp b/eshop2/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp deleted file mode 100644 index 5908bed..0000000 --- a/eshop2/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - -

    You have added the following items to the cart.

    - - - - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}Add to - Cart
    - -

    Do you want to shop more?Please click here

    -

    If you are done shopping, please click here

    - - - \ No newline at end of file diff --git a/eshop2/src/main/webapp/WEB-INF/web.xml b/eshop2/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 8ff9f5e..0000000 --- a/eshop2/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - eshop - - - HomePageServlet - HomePageServlet - com.eshop.web.HomePageServlet - - - HomePageServlet - / - - - - ShoppingCartServlet - ShoppingCartServlet - com.eshop.web.ShoppingCartServlet - - - ShoppingCartServlet - /cart - - - - CheckoutServlet - CheckoutServlet - com.eshop.web.CheckoutServlet - - - CheckoutServlet - /checkout - - \ No newline at end of file diff --git a/eshop2/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF b/eshop2/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF deleted file mode 100644 index 4d6ca1d..0000000 --- a/eshop2/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: venkat -Build-Jdk: 1.8.0_40 -Created-By: Maven Integration for Eclipse - diff --git a/eshop2/target/m2e-wtp/web-resources/META-INF/maven/com.training/esho3/pom.properties b/eshop2/target/m2e-wtp/web-resources/META-INF/maven/com.training/esho3/pom.properties deleted file mode 100644 index 06fa828..0000000 --- a/eshop2/target/m2e-wtp/web-resources/META-INF/maven/com.training/esho3/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Thu May 21 20:27:29 EDT 2015 -version=1.0 -groupId=com.training -m2e.projectName=eshop4 -m2e.projectLocation=D\:\\javatraining\\projects\\eshop4 -artifactId=esho3 diff --git a/eshop2/target/m2e-wtp/web-resources/META-INF/maven/com.training/esho3/pom.xml b/eshop2/target/m2e-wtp/web-resources/META-INF/maven/com.training/esho3/pom.xml deleted file mode 100644 index cabb5e4..0000000 --- a/eshop2/target/m2e-wtp/web-resources/META-INF/maven/com.training/esho3/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - 4.0.0 - com.training - esho3 - war - 1.0 - eshop2 Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - eshop3 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/eshop3/.classpath b/eshop3/.classpath deleted file mode 100644 index b80b726..0000000 --- a/eshop3/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eshop3/.project b/eshop3/.project deleted file mode 100644 index 134458a..0000000 --- a/eshop3/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - eshop2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/eshop3/.settings/.jsdtscope b/eshop3/.settings/.jsdtscope deleted file mode 100644 index 585c967..0000000 --- a/eshop3/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eshop3/.settings/org.eclipse.jdt.core.prefs b/eshop3/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62a317c..0000000 --- a/eshop3/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eshop3/.settings/org.eclipse.m2e.core.prefs b/eshop3/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/eshop3/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/eshop3/.settings/org.eclipse.wst.common.component b/eshop3/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 0bf642f..0000000 --- a/eshop3/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/eshop3/.settings/org.eclipse.wst.common.project.facet.core.xml b/eshop3/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index dac75cc..0000000 --- a/eshop3/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eshop3/.settings/org.eclipse.wst.jsdt.ui.superType.container b/eshop3/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/eshop3/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/eshop3/.settings/org.eclipse.wst.jsdt.ui.superType.name b/eshop3/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/eshop3/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/eshop3/.settings/org.eclipse.wst.validation.prefs b/eshop3/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 6f1cba6..0000000 --- a/eshop3/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/eshop3/pom.xml b/eshop3/pom.xml deleted file mode 100644 index 491ec69..0000000 --- a/eshop3/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - 4.0.0 - com.training - esho3 - war - 1.0 - eshop2 Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - eshop3 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/eshop3/src/main/java/com/eshop/dao/BaseDAO.java b/eshop3/src/main/java/com/eshop/dao/BaseDAO.java deleted file mode 100644 index f30749c..0000000 --- a/eshop3/src/main/java/com/eshop/dao/BaseDAO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException { - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection( - "jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - // Nothing to be done, ignore it. - } - } - - protected int getNextSequenceValue(String sequenceName) throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - try { - con = getConnection(); - - statement = con.createStatement(); - String sql = "select " + sequenceName + ".nextval from dual"; - - rs = statement.executeQuery(sql); - - if (rs.next()) { - return rs.getInt("nextval"); - } - - throw new DAOException("Invalid SQL for sequence next val"); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - } - -} diff --git a/eshop3/src/main/java/com/eshop/dao/Customer.java b/eshop3/src/main/java/com/eshop/dao/Customer.java deleted file mode 100644 index b757416..0000000 --- a/eshop3/src/main/java/com/eshop/dao/Customer.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.eshop.dao; - -import java.util.ArrayList; -import java.util.List; - -public class Customer { - - private int id; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private List orders = new ArrayList(); - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } - - public void addOrder(Order order) { - this.orders.add(order); - } - - public List getOrders() { - return orders; - } -} diff --git a/eshop3/src/main/java/com/eshop/dao/CustomerDAO.java b/eshop3/src/main/java/com/eshop/dao/CustomerDAO.java deleted file mode 100644 index f743d87..0000000 --- a/eshop3/src/main/java/com/eshop/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/eshop3/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java b/eshop3/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 17c0f3a..0000000 --- a/eshop3/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customers"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customers values (customers_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customers " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/eshop3/src/main/java/com/eshop/dao/DAOException.java b/eshop3/src/main/java/com/eshop/dao/DAOException.java deleted file mode 100644 index 21423ce..0000000 --- a/eshop3/src/main/java/com/eshop/dao/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage, Throwable ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } -} diff --git a/eshop3/src/main/java/com/eshop/dao/Order.java b/eshop3/src/main/java/com/eshop/dao/Order.java deleted file mode 100644 index 2e466e3..0000000 --- a/eshop3/src/main/java/com/eshop/dao/Order.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.eshop.dao; - -import java.util.Date; -import java.util.List; - -public class Order { - private int id; - private String orderNumber; - private Date orderDate; - private double orderAmount; - - private List products = null; - - public Order(int id, String orderNumber, Date orderDate, - double orderAmount, List products) { - super(); - this.id = id; - this.orderNumber = orderNumber; - this.orderDate = orderDate; - this.orderAmount = orderAmount; - this.products = products; - } - - public int getId() { - return id; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Date getOrderDate() { - return orderDate; - } - - public double getOrderAmount() { - return orderAmount; - } - - public List getProducts() { - return products; - } -} diff --git a/eshop3/src/main/java/com/eshop/dao/OrdersDAO.java b/eshop3/src/main/java/com/eshop/dao/OrdersDAO.java deleted file mode 100644 index e32ee11..0000000 --- a/eshop3/src/main/java/com/eshop/dao/OrdersDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface OrdersDAO { - - void createOrder(int customerId, Order order) throws DAOException; - List getOrdersForCustomer(int customerId) throws DAOException; -} diff --git a/eshop3/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java b/eshop3/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java deleted file mode 100644 index ea143b6..0000000 --- a/eshop3/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public void createOrder(int customerId, Order order) throws DAOException { - - // step1 : insert into orders table - // step2 : insert into order_details table with the same order id that - // we got from the above step - - Connection con = null; - PreparedStatement statement = null; - - int orderId = 0; - - try { - con = getConnection(); - - String sql = "insert into orders values (?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - orderId = getNextSequenceValue("orders_seq"); - - statement.setInt(1, orderId); - statement.setInt(2, customerId); - statement.setString(3, order.getOrderNumber()); - statement.setDate(4, new Date(order.getOrderDate().getTime())); - statement.setDouble(5, order.getOrderAmount()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating an order", - ex); - } finally { - closeResources(null, statement, con); - } - - insertIntoOrderDetails(orderId, order); - } - - private void insertIntoOrderDetails(int orderId, Order order) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try { - con = getConnection(); - - String sql = "insert into order_details values (order_details_seq.nextval,?,?)"; - - List products = order.getProducts(); - - for (Product product : products) { - statement = con.prepareStatement(sql); - - statement.setInt(1, orderId); - statement.setInt(2, product.getId()); - - statement.executeUpdate(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while inserting the order", - ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public List getOrdersForCustomer(int customerId) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List orders = new ArrayList(); - ProductsDAO dao = new ProductsDAOJDBCImpl(); - - try { - con = getConnection(); - - String sql = "select * from orders where customer_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, customerId); - - rs = statement.executeQuery(sql); - - while (rs.next()) { - int id = rs.getInt("order_id"); - String order_Num = rs.getString("order_number"); - Date order_Date = rs.getDate("order_date"); - double order_amount = rs.getDouble("order_amount"); - List products; - - products = dao.getByOrderId(id); - - Order order = new Order(id, order_Num, order_Date, - order_amount, products); - orders.add(order); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - return orders; - } - -} diff --git a/eshop3/src/main/java/com/eshop/dao/Product.java b/eshop3/src/main/java/com/eshop/dao/Product.java deleted file mode 100644 index 866b450..0000000 --- a/eshop3/src/main/java/com/eshop/dao/Product.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.eshop.dao; - -public class Product { - private int id; - private String type; - private String name; - private double price; - - public Product(int id, String type, String name, double price) { - super(); - this.id = id; - this.type = type; - this.name = name; - this.price = price; - } - - public int getId() { - return id; - } - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - public double getPrice() { - return price; - } -} diff --git a/eshop3/src/main/java/com/eshop/dao/ProductsDAO.java b/eshop3/src/main/java/com/eshop/dao/ProductsDAO.java deleted file mode 100644 index fbffb10..0000000 --- a/eshop3/src/main/java/com/eshop/dao/ProductsDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface ProductsDAO { - - List getByOrderId(int orderId) throws DAOException; - - List getAllProducts() throws DAOException; - - Product findByPrimaryKey(int productId); -} diff --git a/eshop3/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java b/eshop3/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java deleted file mode 100644 index fd4857c..0000000 --- a/eshop3/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class ProductsDAOJDBCImpl extends BaseDAO implements ProductsDAO { - - @Override - public List getByOrderId(int orderId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select p.product_id pid, p.product_type, p.product_name, p.price " + - "from order_details od, products p " + - "where od.product_id = p.product_id " + - "and od.order_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, orderId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("pid"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public List getAllProducts() throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select * from products"; - - statement = con.prepareStatement(sql); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public Product findByPrimaryKey(int productId) { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try - { - con = getConnection(); - - String sql = "select * from products where product_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, productId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - return product; - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return null; - } -} - diff --git a/eshop3/src/main/java/com/eshop/service/CustomerService.java b/eshop3/src/main/java/com/eshop/service/CustomerService.java deleted file mode 100644 index 4364ce5..0000000 --- a/eshop3/src/main/java/com/eshop/service/CustomerService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import com.eshop.dao.Customer; -import com.eshop.dao.CustomerDAO; -import com.eshop.dao.CustomerDAOJDBCImpl; - -public class CustomerService { - - public List getCustomers() { - CustomerDAO dao = new CustomerDAOJDBCImpl(); - return dao.getAllCustomers(); - } -} diff --git a/eshop3/src/main/java/com/eshop/service/OrdersService.java b/eshop3/src/main/java/com/eshop/service/OrdersService.java deleted file mode 100644 index da689e9..0000000 --- a/eshop3/src/main/java/com/eshop/service/OrdersService.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.eshop.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; -import com.eshop.dao.OrdersDAOJDBCImpl; - -public class OrdersService { - - public void placeOrder(int customerId, Order order) { - OrdersDAO dao = new OrdersDAOJDBCImpl(); - dao.createOrder(customerId, order); - } - - public List getOrders(int customerId) { - OrdersDAO dao = new OrdersDAOJDBCImpl(); - return dao.getOrdersForCustomer(customerId); - } - - public List getOrdersForTheMonth(int customerId) { - OrdersDAO dao = new OrdersDAOJDBCImpl(); - List orders = dao.getOrdersForCustomer(customerId); - - List ordersForTheMonth = new ArrayList(); - int currentMonth = new Date().getMonth(); - - for (Order order : orders) { - if (order.getOrderDate().getMonth() == currentMonth) { - ordersForTheMonth.add(order); - } - } - - return ordersForTheMonth; - } -} diff --git a/eshop3/src/main/java/com/eshop/service/ProductsService.java b/eshop3/src/main/java/com/eshop/service/ProductsService.java deleted file mode 100644 index eacb8f2..0000000 --- a/eshop3/src/main/java/com/eshop/service/ProductsService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.eshop.service; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; -import com.eshop.dao.ProductsDAOJDBCImpl; - -public class ProductsService { - - public Product getById(int productId) { - ProductsDAO dao = new ProductsDAOJDBCImpl(); - return dao.findByPrimaryKey(productId); - } - -} diff --git a/eshop3/src/main/java/com/eshop/web/CheckoutServlet.java b/eshop3/src/main/java/com/eshop/web/CheckoutServlet.java deleted file mode 100644 index 75133ab..0000000 --- a/eshop3/src/main/java/com/eshop/web/CheckoutServlet.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; -import com.eshop.dao.OrdersDAOJDBCImpl; -import com.eshop.dao.Product; - -/** - * Servlet implementation class CheckoutServlet - */ -public class CheckoutServlet extends HttpServlet { - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - HttpSession session = request.getSession(); - List products = (List) session.getAttribute("ShoppingCart"); - - double orderAmount = calculateOrderAmount(products); - - String orderNumber = UUID.randomUUID().toString(); - - Order order = new Order(0, orderNumber, new Date(), orderAmount, products); - - OrdersDAO dao = new OrdersDAOJDBCImpl(); - dao.createOrder(1, order); - - session.removeAttribute("ShoppingCart"); - - request.setAttribute("Order", order); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/OrderConfirmation.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - - private double calculateOrderAmount(List products) { - double orderAmount = 0; - - for(Product product : products) { - orderAmount = orderAmount + product.getPrice(); - } - - return orderAmount; - } - -} diff --git a/eshop3/src/main/java/com/eshop/web/HomePageServlet.java b/eshop3/src/main/java/com/eshop/web/HomePageServlet.java deleted file mode 100644 index fb25b64..0000000 --- a/eshop3/src/main/java/com/eshop/web/HomePageServlet.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; -import com.eshop.dao.ProductsDAOJDBCImpl; - -/** - * Servlet implementation class HomePageServlet - */ -public class HomePageServlet extends HttpServlet { - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - ProductsDAO dao = new ProductsDAOJDBCImpl(); - List products = dao.getAllProducts(); - - request.setAttribute("AllProducts", products); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/Home.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/eshop3/src/main/java/com/eshop/web/ShoppingCartServlet.java b/eshop3/src/main/java/com/eshop/web/ShoppingCartServlet.java deleted file mode 100644 index efc5785..0000000 --- a/eshop3/src/main/java/com/eshop/web/ShoppingCartServlet.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - -/** - * Servlet implementation class ShoppingCartServlet - */ -public class ShoppingCartServlet extends HttpServlet { - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String productIdStr = request.getParameter("productId"); - int productId = Integer.parseInt(productIdStr); - - Product product = new ProductsService().getById(productId); - - HttpSession session = request.getSession(); - - //any tab exists with this name - if(session.getAttribute("ShoppingCart") == null) { - - //creating a tab - List products = new ArrayList(); - - //Adding this product to the tab - products.add(product); - - //Adding this tab to the session - session.setAttribute("ShoppingCart", products); - } else { - List products = (List) session.getAttribute("ShoppingCart"); - products.add(product); - } - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/ShoppingCart.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/eshop3/src/main/webapp/WEB-INF/jsp/Home.jsp b/eshop3/src/main/webapp/WEB-INF/jsp/Home.jsp deleted file mode 100644 index 0e0d1de..0000000 --- a/eshop3/src/main/webapp/WEB-INF/jsp/Home.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - -

    Welcome to eShop

    - - - - - - - - - - - - - - - - - - - -
    IdNameTypePrice
    ${product.id}${product.name}${product.type}${product.price}Add to Cart
    - - - - \ No newline at end of file diff --git a/eshop3/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp b/eshop3/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp deleted file mode 100644 index 0535eac..0000000 --- a/eshop3/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

    Your order has been placed, and your order number is - ${Order.orderNumber}.

    -

    If you have any questions regarding this order, - please reference this order number.

    - -
    Click here to go to home page.
    - - - \ No newline at end of file diff --git a/eshop3/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp b/eshop3/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp deleted file mode 100644 index f062ff9..0000000 --- a/eshop3/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - -

    You have added the following items to the cart.

    - - - - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}Add to - Cart
    - -

    Do you want to shop more?Please click here

    -

    If you are done shopping, please click here

    - - - \ No newline at end of file diff --git a/eshop3/src/main/webapp/WEB-INF/web.xml b/eshop3/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 8ff9f5e..0000000 --- a/eshop3/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - eshop - - - HomePageServlet - HomePageServlet - com.eshop.web.HomePageServlet - - - HomePageServlet - / - - - - ShoppingCartServlet - ShoppingCartServlet - com.eshop.web.ShoppingCartServlet - - - ShoppingCartServlet - /cart - - - - CheckoutServlet - CheckoutServlet - com.eshop.web.CheckoutServlet - - - CheckoutServlet - /checkout - - \ No newline at end of file diff --git a/eshop4/.classpath b/eshop4/.classpath deleted file mode 100644 index b80b726..0000000 --- a/eshop4/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eshop4/.project b/eshop4/.project deleted file mode 100644 index 134458a..0000000 --- a/eshop4/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - eshop2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/eshop4/.settings/.jsdtscope b/eshop4/.settings/.jsdtscope deleted file mode 100644 index 585c967..0000000 --- a/eshop4/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eshop4/.settings/org.eclipse.jdt.core.prefs b/eshop4/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62a317c..0000000 --- a/eshop4/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eshop4/.settings/org.eclipse.m2e.core.prefs b/eshop4/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/eshop4/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/eshop4/.settings/org.eclipse.wst.common.component b/eshop4/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 0bf642f..0000000 --- a/eshop4/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/eshop4/.settings/org.eclipse.wst.common.project.facet.core.xml b/eshop4/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index dac75cc..0000000 --- a/eshop4/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eshop4/.settings/org.eclipse.wst.jsdt.ui.superType.container b/eshop4/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/eshop4/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/eshop4/.settings/org.eclipse.wst.jsdt.ui.superType.name b/eshop4/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/eshop4/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/eshop4/.settings/org.eclipse.wst.validation.prefs b/eshop4/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 6f1cba6..0000000 --- a/eshop4/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/eshop4/pom.xml b/eshop4/pom.xml deleted file mode 100644 index cabb5e4..0000000 --- a/eshop4/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - 4.0.0 - com.training - esho3 - war - 1.0 - eshop2 Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - eshop3 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/eshop4/src/main/java/com/eshop/dao/BaseDAO.java b/eshop4/src/main/java/com/eshop/dao/BaseDAO.java deleted file mode 100644 index f30749c..0000000 --- a/eshop4/src/main/java/com/eshop/dao/BaseDAO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException { - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection( - "jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - // Nothing to be done, ignore it. - } - } - - protected int getNextSequenceValue(String sequenceName) throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - try { - con = getConnection(); - - statement = con.createStatement(); - String sql = "select " + sequenceName + ".nextval from dual"; - - rs = statement.executeQuery(sql); - - if (rs.next()) { - return rs.getInt("nextval"); - } - - throw new DAOException("Invalid SQL for sequence next val"); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - } - -} diff --git a/eshop4/src/main/java/com/eshop/dao/Customer.java b/eshop4/src/main/java/com/eshop/dao/Customer.java deleted file mode 100644 index b757416..0000000 --- a/eshop4/src/main/java/com/eshop/dao/Customer.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.eshop.dao; - -import java.util.ArrayList; -import java.util.List; - -public class Customer { - - private int id; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private List orders = new ArrayList(); - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } - - public void addOrder(Order order) { - this.orders.add(order); - } - - public List getOrders() { - return orders; - } -} diff --git a/eshop4/src/main/java/com/eshop/dao/CustomerDAO.java b/eshop4/src/main/java/com/eshop/dao/CustomerDAO.java deleted file mode 100644 index f743d87..0000000 --- a/eshop4/src/main/java/com/eshop/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/eshop4/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java b/eshop4/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 4cb7af4..0000000 --- a/eshop4/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customers"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customers values (customers_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customers " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/eshop4/src/main/java/com/eshop/dao/DAOException.java b/eshop4/src/main/java/com/eshop/dao/DAOException.java deleted file mode 100644 index 21423ce..0000000 --- a/eshop4/src/main/java/com/eshop/dao/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage, Throwable ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } -} diff --git a/eshop4/src/main/java/com/eshop/dao/Order.java b/eshop4/src/main/java/com/eshop/dao/Order.java deleted file mode 100644 index 2e466e3..0000000 --- a/eshop4/src/main/java/com/eshop/dao/Order.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.eshop.dao; - -import java.util.Date; -import java.util.List; - -public class Order { - private int id; - private String orderNumber; - private Date orderDate; - private double orderAmount; - - private List products = null; - - public Order(int id, String orderNumber, Date orderDate, - double orderAmount, List products) { - super(); - this.id = id; - this.orderNumber = orderNumber; - this.orderDate = orderDate; - this.orderAmount = orderAmount; - this.products = products; - } - - public int getId() { - return id; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Date getOrderDate() { - return orderDate; - } - - public double getOrderAmount() { - return orderAmount; - } - - public List getProducts() { - return products; - } -} diff --git a/eshop4/src/main/java/com/eshop/dao/OrdersDAO.java b/eshop4/src/main/java/com/eshop/dao/OrdersDAO.java deleted file mode 100644 index e32ee11..0000000 --- a/eshop4/src/main/java/com/eshop/dao/OrdersDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface OrdersDAO { - - void createOrder(int customerId, Order order) throws DAOException; - List getOrdersForCustomer(int customerId) throws DAOException; -} diff --git a/eshop4/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java b/eshop4/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java deleted file mode 100644 index 267cca8..0000000 --- a/eshop4/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public void createOrder(int customerId, Order order) throws DAOException { - - // step1 : insert into orders table - // step2 : insert into order_details table with the same order id that - // we got from the above step - - Connection con = null; - PreparedStatement statement = null; - - int orderId = 0; - - try { - con = getConnection(); - - String sql = "insert into orders values (?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - orderId = getNextSequenceValue("orders_seq"); - - statement.setInt(1, orderId); - statement.setInt(2, customerId); - statement.setString(3, order.getOrderNumber()); - statement.setDate(4, new Date(order.getOrderDate().getTime())); - statement.setDouble(5, order.getOrderAmount()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating an order", - ex); - } finally { - closeResources(null, statement, con); - } - - insertIntoOrderDetails(orderId, order); - } - - private void insertIntoOrderDetails(int orderId, Order order) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try { - con = getConnection(); - - String sql = "insert into order_details values (order_details_seq.nextval,?,?)"; - - List products = order.getProducts(); - - for (Product product : products) { - statement = con.prepareStatement(sql); - - statement.setInt(1, orderId); - statement.setInt(2, product.getId()); - - statement.executeUpdate(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while inserting the order", - ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public List getOrdersForCustomer(int customerId) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List orders = new ArrayList(); - ProductsDAO dao = new ProductsDAOJDBCImpl(); - - try { - con = getConnection(); - - String sql = "select * from orders where customer_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, customerId); - - rs = statement.executeQuery(sql); - - while (rs.next()) { - int id = rs.getInt("order_id"); - String order_Num = rs.getString("order_number"); - Date order_Date = rs.getDate("order_date"); - double order_amount = rs.getDouble("order_amount"); - List products; - - products = dao.getByOrderId(id); - - Order order = new Order(id, order_Num, order_Date, - order_amount, products); - orders.add(order); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - return orders; - } - -} diff --git a/eshop4/src/main/java/com/eshop/dao/Product.java b/eshop4/src/main/java/com/eshop/dao/Product.java deleted file mode 100644 index 866b450..0000000 --- a/eshop4/src/main/java/com/eshop/dao/Product.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.eshop.dao; - -public class Product { - private int id; - private String type; - private String name; - private double price; - - public Product(int id, String type, String name, double price) { - super(); - this.id = id; - this.type = type; - this.name = name; - this.price = price; - } - - public int getId() { - return id; - } - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - public double getPrice() { - return price; - } -} diff --git a/eshop4/src/main/java/com/eshop/dao/ProductsDAO.java b/eshop4/src/main/java/com/eshop/dao/ProductsDAO.java deleted file mode 100644 index fbffb10..0000000 --- a/eshop4/src/main/java/com/eshop/dao/ProductsDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface ProductsDAO { - - List getByOrderId(int orderId) throws DAOException; - - List getAllProducts() throws DAOException; - - Product findByPrimaryKey(int productId); -} diff --git a/eshop4/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java b/eshop4/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java deleted file mode 100644 index bdaa84b..0000000 --- a/eshop4/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class ProductsDAOJDBCImpl extends BaseDAO implements ProductsDAO { - - @Override - public List getByOrderId(int orderId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select p.product_id pid, p.product_type, p.product_name, p.price " + - "from order_details od, products p " + - "where od.product_id = p.product_id " + - "and od.order_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, orderId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("pid"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public List getAllProducts() throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select * from products"; - - statement = con.prepareStatement(sql); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public Product findByPrimaryKey(int productId) { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try - { - con = getConnection(); - - String sql = "select * from products where product_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, productId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - return product; - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return null; - } -} - diff --git a/eshop4/src/main/java/com/eshop/service/CustomerService.java b/eshop4/src/main/java/com/eshop/service/CustomerService.java deleted file mode 100644 index 6c0cbd5..0000000 --- a/eshop4/src/main/java/com/eshop/service/CustomerService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Customer; -import com.eshop.dao.CustomerDAO; - -@Service -public class CustomerService { - - @Autowired - private CustomerDAO dao; - - public List getCustomers() { - return dao.getAllCustomers(); - } -} diff --git a/eshop4/src/main/java/com/eshop/service/OrdersService.java b/eshop4/src/main/java/com/eshop/service/OrdersService.java deleted file mode 100644 index 2d159f6..0000000 --- a/eshop4/src/main/java/com/eshop/service/OrdersService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eshop.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; - -@Service -public class OrdersService { - - @Autowired - private OrdersDAO dao; - - public void placeOrder(int customerId, Order order) { - dao.createOrder(customerId, order); - } - - public List getOrders(int customerId) { - return dao.getOrdersForCustomer(customerId); - } - - public List getOrdersForTheMonth(int customerId) { - List orders = dao.getOrdersForCustomer(customerId); - - List ordersForTheMonth = new ArrayList(); - int currentMonth = new Date().getMonth(); - - for (Order order : orders) { - if (order.getOrderDate().getMonth() == currentMonth) { - ordersForTheMonth.add(order); - } - } - - return ordersForTheMonth; - } -} diff --git a/eshop4/src/main/java/com/eshop/service/ProductsService.java b/eshop4/src/main/java/com/eshop/service/ProductsService.java deleted file mode 100644 index 74066ab..0000000 --- a/eshop4/src/main/java/com/eshop/service/ProductsService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; - -@Service -public class ProductsService { - - @Autowired - private ProductsDAO dao; - - public Product getById(int productId) { - return dao.findByPrimaryKey(productId); - } - - public List getAllProducts() { - return dao.getAllProducts(); - } -} diff --git a/eshop4/src/main/java/com/eshop/web/CheckoutServlet.java b/eshop4/src/main/java/com/eshop/web/CheckoutServlet.java deleted file mode 100644 index ae42c6f..0000000 --- a/eshop4/src/main/java/com/eshop/web/CheckoutServlet.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; -import com.eshop.dao.OrdersDAOJDBCImpl; -import com.eshop.dao.Product; -import com.eshop.service.OrdersService; - -/** - * Servlet implementation class CheckoutServlet - */ -public class CheckoutServlet extends HttpServlet { - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - HttpSession session = request.getSession(); - List products = (List) session.getAttribute("ShoppingCart"); - - double orderAmount = calculateOrderAmount(products); - - String orderNumber = UUID.randomUUID().toString(); - - Order order = new Order(0, orderNumber, new Date(), orderAmount, products); - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - OrdersService service = context.getBean(OrdersService.class); - - service.placeOrder(1, order); - - session.removeAttribute("ShoppingCart"); - - request.setAttribute("Order", order); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/OrderConfirmation.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - - private double calculateOrderAmount(List products) { - double orderAmount = 0; - - for(Product product : products) { - orderAmount = orderAmount + product.getPrice(); - } - - return orderAmount; - } - -} diff --git a/eshop4/src/main/java/com/eshop/web/HomePageServlet.java b/eshop4/src/main/java/com/eshop/web/HomePageServlet.java deleted file mode 100644 index 909168c..0000000 --- a/eshop4/src/main/java/com/eshop/web/HomePageServlet.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - -/** - * Servlet implementation class HomePageServlet - */ -public class HomePageServlet extends HttpServlet { - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - ProductsService service = context.getBean(ProductsService.class); - - List products = service.getAllProducts(); - - request.setAttribute("AllProducts", products); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/Home.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/eshop4/src/main/java/com/eshop/web/ShoppingCartServlet.java b/eshop4/src/main/java/com/eshop/web/ShoppingCartServlet.java deleted file mode 100644 index dc46a2f..0000000 --- a/eshop4/src/main/java/com/eshop/web/ShoppingCartServlet.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.eshop.web; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - -/** - * Servlet implementation class ShoppingCartServlet - */ -public class ShoppingCartServlet extends HttpServlet { - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String productIdStr = request.getParameter("productId"); - int productId = Integer.parseInt(productIdStr); - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - ProductsService service = context.getBean(ProductsService.class); - - Product product = service.getById(productId); - - HttpSession session = request.getSession(); - - //any tab exists with this name - if(session.getAttribute("ShoppingCart") == null) { - - //creating a tab - List products = new ArrayList(); - - //Adding this product to the tab - products.add(product); - - //Adding this tab to the session - session.setAttribute("ShoppingCart", products); - } else { - List products = (List) session.getAttribute("ShoppingCart"); - products.add(product); - } - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/jsp/ShoppingCart.jsp"); - rd.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/eshop4/src/main/resources/spring-config.xml b/eshop4/src/main/resources/spring-config.xml deleted file mode 100644 index 194c280..0000000 --- a/eshop4/src/main/resources/spring-config.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/eshop4/src/main/webapp/WEB-INF/jsp/Home.jsp b/eshop4/src/main/webapp/WEB-INF/jsp/Home.jsp deleted file mode 100644 index ac5f8c1..0000000 --- a/eshop4/src/main/webapp/WEB-INF/jsp/Home.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - -

    Welcome to eShop

    - - - - - - - - - - - - - - - - - - - -
    IdNameTypePrice
    ${product.id}${product.name}${product.type}${product.price}Add to Cart
    - - - - \ No newline at end of file diff --git a/eshop4/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp b/eshop4/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp deleted file mode 100644 index f614fb2..0000000 --- a/eshop4/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

    Your order has been placed, and your order number is - ${Order.orderNumber}.

    -

    If you have any questions regarding this order, - please reference this order number.

    - -
    Click here to go to home page.
    - - - \ No newline at end of file diff --git a/eshop4/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp b/eshop4/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp deleted file mode 100644 index 5908bed..0000000 --- a/eshop4/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - -

    You have added the following items to the cart.

    - - - - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}Add to - Cart
    - -

    Do you want to shop more?Please click here

    -

    If you are done shopping, please click here

    - - - \ No newline at end of file diff --git a/eshop4/src/main/webapp/WEB-INF/web.xml b/eshop4/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 8ff9f5e..0000000 --- a/eshop4/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - eshop - - - HomePageServlet - HomePageServlet - com.eshop.web.HomePageServlet - - - HomePageServlet - / - - - - ShoppingCartServlet - ShoppingCartServlet - com.eshop.web.ShoppingCartServlet - - - ShoppingCartServlet - /cart - - - - CheckoutServlet - CheckoutServlet - com.eshop.web.CheckoutServlet - - - CheckoutServlet - /checkout - - \ No newline at end of file diff --git a/eshop5_2015/.classpath b/eshop5_2015/.classpath deleted file mode 100644 index b80b726..0000000 --- a/eshop5_2015/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eshop5_2015/.project b/eshop5_2015/.project deleted file mode 100644 index d42fd29..0000000 --- a/eshop5_2015/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - eshop5_2015 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/eshop5_2015/.settings/.jsdtscope b/eshop5_2015/.settings/.jsdtscope deleted file mode 100644 index 585c967..0000000 --- a/eshop5_2015/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eshop5_2015/.settings/org.eclipse.jdt.core.prefs b/eshop5_2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62a317c..0000000 --- a/eshop5_2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eshop5_2015/.settings/org.eclipse.m2e.core.prefs b/eshop5_2015/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/eshop5_2015/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/eshop5_2015/.settings/org.eclipse.wst.common.component b/eshop5_2015/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 7395405..0000000 --- a/eshop5_2015/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/eshop5_2015/.settings/org.eclipse.wst.common.project.facet.core.xml b/eshop5_2015/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index dac75cc..0000000 --- a/eshop5_2015/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eshop5_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container b/eshop5_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/eshop5_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/eshop5_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name b/eshop5_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/eshop5_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/eshop5_2015/.settings/org.eclipse.wst.validation.prefs b/eshop5_2015/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 6f1cba6..0000000 --- a/eshop5_2015/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/eshop5_2015/pom.xml b/eshop5_2015/pom.xml deleted file mode 100644 index c8ff3e5..0000000 --- a/eshop5_2015/pom.xml +++ /dev/null @@ -1,96 +0,0 @@ - - 4.0.0 - com.training - esho6 - war - 1.0 - eshop2 Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - org.springframework - spring-web - 3.2.13.RELEASE - - - - org.springframework - spring-webmvc - 3.2.13.RELEASE - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - esho6 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/eshop5_2015/src/main/java/com/eshop/dao/BaseDAO.java b/eshop5_2015/src/main/java/com/eshop/dao/BaseDAO.java deleted file mode 100644 index f30749c..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/BaseDAO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException { - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection( - "jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - // Nothing to be done, ignore it. - } - } - - protected int getNextSequenceValue(String sequenceName) throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - try { - con = getConnection(); - - statement = con.createStatement(); - String sql = "select " + sequenceName + ".nextval from dual"; - - rs = statement.executeQuery(sql); - - if (rs.next()) { - return rs.getInt("nextval"); - } - - throw new DAOException("Invalid SQL for sequence next val"); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - } - -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/Customer.java b/eshop5_2015/src/main/java/com/eshop/dao/Customer.java deleted file mode 100644 index 8e93724..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/Customer.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.eshop.dao; - -import java.util.ArrayList; -import java.util.List; - -public class Customer { - - private int id; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private List orders = new ArrayList(); - - public Customer() { - } - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } - - public void addOrder(Order order) { - this.orders.add(order); - } - - public List getOrders() { - return orders; - } - - public void setId(int id) { - this.id = id; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public void setAddress(String address) { - this.address = address; - } - - public void setCity(String city) { - this.city = city; - } - - public void setState(String state) { - this.state = state; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public void setOrders(List orders) { - this.orders = orders; - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/CustomerDAO.java b/eshop5_2015/src/main/java/com/eshop/dao/CustomerDAO.java deleted file mode 100644 index f743d87..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java b/eshop5_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 4cb7af4..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customers"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customers values (customers_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customers " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/DAOException.java b/eshop5_2015/src/main/java/com/eshop/dao/DAOException.java deleted file mode 100644 index 21423ce..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage, Throwable ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/Order.java b/eshop5_2015/src/main/java/com/eshop/dao/Order.java deleted file mode 100644 index 2e466e3..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/Order.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.eshop.dao; - -import java.util.Date; -import java.util.List; - -public class Order { - private int id; - private String orderNumber; - private Date orderDate; - private double orderAmount; - - private List products = null; - - public Order(int id, String orderNumber, Date orderDate, - double orderAmount, List products) { - super(); - this.id = id; - this.orderNumber = orderNumber; - this.orderDate = orderDate; - this.orderAmount = orderAmount; - this.products = products; - } - - public int getId() { - return id; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Date getOrderDate() { - return orderDate; - } - - public double getOrderAmount() { - return orderAmount; - } - - public List getProducts() { - return products; - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/OrdersDAO.java b/eshop5_2015/src/main/java/com/eshop/dao/OrdersDAO.java deleted file mode 100644 index e32ee11..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/OrdersDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface OrdersDAO { - - void createOrder(int customerId, Order order) throws DAOException; - List getOrdersForCustomer(int customerId) throws DAOException; -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java b/eshop5_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java deleted file mode 100644 index 267cca8..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public void createOrder(int customerId, Order order) throws DAOException { - - // step1 : insert into orders table - // step2 : insert into order_details table with the same order id that - // we got from the above step - - Connection con = null; - PreparedStatement statement = null; - - int orderId = 0; - - try { - con = getConnection(); - - String sql = "insert into orders values (?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - orderId = getNextSequenceValue("orders_seq"); - - statement.setInt(1, orderId); - statement.setInt(2, customerId); - statement.setString(3, order.getOrderNumber()); - statement.setDate(4, new Date(order.getOrderDate().getTime())); - statement.setDouble(5, order.getOrderAmount()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating an order", - ex); - } finally { - closeResources(null, statement, con); - } - - insertIntoOrderDetails(orderId, order); - } - - private void insertIntoOrderDetails(int orderId, Order order) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try { - con = getConnection(); - - String sql = "insert into order_details values (order_details_seq.nextval,?,?)"; - - List products = order.getProducts(); - - for (Product product : products) { - statement = con.prepareStatement(sql); - - statement.setInt(1, orderId); - statement.setInt(2, product.getId()); - - statement.executeUpdate(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while inserting the order", - ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public List getOrdersForCustomer(int customerId) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List orders = new ArrayList(); - ProductsDAO dao = new ProductsDAOJDBCImpl(); - - try { - con = getConnection(); - - String sql = "select * from orders where customer_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, customerId); - - rs = statement.executeQuery(sql); - - while (rs.next()) { - int id = rs.getInt("order_id"); - String order_Num = rs.getString("order_number"); - Date order_Date = rs.getDate("order_date"); - double order_amount = rs.getDouble("order_amount"); - List products; - - products = dao.getByOrderId(id); - - Order order = new Order(id, order_Num, order_Date, - order_amount, products); - orders.add(order); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - return orders; - } - -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/Product.java b/eshop5_2015/src/main/java/com/eshop/dao/Product.java deleted file mode 100644 index 866b450..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/Product.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.eshop.dao; - -public class Product { - private int id; - private String type; - private String name; - private double price; - - public Product(int id, String type, String name, double price) { - super(); - this.id = id; - this.type = type; - this.name = name; - this.price = price; - } - - public int getId() { - return id; - } - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - public double getPrice() { - return price; - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/ProductsDAO.java b/eshop5_2015/src/main/java/com/eshop/dao/ProductsDAO.java deleted file mode 100644 index fbffb10..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/ProductsDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface ProductsDAO { - - List getByOrderId(int orderId) throws DAOException; - - List getAllProducts() throws DAOException; - - Product findByPrimaryKey(int productId); -} diff --git a/eshop5_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java b/eshop5_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java deleted file mode 100644 index bdaa84b..0000000 --- a/eshop5_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class ProductsDAOJDBCImpl extends BaseDAO implements ProductsDAO { - - @Override - public List getByOrderId(int orderId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select p.product_id pid, p.product_type, p.product_name, p.price " + - "from order_details od, products p " + - "where od.product_id = p.product_id " + - "and od.order_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, orderId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("pid"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public List getAllProducts() throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select * from products"; - - statement = con.prepareStatement(sql); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public Product findByPrimaryKey(int productId) { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try - { - con = getConnection(); - - String sql = "select * from products where product_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, productId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - return product; - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return null; - } -} - diff --git a/eshop5_2015/src/main/java/com/eshop/service/CustomerService.java b/eshop5_2015/src/main/java/com/eshop/service/CustomerService.java deleted file mode 100644 index ab175d6..0000000 --- a/eshop5_2015/src/main/java/com/eshop/service/CustomerService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Customer; -import com.eshop.dao.CustomerDAO; - -@Service -public class CustomerService { - - @Autowired - private CustomerDAO dao; - - public List getCustomers() { - return dao.getAllCustomers(); - } - - public void add(Customer customer) { - dao.createCustomer(customer); - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/service/OrdersService.java b/eshop5_2015/src/main/java/com/eshop/service/OrdersService.java deleted file mode 100644 index 2d159f6..0000000 --- a/eshop5_2015/src/main/java/com/eshop/service/OrdersService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eshop.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; - -@Service -public class OrdersService { - - @Autowired - private OrdersDAO dao; - - public void placeOrder(int customerId, Order order) { - dao.createOrder(customerId, order); - } - - public List getOrders(int customerId) { - return dao.getOrdersForCustomer(customerId); - } - - public List getOrdersForTheMonth(int customerId) { - List orders = dao.getOrdersForCustomer(customerId); - - List ordersForTheMonth = new ArrayList(); - int currentMonth = new Date().getMonth(); - - for (Order order : orders) { - if (order.getOrderDate().getMonth() == currentMonth) { - ordersForTheMonth.add(order); - } - } - - return ordersForTheMonth; - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/service/ProductsService.java b/eshop5_2015/src/main/java/com/eshop/service/ProductsService.java deleted file mode 100644 index 74066ab..0000000 --- a/eshop5_2015/src/main/java/com/eshop/service/ProductsService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; - -@Service -public class ProductsService { - - @Autowired - private ProductsDAO dao; - - public Product getById(int productId) { - return dao.findByPrimaryKey(productId); - } - - public List getAllProducts() { - return dao.getAllProducts(); - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/web/CheckoutController.java b/eshop5_2015/src/main/java/com/eshop/web/CheckoutController.java deleted file mode 100644 index fe8e4f2..0000000 --- a/eshop5_2015/src/main/java/com/eshop/web/CheckoutController.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.eshop.web; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Order; -import com.eshop.dao.Product; -import com.eshop.service.OrdersService; - -@Controller -public class CheckoutController { - - @Autowired - private OrdersService service; - - @RequestMapping("/checkout") - public ModelAndView checkout(HttpSession session) { - List products = (List) session - .getAttribute("ShoppingCart"); - - double orderAmount = calculateOrderAmount(products); - - String orderNumber = UUID.randomUUID().toString(); - - Order order = new Order(0, orderNumber, new Date(), orderAmount, - products); - - service.placeOrder(1, order); - - session.removeAttribute("ShoppingCart"); - - return new ModelAndView("OrderConfirmation", "Order", order); - } - - private double calculateOrderAmount(List products) { - double orderAmount = 0; - - for (Product product : products) { - orderAmount = orderAmount + product.getPrice(); - } - - return orderAmount; - } - -} diff --git a/eshop5_2015/src/main/java/com/eshop/web/HomeController.java b/eshop5_2015/src/main/java/com/eshop/web/HomeController.java deleted file mode 100644 index 4fea1b4..0000000 --- a/eshop5_2015/src/main/java/com/eshop/web/HomeController.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.eshop.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - -@Controller -public class HomeController { - - @Autowired - private ProductsService service; - - @RequestMapping("/") - public ModelAndView homePage() { - List products = service.getAllProducts(); - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Home"); - modelAndView.addObject("AllProducts", products); - - return modelAndView; - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/web/LoginController.java b/eshop5_2015/src/main/java/com/eshop/web/LoginController.java deleted file mode 100644 index 7f2f13e..0000000 --- a/eshop5_2015/src/main/java/com/eshop/web/LoginController.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.eshop.web; - -import org.apache.catalina.connector.Request; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class LoginController { - - @RequestMapping("/login") - public String emptyForm() { - return "Login"; - } - - @RequestMapping(value = "/login", method = RequestMethod.POST) - public String validate(@RequestParam String username, - @RequestParam String password) { - - if ("test".equals(username) && "test".equals(password)) { - return "OrderSummary"; - } else { - return "Login"; - } - } - -} diff --git a/eshop5_2015/src/main/java/com/eshop/web/ShoppingCartController.java b/eshop5_2015/src/main/java/com/eshop/web/ShoppingCartController.java deleted file mode 100644 index 75bd2f8..0000000 --- a/eshop5_2015/src/main/java/com/eshop/web/ShoppingCartController.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.eshop.web; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - - -@Controller -public class ShoppingCartController { - - @Autowired - private ProductsService service; - - @RequestMapping("/cart") - public String addProductToCart(@RequestParam("productId") int productId, HttpSession session) { - Product product = service.getById(productId); - - //any tab exists with this name - if(session.getAttribute("ShoppingCart") == null) { - - //creating a tab - List products = new ArrayList(); - - //Adding this product to the tab - products.add(product); - - //Adding this tab to the session - session.setAttribute("ShoppingCart", products); - } else { - List products = (List) session.getAttribute("ShoppingCart"); - products.add(product); - } - - return "ShoppingCart"; - } -} diff --git a/eshop5_2015/src/main/java/com/eshop/web/SignUpController.java b/eshop5_2015/src/main/java/com/eshop/web/SignUpController.java deleted file mode 100644 index 0911519..0000000 --- a/eshop5_2015/src/main/java/com/eshop/web/SignUpController.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.eshop.web; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Customer; -import com.eshop.service.CustomerService; - -@Controller -public class SignUpController { - - @Autowired - private CustomerService service; - - @RequestMapping("/signup") - public ModelAndView emptyForm() { - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("SignUp"); - modelAndView.addObject("customer", new Customer()); - - return modelAndView; - } - - @RequestMapping(value = "/signup", method=RequestMethod.POST) - public String signup(Customer customer) { - service.add(customer); - return "Login"; - } -} diff --git a/eshop5_2015/src/main/resources/spring-config.xml b/eshop5_2015/src/main/resources/spring-config.xml deleted file mode 100644 index 194c280..0000000 --- a/eshop5_2015/src/main/resources/spring-config.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/eshop5_2015/src/main/webapp/WEB-INF/eshop-servlet.xml b/eshop5_2015/src/main/webapp/WEB-INF/eshop-servlet.xml deleted file mode 100644 index e41aa8f..0000000 --- a/eshop5_2015/src/main/webapp/WEB-INF/eshop-servlet.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - diff --git a/eshop5_2015/src/main/webapp/WEB-INF/jsp/Home.jsp b/eshop5_2015/src/main/webapp/WEB-INF/jsp/Home.jsp deleted file mode 100644 index 5ea9db8..0000000 --- a/eshop5_2015/src/main/webapp/WEB-INF/jsp/Home.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - -

    Welcome to eShop

    - - - - - - - - - - - - - - - - - - - -
    IdNameTypePrice
    ${product.id}${product.name}${product.type}${product.price}Add to Cart
    - - - - \ No newline at end of file diff --git a/eshop5_2015/src/main/webapp/WEB-INF/jsp/Login.jsp b/eshop5_2015/src/main/webapp/WEB-INF/jsp/Login.jsp deleted file mode 100644 index 6dd0f18..0000000 --- a/eshop5_2015/src/main/webapp/WEB-INF/jsp/Login.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

    If you are returning customer, please login.

    - -
    - - Username :

    - Password :

    - - -
    - - -

    If you are 1st timer, please click here

    - - - \ No newline at end of file diff --git a/eshop5_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp b/eshop5_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp deleted file mode 100644 index ba98a8a..0000000 --- a/eshop5_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

    Your order has been placed, and your order number is - ${Order.orderNumber}.

    -

    If you have any questions regarding this order, - please reference this order number.

    - -
    Click here to go to home page.
    - - - \ No newline at end of file diff --git a/eshop5_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp b/eshop5_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp deleted file mode 100644 index 27135df..0000000 --- a/eshop5_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - -

    Here is your order summary, please confirm.

    - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}
    - - Confirm - - - \ No newline at end of file diff --git a/eshop5_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp b/eshop5_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp deleted file mode 100644 index dc975b7..0000000 --- a/eshop5_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - -

    You have added the following items to the cart.

    - - - - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}Add to - Cart
    - -

    Do you want to shop more?Please click here

    -

    If you are done shopping, please click here

    - - - \ No newline at end of file diff --git a/eshop5_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp b/eshop5_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp deleted file mode 100644 index 660f3f6..0000000 --- a/eshop5_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%> - - - - -Insert title here - - - - - First name :
    - Last name :
    - Address :
    - City :
    - State :
    - Zip :
    - - -
    - - - - \ No newline at end of file diff --git a/eshop5_2015/src/main/webapp/WEB-INF/web.xml b/eshop5_2015/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 4214d48..0000000 --- a/eshop5_2015/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - eshop - - eshop - org.springframework.web.servlet.DispatcherServlet - - - eshop - / - - \ No newline at end of file diff --git a/eshop6_2015/.classpath b/eshop6_2015/.classpath deleted file mode 100644 index b80b726..0000000 --- a/eshop6_2015/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eshop6_2015/.project b/eshop6_2015/.project deleted file mode 100644 index d42fd29..0000000 --- a/eshop6_2015/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - eshop5_2015 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/eshop6_2015/.settings/.jsdtscope b/eshop6_2015/.settings/.jsdtscope deleted file mode 100644 index 585c967..0000000 --- a/eshop6_2015/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eshop6_2015/.settings/org.eclipse.jdt.core.prefs b/eshop6_2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62a317c..0000000 --- a/eshop6_2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eshop6_2015/.settings/org.eclipse.m2e.core.prefs b/eshop6_2015/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/eshop6_2015/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/eshop6_2015/.settings/org.eclipse.wst.common.component b/eshop6_2015/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 89f878c..0000000 --- a/eshop6_2015/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/eshop6_2015/.settings/org.eclipse.wst.common.project.facet.core.xml b/eshop6_2015/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index dac75cc..0000000 --- a/eshop6_2015/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eshop6_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container b/eshop6_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/eshop6_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/eshop6_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name b/eshop6_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/eshop6_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/eshop6_2015/.settings/org.eclipse.wst.validation.prefs b/eshop6_2015/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 6f1cba6..0000000 --- a/eshop6_2015/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/eshop6_2015/pom.xml b/eshop6_2015/pom.xml deleted file mode 100644 index 7b203ec..0000000 --- a/eshop6_2015/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - 4.0.0 - com.training - esho6 - war - 1.0 - eshop2 Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - org.springframework - spring-web - 3.2.13.RELEASE - - - - org.springframework - spring-webmvc - 3.2.13.RELEASE - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.3.1.Final - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - esho6 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/eshop6_2015/src/main/java/com/eshop/dao/BaseDAO.java b/eshop6_2015/src/main/java/com/eshop/dao/BaseDAO.java deleted file mode 100644 index f30749c..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/BaseDAO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException { - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection( - "jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - // Nothing to be done, ignore it. - } - } - - protected int getNextSequenceValue(String sequenceName) throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - try { - con = getConnection(); - - statement = con.createStatement(); - String sql = "select " + sequenceName + ".nextval from dual"; - - rs = statement.executeQuery(sql); - - if (rs.next()) { - return rs.getInt("nextval"); - } - - throw new DAOException("Invalid SQL for sequence next val"); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - } - -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/Customer.java b/eshop6_2015/src/main/java/com/eshop/dao/Customer.java deleted file mode 100644 index 498cec2..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/Customer.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.eshop.dao; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.NotBlank; -import org.hibernate.validator.constraints.NotEmpty; - -public class Customer { - - private int id; - - @Size(min=3, max=30, message="First name must be 3 charcters min and max of 30") - @NotBlank - @Pattern(regexp="[a-z-A-Z]*") - private String firstName; - - @NotEmpty(message="Last name cannot be empty") - private String lastName; - private String address; - private String city; - private String state; - - @NotEmpty(message="Zip code cannot be blank") - @Pattern(regexp="[0-9]*", message="Zip can only take numbers") - private String zipCode; - private List orders = new ArrayList(); - - public Customer() { - } - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } - - public void addOrder(Order order) { - this.orders.add(order); - } - - public List getOrders() { - return orders; - } - - public void setId(int id) { - this.id = id; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public void setAddress(String address) { - this.address = address; - } - - public void setCity(String city) { - this.city = city; - } - - public void setState(String state) { - this.state = state; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public void setOrders(List orders) { - this.orders = orders; - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/CustomerDAO.java b/eshop6_2015/src/main/java/com/eshop/dao/CustomerDAO.java deleted file mode 100644 index f743d87..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java b/eshop6_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 4cb7af4..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customers"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customers values (customers_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customers " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/DAOException.java b/eshop6_2015/src/main/java/com/eshop/dao/DAOException.java deleted file mode 100644 index 21423ce..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage, Throwable ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/Order.java b/eshop6_2015/src/main/java/com/eshop/dao/Order.java deleted file mode 100644 index 2e466e3..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/Order.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.eshop.dao; - -import java.util.Date; -import java.util.List; - -public class Order { - private int id; - private String orderNumber; - private Date orderDate; - private double orderAmount; - - private List products = null; - - public Order(int id, String orderNumber, Date orderDate, - double orderAmount, List products) { - super(); - this.id = id; - this.orderNumber = orderNumber; - this.orderDate = orderDate; - this.orderAmount = orderAmount; - this.products = products; - } - - public int getId() { - return id; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Date getOrderDate() { - return orderDate; - } - - public double getOrderAmount() { - return orderAmount; - } - - public List getProducts() { - return products; - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/OrdersDAO.java b/eshop6_2015/src/main/java/com/eshop/dao/OrdersDAO.java deleted file mode 100644 index e32ee11..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/OrdersDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface OrdersDAO { - - void createOrder(int customerId, Order order) throws DAOException; - List getOrdersForCustomer(int customerId) throws DAOException; -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java b/eshop6_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java deleted file mode 100644 index 267cca8..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public void createOrder(int customerId, Order order) throws DAOException { - - // step1 : insert into orders table - // step2 : insert into order_details table with the same order id that - // we got from the above step - - Connection con = null; - PreparedStatement statement = null; - - int orderId = 0; - - try { - con = getConnection(); - - String sql = "insert into orders values (?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - orderId = getNextSequenceValue("orders_seq"); - - statement.setInt(1, orderId); - statement.setInt(2, customerId); - statement.setString(3, order.getOrderNumber()); - statement.setDate(4, new Date(order.getOrderDate().getTime())); - statement.setDouble(5, order.getOrderAmount()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating an order", - ex); - } finally { - closeResources(null, statement, con); - } - - insertIntoOrderDetails(orderId, order); - } - - private void insertIntoOrderDetails(int orderId, Order order) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try { - con = getConnection(); - - String sql = "insert into order_details values (order_details_seq.nextval,?,?)"; - - List products = order.getProducts(); - - for (Product product : products) { - statement = con.prepareStatement(sql); - - statement.setInt(1, orderId); - statement.setInt(2, product.getId()); - - statement.executeUpdate(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while inserting the order", - ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public List getOrdersForCustomer(int customerId) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List orders = new ArrayList(); - ProductsDAO dao = new ProductsDAOJDBCImpl(); - - try { - con = getConnection(); - - String sql = "select * from orders where customer_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, customerId); - - rs = statement.executeQuery(sql); - - while (rs.next()) { - int id = rs.getInt("order_id"); - String order_Num = rs.getString("order_number"); - Date order_Date = rs.getDate("order_date"); - double order_amount = rs.getDouble("order_amount"); - List products; - - products = dao.getByOrderId(id); - - Order order = new Order(id, order_Num, order_Date, - order_amount, products); - orders.add(order); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - return orders; - } - -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/Product.java b/eshop6_2015/src/main/java/com/eshop/dao/Product.java deleted file mode 100644 index 866b450..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/Product.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.eshop.dao; - -public class Product { - private int id; - private String type; - private String name; - private double price; - - public Product(int id, String type, String name, double price) { - super(); - this.id = id; - this.type = type; - this.name = name; - this.price = price; - } - - public int getId() { - return id; - } - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - public double getPrice() { - return price; - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/ProductsDAO.java b/eshop6_2015/src/main/java/com/eshop/dao/ProductsDAO.java deleted file mode 100644 index fbffb10..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/ProductsDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface ProductsDAO { - - List getByOrderId(int orderId) throws DAOException; - - List getAllProducts() throws DAOException; - - Product findByPrimaryKey(int productId); -} diff --git a/eshop6_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java b/eshop6_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java deleted file mode 100644 index bdaa84b..0000000 --- a/eshop6_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class ProductsDAOJDBCImpl extends BaseDAO implements ProductsDAO { - - @Override - public List getByOrderId(int orderId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select p.product_id pid, p.product_type, p.product_name, p.price " + - "from order_details od, products p " + - "where od.product_id = p.product_id " + - "and od.order_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, orderId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("pid"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public List getAllProducts() throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select * from products"; - - statement = con.prepareStatement(sql); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public Product findByPrimaryKey(int productId) { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try - { - con = getConnection(); - - String sql = "select * from products where product_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, productId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - return product; - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return null; - } -} - diff --git a/eshop6_2015/src/main/java/com/eshop/service/CustomerService.java b/eshop6_2015/src/main/java/com/eshop/service/CustomerService.java deleted file mode 100644 index ab175d6..0000000 --- a/eshop6_2015/src/main/java/com/eshop/service/CustomerService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Customer; -import com.eshop.dao.CustomerDAO; - -@Service -public class CustomerService { - - @Autowired - private CustomerDAO dao; - - public List getCustomers() { - return dao.getAllCustomers(); - } - - public void add(Customer customer) { - dao.createCustomer(customer); - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/service/OrdersService.java b/eshop6_2015/src/main/java/com/eshop/service/OrdersService.java deleted file mode 100644 index 2d159f6..0000000 --- a/eshop6_2015/src/main/java/com/eshop/service/OrdersService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eshop.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; - -@Service -public class OrdersService { - - @Autowired - private OrdersDAO dao; - - public void placeOrder(int customerId, Order order) { - dao.createOrder(customerId, order); - } - - public List getOrders(int customerId) { - return dao.getOrdersForCustomer(customerId); - } - - public List getOrdersForTheMonth(int customerId) { - List orders = dao.getOrdersForCustomer(customerId); - - List ordersForTheMonth = new ArrayList(); - int currentMonth = new Date().getMonth(); - - for (Order order : orders) { - if (order.getOrderDate().getMonth() == currentMonth) { - ordersForTheMonth.add(order); - } - } - - return ordersForTheMonth; - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/service/ProductsService.java b/eshop6_2015/src/main/java/com/eshop/service/ProductsService.java deleted file mode 100644 index 74066ab..0000000 --- a/eshop6_2015/src/main/java/com/eshop/service/ProductsService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; - -@Service -public class ProductsService { - - @Autowired - private ProductsDAO dao; - - public Product getById(int productId) { - return dao.findByPrimaryKey(productId); - } - - public List getAllProducts() { - return dao.getAllProducts(); - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/web/CheckoutController.java b/eshop6_2015/src/main/java/com/eshop/web/CheckoutController.java deleted file mode 100644 index fe8e4f2..0000000 --- a/eshop6_2015/src/main/java/com/eshop/web/CheckoutController.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.eshop.web; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Order; -import com.eshop.dao.Product; -import com.eshop.service.OrdersService; - -@Controller -public class CheckoutController { - - @Autowired - private OrdersService service; - - @RequestMapping("/checkout") - public ModelAndView checkout(HttpSession session) { - List products = (List) session - .getAttribute("ShoppingCart"); - - double orderAmount = calculateOrderAmount(products); - - String orderNumber = UUID.randomUUID().toString(); - - Order order = new Order(0, orderNumber, new Date(), orderAmount, - products); - - service.placeOrder(1, order); - - session.removeAttribute("ShoppingCart"); - - return new ModelAndView("OrderConfirmation", "Order", order); - } - - private double calculateOrderAmount(List products) { - double orderAmount = 0; - - for (Product product : products) { - orderAmount = orderAmount + product.getPrice(); - } - - return orderAmount; - } - -} diff --git a/eshop6_2015/src/main/java/com/eshop/web/HomeController.java b/eshop6_2015/src/main/java/com/eshop/web/HomeController.java deleted file mode 100644 index 4fea1b4..0000000 --- a/eshop6_2015/src/main/java/com/eshop/web/HomeController.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.eshop.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - -@Controller -public class HomeController { - - @Autowired - private ProductsService service; - - @RequestMapping("/") - public ModelAndView homePage() { - List products = service.getAllProducts(); - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Home"); - modelAndView.addObject("AllProducts", products); - - return modelAndView; - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/web/LoginController.java b/eshop6_2015/src/main/java/com/eshop/web/LoginController.java deleted file mode 100644 index 7f2f13e..0000000 --- a/eshop6_2015/src/main/java/com/eshop/web/LoginController.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.eshop.web; - -import org.apache.catalina.connector.Request; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class LoginController { - - @RequestMapping("/login") - public String emptyForm() { - return "Login"; - } - - @RequestMapping(value = "/login", method = RequestMethod.POST) - public String validate(@RequestParam String username, - @RequestParam String password) { - - if ("test".equals(username) && "test".equals(password)) { - return "OrderSummary"; - } else { - return "Login"; - } - } - -} diff --git a/eshop6_2015/src/main/java/com/eshop/web/ShoppingCartController.java b/eshop6_2015/src/main/java/com/eshop/web/ShoppingCartController.java deleted file mode 100644 index 75bd2f8..0000000 --- a/eshop6_2015/src/main/java/com/eshop/web/ShoppingCartController.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.eshop.web; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - - -@Controller -public class ShoppingCartController { - - @Autowired - private ProductsService service; - - @RequestMapping("/cart") - public String addProductToCart(@RequestParam("productId") int productId, HttpSession session) { - Product product = service.getById(productId); - - //any tab exists with this name - if(session.getAttribute("ShoppingCart") == null) { - - //creating a tab - List products = new ArrayList(); - - //Adding this product to the tab - products.add(product); - - //Adding this tab to the session - session.setAttribute("ShoppingCart", products); - } else { - List products = (List) session.getAttribute("ShoppingCart"); - products.add(product); - } - - return "ShoppingCart"; - } -} diff --git a/eshop6_2015/src/main/java/com/eshop/web/SignUpController.java b/eshop6_2015/src/main/java/com/eshop/web/SignUpController.java deleted file mode 100644 index bdb2fca..0000000 --- a/eshop6_2015/src/main/java/com/eshop/web/SignUpController.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eshop.web; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Customer; -import com.eshop.service.CustomerService; - -@Controller -public class SignUpController { - - @Autowired - private CustomerService service; - - @RequestMapping("/signup") - public ModelAndView emptyForm() { - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("SignUp"); - modelAndView.addObject("customer", new Customer()); - - return modelAndView; - } - - @RequestMapping(value = "/signup", method=RequestMethod.POST) - public String signup(@Valid Customer customer, BindingResult bindingResult) { - - if(bindingResult.hasErrors()) { - return "SignUp"; - } else { - service.add(customer); - return "Login"; - } - } -} diff --git a/eshop6_2015/src/main/resources/spring-config.xml b/eshop6_2015/src/main/resources/spring-config.xml deleted file mode 100644 index 194c280..0000000 --- a/eshop6_2015/src/main/resources/spring-config.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/eshop6_2015/src/main/webapp/WEB-INF/eshop-servlet.xml b/eshop6_2015/src/main/webapp/WEB-INF/eshop-servlet.xml deleted file mode 100644 index ec523c5..0000000 --- a/eshop6_2015/src/main/webapp/WEB-INF/eshop-servlet.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - diff --git a/eshop6_2015/src/main/webapp/WEB-INF/jsp/Home.jsp b/eshop6_2015/src/main/webapp/WEB-INF/jsp/Home.jsp deleted file mode 100644 index 5ea9db8..0000000 --- a/eshop6_2015/src/main/webapp/WEB-INF/jsp/Home.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - -

    Welcome to eShop

    - - - - - - - - - - - - - - - - - - - -
    IdNameTypePrice
    ${product.id}${product.name}${product.type}${product.price}Add to Cart
    - - - - \ No newline at end of file diff --git a/eshop6_2015/src/main/webapp/WEB-INF/jsp/Login.jsp b/eshop6_2015/src/main/webapp/WEB-INF/jsp/Login.jsp deleted file mode 100644 index 6dd0f18..0000000 --- a/eshop6_2015/src/main/webapp/WEB-INF/jsp/Login.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

    If you are returning customer, please login.

    - -
    - - Username :

    - Password :

    - - -
    - - -

    If you are 1st timer, please click here

    - - - \ No newline at end of file diff --git a/eshop6_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp b/eshop6_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp deleted file mode 100644 index ba98a8a..0000000 --- a/eshop6_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

    Your order has been placed, and your order number is - ${Order.orderNumber}.

    -

    If you have any questions regarding this order, - please reference this order number.

    - -
    Click here to go to home page.
    - - - \ No newline at end of file diff --git a/eshop6_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp b/eshop6_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp deleted file mode 100644 index 27135df..0000000 --- a/eshop6_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - -

    Here is your order summary, please confirm.

    - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}
    - - Confirm - - - \ No newline at end of file diff --git a/eshop6_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp b/eshop6_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp deleted file mode 100644 index dc975b7..0000000 --- a/eshop6_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - -

    You have added the following items to the cart.

    - - - - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}Add to - Cart
    - -

    Do you want to shop more?Please click here

    -

    If you are done shopping, please click here

    - - - \ No newline at end of file diff --git a/eshop6_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp b/eshop6_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp deleted file mode 100644 index 5763386..0000000 --- a/eshop6_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp +++ /dev/null @@ -1,40 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%> - - - - -Insert title here - - - - - - - - - -

    - - First name :
    - Last name :
    - Address :
    - City :
    - State :
    - Zip :
    - - -
    - - - - \ No newline at end of file diff --git a/eshop6_2015/src/main/webapp/WEB-INF/web.xml b/eshop6_2015/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 4214d48..0000000 --- a/eshop6_2015/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - eshop - - eshop - org.springframework.web.servlet.DispatcherServlet - - - eshop - / - - \ No newline at end of file diff --git a/eshop7_2015/.classpath b/eshop7_2015/.classpath deleted file mode 100644 index b80b726..0000000 --- a/eshop7_2015/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eshop7_2015/.project b/eshop7_2015/.project deleted file mode 100644 index d42fd29..0000000 --- a/eshop7_2015/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - eshop5_2015 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/eshop7_2015/.settings/.jsdtscope b/eshop7_2015/.settings/.jsdtscope deleted file mode 100644 index 585c967..0000000 --- a/eshop7_2015/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eshop7_2015/.settings/org.eclipse.jdt.core.prefs b/eshop7_2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62a317c..0000000 --- a/eshop7_2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eshop7_2015/.settings/org.eclipse.m2e.core.prefs b/eshop7_2015/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/eshop7_2015/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/eshop7_2015/.settings/org.eclipse.wst.common.component b/eshop7_2015/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 89f878c..0000000 --- a/eshop7_2015/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/eshop7_2015/.settings/org.eclipse.wst.common.project.facet.core.xml b/eshop7_2015/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index dac75cc..0000000 --- a/eshop7_2015/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eshop7_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container b/eshop7_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/eshop7_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/eshop7_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name b/eshop7_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/eshop7_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/eshop7_2015/.settings/org.eclipse.wst.validation.prefs b/eshop7_2015/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 6f1cba6..0000000 --- a/eshop7_2015/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/eshop7_2015/pom.xml b/eshop7_2015/pom.xml deleted file mode 100644 index 7b203ec..0000000 --- a/eshop7_2015/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - 4.0.0 - com.training - esho6 - war - 1.0 - eshop2 Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - org.springframework - spring-web - 3.2.13.RELEASE - - - - org.springframework - spring-webmvc - 3.2.13.RELEASE - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.3.1.Final - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - esho6 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/eshop7_2015/src/main/java/com/eshop/dao/BaseDAO.java b/eshop7_2015/src/main/java/com/eshop/dao/BaseDAO.java deleted file mode 100644 index f30749c..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/BaseDAO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException { - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection( - "jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - // Nothing to be done, ignore it. - } - } - - protected int getNextSequenceValue(String sequenceName) throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - try { - con = getConnection(); - - statement = con.createStatement(); - String sql = "select " + sequenceName + ".nextval from dual"; - - rs = statement.executeQuery(sql); - - if (rs.next()) { - return rs.getInt("nextval"); - } - - throw new DAOException("Invalid SQL for sequence next val"); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - } - -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/Customer.java b/eshop7_2015/src/main/java/com/eshop/dao/Customer.java deleted file mode 100644 index 498cec2..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/Customer.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.eshop.dao; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.NotBlank; -import org.hibernate.validator.constraints.NotEmpty; - -public class Customer { - - private int id; - - @Size(min=3, max=30, message="First name must be 3 charcters min and max of 30") - @NotBlank - @Pattern(regexp="[a-z-A-Z]*") - private String firstName; - - @NotEmpty(message="Last name cannot be empty") - private String lastName; - private String address; - private String city; - private String state; - - @NotEmpty(message="Zip code cannot be blank") - @Pattern(regexp="[0-9]*", message="Zip can only take numbers") - private String zipCode; - private List orders = new ArrayList(); - - public Customer() { - } - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } - - public void addOrder(Order order) { - this.orders.add(order); - } - - public List getOrders() { - return orders; - } - - public void setId(int id) { - this.id = id; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public void setAddress(String address) { - this.address = address; - } - - public void setCity(String city) { - this.city = city; - } - - public void setState(String state) { - this.state = state; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public void setOrders(List orders) { - this.orders = orders; - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/CustomerDAO.java b/eshop7_2015/src/main/java/com/eshop/dao/CustomerDAO.java deleted file mode 100644 index f743d87..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java b/eshop7_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 4cb7af4..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customers"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customers values (customers_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customers " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/DAOException.java b/eshop7_2015/src/main/java/com/eshop/dao/DAOException.java deleted file mode 100644 index 21423ce..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage, Throwable ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/Order.java b/eshop7_2015/src/main/java/com/eshop/dao/Order.java deleted file mode 100644 index 2e466e3..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/Order.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.eshop.dao; - -import java.util.Date; -import java.util.List; - -public class Order { - private int id; - private String orderNumber; - private Date orderDate; - private double orderAmount; - - private List products = null; - - public Order(int id, String orderNumber, Date orderDate, - double orderAmount, List products) { - super(); - this.id = id; - this.orderNumber = orderNumber; - this.orderDate = orderDate; - this.orderAmount = orderAmount; - this.products = products; - } - - public int getId() { - return id; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Date getOrderDate() { - return orderDate; - } - - public double getOrderAmount() { - return orderAmount; - } - - public List getProducts() { - return products; - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/OrdersDAO.java b/eshop7_2015/src/main/java/com/eshop/dao/OrdersDAO.java deleted file mode 100644 index e32ee11..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/OrdersDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface OrdersDAO { - - void createOrder(int customerId, Order order) throws DAOException; - List getOrdersForCustomer(int customerId) throws DAOException; -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java b/eshop7_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java deleted file mode 100644 index 267cca8..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public void createOrder(int customerId, Order order) throws DAOException { - - // step1 : insert into orders table - // step2 : insert into order_details table with the same order id that - // we got from the above step - - Connection con = null; - PreparedStatement statement = null; - - int orderId = 0; - - try { - con = getConnection(); - - String sql = "insert into orders values (?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - orderId = getNextSequenceValue("orders_seq"); - - statement.setInt(1, orderId); - statement.setInt(2, customerId); - statement.setString(3, order.getOrderNumber()); - statement.setDate(4, new Date(order.getOrderDate().getTime())); - statement.setDouble(5, order.getOrderAmount()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating an order", - ex); - } finally { - closeResources(null, statement, con); - } - - insertIntoOrderDetails(orderId, order); - } - - private void insertIntoOrderDetails(int orderId, Order order) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try { - con = getConnection(); - - String sql = "insert into order_details values (order_details_seq.nextval,?,?)"; - - List products = order.getProducts(); - - for (Product product : products) { - statement = con.prepareStatement(sql); - - statement.setInt(1, orderId); - statement.setInt(2, product.getId()); - - statement.executeUpdate(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while inserting the order", - ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public List getOrdersForCustomer(int customerId) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List orders = new ArrayList(); - ProductsDAO dao = new ProductsDAOJDBCImpl(); - - try { - con = getConnection(); - - String sql = "select * from orders where customer_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, customerId); - - rs = statement.executeQuery(sql); - - while (rs.next()) { - int id = rs.getInt("order_id"); - String order_Num = rs.getString("order_number"); - Date order_Date = rs.getDate("order_date"); - double order_amount = rs.getDouble("order_amount"); - List products; - - products = dao.getByOrderId(id); - - Order order = new Order(id, order_Num, order_Date, - order_amount, products); - orders.add(order); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - return orders; - } - -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/Product.java b/eshop7_2015/src/main/java/com/eshop/dao/Product.java deleted file mode 100644 index 866b450..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/Product.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.eshop.dao; - -public class Product { - private int id; - private String type; - private String name; - private double price; - - public Product(int id, String type, String name, double price) { - super(); - this.id = id; - this.type = type; - this.name = name; - this.price = price; - } - - public int getId() { - return id; - } - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - public double getPrice() { - return price; - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/ProductsDAO.java b/eshop7_2015/src/main/java/com/eshop/dao/ProductsDAO.java deleted file mode 100644 index fbffb10..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/ProductsDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface ProductsDAO { - - List getByOrderId(int orderId) throws DAOException; - - List getAllProducts() throws DAOException; - - Product findByPrimaryKey(int productId); -} diff --git a/eshop7_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java b/eshop7_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java deleted file mode 100644 index bdaa84b..0000000 --- a/eshop7_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class ProductsDAOJDBCImpl extends BaseDAO implements ProductsDAO { - - @Override - public List getByOrderId(int orderId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select p.product_id pid, p.product_type, p.product_name, p.price " + - "from order_details od, products p " + - "where od.product_id = p.product_id " + - "and od.order_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, orderId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("pid"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public List getAllProducts() throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select * from products"; - - statement = con.prepareStatement(sql); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public Product findByPrimaryKey(int productId) { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try - { - con = getConnection(); - - String sql = "select * from products where product_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, productId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - return product; - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return null; - } -} - diff --git a/eshop7_2015/src/main/java/com/eshop/service/CustomerService.java b/eshop7_2015/src/main/java/com/eshop/service/CustomerService.java deleted file mode 100644 index ab175d6..0000000 --- a/eshop7_2015/src/main/java/com/eshop/service/CustomerService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Customer; -import com.eshop.dao.CustomerDAO; - -@Service -public class CustomerService { - - @Autowired - private CustomerDAO dao; - - public List getCustomers() { - return dao.getAllCustomers(); - } - - public void add(Customer customer) { - dao.createCustomer(customer); - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/service/OrdersService.java b/eshop7_2015/src/main/java/com/eshop/service/OrdersService.java deleted file mode 100644 index 2d159f6..0000000 --- a/eshop7_2015/src/main/java/com/eshop/service/OrdersService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eshop.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; - -@Service -public class OrdersService { - - @Autowired - private OrdersDAO dao; - - public void placeOrder(int customerId, Order order) { - dao.createOrder(customerId, order); - } - - public List getOrders(int customerId) { - return dao.getOrdersForCustomer(customerId); - } - - public List getOrdersForTheMonth(int customerId) { - List orders = dao.getOrdersForCustomer(customerId); - - List ordersForTheMonth = new ArrayList(); - int currentMonth = new Date().getMonth(); - - for (Order order : orders) { - if (order.getOrderDate().getMonth() == currentMonth) { - ordersForTheMonth.add(order); - } - } - - return ordersForTheMonth; - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/service/ProductsService.java b/eshop7_2015/src/main/java/com/eshop/service/ProductsService.java deleted file mode 100644 index 74066ab..0000000 --- a/eshop7_2015/src/main/java/com/eshop/service/ProductsService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; - -@Service -public class ProductsService { - - @Autowired - private ProductsDAO dao; - - public Product getById(int productId) { - return dao.findByPrimaryKey(productId); - } - - public List getAllProducts() { - return dao.getAllProducts(); - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/web/CheckoutController.java b/eshop7_2015/src/main/java/com/eshop/web/CheckoutController.java deleted file mode 100644 index fe8e4f2..0000000 --- a/eshop7_2015/src/main/java/com/eshop/web/CheckoutController.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.eshop.web; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Order; -import com.eshop.dao.Product; -import com.eshop.service.OrdersService; - -@Controller -public class CheckoutController { - - @Autowired - private OrdersService service; - - @RequestMapping("/checkout") - public ModelAndView checkout(HttpSession session) { - List products = (List) session - .getAttribute("ShoppingCart"); - - double orderAmount = calculateOrderAmount(products); - - String orderNumber = UUID.randomUUID().toString(); - - Order order = new Order(0, orderNumber, new Date(), orderAmount, - products); - - service.placeOrder(1, order); - - session.removeAttribute("ShoppingCart"); - - return new ModelAndView("OrderConfirmation", "Order", order); - } - - private double calculateOrderAmount(List products) { - double orderAmount = 0; - - for (Product product : products) { - orderAmount = orderAmount + product.getPrice(); - } - - return orderAmount; - } - -} diff --git a/eshop7_2015/src/main/java/com/eshop/web/HomeController.java b/eshop7_2015/src/main/java/com/eshop/web/HomeController.java deleted file mode 100644 index 4fea1b4..0000000 --- a/eshop7_2015/src/main/java/com/eshop/web/HomeController.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.eshop.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - -@Controller -public class HomeController { - - @Autowired - private ProductsService service; - - @RequestMapping("/") - public ModelAndView homePage() { - List products = service.getAllProducts(); - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Home"); - modelAndView.addObject("AllProducts", products); - - return modelAndView; - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/web/LoginController.java b/eshop7_2015/src/main/java/com/eshop/web/LoginController.java deleted file mode 100644 index 7f2f13e..0000000 --- a/eshop7_2015/src/main/java/com/eshop/web/LoginController.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.eshop.web; - -import org.apache.catalina.connector.Request; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class LoginController { - - @RequestMapping("/login") - public String emptyForm() { - return "Login"; - } - - @RequestMapping(value = "/login", method = RequestMethod.POST) - public String validate(@RequestParam String username, - @RequestParam String password) { - - if ("test".equals(username) && "test".equals(password)) { - return "OrderSummary"; - } else { - return "Login"; - } - } - -} diff --git a/eshop7_2015/src/main/java/com/eshop/web/ShoppingCartController.java b/eshop7_2015/src/main/java/com/eshop/web/ShoppingCartController.java deleted file mode 100644 index 75bd2f8..0000000 --- a/eshop7_2015/src/main/java/com/eshop/web/ShoppingCartController.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.eshop.web; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - - -@Controller -public class ShoppingCartController { - - @Autowired - private ProductsService service; - - @RequestMapping("/cart") - public String addProductToCart(@RequestParam("productId") int productId, HttpSession session) { - Product product = service.getById(productId); - - //any tab exists with this name - if(session.getAttribute("ShoppingCart") == null) { - - //creating a tab - List products = new ArrayList(); - - //Adding this product to the tab - products.add(product); - - //Adding this tab to the session - session.setAttribute("ShoppingCart", products); - } else { - List products = (List) session.getAttribute("ShoppingCart"); - products.add(product); - } - - return "ShoppingCart"; - } -} diff --git a/eshop7_2015/src/main/java/com/eshop/web/SignUpController.java b/eshop7_2015/src/main/java/com/eshop/web/SignUpController.java deleted file mode 100644 index bdb2fca..0000000 --- a/eshop7_2015/src/main/java/com/eshop/web/SignUpController.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eshop.web; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Customer; -import com.eshop.service.CustomerService; - -@Controller -public class SignUpController { - - @Autowired - private CustomerService service; - - @RequestMapping("/signup") - public ModelAndView emptyForm() { - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("SignUp"); - modelAndView.addObject("customer", new Customer()); - - return modelAndView; - } - - @RequestMapping(value = "/signup", method=RequestMethod.POST) - public String signup(@Valid Customer customer, BindingResult bindingResult) { - - if(bindingResult.hasErrors()) { - return "SignUp"; - } else { - service.add(customer); - return "Login"; - } - } -} diff --git a/eshop7_2015/src/main/resources/spring-config.xml b/eshop7_2015/src/main/resources/spring-config.xml deleted file mode 100644 index 194c280..0000000 --- a/eshop7_2015/src/main/resources/spring-config.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/eshop7_2015/src/main/webapp/Header.jsp b/eshop7_2015/src/main/webapp/Header.jsp deleted file mode 100644 index dbcefb6..0000000 --- a/eshop7_2015/src/main/webapp/Header.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - - - - - - - \ No newline at end of file diff --git a/eshop7_2015/src/main/webapp/WEB-INF/eshop-servlet.xml b/eshop7_2015/src/main/webapp/WEB-INF/eshop-servlet.xml deleted file mode 100644 index ddda57c..0000000 --- a/eshop7_2015/src/main/webapp/WEB-INF/eshop-servlet.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/eshop7_2015/src/main/webapp/WEB-INF/jsp/Header.jsp b/eshop7_2015/src/main/webapp/WEB-INF/jsp/Header.jsp deleted file mode 100644 index 8378716..0000000 --- a/eshop7_2015/src/main/webapp/WEB-INF/jsp/Header.jsp +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/eshop7_2015/src/main/webapp/WEB-INF/jsp/Home.jsp b/eshop7_2015/src/main/webapp/WEB-INF/jsp/Home.jsp deleted file mode 100644 index b04d268..0000000 --- a/eshop7_2015/src/main/webapp/WEB-INF/jsp/Home.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - <%@include file="Header.jsp" %> - -

    Welcome to eShop

    - - - - - - - - - - - - - - - - - - - -
    IdNameTypePrice
    ${product.id}${product.name}${product.type}${product.price}
    - - - - - - \ No newline at end of file diff --git a/eshop7_2015/src/main/webapp/WEB-INF/jsp/Login.jsp b/eshop7_2015/src/main/webapp/WEB-INF/jsp/Login.jsp deleted file mode 100644 index 7425daf..0000000 --- a/eshop7_2015/src/main/webapp/WEB-INF/jsp/Login.jsp +++ /dev/null @@ -1,35 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - <%@include file="Header.jsp" %> - -

    If you are returning customer, please login.

    - - -
    - - Username :

    - Password :

    - - -
    - - -

    If you are 1st timer, please click here

    - - - - - - \ No newline at end of file diff --git a/eshop7_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp b/eshop7_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp deleted file mode 100644 index e0cc7fe..0000000 --- a/eshop7_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp +++ /dev/null @@ -1,27 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - <%@include file="Header.jsp" %> - -

    Your order has been placed, and your order number is - ${Order.orderNumber}.

    -

    If you have any questions regarding this order, - please reference this order number.

    - -
    Click here to go to home page.
    - - - - - - \ No newline at end of file diff --git a/eshop7_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp b/eshop7_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp deleted file mode 100644 index e047545..0000000 --- a/eshop7_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp +++ /dev/null @@ -1,40 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - <%@include file="Header.jsp" %> - -

    Here is your order summary, please confirm.

    - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}
    - - - Confirm - - - - - - \ No newline at end of file diff --git a/eshop7_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp b/eshop7_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp deleted file mode 100644 index 12e7816..0000000 --- a/eshop7_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp +++ /dev/null @@ -1,45 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - <%@include file="Header.jsp" %> - -

    You have added the following items to the cart.

    - - - - - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}Add to Cart
    - - -

    Do you want to shop more?Please click here

    -

    If you are done shopping, please click here

    - - - - - - \ No newline at end of file diff --git a/eshop7_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp b/eshop7_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp deleted file mode 100644 index a69111c..0000000 --- a/eshop7_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp +++ /dev/null @@ -1,39 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%> - - - - -Insert title here - - - - - - - - <%@include file="Header.jsp" %> - - - - -

    - - First name :
    - Last name :
    - Address :
    - City :
    - State :
    - Zip :
    - - -
    - - - - - - - \ No newline at end of file diff --git a/eshop7_2015/src/main/webapp/WEB-INF/web.xml b/eshop7_2015/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 4214d48..0000000 --- a/eshop7_2015/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - eshop - - eshop - org.springframework.web.servlet.DispatcherServlet - - - eshop - / - - \ No newline at end of file diff --git a/eshop7_2015/src/main/webapp/images/cart.jpg b/eshop7_2015/src/main/webapp/images/cart.jpg deleted file mode 100644 index ef32228..0000000 Binary files a/eshop7_2015/src/main/webapp/images/cart.jpg and /dev/null differ diff --git a/eshop7_2015/src/main/webapp/images/eshop.png b/eshop7_2015/src/main/webapp/images/eshop.png deleted file mode 100644 index ea3dce1..0000000 Binary files a/eshop7_2015/src/main/webapp/images/eshop.png and /dev/null differ diff --git a/eshop7_2015/src/main/webapp/styles/eshop.css b/eshop7_2015/src/main/webapp/styles/eshop.css deleted file mode 100644 index 9f87ed6..0000000 --- a/eshop7_2015/src/main/webapp/styles/eshop.css +++ /dev/null @@ -1,48 +0,0 @@ -table, td, th { - border: 1px solid green; -} - -table.list1 { - background-color: white; - border: 1px solid blue; -} - -table.list1 th { - background-color: red; -} - - -th { - background-color: green; - color: white; -} - -body { - background-color: #EBF5F0; - font-family: monospace; - font-size: 14px; - font-weight: bold; - margin-left: 10%; - margin-top: 1%; - margin-bottom: 10%; - margin-right: 10%; - - background-image: url("../images/eshop.png"); - background-repeat: no-repeat; - background-position: right top; -} - -input { - margin-left: 10px; - margin-bottom: 10px; -} - -#mainHeading{ - color: green; - font-size: 32px; -} - -img#cart { - height: 25px; - width: 30px; -} \ No newline at end of file diff --git a/eshop8_2015/.classpath b/eshop8_2015/.classpath deleted file mode 100644 index b80b726..0000000 --- a/eshop8_2015/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eshop8_2015/.project b/eshop8_2015/.project deleted file mode 100644 index d42fd29..0000000 --- a/eshop8_2015/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - eshop5_2015 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/eshop8_2015/.settings/.jsdtscope b/eshop8_2015/.settings/.jsdtscope deleted file mode 100644 index 585c967..0000000 --- a/eshop8_2015/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eshop8_2015/.settings/org.eclipse.jdt.core.prefs b/eshop8_2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62a317c..0000000 --- a/eshop8_2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eshop8_2015/.settings/org.eclipse.m2e.core.prefs b/eshop8_2015/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/eshop8_2015/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/eshop8_2015/.settings/org.eclipse.wst.common.component b/eshop8_2015/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 89f878c..0000000 --- a/eshop8_2015/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/eshop8_2015/.settings/org.eclipse.wst.common.project.facet.core.xml b/eshop8_2015/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index dac75cc..0000000 --- a/eshop8_2015/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eshop8_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container b/eshop8_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/eshop8_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/eshop8_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name b/eshop8_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/eshop8_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/eshop8_2015/.settings/org.eclipse.wst.validation.prefs b/eshop8_2015/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 6f1cba6..0000000 --- a/eshop8_2015/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/eshop8_2015/pom.xml b/eshop8_2015/pom.xml deleted file mode 100644 index a84dcbe..0000000 --- a/eshop8_2015/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - 4.0.0 - com.training - esho6 - war - 1.0 - eshop2 Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - org.springframework - spring-web - 3.2.13.RELEASE - - - org.springframework - spring-oxm - 3.2.13.RELEASE - - - org.springframework - spring-webmvc - 3.2.13.RELEASE - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.3.1.Final - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.5 - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - esho6 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/eshop8_2015/src/main/java/com/eshop/dao/BaseDAO.java b/eshop8_2015/src/main/java/com/eshop/dao/BaseDAO.java deleted file mode 100644 index f30749c..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/BaseDAO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException { - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection( - "jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - // Nothing to be done, ignore it. - } - } - - protected int getNextSequenceValue(String sequenceName) throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - try { - con = getConnection(); - - statement = con.createStatement(); - String sql = "select " + sequenceName + ".nextval from dual"; - - rs = statement.executeQuery(sql); - - if (rs.next()) { - return rs.getInt("nextval"); - } - - throw new DAOException("Invalid SQL for sequence next val"); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - } - -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/Customer.java b/eshop8_2015/src/main/java/com/eshop/dao/Customer.java deleted file mode 100644 index 498cec2..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/Customer.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.eshop.dao; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.NotBlank; -import org.hibernate.validator.constraints.NotEmpty; - -public class Customer { - - private int id; - - @Size(min=3, max=30, message="First name must be 3 charcters min and max of 30") - @NotBlank - @Pattern(regexp="[a-z-A-Z]*") - private String firstName; - - @NotEmpty(message="Last name cannot be empty") - private String lastName; - private String address; - private String city; - private String state; - - @NotEmpty(message="Zip code cannot be blank") - @Pattern(regexp="[0-9]*", message="Zip can only take numbers") - private String zipCode; - private List orders = new ArrayList(); - - public Customer() { - } - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } - - public void addOrder(Order order) { - this.orders.add(order); - } - - public List getOrders() { - return orders; - } - - public void setId(int id) { - this.id = id; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public void setAddress(String address) { - this.address = address; - } - - public void setCity(String city) { - this.city = city; - } - - public void setState(String state) { - this.state = state; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public void setOrders(List orders) { - this.orders = orders; - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/CustomerDAO.java b/eshop8_2015/src/main/java/com/eshop/dao/CustomerDAO.java deleted file mode 100644 index f743d87..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java b/eshop8_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 4cb7af4..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customers"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customers values (customers_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customers " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/DAOException.java b/eshop8_2015/src/main/java/com/eshop/dao/DAOException.java deleted file mode 100644 index 21423ce..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage, Throwable ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/Order.java b/eshop8_2015/src/main/java/com/eshop/dao/Order.java deleted file mode 100644 index 2e466e3..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/Order.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.eshop.dao; - -import java.util.Date; -import java.util.List; - -public class Order { - private int id; - private String orderNumber; - private Date orderDate; - private double orderAmount; - - private List products = null; - - public Order(int id, String orderNumber, Date orderDate, - double orderAmount, List products) { - super(); - this.id = id; - this.orderNumber = orderNumber; - this.orderDate = orderDate; - this.orderAmount = orderAmount; - this.products = products; - } - - public int getId() { - return id; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Date getOrderDate() { - return orderDate; - } - - public double getOrderAmount() { - return orderAmount; - } - - public List getProducts() { - return products; - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/OrdersDAO.java b/eshop8_2015/src/main/java/com/eshop/dao/OrdersDAO.java deleted file mode 100644 index e32ee11..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/OrdersDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface OrdersDAO { - - void createOrder(int customerId, Order order) throws DAOException; - List getOrdersForCustomer(int customerId) throws DAOException; -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java b/eshop8_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java deleted file mode 100644 index 267cca8..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public void createOrder(int customerId, Order order) throws DAOException { - - // step1 : insert into orders table - // step2 : insert into order_details table with the same order id that - // we got from the above step - - Connection con = null; - PreparedStatement statement = null; - - int orderId = 0; - - try { - con = getConnection(); - - String sql = "insert into orders values (?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - orderId = getNextSequenceValue("orders_seq"); - - statement.setInt(1, orderId); - statement.setInt(2, customerId); - statement.setString(3, order.getOrderNumber()); - statement.setDate(4, new Date(order.getOrderDate().getTime())); - statement.setDouble(5, order.getOrderAmount()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating an order", - ex); - } finally { - closeResources(null, statement, con); - } - - insertIntoOrderDetails(orderId, order); - } - - private void insertIntoOrderDetails(int orderId, Order order) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try { - con = getConnection(); - - String sql = "insert into order_details values (order_details_seq.nextval,?,?)"; - - List products = order.getProducts(); - - for (Product product : products) { - statement = con.prepareStatement(sql); - - statement.setInt(1, orderId); - statement.setInt(2, product.getId()); - - statement.executeUpdate(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while inserting the order", - ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public List getOrdersForCustomer(int customerId) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List orders = new ArrayList(); - ProductsDAO dao = new ProductsDAOJDBCImpl(); - - try { - con = getConnection(); - - String sql = "select * from orders where customer_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, customerId); - - rs = statement.executeQuery(sql); - - while (rs.next()) { - int id = rs.getInt("order_id"); - String order_Num = rs.getString("order_number"); - Date order_Date = rs.getDate("order_date"); - double order_amount = rs.getDouble("order_amount"); - List products; - - products = dao.getByOrderId(id); - - Order order = new Order(id, order_Num, order_Date, - order_amount, products); - orders.add(order); - } - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - return orders; - } - -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/Product.java b/eshop8_2015/src/main/java/com/eshop/dao/Product.java deleted file mode 100644 index aa04500..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/Product.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.eshop.dao; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class Product { - private int id; - private String type; - private String name; - private double price; - - public Product() { - - } - - public Product(int id, String type, String name, double price) { - super(); - this.id = id; - this.type = type; - this.name = name; - this.price = price; - } - - public int getId() { - return id; - } - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - public double getPrice() { - return price; - } - - public void setId(int id) { - this.id = id; - } - - public void setType(String type) { - this.type = type; - } - - public void setName(String name) { - this.name = name; - } - - public void setPrice(double price) { - this.price = price; - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/Products.java b/eshop8_2015/src/main/java/com/eshop/dao/Products.java deleted file mode 100644 index 1f2205f..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/Products.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.eshop.dao; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "products") -public class Products { - - private List products = new ArrayList(); - - @XmlElement(name = "product") - public List getProducts() { - return products; - } - - public void addProduct(Product product) { - this.products.add(product); - } - - public void setProducts(List products) { - this.products = products; - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/ProductsDAO.java b/eshop8_2015/src/main/java/com/eshop/dao/ProductsDAO.java deleted file mode 100644 index fbffb10..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/ProductsDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eshop.dao; - -import java.util.List; - -public interface ProductsDAO { - - List getByOrderId(int orderId) throws DAOException; - - List getAllProducts() throws DAOException; - - Product findByPrimaryKey(int productId); -} diff --git a/eshop8_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java b/eshop8_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java deleted file mode 100644 index bdaa84b..0000000 --- a/eshop8_2015/src/main/java/com/eshop/dao/ProductsDAOJDBCImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.eshop.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class ProductsDAOJDBCImpl extends BaseDAO implements ProductsDAO { - - @Override - public List getByOrderId(int orderId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select p.product_id pid, p.product_type, p.product_name, p.price " + - "from order_details od, products p " + - "where od.product_id = p.product_id " + - "and od.order_id = ?"; - - statement = con.prepareStatement(sql); - statement.setInt(1, orderId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("pid"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public List getAllProducts() throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - List products = new ArrayList(); - - try - { - con = getConnection(); - - String sql = "select * from products"; - - statement = con.prepareStatement(sql); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - products.add(product); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return products; - } - - @Override - public Product findByPrimaryKey(int productId) { - Connection con = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try - { - con = getConnection(); - - String sql = "select * from products where product_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setInt(1, productId); - - rs = statement.executeQuery(); - - while(rs.next()) - { - int id = rs.getInt("product_id"); - String type = rs.getString("product_type"); - String name = rs.getString("product_name"); - double price = rs.getDouble("price"); - - Product product = new Product(id, type, name, price); - return product; - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return null; - } -} - diff --git a/eshop8_2015/src/main/java/com/eshop/service/CustomerService.java b/eshop8_2015/src/main/java/com/eshop/service/CustomerService.java deleted file mode 100644 index ab175d6..0000000 --- a/eshop8_2015/src/main/java/com/eshop/service/CustomerService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Customer; -import com.eshop.dao.CustomerDAO; - -@Service -public class CustomerService { - - @Autowired - private CustomerDAO dao; - - public List getCustomers() { - return dao.getAllCustomers(); - } - - public void add(Customer customer) { - dao.createCustomer(customer); - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/service/OrdersService.java b/eshop8_2015/src/main/java/com/eshop/service/OrdersService.java deleted file mode 100644 index 2d159f6..0000000 --- a/eshop8_2015/src/main/java/com/eshop/service/OrdersService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eshop.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Order; -import com.eshop.dao.OrdersDAO; - -@Service -public class OrdersService { - - @Autowired - private OrdersDAO dao; - - public void placeOrder(int customerId, Order order) { - dao.createOrder(customerId, order); - } - - public List getOrders(int customerId) { - return dao.getOrdersForCustomer(customerId); - } - - public List getOrdersForTheMonth(int customerId) { - List orders = dao.getOrdersForCustomer(customerId); - - List ordersForTheMonth = new ArrayList(); - int currentMonth = new Date().getMonth(); - - for (Order order : orders) { - if (order.getOrderDate().getMonth() == currentMonth) { - ordersForTheMonth.add(order); - } - } - - return ordersForTheMonth; - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/service/ProductsService.java b/eshop8_2015/src/main/java/com/eshop/service/ProductsService.java deleted file mode 100644 index 74066ab..0000000 --- a/eshop8_2015/src/main/java/com/eshop/service/ProductsService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eshop.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.eshop.dao.Product; -import com.eshop.dao.ProductsDAO; - -@Service -public class ProductsService { - - @Autowired - private ProductsDAO dao; - - public Product getById(int productId) { - return dao.findByPrimaryKey(productId); - } - - public List getAllProducts() { - return dao.getAllProducts(); - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/web/CheckoutController.java b/eshop8_2015/src/main/java/com/eshop/web/CheckoutController.java deleted file mode 100644 index fe8e4f2..0000000 --- a/eshop8_2015/src/main/java/com/eshop/web/CheckoutController.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.eshop.web; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Order; -import com.eshop.dao.Product; -import com.eshop.service.OrdersService; - -@Controller -public class CheckoutController { - - @Autowired - private OrdersService service; - - @RequestMapping("/checkout") - public ModelAndView checkout(HttpSession session) { - List products = (List) session - .getAttribute("ShoppingCart"); - - double orderAmount = calculateOrderAmount(products); - - String orderNumber = UUID.randomUUID().toString(); - - Order order = new Order(0, orderNumber, new Date(), orderAmount, - products); - - service.placeOrder(1, order); - - session.removeAttribute("ShoppingCart"); - - return new ModelAndView("OrderConfirmation", "Order", order); - } - - private double calculateOrderAmount(List products) { - double orderAmount = 0; - - for (Product product : products) { - orderAmount = orderAmount + product.getPrice(); - } - - return orderAmount; - } - -} diff --git a/eshop8_2015/src/main/java/com/eshop/web/HomeController.java b/eshop8_2015/src/main/java/com/eshop/web/HomeController.java deleted file mode 100644 index 4fea1b4..0000000 --- a/eshop8_2015/src/main/java/com/eshop/web/HomeController.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.eshop.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - -@Controller -public class HomeController { - - @Autowired - private ProductsService service; - - @RequestMapping("/") - public ModelAndView homePage() { - List products = service.getAllProducts(); - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Home"); - modelAndView.addObject("AllProducts", products); - - return modelAndView; - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/web/LoginController.java b/eshop8_2015/src/main/java/com/eshop/web/LoginController.java deleted file mode 100644 index 7f2f13e..0000000 --- a/eshop8_2015/src/main/java/com/eshop/web/LoginController.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.eshop.web; - -import org.apache.catalina.connector.Request; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class LoginController { - - @RequestMapping("/login") - public String emptyForm() { - return "Login"; - } - - @RequestMapping(value = "/login", method = RequestMethod.POST) - public String validate(@RequestParam String username, - @RequestParam String password) { - - if ("test".equals(username) && "test".equals(password)) { - return "OrderSummary"; - } else { - return "Login"; - } - } - -} diff --git a/eshop8_2015/src/main/java/com/eshop/web/ProductSearchController.java b/eshop8_2015/src/main/java/com/eshop/web/ProductSearchController.java deleted file mode 100644 index 0b8ccb4..0000000 --- a/eshop8_2015/src/main/java/com/eshop/web/ProductSearchController.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.eshop.web; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -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.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Product; -import com.eshop.dao.Products; -import com.eshop.service.ProductsService; - -@Controller -@RequestMapping("/product/search") -public class ProductSearchController { - - @Autowired - private ProductsService service; - - @RequestMapping("suggestions") - @ResponseBody - public Products getSuggestions(@RequestParam String key) { - List allProducts = service.getAllProducts(); - - Products products = new Products(); - - for(Product product : allProducts) { - if(product.getName().startsWith(key)) { - products.addProduct(product); - } - } - - return products; - } - - @RequestMapping(value = "/", method=RequestMethod.POST) - public ModelAndView homePage(@RequestParam String productSearch) { - System.out.println("Real search has been called"); - List allProducts = service.getAllProducts(); - - List resultProducts = new ArrayList(); - - for(Product product : allProducts) { - if(product.getName().startsWith(productSearch)) { - resultProducts.add(product); - } - } - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Home"); - modelAndView.addObject("AllProducts", resultProducts); - - return modelAndView; - } -} \ No newline at end of file diff --git a/eshop8_2015/src/main/java/com/eshop/web/ShoppingCartController.java b/eshop8_2015/src/main/java/com/eshop/web/ShoppingCartController.java deleted file mode 100644 index 75bd2f8..0000000 --- a/eshop8_2015/src/main/java/com/eshop/web/ShoppingCartController.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.eshop.web; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import com.eshop.dao.Product; -import com.eshop.service.ProductsService; - - -@Controller -public class ShoppingCartController { - - @Autowired - private ProductsService service; - - @RequestMapping("/cart") - public String addProductToCart(@RequestParam("productId") int productId, HttpSession session) { - Product product = service.getById(productId); - - //any tab exists with this name - if(session.getAttribute("ShoppingCart") == null) { - - //creating a tab - List products = new ArrayList(); - - //Adding this product to the tab - products.add(product); - - //Adding this tab to the session - session.setAttribute("ShoppingCart", products); - } else { - List products = (List) session.getAttribute("ShoppingCart"); - products.add(product); - } - - return "ShoppingCart"; - } -} diff --git a/eshop8_2015/src/main/java/com/eshop/web/SignUpController.java b/eshop8_2015/src/main/java/com/eshop/web/SignUpController.java deleted file mode 100644 index bdb2fca..0000000 --- a/eshop8_2015/src/main/java/com/eshop/web/SignUpController.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eshop.web; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.eshop.dao.Customer; -import com.eshop.service.CustomerService; - -@Controller -public class SignUpController { - - @Autowired - private CustomerService service; - - @RequestMapping("/signup") - public ModelAndView emptyForm() { - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("SignUp"); - modelAndView.addObject("customer", new Customer()); - - return modelAndView; - } - - @RequestMapping(value = "/signup", method=RequestMethod.POST) - public String signup(@Valid Customer customer, BindingResult bindingResult) { - - if(bindingResult.hasErrors()) { - return "SignUp"; - } else { - service.add(customer); - return "Login"; - } - } -} diff --git a/eshop8_2015/src/main/resources/spring-config.xml b/eshop8_2015/src/main/resources/spring-config.xml deleted file mode 100644 index 194c280..0000000 --- a/eshop8_2015/src/main/resources/spring-config.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/eshop8_2015/src/main/webapp/WEB-INF/eshop-servlet.xml b/eshop8_2015/src/main/webapp/WEB-INF/eshop-servlet.xml deleted file mode 100644 index d53b170..0000000 --- a/eshop8_2015/src/main/webapp/WEB-INF/eshop-servlet.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - com.eshop.dao.Product - com.eshop.dao.Products - - - - diff --git a/eshop8_2015/src/main/webapp/WEB-INF/jsp/Header.jsp b/eshop8_2015/src/main/webapp/WEB-INF/jsp/Header.jsp deleted file mode 100644 index 2dd9aca..0000000 --- a/eshop8_2015/src/main/webapp/WEB-INF/jsp/Header.jsp +++ /dev/null @@ -1,24 +0,0 @@ -
    - -
    \ No newline at end of file diff --git a/eshop8_2015/src/main/webapp/WEB-INF/jsp/Home.jsp b/eshop8_2015/src/main/webapp/WEB-INF/jsp/Home.jsp deleted file mode 100644 index 2209a4b..0000000 --- a/eshop8_2015/src/main/webapp/WEB-INF/jsp/Home.jsp +++ /dev/null @@ -1,78 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - <%@include file="Header.jsp" %> - -
    - -
    -
    - - -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    IdNameTypePrice
    ${product.id}${product.name}${product.type}${product.price}
    - -
    -
    -

    Current Deals

    - -
      -
    • Diet Coke $.50
    • -
    • iPad for $299
    • - -
    -
    - -
    -

    Coupons

    -
    - -
    -

    Contact Us

    -
    -
    -
    - - - - - - - - - \ No newline at end of file diff --git a/eshop8_2015/src/main/webapp/WEB-INF/jsp/Login.jsp b/eshop8_2015/src/main/webapp/WEB-INF/jsp/Login.jsp deleted file mode 100644 index 6e7ddcc..0000000 --- a/eshop8_2015/src/main/webapp/WEB-INF/jsp/Login.jsp +++ /dev/null @@ -1,37 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - <%@include file="Header.jsp" %> - -
    - - - -
    - - Username :

    - Password :

    - - -
    - - -

    If you are 1st timer, please click here

    -
    - - - - - - \ No newline at end of file diff --git a/eshop8_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp b/eshop8_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp deleted file mode 100644 index afc1268..0000000 --- a/eshop8_2015/src/main/webapp/WEB-INF/jsp/OrderConfirmation.jsp +++ /dev/null @@ -1,29 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - <%@include file="Header.jsp" %> - -
    -

    Your order has been placed, and your order number is - ${Order.orderNumber}.

    -

    If you have any questions regarding this order, - please reference this order number.

    - -
    Click here to go to home page.
    -
    - - - - - - \ No newline at end of file diff --git a/eshop8_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp b/eshop8_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp deleted file mode 100644 index 0719288..0000000 --- a/eshop8_2015/src/main/webapp/WEB-INF/jsp/OrderSummary.jsp +++ /dev/null @@ -1,41 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - <%@include file="Header.jsp" %> - -
    -

    Here is your order summary, please confirm.

    - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}
    - - Confirm -
    - - - - - - \ No newline at end of file diff --git a/eshop8_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp b/eshop8_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp deleted file mode 100644 index 286bbbe..0000000 --- a/eshop8_2015/src/main/webapp/WEB-INF/jsp/ShoppingCart.jsp +++ /dev/null @@ -1,52 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - <%@include file="Header.jsp" %> - -
    -

    You have added the following items to the cart.

    - - - - - - - - - - - - - - - - - - -
    NameTypePrice
    ${product.name}${product.type}${product.price}Add to Cart
    - - -
    -

    Want to shop more?Please click here

    -
    - -
    -

    Done shopping? Checkout

    -
    -
    - - - - - - \ No newline at end of file diff --git a/eshop8_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp b/eshop8_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp deleted file mode 100644 index 3119639..0000000 --- a/eshop8_2015/src/main/webapp/WEB-INF/jsp/SignUp.jsp +++ /dev/null @@ -1,51 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%> - - - - -Insert title here - - - - - - - - <%@include file="Header.jsp" %> - -
    - - - -

    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    -
    - - - - - - \ No newline at end of file diff --git a/eshop8_2015/src/main/webapp/WEB-INF/web.xml b/eshop8_2015/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 4214d48..0000000 --- a/eshop8_2015/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - eshop - - eshop - org.springframework.web.servlet.DispatcherServlet - - - eshop - / - - \ No newline at end of file diff --git a/eshop8_2015/src/main/webapp/images/cart.jpg b/eshop8_2015/src/main/webapp/images/cart.jpg deleted file mode 100644 index ef32228..0000000 Binary files a/eshop8_2015/src/main/webapp/images/cart.jpg and /dev/null differ diff --git a/eshop8_2015/src/main/webapp/images/eshop.png b/eshop8_2015/src/main/webapp/images/eshop.png deleted file mode 100644 index ea3dce1..0000000 Binary files a/eshop8_2015/src/main/webapp/images/eshop.png and /dev/null differ diff --git a/eshop8_2015/src/main/webapp/scripts/application.js b/eshop8_2015/src/main/webapp/scripts/application.js deleted file mode 100644 index 152bd33..0000000 --- a/eshop8_2015/src/main/webapp/scripts/application.js +++ /dev/null @@ -1,48 +0,0 @@ -$(document).ready(function() { - - $("#productSearch").keyup(function() { - - var searchKey = $("#productSearch").val(); - - //If user didn't enter anything, do not go to server. Just empty the html in the search results div. - if(searchKey == '') { - $("#searchResults").html(""); - return; - } - - var data = {"key" : searchKey}; - - $.getJSON('http://localhost:9090/eshop9/product/search/suggestions.json', data, function(responseData) { - - var searchResultsHtml = ""; - - var resultsArray = responseData.products; - - $.each(resultsArray, function(index, product) { - - var idOfAnchorTag = "searchResult_"+index; - - searchResultsHtml += "" + product.name + "
    "; - - }); - - //Write the final HTML into search results div - $("#searchResults").html(searchResultsHtml); - - }); - - }); -}); - -function copyIntoSearchBox(id) { - - console.log(id); - - var jQueryId = "#"+id; - console.log(jQueryId); - - var selectedAnchorTagValue = $(jQueryId).text(); - console.log('selectedAnchorTagValue = ' + selectedAnchorTagValue); - - $("#productSearch").val(selectedAnchorTagValue); -} \ No newline at end of file diff --git a/eshop8_2015/src/main/webapp/styles/eshop.css b/eshop8_2015/src/main/webapp/styles/eshop.css deleted file mode 100644 index b3366fc..0000000 --- a/eshop8_2015/src/main/webapp/styles/eshop.css +++ /dev/null @@ -1,54 +0,0 @@ - -.row-eq-height { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: none; -} - -table, td, th { - border: 1px solid green; -} - -table.list1 { - background-color: white; - border: 1px solid blue; -} - -table.list1 th { - background-color: red; -} - - -th { - background-color: green; - color: white; -} - -input { - margin-left: 10px; - margin-bottom: 10px; -} - -#mainHeading{ - color: green; - font-size: 32px; -} - -img#cart { - height: 25px; - width: 30px; -} - -h4.login { - color: green; -} - -label { - width: 100px; -} - -.glyphicon-shopping-cart { - font-size: 28px; - color: green; -} diff --git a/hibernate1/.classpath b/hibernate1/.classpath deleted file mode 100644 index d90b917..0000000 --- a/hibernate1/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/hibernate1/.project b/hibernate1/.project deleted file mode 100644 index 91dc642..0000000 --- a/hibernate1/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - hibernate1 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/hibernate1/.settings/org.eclipse.core.resources.prefs b/hibernate1/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 403a991..0000000 --- a/hibernate1/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Sun Mar 18 07:11:20 EDT 2012 -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/hibernate1/.settings/org.eclipse.jdt.core.prefs b/hibernate1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f27df63..0000000 --- a/hibernate1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Sun Mar 18 07:11:20 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/hibernate1/.settings/org.eclipse.m2e.core.prefs b/hibernate1/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 4181fb7..0000000 --- a/hibernate1/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 18 07:08:07 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/hibernate1/pom.xml b/hibernate1/pom.xml deleted file mode 100644 index 911d904..0000000 --- a/hibernate1/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - - com.training - hibernate1 - 1.0 - jar - - hibernate1 - http://maven.apache.org - - - UTF-8 - - - - - org.hibernate - hibernate-core - 3.6.0.Final - - - org.hibernate - hibernate-annotations - 3.5.6-Final - - - junit - junit - 4.10 - - - mysql - mysql-connector-java - 5.1.17 - - - javassist - javassist - 3.6.0.GA - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - - - diff --git a/hibernate1/src/main/java/com/training/java/hibernate/Book.java b/hibernate1/src/main/java/com/training/java/hibernate/Book.java deleted file mode 100644 index f88a5e9..0000000 --- a/hibernate1/src/main/java/com/training/java/hibernate/Book.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.training.java.hibernate; - -import java.io.Serializable; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Entity -@Table(name = "book") -public class Book implements Serializable { - - @Id - @Column(name = "id") - private int id; - - @Column(name = "title") - private String title; - - @Column(name = "author") - private String author; - - @Column(name = "isbn") - private String isbn; - - @Column(name = "pages") - private int pages; - - @ManyToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER) - @JoinColumn(name="publisher_id") - private Publisher publisher; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public Publisher getPublisher() { - return publisher; - } - - public void setPublisher(Publisher publisher) { - this.publisher = publisher; - } - -} diff --git a/hibernate1/src/main/java/com/training/java/hibernate/BookDAO.java b/hibernate1/src/main/java/com/training/java/hibernate/BookDAO.java deleted file mode 100644 index c17d70f..0000000 --- a/hibernate1/src/main/java/com/training/java/hibernate/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.hibernate; - - -import java.util.List; - -public interface BookDAO { - - public void create(Book aNewBook) throws DAOException; - public List getAllBooks() throws DAOException; - public Book findByPrimaryKey(int id) throws DAOException; - public void update(Book bookToUpdate) throws DAOException; - public void delete(int id) throws DAOException; -} diff --git a/hibernate1/src/main/java/com/training/java/hibernate/BookDAOHibernateImpl.java b/hibernate1/src/main/java/com/training/java/hibernate/BookDAOHibernateImpl.java deleted file mode 100644 index 542c8f9..0000000 --- a/hibernate1/src/main/java/com/training/java/hibernate/BookDAOHibernateImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.training.java.hibernate; - -import java.util.List; - -import org.hibernate.Session; - -public class BookDAOHibernateImpl implements BookDAO -{ - - @Override - public void create(Book aNewBook) throws DAOException - { - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - - session.getTransaction().begin(); - session.save(aNewBook); - session.getTransaction().commit(); - } - - @Override - public List getAllBooks() throws DAOException - { - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - - session.getTransaction().begin(); - List books = session.createCriteria(Book.class).list(); - session.getTransaction().commit(); - - return books; - } - - @Override - public Book findByPrimaryKey(int id) throws DAOException - { - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - session.getTransaction().begin(); - Book book = (Book) session.get(Book.class, id); - session.getTransaction().commit(); - - return book; - } - - @Override - public void update(Book bookToUpdate) throws DAOException - { - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - session.getTransaction().begin(); - session.update(bookToUpdate); - session.getTransaction().commit(); - } - - @Override - public void delete(int id) throws DAOException - { - Session session = HibernateUtil.getSessionFactory().getCurrentSession(); - session.getTransaction().begin(); - - Book bookToDelete = new Book(); - bookToDelete.setId(id); - - session.delete(bookToDelete); - session.getTransaction().commit(); - } - -} diff --git a/hibernate1/src/main/java/com/training/java/hibernate/DAOException.java b/hibernate1/src/main/java/com/training/java/hibernate/DAOException.java deleted file mode 100644 index b326ca2..0000000 --- a/hibernate1/src/main/java/com/training/java/hibernate/DAOException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.hibernate; - -public class DAOException extends Exception { - - public DAOException(Exception cause) - { - super(cause); - } - - public DAOException(String message) - { - super(message); - } - -} diff --git a/hibernate1/src/main/java/com/training/java/hibernate/HibernateUtil.java b/hibernate1/src/main/java/com/training/java/hibernate/HibernateUtil.java deleted file mode 100644 index 5b057b2..0000000 --- a/hibernate1/src/main/java/com/training/java/hibernate/HibernateUtil.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.hibernate; - -import org.hibernate.SessionFactory; -import org.hibernate.cfg.Configuration; - -public class HibernateUtil { - private static final SessionFactory sessionFactory; - static { - try { - sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory(); - } catch (Throwable ex) { - ex.printStackTrace(); - throw new ExceptionInInitializerError(ex); - } - } - - public static SessionFactory getSessionFactory() { - return sessionFactory; - } -} diff --git a/hibernate1/src/main/java/com/training/java/hibernate/Publisher.java b/hibernate1/src/main/java/com/training/java/hibernate/Publisher.java deleted file mode 100644 index d3558eb..0000000 --- a/hibernate1/src/main/java/com/training/java/hibernate/Publisher.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.hibernate; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "publisher") -public class Publisher { - @Id - @Column(name = "publisher_id") - private int id; - - @Column(name = "name") - private String name; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/hibernate1/src/main/resources/hibernate.cfg.xml b/hibernate1/src/main/resources/hibernate.cfg.xml deleted file mode 100644 index 5b42820..0000000 --- a/hibernate1/src/main/resources/hibernate.cfg.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - com.mysql.jdbc.Driver - jdbc:mysql://localhost/training - root - password - - - 1 - - - org.hibernate.dialect.MySQLDialect - - - org.hibernate.cache.NoCacheProvider - - - true - org.hibernate.context.ThreadLocalSessionContext - - - - - - - - \ No newline at end of file diff --git a/hibernate1/src/test/java/com/training/java/hibernate/BookDAOHibernateImplTest.java b/hibernate1/src/test/java/com/training/java/hibernate/BookDAOHibernateImplTest.java deleted file mode 100644 index f78dce1..0000000 --- a/hibernate1/src/test/java/com/training/java/hibernate/BookDAOHibernateImplTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.training.java.hibernate; - -import java.util.List; - -import org.junit.Ignore; -import org.junit.Test; - -public class BookDAOHibernateImplTest { - - @Test - public void testList() throws Exception { - - BookDAO dao = new BookDAOHibernateImpl(); - List books = dao.getAllBooks(); - - for(Book aBook : books) - { - System.out.println("dept name " + aBook.getPublisher().getName()); - } - - - System.out.println("books size = " + books.size()); - } - - @Test - public void testFindByPrimaryKey() throws Exception { - - BookDAO dao = new BookDAOHibernateImpl(); - Book book = dao.findByPrimaryKey(1); - - System.out.println("Title = " + book.getTitle()); - System.out.println("Author = " + book.getAuthor()); - System.out.println("ISBN = " + book.getIsbn()); - } - - - @Ignore - public void testAdd() throws Exception - { - BookDAO dao = new BookDAOHibernateImpl(); - - Book newBook = new Book(); - newBook.setId(6); - newBook.setAuthor("Gavin King"); - newBook.setIsbn("1234"); - newBook.setTitle("Hibernate "); - - Publisher pub = new Publisher(); - pub.setId(5); - pub.setName("ABC"); - - newBook.setPublisher(pub); - - dao.create(newBook); - } - - @Ignore - public void testUpdate() throws Exception - { - BookDAO dao = new BookDAOHibernateImpl(); - Book book = dao.findByPrimaryKey(1); - - book.setAuthor("Venkat"); - - dao.update(book); - } - - @Ignore - public void testDelete() throws Exception - { - BookDAO dao = new BookDAOHibernateImpl(); - dao.delete(1); - } - -} diff --git a/javascript/.classpath b/javascript/.classpath deleted file mode 100644 index 26b8264..0000000 --- a/javascript/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/javascript/.project b/javascript/.project deleted file mode 100644 index 48edf23..0000000 --- a/javascript/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - javascript - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/javascript/.settings/.jsdtscope b/javascript/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/javascript/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/javascript/.settings/org.eclipse.jdt.core.prefs b/javascript/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 295926d..0000000 --- a/javascript/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/javascript/.settings/org.eclipse.wst.common.component b/javascript/.settings/org.eclipse.wst.common.component deleted file mode 100644 index bb377ed..0000000 --- a/javascript/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/javascript/.settings/org.eclipse.wst.common.project.facet.core.xml b/javascript/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index a24a7de..0000000 --- a/javascript/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/javascript/.settings/org.eclipse.wst.jsdt.ui.superType.container b/javascript/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/javascript/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/javascript/.settings/org.eclipse.wst.jsdt.ui.superType.name b/javascript/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/javascript/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/javascript/WebContent/META-INF/MANIFEST.MF b/javascript/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/javascript/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/javascript/WebContent/Test.html b/javascript/WebContent/Test.html deleted file mode 100644 index 2f33a33..0000000 --- a/javascript/WebContent/Test.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - -Insert title here - - - - -

    Welcome to our store!!

    - - - - - - - - \ No newline at end of file diff --git a/javascript/WebContent/Validation.html b/javascript/WebContent/Validation.html deleted file mode 100644 index ee3bd59..0000000 --- a/javascript/WebContent/Validation.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - -Insert title here - - - - -
    -
    - -
    -
      -
      - -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      - -
      - -
      -
      -
      - - - - - - - \ No newline at end of file diff --git a/javascript/WebContent/WEB-INF/web.xml b/javascript/WebContent/WEB-INF/web.xml deleted file mode 100644 index 8d0570a..0000000 --- a/javascript/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - javascript - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - \ No newline at end of file diff --git a/javascript/WebContent/validation.js b/javascript/WebContent/validation.js deleted file mode 100644 index ca4848c..0000000 --- a/javascript/WebContent/validation.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -function validate() { - - var errorHTML = ""; - - if(document.getElementById("firstName").value == "") { - errorHTML = errorHTML + "
    • First name cannot be blank
    • "; - } - - if(document.getElementById("lastName").value == "") { - errorHTML = errorHTML + "
    • Last name cannot be blank
    • "; - } - - var zip = document.getElementById("zipCode").value; - if(zip == "") { - errorHTML = errorHTML + "
    • Zip cannot be blank
    • "; - } else if(isNaN(zip) || (zip.length != 5)) { - errorHTML = errorHTML + "
    • Zip must be 5 digits
    • "; - } - - var age = document.getElementById("age").value; - - if(age == "") { - errorHTML = errorHTML + "
    • Age cannot be blank
    • "; - } else if(isNaN(age) || age < 1 || age > 120) { - errorHTML = errorHTML + "
    • Age must be between 1 and 120
    • "; - } - - var state = document.getElementById("state"); - var selectedIndex = state.selectedIndex; - - var selectedOptionText = state.options[selectedIndex].text; - var selectedOptionValue = state.options[selectedIndex].value; - - if(selectedIndex == 0) { - errorHTML = errorHTML + "
    • State must be selected
    • "; - } - - document.getElementById("errorMessage").innerHTML = errorHTML; - -} diff --git a/jenkinstest/.classpath b/jenkinstest/.classpath deleted file mode 100644 index 24fb195..0000000 --- a/jenkinstest/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jenkinstest/.project b/jenkinstest/.project deleted file mode 100644 index afaa9a2..0000000 --- a/jenkinstest/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jenkinstest - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/jenkinstest/.settings/org.eclipse.core.resources.prefs b/jenkinstest/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a..0000000 --- a/jenkinstest/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/jenkinstest/.settings/org.eclipse.jdt.core.prefs b/jenkinstest/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8626026..0000000 --- a/jenkinstest/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/jenkinstest/.settings/org.eclipse.m2e.core.prefs b/jenkinstest/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/jenkinstest/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/jenkinstest/build.xml b/jenkinstest/build.xml deleted file mode 100644 index 32034b5..0000000 --- a/jenkinstest/build.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jenkinstest/lib/ant/ant-antlr.jar b/jenkinstest/lib/ant/ant-antlr.jar deleted file mode 100644 index d0c259c..0000000 Binary files a/jenkinstest/lib/ant/ant-antlr.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-apache-bcel.jar b/jenkinstest/lib/ant/ant-apache-bcel.jar deleted file mode 100644 index d5b34e8..0000000 Binary files a/jenkinstest/lib/ant/ant-apache-bcel.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-apache-bsf.jar b/jenkinstest/lib/ant/ant-apache-bsf.jar deleted file mode 100644 index 30924f1..0000000 Binary files a/jenkinstest/lib/ant/ant-apache-bsf.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-apache-log4j.jar b/jenkinstest/lib/ant/ant-apache-log4j.jar deleted file mode 100644 index e180f4f..0000000 Binary files a/jenkinstest/lib/ant/ant-apache-log4j.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-apache-oro.jar b/jenkinstest/lib/ant/ant-apache-oro.jar deleted file mode 100644 index 3bf9d87..0000000 Binary files a/jenkinstest/lib/ant/ant-apache-oro.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-apache-regexp.jar b/jenkinstest/lib/ant/ant-apache-regexp.jar deleted file mode 100644 index 612f8d4..0000000 Binary files a/jenkinstest/lib/ant/ant-apache-regexp.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-apache-resolver.jar b/jenkinstest/lib/ant/ant-apache-resolver.jar deleted file mode 100644 index 7dcfdc7..0000000 Binary files a/jenkinstest/lib/ant/ant-apache-resolver.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-apache-xalan2.jar b/jenkinstest/lib/ant/ant-apache-xalan2.jar deleted file mode 100644 index 6eca243..0000000 Binary files a/jenkinstest/lib/ant/ant-apache-xalan2.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-commons-logging.jar b/jenkinstest/lib/ant/ant-commons-logging.jar deleted file mode 100644 index 0b2b45a..0000000 Binary files a/jenkinstest/lib/ant/ant-commons-logging.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-commons-net.jar b/jenkinstest/lib/ant/ant-commons-net.jar deleted file mode 100644 index 1cb33c3..0000000 Binary files a/jenkinstest/lib/ant/ant-commons-net.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-jai.jar b/jenkinstest/lib/ant/ant-jai.jar deleted file mode 100644 index 22f8037..0000000 Binary files a/jenkinstest/lib/ant/ant-jai.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-javamail.jar b/jenkinstest/lib/ant/ant-javamail.jar deleted file mode 100644 index ce3be56..0000000 Binary files a/jenkinstest/lib/ant/ant-javamail.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-jdepend.jar b/jenkinstest/lib/ant/ant-jdepend.jar deleted file mode 100644 index 8921daa..0000000 Binary files a/jenkinstest/lib/ant/ant-jdepend.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-jmf.jar b/jenkinstest/lib/ant/ant-jmf.jar deleted file mode 100644 index 3b0816a..0000000 Binary files a/jenkinstest/lib/ant/ant-jmf.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-jsch.jar b/jenkinstest/lib/ant/ant-jsch.jar deleted file mode 100644 index 18cc470..0000000 Binary files a/jenkinstest/lib/ant/ant-jsch.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-junit.jar b/jenkinstest/lib/ant/ant-junit.jar deleted file mode 100644 index 6ce0e52..0000000 Binary files a/jenkinstest/lib/ant/ant-junit.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-junit4.jar b/jenkinstest/lib/ant/ant-junit4.jar deleted file mode 100644 index b0bf94e..0000000 Binary files a/jenkinstest/lib/ant/ant-junit4.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-launcher.jar b/jenkinstest/lib/ant/ant-launcher.jar deleted file mode 100644 index 49f9ae4..0000000 Binary files a/jenkinstest/lib/ant/ant-launcher.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-netrexx.jar b/jenkinstest/lib/ant/ant-netrexx.jar deleted file mode 100644 index c9042c6..0000000 Binary files a/jenkinstest/lib/ant/ant-netrexx.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-swing.jar b/jenkinstest/lib/ant/ant-swing.jar deleted file mode 100644 index 249c921..0000000 Binary files a/jenkinstest/lib/ant/ant-swing.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant-testutil.jar b/jenkinstest/lib/ant/ant-testutil.jar deleted file mode 100644 index 279c32a..0000000 Binary files a/jenkinstest/lib/ant/ant-testutil.jar and /dev/null differ diff --git a/jenkinstest/lib/ant/ant.jar b/jenkinstest/lib/ant/ant.jar deleted file mode 100644 index 428b2ee..0000000 Binary files a/jenkinstest/lib/ant/ant.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/asm-4.1.jar b/jenkinstest/lib/cobertura/asm-4.1.jar deleted file mode 100644 index 4ede5c9..0000000 Binary files a/jenkinstest/lib/cobertura/asm-4.1.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/asm-analysis-4.1.jar b/jenkinstest/lib/cobertura/asm-analysis-4.1.jar deleted file mode 100644 index 3158453..0000000 Binary files a/jenkinstest/lib/cobertura/asm-analysis-4.1.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/asm-commons-4.1.jar b/jenkinstest/lib/cobertura/asm-commons-4.1.jar deleted file mode 100644 index 6d95f2c..0000000 Binary files a/jenkinstest/lib/cobertura/asm-commons-4.1.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/asm-tree-4.1.jar b/jenkinstest/lib/cobertura/asm-tree-4.1.jar deleted file mode 100644 index 9383d99..0000000 Binary files a/jenkinstest/lib/cobertura/asm-tree-4.1.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/asm-util-4.1.jar b/jenkinstest/lib/cobertura/asm-util-4.1.jar deleted file mode 100644 index 4d0777e..0000000 Binary files a/jenkinstest/lib/cobertura/asm-util-4.1.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/cobertura-2.0.3.jar b/jenkinstest/lib/cobertura/cobertura-2.0.3.jar deleted file mode 100644 index db8c628..0000000 Binary files a/jenkinstest/lib/cobertura/cobertura-2.0.3.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/dom4j-1.6.1.jar b/jenkinstest/lib/cobertura/dom4j-1.6.1.jar deleted file mode 100644 index c8c4dbb..0000000 Binary files a/jenkinstest/lib/cobertura/dom4j-1.6.1.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/icu4j-2.6.1.jar b/jenkinstest/lib/cobertura/icu4j-2.6.1.jar deleted file mode 100644 index 9b5f51f..0000000 Binary files a/jenkinstest/lib/cobertura/icu4j-2.6.1.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/jaxen-1.1-beta-8.jar b/jenkinstest/lib/cobertura/jaxen-1.1-beta-8.jar deleted file mode 100644 index 6b007d9..0000000 Binary files a/jenkinstest/lib/cobertura/jaxen-1.1-beta-8.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/jdom-1.0.jar b/jenkinstest/lib/cobertura/jdom-1.0.jar deleted file mode 100644 index 288e64c..0000000 Binary files a/jenkinstest/lib/cobertura/jdom-1.0.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/jetty-6.1.14.jar b/jenkinstest/lib/cobertura/jetty-6.1.14.jar deleted file mode 100644 index 8c503be..0000000 Binary files a/jenkinstest/lib/cobertura/jetty-6.1.14.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/jetty-util-6.1.14.jar b/jenkinstest/lib/cobertura/jetty-util-6.1.14.jar deleted file mode 100644 index 8f924bb..0000000 Binary files a/jenkinstest/lib/cobertura/jetty-util-6.1.14.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/log4j-1.2.9.jar b/jenkinstest/lib/cobertura/log4j-1.2.9.jar deleted file mode 100644 index a6568b0..0000000 Binary files a/jenkinstest/lib/cobertura/log4j-1.2.9.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/oro-2.0.8.jar b/jenkinstest/lib/cobertura/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/jenkinstest/lib/cobertura/oro-2.0.8.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/servlet-api-2.5-6.1.14.jar b/jenkinstest/lib/cobertura/servlet-api-2.5-6.1.14.jar deleted file mode 100644 index 6d7404f..0000000 Binary files a/jenkinstest/lib/cobertura/servlet-api-2.5-6.1.14.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/tagsoup-0.9.7.jar b/jenkinstest/lib/cobertura/tagsoup-0.9.7.jar deleted file mode 100644 index a7d25fb..0000000 Binary files a/jenkinstest/lib/cobertura/tagsoup-0.9.7.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/xmlParserAPIs-2.6.2.jar b/jenkinstest/lib/cobertura/xmlParserAPIs-2.6.2.jar deleted file mode 100644 index 2dd8377..0000000 Binary files a/jenkinstest/lib/cobertura/xmlParserAPIs-2.6.2.jar and /dev/null differ diff --git a/jenkinstest/lib/cobertura/xom-1.0b3.jar b/jenkinstest/lib/cobertura/xom-1.0b3.jar deleted file mode 100644 index 4a39fcf..0000000 Binary files a/jenkinstest/lib/cobertura/xom-1.0b3.jar and /dev/null differ diff --git a/jenkinstest/lib/junit/hamcrest-core-1.3.jar b/jenkinstest/lib/junit/hamcrest-core-1.3.jar deleted file mode 100644 index 9d5fe16..0000000 Binary files a/jenkinstest/lib/junit/hamcrest-core-1.3.jar and /dev/null differ diff --git a/jenkinstest/lib/junit/junit-4.11.jar b/jenkinstest/lib/junit/junit-4.11.jar deleted file mode 100644 index aaf7444..0000000 Binary files a/jenkinstest/lib/junit/junit-4.11.jar and /dev/null differ diff --git a/jenkinstest/pom.xml b/jenkinstest/pom.xml deleted file mode 100644 index 88875d4..0000000 --- a/jenkinstest/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - 4.0.0 - - com.venkat - jenkinstest - 1.0 - jar - - jenkinstest - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.11 - test - - - diff --git a/jenkinstest/src/main/java/com/venkat/jenkinstest/Calculator.java b/jenkinstest/src/main/java/com/venkat/jenkinstest/Calculator.java deleted file mode 100644 index 39940a8..0000000 --- a/jenkinstest/src/main/java/com/venkat/jenkinstest/Calculator.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.venkat.jenkinstest; - -public class Calculator { - - public double add(double one, double two) { - return one + two; - } - - public double subtract(double one, double two) { - return one - two; - } - - public double divide(double one, double two, boolean reverse) { - if (reverse) { - return one / two; - } else { - return two / one; - } - } - -} diff --git a/jenkinstest/src/test/java/com/venkat/jenkinstest/CalculatorTest.java b/jenkinstest/src/test/java/com/venkat/jenkinstest/CalculatorTest.java deleted file mode 100644 index 3dad7ba..0000000 --- a/jenkinstest/src/test/java/com/venkat/jenkinstest/CalculatorTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.venkat.jenkinstest; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class CalculatorTest { - - @Test - public void testAdd() { - - double result = new Calculator().add(2, 5); - assertEquals(8, result, 0); - } - - @Test - public void testDivideRegular() throws Exception { - - double result = new Calculator().divide(10, 2, true); - System.out.println("Result = " + result); - - } - -} diff --git a/jms1/.classpath b/jms1/.classpath deleted file mode 100644 index 41dc2b0..0000000 --- a/jms1/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jms1/.project b/jms1/.project deleted file mode 100644 index b6881b5..0000000 --- a/jms1/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - jms1 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/jms1/.settings/org.eclipse.core.resources.prefs b/jms1/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 365bbd6..0000000 --- a/jms1/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/jms1/.settings/org.eclipse.jdt.core.prefs b/jms1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8626026..0000000 --- a/jms1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/jms1/.settings/org.eclipse.m2e.core.prefs b/jms1/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/jms1/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/jms1/.springBeans b/jms1/.springBeans deleted file mode 100644 index c2332e7..0000000 --- a/jms1/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/jms1/pom.xml b/jms1/pom.xml deleted file mode 100644 index e98b2ca..0000000 --- a/jms1/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - 4.0.0 - - com.training - jms1 - 1.0 - jar - - jms1 - http://maven.apache.org - - - UTF-8 - 3.1.2.RELEASE - - - - - - junit - junit - 4.10 - test - - - - org.apache.activemq - activemq-all - 5.1.0 - compile - - - org.springframework - spring-jms - ${spring.version} - - - org.springframework - spring-test - ${spring.version} - - - diff --git a/jms1/src/main/java/com/training/jms2/Chat.java b/jms1/src/main/java/com/training/jms2/Chat.java deleted file mode 100644 index dd0b2cc..0000000 --- a/jms1/src/main/java/com/training/jms2/Chat.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.training.jms2; - -import java.io.*; -import javax.jms.*; -import javax.naming.*; - -public class Chat implements javax.jms.MessageListener { - private TopicSession pubSession; - private TopicPublisher publisher; - private TopicConnection connection; - private String username; - - /* Constructor used to Initialize Chat */ - public Chat(String topicFactory, String topicName, String username) - throws Exception { - // Obtain a JNDI connection using the jndi.properties file - InitialContext ctx = new InitialContext(); - - // Look up a JMS connection factory and create the connection - TopicConnectionFactory conFactory = (TopicConnectionFactory) ctx - .lookup(topicFactory); - - TopicConnection connection = conFactory.createTopicConnection(); - - // Create two JMS session objects - TopicSession pubSession = connection.createTopicSession(false, - Session.AUTO_ACKNOWLEDGE); - - TopicSession subSession = connection.createTopicSession(false, - Session.AUTO_ACKNOWLEDGE); - - // Look up a JMS topic - Topic chatTopic = (Topic) ctx.lookup(topicName); - // Create a JMS publisher and subscriber. The additional parameters - // on the createSubscriber are a message selector (null) and a true - // value for the noLocal flag indicating that messages produced from - // this publisher should not be consumed by this publisher. - TopicPublisher publisher = pubSession.createPublisher(chatTopic); - TopicSubscriber subscriber = subSession.createSubscriber(chatTopic, - null, true); - - // Set a JMS message listener - subscriber.setMessageListener(this); - - // Intialize the Chat application variables - this.connection = connection; - this.pubSession = pubSession; - this.publisher = publisher; - this.username = username; - - // Start the JMS connection; allows messages to be delivered - connection.start(); - } - - /* Receive Messages From Topic Subscriber */ - public void onMessage(Message message) { - try { - TextMessage textMessage = (TextMessage) message; - System.out.println(textMessage.getText()); - } catch (JMSException jmse) { - jmse.printStackTrace(); - } - } - - /* Create and Send Message Using Publisher */ - protected void writeMessage(String text) throws JMSException { - TextMessage message = pubSession.createTextMessage(); - message.setText(username + ": " + text); - publisher.publish(message); - } - - /* Close the JMS Connection */ - public void close() throws JMSException { - connection.close(); - } - - /* Run the Chat Client */ - public static void main(String[] args) { - try { - String username = args[0]; - Chat chat = new Chat("TopicCF", "topic1", username); - - // Read from command line - BufferedReader commandLine = new java.io.BufferedReader( - new InputStreamReader(System.in)); - - // Loop until the word "exit" is typed - while (true) { - String s = commandLine.readLine(); - if (s.equalsIgnoreCase("exit")) { - chat.close(); - System.exit(0); - } else - chat.writeMessage(s); - } - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/jms1/src/main/java/com/training/jms2/MessageReceiver.java b/jms1/src/main/java/com/training/jms2/MessageReceiver.java deleted file mode 100644 index 1899fce..0000000 --- a/jms1/src/main/java/com/training/jms2/MessageReceiver.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.jms2; - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Queue; -import javax.jms.TextMessage; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.stereotype.Component; - -@Component -public class MessageReceiver { - - @Autowired - private JmsTemplate jmsTemplate; - - @Autowired - @Qualifier("statementProcessingQueue") - private Queue statementProcessingQueue; - - public void receiveMessage() throws JMSException - { - Message message = jmsTemplate.receive(statementProcessingQueue); - if (message instanceof TextMessage) - { - TextMessage textMsg = (TextMessage) message; - System.out.println("Message received was " + textMsg.getText()); - } - } - - - -} diff --git a/jms1/src/main/java/com/training/jms2/MessageSender.java b/jms1/src/main/java/com/training/jms2/MessageSender.java deleted file mode 100644 index 81a8f07..0000000 --- a/jms1/src/main/java/com/training/jms2/MessageSender.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.jms2; - -import javax.jms.JMSException; -import javax.jms.Queue; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.stereotype.Component; - -@Component -public class MessageSender -{ - @Autowired - private JmsTemplate jmsTemplate; - - @Autowired - @Qualifier("statementProcessingQueue") - private Queue testQueue; - - public void sendMessage(String message) throws JMSException - { - System.out.println("Sending the message .." + message); - jmsTemplate.convertAndSend(testQueue, message); - } -} \ No newline at end of file diff --git a/jms1/src/main/java/com/training/jms2/TestMessageListener.java b/jms1/src/main/java/com/training/jms2/TestMessageListener.java deleted file mode 100644 index f68ad4b..0000000 --- a/jms1/src/main/java/com/training/jms2/TestMessageListener.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.jms2; - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.TextMessage; - -public class TestMessageListener implements MessageListener { - - public void onMessage(Message message) { - System.out.println("onMessage called"); - - if (message instanceof TextMessage) { - try { - String msgText = ((TextMessage) message).getText(); - System.out.println("Received the message: " + msgText); - } catch (JMSException ex) { - ex.printStackTrace(); - } - } else { - throw new RuntimeException("Message is not of expected type!!"); - } - } - -} diff --git a/jms1/src/main/resources/jndi.properties b/jms1/src/main/resources/jndi.properties deleted file mode 100644 index ff15e27..0000000 --- a/jms1/src/main/resources/jndi.properties +++ /dev/null @@ -1,8 +0,0 @@ -java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory -java.naming.provider.url = tcp://localhost:61616 -java.naming.security.principal=system -java.naming.security.credentials=manager - -connectionFactoryNames = TopicCF -topic.topic1 = jms.topic1 - diff --git a/jms1/src/main/resources/spring-config.xml b/jms1/src/main/resources/spring-config.xml deleted file mode 100644 index 3debea7..0000000 --- a/jms1/src/main/resources/spring-config.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - tcp://localhost:61616 - - - - - - - - - - - - - diff --git a/jms1/src/test/java/com/training/jms2/MessageReceiverTest.java b/jms1/src/test/java/com/training/jms2/MessageReceiverTest.java deleted file mode 100644 index bd9d7c4..0000000 --- a/jms1/src/test/java/com/training/jms2/MessageReceiverTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.jms2; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations="classpath:spring-config.xml") -public class MessageReceiverTest { - - @Autowired - private MessageReceiver receiver; - - @Test - public void testReceive() throws Exception { - receiver.receiveMessage(); - } - -} diff --git a/jms1/src/test/java/com/training/jms2/MessageSenderTest.java b/jms1/src/test/java/com/training/jms2/MessageSenderTest.java deleted file mode 100644 index efdcbcb..0000000 --- a/jms1/src/test/java/com/training/jms2/MessageSenderTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.jms2; - -import java.io.BufferedReader; -import java.io.InputStreamReader; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = "classpath:spring-config.xml") -public class MessageSenderTest { - - @Autowired - private MessageSender messageSender; - - @Test - public void testSend() throws Exception { - - // Read from command line - BufferedReader commandLine = new java.io.BufferedReader(new InputStreamReader(System.in)); - - // Loop until the word "exit" is typed - while (true) { - String stringLine = commandLine.readLine(); - if (stringLine.equalsIgnoreCase("exit")) { - System.exit(0); - } else - messageSender.sendMessage(stringLine); - } - } - -} diff --git a/jpa1/.classpath b/jpa1/.classpath deleted file mode 100644 index 13cc653..0000000 --- a/jpa1/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa1/.project b/jpa1/.project deleted file mode 100644 index 42308b2..0000000 --- a/jpa1/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jpa2 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/jpa1/.settings/org.eclipse.core.resources.prefs b/jpa1/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a..0000000 --- a/jpa1/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/jpa1/.settings/org.eclipse.jdt.core.prefs b/jpa1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8626026..0000000 --- a/jpa1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/jpa1/.settings/org.eclipse.m2e.core.prefs b/jpa1/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/jpa1/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/jpa1/pom.xml b/jpa1/pom.xml deleted file mode 100644 index fccbb7a..0000000 --- a/jpa1/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - 4.0.0 - - com.training - jpa2 - 1.0 - jar - - jpa2 - http://maven.apache.org - - - - - - junit - junit - 4.10 - test - - - - org.hibernate - hibernate-core - 4.1.0.Final - - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - 1.0.1.Final - - - - org.hibernate - hibernate-entitymanager - 4.1.0.Final - - - - com.oracle - ojdbc6 - 11.2.0 - - - - - - diff --git a/jpa1/src/main/java/com/training/jpa1/Publisher.java b/jpa1/src/main/java/com/training/jpa1/Publisher.java deleted file mode 100644 index 4de3532..0000000 --- a/jpa1/src/main/java/com/training/jpa1/Publisher.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.jpa1; - -import java.util.Collection; - -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.SequenceGenerator; - -@Entity -@Access(AccessType.FIELD) -@SequenceGenerator(name = "generator_publisher_id_seq", sequenceName = "publisher_id_seq", allocationSize = 1) -public class Publisher { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator_publisher_id_seq") - private int id; - private String name; - private String address; - private String city; - - @Column(name = "zip_code") - private String zipCode; - - // When FetchType is EAGER, observe that it retrieves the Book details also - // along with the Publisher. - // When FetchType is LAZY (default for Collection types), observe that Book - // details will not be fetched along with the Publisher. When you try to - // first access the books (through getBooks()), then it makes a fresh - // database call and retrieves and the Books. If EntityManager is closed by - // then, it will throw LazyInitializationException. - @OneToMany(mappedBy = "publisher", targetEntity = Book.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY) - private Collection books; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public Collection getBooks() { - return books; - } - - public void setBooks(Collection books) { - this.books = books; - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - - sb.append("Name = " + this.name + "\n"); - sb.append("Address = " + this.address + "\n"); - sb.append("City = " + this.city + "\n"); - sb.append("ZipCode = " + this.zipCode + "\n"); - - return sb.toString(); - } -} diff --git a/jpa1/src/main/java/com/training/jpa1/PublisherDAO.java b/jpa1/src/main/java/com/training/jpa1/PublisherDAO.java deleted file mode 100644 index f4d2102..0000000 --- a/jpa1/src/main/java/com/training/jpa1/PublisherDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.jpa1; - -public interface PublisherDAO { - - void create(Publisher publisher); - Publisher findByName(String name); - -} diff --git a/jpa1/src/main/java/com/training/jpa1/PublisherDAOJPAImpl.java b/jpa1/src/main/java/com/training/jpa1/PublisherDAOJPAImpl.java deleted file mode 100644 index 9f76b5e..0000000 --- a/jpa1/src/main/java/com/training/jpa1/PublisherDAOJPAImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.jpa1; - -import javax.persistence.EntityManager; -import javax.persistence.Query; - -import com.trainig.jpa.util.EntityManagerUtil; - -public class PublisherDAOJPAImpl implements PublisherDAO { - - public void create(Publisher publisher) { - - EntityManager em = EntityManagerUtil.getEMF().createEntityManager(); - em.getTransaction().begin(); - em.persist(publisher); - em.getTransaction().commit(); - } - - public Publisher findByName(String name) { - EntityManager em = EntityManagerUtil.getEMF().createEntityManager(); - - Query query = em.createQuery("select pub from Publisher pub where pub.name = ?"); - query.setParameter(1, name); - - return (Publisher) query.getSingleResult(); - } - -} diff --git a/jpa1/src/main/java/com/training/jpa1/domain/Book.java b/jpa1/src/main/java/com/training/jpa1/domain/Book.java deleted file mode 100644 index 7246bc5..0000000 --- a/jpa1/src/main/java/com/training/jpa1/domain/Book.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.training.jpa1.domain; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.SequenceGenerator; - -@Entity -@Access(AccessType.FIELD) -@SequenceGenerator(name="generator_book_id_seq", sequenceName="book_id_seq", allocationSize=1) -public class Book implements Serializable { - - @Id - @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="generator_book_id_seq") - @Column(name="book_id") - private int id; - private String title; - private String author; - private String isbn; - - @Column(name="number_of_pages") - private int pages; - - @Column(name="pub_date") - private Date publisherDate; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - - public void setPublisherDate(Date publisherDate) { - this.publisherDate = publisherDate; - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - - sb.append("Title = " + this.title + "\n"); - sb.append("Author = " + this.author + "\n"); - sb.append("Pages = " + this.pages + "\n"); - sb.append("Pub. Date = " + this.publisherDate + "\n"); - - return sb.toString(); - } -} diff --git a/jpa1/src/main/java/com/training/jpa1/domain/BookDAO.java b/jpa1/src/main/java/com/training/jpa1/domain/BookDAO.java deleted file mode 100644 index 510d22c..0000000 --- a/jpa1/src/main/java/com/training/jpa1/domain/BookDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.jpa1.domain; - -public interface BookDAO { - - void create(Book book); - Book findByPrimaryKey(int id); - void update(Book book); - void delete(int id); - -} diff --git a/jpa1/src/main/java/com/training/jpa1/domain/BookDAOJPAImpl.java b/jpa1/src/main/java/com/training/jpa1/domain/BookDAOJPAImpl.java deleted file mode 100644 index 4518f09..0000000 --- a/jpa1/src/main/java/com/training/jpa1/domain/BookDAOJPAImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.jpa1.domain; - -import javax.persistence.EntityManager; - -import com.training.jpa1.util.EntityManagerUtil; - -public class BookDAOJPAImpl implements BookDAO { - - public void create(Book book) { - - EntityManager em = EntityManagerUtil.getEMF().createEntityManager(); - em.getTransaction().begin(); - em.persist(book); - em.getTransaction().commit(); - } - - public Book findByPrimaryKey(int id) { - EntityManager em = EntityManagerUtil.getEMF().createEntityManager(); - return em.find(Book.class, id); - } - - public void update(Book book) { - EntityManager em = EntityManagerUtil.getEMF().createEntityManager(); - - em.getTransaction().begin(); - em.merge(book); - em.getTransaction().commit(); - - } - - public void delete(int id) { - EntityManager em = EntityManagerUtil.getEMF().createEntityManager(); - - Book book = em.find(Book.class, id); - - em.getTransaction().begin(); - em.remove(book); - em.getTransaction().commit(); - } -} diff --git a/jpa1/src/main/java/com/training/jpa1/util/EntityManagerUtil.java b/jpa1/src/main/java/com/training/jpa1/util/EntityManagerUtil.java deleted file mode 100644 index 92b092d..0000000 --- a/jpa1/src/main/java/com/training/jpa1/util/EntityManagerUtil.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.jpa1.util; - -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; - -public class EntityManagerUtil { - - private static EntityManagerFactory emf = null; - - static - { - emf = Persistence.createEntityManagerFactory("bookStore"); - } - - public static EntityManagerFactory getEMF() - { - return emf; - } - -} diff --git a/jpa1/src/main/java/com/training/jpa1/util/package-info.java b/jpa1/src/main/java/com/training/jpa1/util/package-info.java deleted file mode 100644 index 8255b62..0000000 --- a/jpa1/src/main/java/com/training/jpa1/util/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Venkata - * - */ -package com.training.jpa1.util; \ No newline at end of file diff --git a/jpa1/src/main/resources/META-INF/persistence.xml b/jpa1/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index a66bc32..0000000 --- a/jpa1/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - org.hibernate.ejb.HibernatePersistence - - com.training.jpa1.Book - - - - - - - - - - - - - \ No newline at end of file diff --git a/jpa1/src/test/java/com/training/jpa1/PublisherDAOJPAImplTest.java b/jpa1/src/test/java/com/training/jpa1/PublisherDAOJPAImplTest.java deleted file mode 100644 index 7b9007e..0000000 --- a/jpa1/src/test/java/com/training/jpa1/PublisherDAOJPAImplTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.jpa1; - -import org.junit.Ignore; -import org.junit.Test; - -public class PublisherDAOJPAImplTest { - - @Test - public void testFindByName() { - PublisherDAO dao = new PublisherDAOJPAImpl(); - Publisher publisher = dao.findByName("Orielly"); - - System.out.println("Publisher = " + publisher); - System.out.println("Books = " + publisher.getBooks()); - } - - @Ignore - public void testCreate() { - - Publisher publisher = new Publisher(); - - publisher.setName("Apple Press"); - publisher.setAddress("One Infinite Loop"); - publisher.setCity("Cupertino"); - publisher.setZipCode("12345"); - - PublisherDAO dao = new PublisherDAOJPAImpl(); - dao.create(publisher); - } - -} diff --git a/jpa1/src/test/java/com/training/jpa1/domain/BookDAOJPAImplTest.java b/jpa1/src/test/java/com/training/jpa1/domain/BookDAOJPAImplTest.java deleted file mode 100644 index 4734647..0000000 --- a/jpa1/src/test/java/com/training/jpa1/domain/BookDAOJPAImplTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.jpa1.domain; - -import java.util.Date; - -import org.junit.Ignore; -import org.junit.Test; - -import com.training.jpa1.domain.Book; -import com.training.jpa1.domain.BookDAO; -import com.training.jpa1.domain.BookDAOJPAImpl; - -public class BookDAOJPAImplTest { - - @Ignore - public void testCreate() throws Exception { - - BookDAO dao = new BookDAOJPAImpl(); - - Book book = new Book(); - book.setAuthor("Cathy Sierra"); - book.setTitle("Head First Java"); - book.setIsbn("987654"); - book.setPages(321); - book.setPublisherDate(new Date()); - - dao.create(book); - } - - @Test - public void testFindByPrimaryKey() throws Exception { - - BookDAO dao = new BookDAOJPAImpl(); - - Book book = dao.findByPrimaryKey(4); - - System.out.println("book = " + book); - } - - @Test - public void testUpdate() throws Exception { - - BookDAO dao = new BookDAOJPAImpl(); - - Book book = dao.findByPrimaryKey(4); - - book.setAuthor("Cathy Sierra & Bert Bates"); - - dao.update(book); - } - - @Test - public void testDelete() throws Exception { - BookDAO dao = new BookDAOJPAImpl(); - dao.delete(4); - } - -} diff --git a/jpa2/.classpath b/jpa2/.classpath deleted file mode 100644 index 13cc653..0000000 --- a/jpa2/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa2/.project b/jpa2/.project deleted file mode 100644 index db34bda..0000000 --- a/jpa2/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - springjpa1 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/jpa2/.settings/org.eclipse.core.resources.prefs b/jpa2/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a..0000000 --- a/jpa2/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/jpa2/.settings/org.eclipse.jdt.core.prefs b/jpa2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8626026..0000000 --- a/jpa2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/jpa2/.settings/org.eclipse.m2e.core.prefs b/jpa2/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/jpa2/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/jpa2/.springBeans b/jpa2/.springBeans deleted file mode 100644 index c2332e7..0000000 --- a/jpa2/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/jpa2/pom.xml b/jpa2/pom.xml deleted file mode 100644 index dbc6888..0000000 --- a/jpa2/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - 4.0.0 - - com.training - springjpa1 - 1.0 - jar - - springjpa1 - http://maven.apache.org - - - - - - junit - junit - 4.10 - test - - - - org.springframework - spring-orm - 3.1.2.RELEASE - - - - org.springframework - spring-test - 3.1.2.RELEASE - - - - org.hibernate - hibernate-core - 4.1.0.Final - - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - 1.0.1.Final - - - - org.hibernate - hibernate-entitymanager - 4.1.0.Final - - - - com.oracle - ojdbc6 - 11.2.0 - - - - commons-dbcp - commons-dbcp - 1.4 - - - - - - diff --git a/jpa2/src/main/java/com/training/jpa2/domain/Book.java b/jpa2/src/main/java/com/training/jpa2/domain/Book.java deleted file mode 100644 index eddf892..0000000 --- a/jpa2/src/main/java/com/training/jpa2/domain/Book.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.training.jpa2.domain; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; - -@Entity -@Access(AccessType.FIELD) -@SequenceGenerator(name = "generator_book_id_seq", sequenceName = "book_id_seq", allocationSize = 1) -public class Book implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator_book_id_seq") - @Column(name = "book_id") - private int id; - private String title; - private String author; - private String isbn; - - @Column(name = "number_of_pages") - private int pages; - - @Column(name = "pub_date") - private Date publisherDate; - - @ManyToOne(cascade=CascadeType.ALL) - @JoinColumn(name = "publisher_id", referencedColumnName = "id") - private Publisher publisher; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - - public void setPublisherDate(Date publisherDate) { - this.publisherDate = publisherDate; - } - - public Publisher getPublisher() { - return publisher; - } - - public void setPublisher(Publisher publisher) { - this.publisher = publisher; - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - - sb.append("Title = " + this.title + "\n"); - sb.append("Author = " + this.author + "\n"); - sb.append("Pages = " + this.pages + "\n"); - sb.append("Pub. Date = " + this.publisherDate + "\n"); - - return sb.toString(); - } -} diff --git a/jpa2/src/main/java/com/training/jpa2/domain/BookDAO.java b/jpa2/src/main/java/com/training/jpa2/domain/BookDAO.java deleted file mode 100644 index b9fd0e9..0000000 --- a/jpa2/src/main/java/com/training/jpa2/domain/BookDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.jpa2.domain; - -public interface BookDAO { - - void create(Book book); - Book findByPrimaryKey(int id); - void update(Book book); - void delete(int id); - -} diff --git a/jpa2/src/main/java/com/training/jpa2/domain/BookDAOJPAImpl.java b/jpa2/src/main/java/com/training/jpa2/domain/BookDAOJPAImpl.java deleted file mode 100644 index a4ae8f4..0000000 --- a/jpa2/src/main/java/com/training/jpa2/domain/BookDAOJPAImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.jpa2.domain; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; - -import org.springframework.stereotype.Repository; - -@Repository -public class BookDAOJPAImpl implements BookDAO { - - @PersistenceContext - private EntityManager em; - - public void create(Book book) { - em.persist(book); - } - - public Book findByPrimaryKey(int id) { - return em.find(Book.class, id); - } - - public void update(Book book) { - em.merge(book); - } - - public void delete(int id) { - Book book = em.find(Book.class, id); - em.remove(book); - } -} diff --git a/jpa2/src/main/java/com/training/jpa2/domain/Publisher.java b/jpa2/src/main/java/com/training/jpa2/domain/Publisher.java deleted file mode 100644 index 1bd664b..0000000 --- a/jpa2/src/main/java/com/training/jpa2/domain/Publisher.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.jpa2.domain; - -import java.util.Collection; - -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.SequenceGenerator; - -@Entity -@Access(AccessType.FIELD) -@SequenceGenerator(name = "generator_publisher_id_seq", sequenceName = "publisher_id_seq", allocationSize = 1) -public class Publisher { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator_publisher_id_seq") - private int id; - private String name; - private String address; - private String city; - - @Column(name = "zip_code") - private String zipCode; - - // When FetchType is EAGER, observe that it retrieves the Book details also - // along with the Publisher. - // When FetchType is LAZY (default for Collection types), observe that Book - // details will not be fetched along with the Publisher. When you try to - // first access the books (through getBooks()), then it makes a fresh - // database call and retrieves and the Books. If EntityManager is closed by - // then, it will throw LazyInitializationException. - @OneToMany(mappedBy = "publisher", targetEntity = Book.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY) - private Collection books; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public Collection getBooks() { - return books; - } - - public void setBooks(Collection books) { - this.books = books; - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - - sb.append("Name = " + this.name + "\n"); - sb.append("Address = " + this.address + "\n"); - sb.append("City = " + this.city + "\n"); - sb.append("ZipCode = " + this.zipCode + "\n"); - - return sb.toString(); - } -} diff --git a/jpa2/src/main/java/com/training/jpa2/domain/PublisherDAO.java b/jpa2/src/main/java/com/training/jpa2/domain/PublisherDAO.java deleted file mode 100644 index 38d855d..0000000 --- a/jpa2/src/main/java/com/training/jpa2/domain/PublisherDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.jpa2.domain; - -public interface PublisherDAO { - - void create(Publisher publisher); - Publisher findByName(String name); - -} diff --git a/jpa2/src/main/java/com/training/jpa2/domain/PublisherDAOJPAImpl.java b/jpa2/src/main/java/com/training/jpa2/domain/PublisherDAOJPAImpl.java deleted file mode 100644 index 34f91c8..0000000 --- a/jpa2/src/main/java/com/training/jpa2/domain/PublisherDAOJPAImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.jpa2.domain; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; - -import org.springframework.stereotype.Repository; - -@Repository -public class PublisherDAOJPAImpl implements PublisherDAO { - - @PersistenceContext(unitName="bookStore") - private EntityManager em; - - public void create(Publisher publisher) { - em.persist(publisher); - } - - public Publisher findByName(String name) { - - Query query = em.createQuery("select pub from Publisher pub where pub.name = ?"); - query.setParameter(1, name); - - return (Publisher) query.getSingleResult(); - } - -} diff --git a/jpa2/src/main/java/com/training/jpa2/domain/PublisherService.java b/jpa2/src/main/java/com/training/jpa2/domain/PublisherService.java deleted file mode 100644 index 697ce7a..0000000 --- a/jpa2/src/main/java/com/training/jpa2/domain/PublisherService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.jpa2.domain; - -public interface PublisherService { - - void create(Publisher publisher); - -} diff --git a/jpa2/src/main/java/com/training/jpa2/domain/PublisherServiceImpl.java b/jpa2/src/main/java/com/training/jpa2/domain/PublisherServiceImpl.java deleted file mode 100644 index cfd7e00..0000000 --- a/jpa2/src/main/java/com/training/jpa2/domain/PublisherServiceImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.jpa2.domain; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class PublisherServiceImpl implements PublisherService { - - @Autowired - private PublisherDAO dao; - - @Transactional - public void create(Publisher publisher) { - dao.create(publisher); - } - -} diff --git a/jpa2/src/main/java/com/training/jpa2/domain/package-info.java b/jpa2/src/main/java/com/training/jpa2/domain/package-info.java deleted file mode 100644 index c385699..0000000 --- a/jpa2/src/main/java/com/training/jpa2/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Venkata - * - */ -package com.training.jpa2.domain; \ No newline at end of file diff --git a/jpa2/src/main/resources/META-INF/persistence.xml b/jpa2/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index fff9c97..0000000 --- a/jpa2/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - org.hibernate.ejb.HibernatePersistence - - - - - - - - - - - - - \ No newline at end of file diff --git a/jpa2/src/main/resources/spring-config.xml b/jpa2/src/main/resources/spring-config.xml deleted file mode 100644 index 4f58f8b..0000000 --- a/jpa2/src/main/resources/spring-config.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa2/src/test/java/com/training/jpa2/domain/BookDAOJPAImplTest.java b/jpa2/src/test/java/com/training/jpa2/domain/BookDAOJPAImplTest.java deleted file mode 100644 index 5e83407..0000000 --- a/jpa2/src/test/java/com/training/jpa2/domain/BookDAOJPAImplTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.training.jpa2.domain; - -import java.util.Date; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations="classpath:spring-config.xml") -public class BookDAOJPAImplTest { - - @Autowired - private BookDAO dao; - - @Ignore - public void testCreate() throws Exception { - - Book book = new Book(); - book.setAuthor("Cathy Sierra"); - book.setTitle("Head First Java"); - book.setIsbn("987654"); - book.setPages(321); - book.setPublisherDate(new Date()); - - // If Cascade persist or Cascade ALL if ON, if this publisher doesn't - // exist, it will create a new publisher first and then inserts its key in book table - Publisher publisher = new Publisher(); - - publisher.setName("Orielly"); - publisher.setAddress("1234 Main St"); - publisher.setCity("Troy"); - publisher.setZipCode("48084"); - - book.setPublisher(publisher); - - dao.create(book); - } - - @Ignore - public void testFindByPrimaryKey() throws Exception { - - Book book = dao.findByPrimaryKey(7); - - System.out.println("book = " + book); - System.out.println("Publisher = " + book.getPublisher()); - } - - @Test - public void testUpdate() throws Exception { - - Book book = dao.findByPrimaryKey(7); - - book.setAuthor("Cathy Sierra & Bert Bates"); - - dao.update(book); - } - - @Ignore - public void testDelete() throws Exception { - dao.delete(4); - } - -} diff --git a/jpa2/src/test/java/com/training/jpa2/domain/PublisherDAOJPAImplTest.java b/jpa2/src/test/java/com/training/jpa2/domain/PublisherDAOJPAImplTest.java deleted file mode 100644 index 43c0235..0000000 --- a/jpa2/src/test/java/com/training/jpa2/domain/PublisherDAOJPAImplTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.jpa2.domain; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations="classpath:spring-config.xml") -public class PublisherDAOJPAImplTest { - - @Autowired - private PublisherDAO dao; - - @Test - public void testFindByName() { - Publisher publisher = dao.findByName("Orielly"); - - System.out.println("Publisher = " + publisher); - System.out.println("Books = " + publisher.getBooks()); - } - - @Ignore - public void testCreate() { - - Publisher publisher = new Publisher(); - - publisher.setName("Apple Press"); - publisher.setAddress("One Infinite Loop"); - publisher.setCity("Cupertino"); - publisher.setZipCode("12345"); - - dao.create(publisher); - } - -} diff --git a/jpa2/src/test/java/com/training/jpa2/domain/PublisherServiceImplTest.java b/jpa2/src/test/java/com/training/jpa2/domain/PublisherServiceImplTest.java deleted file mode 100644 index a6e09e6..0000000 --- a/jpa2/src/test/java/com/training/jpa2/domain/PublisherServiceImplTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.jpa2.domain; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations="classpath:spring-config.xml") -public class PublisherServiceImplTest { - - @Autowired - private PublisherService service; - - @Test - public void testCreate() { - - Publisher publisher = new Publisher(); - - publisher.setName("Oracle Press"); - publisher.setAddress("2 Oracle drive"); - publisher.setCity("MountainView"); - publisher.setZipCode("98765"); - - service.create(publisher); - } - -} diff --git a/jquery/.classpath b/jquery/.classpath deleted file mode 100644 index 26b8264..0000000 --- a/jquery/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/jquery/.project b/jquery/.project deleted file mode 100644 index 62a9159..0000000 --- a/jquery/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - jquery - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/jquery/.settings/.jsdtscope b/jquery/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/jquery/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jquery/.settings/org.eclipse.jdt.core.prefs b/jquery/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 295926d..0000000 --- a/jquery/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/jquery/.settings/org.eclipse.wst.common.component b/jquery/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 8ead6b8..0000000 --- a/jquery/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/jquery/.settings/org.eclipse.wst.common.project.facet.core.xml b/jquery/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 1fd6a47..0000000 --- a/jquery/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/jquery/.settings/org.eclipse.wst.jsdt.ui.superType.container b/jquery/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/jquery/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/jquery/.settings/org.eclipse.wst.jsdt.ui.superType.name b/jquery/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/jquery/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/jquery/WebContent/META-INF/MANIFEST.MF b/jquery/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/jquery/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/jquery/WebContent/WEB-INF/web.xml b/jquery/WebContent/WEB-INF/web.xml deleted file mode 100644 index 8b29999..0000000 --- a/jquery/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - jquery - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - \ No newline at end of file diff --git a/jquery/WebContent/jQuery1.html b/jquery/WebContent/jQuery1.html deleted file mode 100644 index a24d3f6..0000000 --- a/jquery/WebContent/jQuery1.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - -Insert title here - - - - - - -

      Welcome to our store

      - -

      Hope you are doing good.

      - -
      -

      Fruits

      -
        -
      • Banana
      • -
      • Apple
      • -
      • Orange
      • -
      • Watermelon
      • -
      -
      - - - - - - - - - - - - - \ No newline at end of file diff --git a/jquery/WebContent/main.js b/jquery/WebContent/main.js deleted file mode 100644 index 661976e..0000000 --- a/jquery/WebContent/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * - */ - -$(document).ready(function() { - - $('#fruitsDiv').hide(); - - $('button').on('click', function() { - - $('h1#greeting').html("Changed Text"); - - }); - - $('button#removeGreeting').on('click', function() { - - $('h1#greeting').remove(); - - }); - - $('button#changeCSS').on('click', function() { - - console.log($('h1#greeting2').css('background-color')); - - $('h1#greeting2').css({ - 'color' : 'red', - 'background-color' : 'blue' - }); - }); - - $('button#changeAttributes').on('click', function() { - - $('h1#greeting').attr('align', 'center'); - - }); - - $('button#changeColorForFirst').on('click', function() { - - $('li:first').css('color', 'blue'); - - }); - - $('button#showFruits').on('click', function() { - - $('#fruitsDiv').slideDown(1000).delay(800).fadeIn(400); - - }); - - $('button#addLast').on('click', function() { - - var grapes = $('
    • Grapes
    • '); - - $('li:last').prev().prev().append(grapes); - - }); - - - - - - - -}); - - diff --git a/jsp-el/.classpath b/jsp-el/.classpath deleted file mode 100644 index 78413a7..0000000 --- a/jsp-el/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/jsp-el/.project b/jsp-el/.project deleted file mode 100644 index d7413e0..0000000 --- a/jsp-el/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - jsp-el - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/jsp-el/.settings/.jsdtscope b/jsp-el/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/jsp-el/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jsp-el/.settings/org.eclipse.jdt.core.prefs b/jsp-el/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 266434f..0000000 --- a/jsp-el/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sun Feb 12 09:40:56 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/jsp-el/.settings/org.eclipse.wst.common.component b/jsp-el/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 66c91e7..0000000 --- a/jsp-el/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/jsp-el/.settings/org.eclipse.wst.common.project.facet.core.xml b/jsp-el/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index afe9e5e..0000000 --- a/jsp-el/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/jsp-el/.settings/org.eclipse.wst.jsdt.ui.superType.container b/jsp-el/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/jsp-el/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/jsp-el/.settings/org.eclipse.wst.jsdt.ui.superType.name b/jsp-el/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/jsp-el/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/jsp-el/WebContent/META-INF/MANIFEST.MF b/jsp-el/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/jsp-el/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/jsp-el/WebContent/WEB-INF/student.jsp b/jsp-el/WebContent/WEB-INF/student.jsp deleted file mode 100644 index c121fd6..0000000 --- a/jsp-el/WebContent/WEB-INF/student.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<%@page import="com.training.java.mvc1.domain.Student"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - First name from EL : ${student.firstName}
      - Last name from EL : ${student.lastName}
      - City from EL : ${student.city}
      - - State from EL : ${param.state}
      - Country from EL : ${param.country}
      - - <% - String state = request.getParameter("state"); - String country = request.getParameter("country"); - %> - - State : <%=state %>
      - Country : <%=country %>
      - - First name from EL in request scope : ${sessionScope.student.firstName}
      - Last name from EL in request scope : ${requestScope.student.lastName}
      - City from EL in request scope : ${requestScope.student.city}
      - - Street from session scope : ${sessionScope.street}
      - - Second student details : ${students[1].lastName} - - - \ No newline at end of file diff --git a/jsp-el/WebContent/WEB-INF/web.xml b/jsp-el/WebContent/WEB-INF/web.xml deleted file mode 100644 index a5baf00..0000000 --- a/jsp-el/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - jsp-el - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - StudentServlet - StudentServlet - com.training.java.jspel.web.StudentServlet - - - StudentServlet - /student - - \ No newline at end of file diff --git a/jsp-el/lib/junit-4.8.2.jar b/jsp-el/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/jsp-el/lib/junit-4.8.2.jar and /dev/null differ diff --git a/jsp-el/src/com/training/java/jspel/web/StudentServlet.java b/jsp-el/src/com/training/java/jspel/web/StudentServlet.java deleted file mode 100644 index 40999e2..0000000 --- a/jsp-el/src/com/training/java/jspel/web/StudentServlet.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.training.java.jspel.web; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.mvc1.domain.Student; -import com.training.java.mvc1.domain.StudentService; - -/** - * Servlet implementation class StudentServlet - */ -public class StudentServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public StudentServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - Student student = new Student(); - - student.setFirstName("Sasi"); - student.setLastName("Raj Kumar"); - student.setCity("Troy"); - - request.setAttribute("student", student); - - HttpSession session = request.getSession(); - session.setAttribute("street", "Corporate Dr"); - - List students = new ArrayList(); - - students.add(student); - - Student student2 = new Student(); - student2.setFirstName("Ronnie"); - student2.setLastName("Mac"); - student2.setCity("Rochester"); - - students.add(student2); - - request.setAttribute("students", students); - - RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/student.jsp"); - dispatcher.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/jsp-el/src/com/training/java/mvc1/domain/DAOException.java b/jsp-el/src/com/training/java/mvc1/domain/DAOException.java deleted file mode 100644 index 9752b9c..0000000 --- a/jsp-el/src/com/training/java/mvc1/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.mvc1.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/jsp-el/src/com/training/java/mvc1/domain/Student.java b/jsp-el/src/com/training/java/mvc1/domain/Student.java deleted file mode 100644 index 345b8ca..0000000 --- a/jsp-el/src/com/training/java/mvc1/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.mvc1.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/jsp-el/src/com/training/java/mvc1/domain/StudentDAO.java b/jsp-el/src/com/training/java/mvc1/domain/StudentDAO.java deleted file mode 100644 index 35b6ea4..0000000 --- a/jsp-el/src/com/training/java/mvc1/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.util.List; - -interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/jsp-el/src/com/training/java/mvc1/domain/StudentDAOJDBCImpl.java b/jsp-el/src/com/training/java/mvc1/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index 9a3b90e..0000000 --- a/jsp-el/src/com/training/java/mvc1/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/jsp-el/src/com/training/java/mvc1/domain/StudentDAOJDBCImplTest.java b/jsp-el/src/com/training/java/mvc1/domain/StudentDAOJDBCImplTest.java deleted file mode 100644 index 999e05d..0000000 --- a/jsp-el/src/com/training/java/mvc1/domain/StudentDAOJDBCImplTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.util.List; - -import org.junit.Ignore; -import org.junit.Test; - -public class StudentDAOJDBCImplTest { - - @Test - public void testGetAllStudents() { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - List students = dao.getAllStudents(); - - for(Student current : students) - { - System.out.println(current); - } - } - - @Ignore - public void testCreateStudent(){ - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - - Student student = new Student(); - student.setAge(20); - student.setCity("Sterling Heights"); - student.setEmail("priya@gmail.com"); - student.setFirstName("Priya"); - student.setId(7); - student.setLastName("Patel"); - student.setPhoneNumber("248-238-9874"); - - dao.create(student); - - //assert that your student is created - - //delete the student that you just created - } - -} diff --git a/jsp-el/src/com/training/java/mvc1/domain/StudentService.java b/jsp-el/src/com/training/java/mvc1/domain/StudentService.java deleted file mode 100644 index 4a67bd5..0000000 --- a/jsp-el/src/com/training/java/mvc1/domain/StudentService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.util.List; - -public interface StudentService { - - List getAllStudents(); - void addStudent(Student student); - -} diff --git a/jsp-el/src/com/training/java/mvc1/domain/StudentServiceImpl.java b/jsp-el/src/com/training/java/mvc1/domain/StudentServiceImpl.java deleted file mode 100644 index 56cc233..0000000 --- a/jsp-el/src/com/training/java/mvc1/domain/StudentServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.util.List; - -public class StudentServiceImpl implements StudentService { - - @Override - public void addStudent(Student student) { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - dao.create(student); - - } - - @Override - public List getAllStudents() { - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - return dao.getAllStudents(); - } -} diff --git a/jsp-standardactions/.classpath b/jsp-standardactions/.classpath deleted file mode 100644 index 700a9c5..0000000 --- a/jsp-standardactions/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/jsp-standardactions/.project b/jsp-standardactions/.project deleted file mode 100644 index 3b2de54..0000000 --- a/jsp-standardactions/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - jsp-standardactions - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/jsp-standardactions/.settings/.jsdtscope b/jsp-standardactions/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/jsp-standardactions/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jsp-standardactions/.settings/org.eclipse.jdt.core.prefs b/jsp-standardactions/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 5d2f90c..0000000 --- a/jsp-standardactions/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Feb 16 18:52:12 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/jsp-standardactions/.settings/org.eclipse.wst.common.component b/jsp-standardactions/.settings/org.eclipse.wst.common.component deleted file mode 100644 index a72892a..0000000 --- a/jsp-standardactions/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/jsp-standardactions/.settings/org.eclipse.wst.common.project.facet.core.xml b/jsp-standardactions/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d62d1e5..0000000 --- a/jsp-standardactions/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/jsp-standardactions/.settings/org.eclipse.wst.jsdt.ui.superType.container b/jsp-standardactions/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/jsp-standardactions/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/jsp-standardactions/.settings/org.eclipse.wst.jsdt.ui.superType.name b/jsp-standardactions/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/jsp-standardactions/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/jsp-standardactions/WebContent/META-INF/MANIFEST.MF b/jsp-standardactions/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/jsp-standardactions/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/jsp-standardactions/WebContent/WEB-INF/student.jsp b/jsp-standardactions/WebContent/WEB-INF/student.jsp deleted file mode 100644 index 5b7eb09..0000000 --- a/jsp-standardactions/WebContent/WEB-INF/student.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

      Student Details :

      - - -First Name :
      -Last Name :
      -City :
      - - - \ No newline at end of file diff --git a/jsp-standardactions/WebContent/WEB-INF/web.xml b/jsp-standardactions/WebContent/WEB-INF/web.xml deleted file mode 100644 index 32b91fe..0000000 --- a/jsp-standardactions/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - jsp-el - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - StudentServlet - StudentServlet - com.training.java.jsp.actions.web.StudentServlet - - - StudentServlet - /student - - \ No newline at end of file diff --git a/jsp-standardactions/src/com/training/java/jsp/actions/domain/DAOException.java b/jsp-standardactions/src/com/training/java/jsp/actions/domain/DAOException.java deleted file mode 100644 index a705ed6..0000000 --- a/jsp-standardactions/src/com/training/java/jsp/actions/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.jsp.actions.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/jsp-standardactions/src/com/training/java/jsp/actions/domain/Student.java b/jsp-standardactions/src/com/training/java/jsp/actions/domain/Student.java deleted file mode 100644 index 4507d76..0000000 --- a/jsp-standardactions/src/com/training/java/jsp/actions/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.jsp.actions.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentDAO.java b/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentDAO.java deleted file mode 100644 index 46bf3ff..0000000 --- a/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.jsp.actions.domain; - -import java.util.List; - -interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentDAOJDBCImpl.java b/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index be129d5..0000000 --- a/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.jsp.actions.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentService.java b/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentService.java deleted file mode 100644 index 87f1bd5..0000000 --- a/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.jsp.actions.domain; - -import java.util.List; - -public interface StudentService { - - List getAllStudents(); - void addStudent(Student student); - -} diff --git a/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentServiceImpl.java b/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentServiceImpl.java deleted file mode 100644 index c3c2258..0000000 --- a/jsp-standardactions/src/com/training/java/jsp/actions/domain/StudentServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.jsp.actions.domain; - -import java.util.List; - -public class StudentServiceImpl implements StudentService { - - @Override - public void addStudent(Student student) { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - dao.create(student); - - } - - @Override - public List getAllStudents() { - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - return dao.getAllStudents(); - } -} diff --git a/jsp-standardactions/src/com/training/java/jsp/actions/web/StudentServlet.java b/jsp-standardactions/src/com/training/java/jsp/actions/web/StudentServlet.java deleted file mode 100644 index f1fcc40..0000000 --- a/jsp-standardactions/src/com/training/java/jsp/actions/web/StudentServlet.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.training.java.jsp.actions.web; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.jsp.actions.domain.Student; -import com.training.java.jsp.actions.domain.StudentService; - -/** - * Servlet implementation class StudentServlet - */ -public class StudentServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public StudentServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - Student student = new Student(); - - student.setFirstName("Sasi"); - student.setLastName("Raj Kumar"); - student.setCity("Troy"); - - request.setAttribute("student", student); - - HttpSession session = request.getSession(); - session.setAttribute("street", "Corporate Dr"); - - List students = new ArrayList(); - - students.add(student); - - Student student2 = new Student(); - student2.setFirstName("Ronnie"); - student2.setLastName("Mac"); - student2.setCity("Rochester"); - - students.add(student2); - - request.setAttribute("students", students); - - RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/student.jsp"); - dispatcher.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/jsp1/.classpath b/jsp1/.classpath deleted file mode 100644 index 78413a7..0000000 --- a/jsp1/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/jsp1/.project b/jsp1/.project deleted file mode 100644 index 2b975cb..0000000 --- a/jsp1/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - jsp1 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/jsp1/.settings/.jsdtscope b/jsp1/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/jsp1/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jsp1/.settings/org.eclipse.jdt.core.prefs b/jsp1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 50d77e3..0000000 --- a/jsp1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sat Feb 11 08:16:46 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/jsp1/.settings/org.eclipse.wst.common.component b/jsp1/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 6333641..0000000 --- a/jsp1/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/jsp1/.settings/org.eclipse.wst.common.project.facet.core.xml b/jsp1/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index a5f10cb..0000000 --- a/jsp1/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/jsp1/.settings/org.eclipse.wst.jsdt.ui.superType.container b/jsp1/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/jsp1/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/jsp1/.settings/org.eclipse.wst.jsdt.ui.superType.name b/jsp1/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/jsp1/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/jsp1/WebContent/META-INF/MANIFEST.MF b/jsp1/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/jsp1/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/jsp1/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar b/jsp1/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar deleted file mode 100644 index cdee6a1..0000000 Binary files a/jsp1/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar and /dev/null differ diff --git a/jsp1/WebContent/WEB-INF/web.xml b/jsp1/WebContent/WEB-INF/web.xml deleted file mode 100644 index 0247dae..0000000 --- a/jsp1/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - jsp1 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - \ No newline at end of file diff --git a/jsp1/WebContent/errorPage.jsp b/jsp1/WebContent/errorPage.jsp deleted file mode 100644 index 64ab6d0..0000000 --- a/jsp1/WebContent/errorPage.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@ page isErrorPage="true" %> - - - - - -Insert title here - - - -<% - - exception.printStackTrace(); - -%> - - -

      An unknown eroor occured, please contact us at 1800-800-8001

      - - - \ No newline at end of file diff --git a/jsp1/WebContent/footer.jsp b/jsp1/WebContent/footer.jsp deleted file mode 100644 index a0b1637..0000000 --- a/jsp1/WebContent/footer.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - -

      Please contact us at manpreet@javatraining.com

      - - - - \ No newline at end of file diff --git a/jsp1/WebContent/index.jsp b/jsp1/WebContent/index.jsp deleted file mode 100644 index 16daf3e..0000000 --- a/jsp1/WebContent/index.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@page import="java.util.Date"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - - -Insert title here - - - - <% - Date todaysDate = new Date(); - System.out.println("Today's date = " + todaysDate); - - String firstName = request.getParameter("fn"); - String lastName = request.getParameter("ln"); - - out.println("Hi " + lastName + " , " + firstName); - %> - -

      Welcome to my page!

      - - Today's date is : <%= new Date() %> - - -<%@ include file="footer.jsp" %> - - \ No newline at end of file diff --git a/jsp1/WebContent/liststudents.jsp b/jsp1/WebContent/liststudents.jsp deleted file mode 100644 index 74ce72f..0000000 --- a/jsp1/WebContent/liststudents.jsp +++ /dev/null @@ -1,57 +0,0 @@ -<%@page import="java.util.Date"%> -<%@page import="com.training.java.jsp1.domain.Student"%> -<%@page import="java.util.List"%> -<%@page import="com.training.java.jsp1.domain.StudentDAOJDBCImpl"%> -<%@page import="com.training.java.jsp1.domain.StudentDAO"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@ page errorPage="errorPage.jsp" %> - - - - - -Insert title here - - - -<%! - - public Date getCurrentDate() -{ - return new Date(); -} - -%> - - Current date = <%=getCurrentDate() %> - - - - - - - - <% - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - List students = dao.getAllStudents(); - - for (Student current : students) { - %> - - - - - - - - <% - } - %> -
      First NameLast NamePhone Number
      <%= current.getFirstName() %> <%= current.getLastName() %> <%= current.getPhoneNumber() %>
      - -<%@ include file="footer.jsp" %> - - \ No newline at end of file diff --git a/jsp1/lib/junit-4.8.2.jar b/jsp1/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/jsp1/lib/junit-4.8.2.jar and /dev/null differ diff --git a/jsp1/src/com/training/java/jsp1/domain/DAOException.java b/jsp1/src/com/training/java/jsp1/domain/DAOException.java deleted file mode 100644 index b1121f6..0000000 --- a/jsp1/src/com/training/java/jsp1/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.jsp1.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/jsp1/src/com/training/java/jsp1/domain/Student.java b/jsp1/src/com/training/java/jsp1/domain/Student.java deleted file mode 100644 index ff74dd2..0000000 --- a/jsp1/src/com/training/java/jsp1/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.jsp1.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/jsp1/src/com/training/java/jsp1/domain/StudentDAO.java b/jsp1/src/com/training/java/jsp1/domain/StudentDAO.java deleted file mode 100644 index 17f8b55..0000000 --- a/jsp1/src/com/training/java/jsp1/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.jsp1.domain; - -import java.util.List; - -public interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/jsp1/src/com/training/java/jsp1/domain/StudentDAOJDBCImpl.java b/jsp1/src/com/training/java/jsp1/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index 567138d..0000000 --- a/jsp1/src/com/training/java/jsp1/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.jsp1.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/jsp1/src/com/training/java/jsp1/domain/StudentDAOJDBCImplTest.java b/jsp1/src/com/training/java/jsp1/domain/StudentDAOJDBCImplTest.java deleted file mode 100644 index fe1db4a..0000000 --- a/jsp1/src/com/training/java/jsp1/domain/StudentDAOJDBCImplTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.java.jsp1.domain; - -import java.util.List; - -import org.junit.Ignore; -import org.junit.Test; - -public class StudentDAOJDBCImplTest { - - @Test - public void testGetAllStudents() { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - List students = dao.getAllStudents(); - - for(Student current : students) - { - System.out.println(current); - } - } - - @Ignore - public void testCreateStudent(){ - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - - Student student = new Student(); - student.setAge(20); - student.setCity("Sterling Heights"); - student.setEmail("priya@gmail.com"); - student.setFirstName("Priya"); - student.setId(7); - student.setLastName("Patel"); - student.setPhoneNumber("248-238-9874"); - - dao.create(student); - - //assert that your student is created - - //delete the student that you just created - } - -} diff --git a/jsp2/.classpath b/jsp2/.classpath deleted file mode 100644 index 700a9c5..0000000 --- a/jsp2/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/jsp2/.project b/jsp2/.project deleted file mode 100644 index d163596..0000000 --- a/jsp2/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - jsp2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/jsp2/.settings/.jsdtscope b/jsp2/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/jsp2/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jsp2/.settings/org.eclipse.jdt.core.prefs b/jsp2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8f02daf..0000000 --- a/jsp2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sat Feb 11 09:42:43 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/jsp2/.settings/org.eclipse.wst.common.component b/jsp2/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 88ea6bd..0000000 --- a/jsp2/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/jsp2/.settings/org.eclipse.wst.common.project.facet.core.xml b/jsp2/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index a5f10cb..0000000 --- a/jsp2/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/jsp2/.settings/org.eclipse.wst.jsdt.ui.superType.container b/jsp2/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/jsp2/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/jsp2/.settings/org.eclipse.wst.jsdt.ui.superType.name b/jsp2/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/jsp2/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/jsp2/WebContent/META-INF/MANIFEST.MF b/jsp2/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/jsp2/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/jsp2/WebContent/WEB-INF/web.xml b/jsp2/WebContent/WEB-INF/web.xml deleted file mode 100644 index 4355279..0000000 --- a/jsp2/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - jsp2 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - \ No newline at end of file diff --git a/jsp2/WebContent/cart.jsp b/jsp2/WebContent/cart.jsp deleted file mode 100644 index d52694d..0000000 --- a/jsp2/WebContent/cart.jsp +++ /dev/null @@ -1,57 +0,0 @@ -<%@page import="java.util.ArrayList"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -<% - if(session.isNew()) - { - out.print("

      Welcome to our store"); - } - else - { - String bookName = request.getParameter("bookName"); - - List booksBought = null; - - if(session.getAttribute("booksBought") == null) - { - booksBought = new ArrayList(); - session.setAttribute("booksBought", booksBought); - } - else - { - booksBought = (List) session.getAttribute("booksBought"); - } - - booksBought.add(bookName); - - out.print("

      Welcome back, you bought.."); - out.println("
      "); - - for(String current : booksBought) - { - out.println(current); - out.println("
      "); - } - } -%> - -
      - -

      Please enter the book that you want to buy : - - - - - - - - \ No newline at end of file diff --git a/jsp_el_feb2015/.classpath b/jsp_el_feb2015/.classpath deleted file mode 100644 index 26b8264..0000000 --- a/jsp_el_feb2015/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/jsp_el_feb2015/.project b/jsp_el_feb2015/.project deleted file mode 100644 index 972b4ce..0000000 --- a/jsp_el_feb2015/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - jsp_el_feb2015 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/jsp_el_feb2015/.settings/.jsdtscope b/jsp_el_feb2015/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/jsp_el_feb2015/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jsp_el_feb2015/.settings/org.eclipse.jdt.core.prefs b/jsp_el_feb2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 295926d..0000000 --- a/jsp_el_feb2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/jsp_el_feb2015/.settings/org.eclipse.wst.common.component b/jsp_el_feb2015/.settings/org.eclipse.wst.common.component deleted file mode 100644 index b6bc621..0000000 --- a/jsp_el_feb2015/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/jsp_el_feb2015/.settings/org.eclipse.wst.common.project.facet.core.xml b/jsp_el_feb2015/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index b00bde3..0000000 --- a/jsp_el_feb2015/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/jsp_el_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.container b/jsp_el_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/jsp_el_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/jsp_el_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.name b/jsp_el_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/jsp_el_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/jsp_el_feb2015/WebContent/META-INF/MANIFEST.MF b/jsp_el_feb2015/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/jsp_el_feb2015/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/jsp_el_feb2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar b/jsp_el_feb2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar deleted file mode 100644 index a86a365..0000000 Binary files a/jsp_el_feb2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar and /dev/null differ diff --git a/jsp_el_feb2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar b/jsp_el_feb2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar deleted file mode 100644 index 4b3b433..0000000 Binary files a/jsp_el_feb2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar and /dev/null differ diff --git a/jsp_el_feb2015/WebContent/WEB-INF/lib/ojdbc6.jar b/jsp_el_feb2015/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 767eba7..0000000 Binary files a/jsp_el_feb2015/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/jsp_el_feb2015/WebContent/WEB-INF/list_customers.jsp b/jsp_el_feb2015/WebContent/WEB-INF/list_customers.jsp deleted file mode 100644 index eea4922..0000000 --- a/jsp_el_feb2015/WebContent/WEB-INF/list_customers.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@page import="com.eshop.dao.Customer"%> -<%@page import="java.util.List"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - - - - - -
      First NameLast NameAddressCityStateZip
      ${customer.firstName}${customer.lastName}${customer.address}${customer.city}${customer.state}${customer.zipCode}
      - - \ No newline at end of file diff --git a/jsp_el_feb2015/WebContent/WEB-INF/web.xml b/jsp_el_feb2015/WebContent/WEB-INF/web.xml deleted file mode 100644 index f2fd358..0000000 --- a/jsp_el_feb2015/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - mvc1_2015 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ListCustomersServlet - ListCustomersServlet - com.training.amazon.servlets.ListCustomersServlet - - - ListCustomersServlet - /list - - \ No newline at end of file diff --git a/jsp_el_feb2015/src/com/training/amazon/dao/BaseDAO.java b/jsp_el_feb2015/src/com/training/amazon/dao/BaseDAO.java deleted file mode 100644 index e833573..0000000 --- a/jsp_el_feb2015/src/com/training/amazon/dao/BaseDAO.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.training.amazon.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException{ - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - //Nothing to be done, ignore it. - } - } - -} diff --git a/jsp_el_feb2015/src/com/training/amazon/dao/Customer.java b/jsp_el_feb2015/src/com/training/amazon/dao/Customer.java deleted file mode 100644 index d4aa2e3..0000000 --- a/jsp_el_feb2015/src/com/training/amazon/dao/Customer.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.training.amazon.dao; - -public class Customer { - - private int id; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } -} diff --git a/jsp_el_feb2015/src/com/training/amazon/dao/CustomerDAO.java b/jsp_el_feb2015/src/com/training/amazon/dao/CustomerDAO.java deleted file mode 100644 index d496887..0000000 --- a/jsp_el_feb2015/src/com/training/amazon/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.amazon.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/jsp_el_feb2015/src/com/training/amazon/dao/CustomerDAOJDBCImpl.java b/jsp_el_feb2015/src/com/training/amazon/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 4721d61..0000000 --- a/jsp_el_feb2015/src/com/training/amazon/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.training.amazon.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customer"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customer values (customer_id_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customer " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customer where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/jsp_el_feb2015/src/com/training/amazon/dao/DAOException.java b/jsp_el_feb2015/src/com/training/amazon/dao/DAOException.java deleted file mode 100644 index 4aa69db..0000000 --- a/jsp_el_feb2015/src/com/training/amazon/dao/DAOException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.amazon.dao; - -public class DAOException extends Exception { - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/jsp_el_feb2015/src/com/training/amazon/dao/c.tld b/jsp_el_feb2015/src/com/training/amazon/dao/c.tld deleted file mode 100644 index 089bfcb..0000000 --- a/jsp_el_feb2015/src/com/training/amazon/dao/c.tld +++ /dev/null @@ -1,613 +0,0 @@ - - - - - - JSTL 1.2 core library - JSTL core - 1.2 - c - http://java.sun.com/jsp/jstl/core - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlCoreTLV - - - - - - Catches any Throwable that occurs in its body and optionally - exposes it. - - catch - org.apache.taglibs.standard.tag.common.core.CatchTag - JSP - - -Name of the exported scoped variable for the -exception thrown from a nested action. The type of the -scoped variable is the type of the exception thrown. - - var - false - false - - - - - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - - - - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - - if - org.apache.taglibs.standard.tag.rt.core.IfTag - JSP - - -The test condition that determines whether or -not the body content should be processed. - - test - true - true - boolean - - - -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - - var - false - false - - - -Scope for var. - - scope - false - false - - - - - - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - - import - org.apache.taglibs.standard.tag.rt.core.ImportTag - org.apache.taglibs.standard.tei.ImportTEI - JSP - - -The URL of the resource to import. - - url - true - true - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is Reader. - - varReader - false - false - - - -Name of the context when accessing a relative -URL resource that belongs to a foreign -context. - - context - false - true - - - -Character encoding of the content at the input -resource. - - charEncoding - false - true - - - - - - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - - forEach - org.apache.taglibs.standard.tag.rt.core.ForEachTag - org.apache.taglibs.standard.tei.ForEachTEI - JSP - - -Collection of items to iterate over. - - items - false - true - java.lang.Object - - java.lang.Object - - - - -If items specified: -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. -If items not specified: -Iteration begins with index set at the value -specified. - - begin - false - true - int - - - -If items specified: -Iteration ends at the item located at the -specified index (inclusive). -If items not specified: -Iteration ends when index reaches the value -specified. - - end - false - true - int - - - -Iteration will only process every step items of -the collection, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. Its type depends -on the object of the underlying collection. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Iterates over tokens, separated by the supplied delimeters - - forTokens - org.apache.taglibs.standard.tag.rt.core.ForTokensTag - JSP - - -String of tokens to iterate over. - - items - true - true - java.lang.String - - java.lang.String - - - - -The set of delimiters (the characters that -separate the tokens in the string). - - delims - true - true - java.lang.String - - - -Iteration begins at the token located at the -specified index. First token has index 0. - - begin - false - true - int - - - -Iteration ends at the token located at the -specified index (inclusive). - - end - false - true - int - - - -Iteration will only process every step tokens -of the string, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of -type -javax.servlet.jsp.jstl.core.LoopTag -Status. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Like <%= ... >, but for expressions. - - out - org.apache.taglibs.standard.tag.rt.core.OutTag - JSP - - -Expression to be evaluated. - - value - true - true - - - -Default value if the resulting value is null. - - default - false - true - - - -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default value is -true. - - escapeXml - false - true - - - - - - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - - - - Adds a parameter to a containing 'import' tag's URL. - - param - org.apache.taglibs.standard.tag.rt.core.ParamTag - JSP - - -Name of the query string parameter. - - name - true - true - - - -Value of the parameter. - - value - false - true - - - - - - Redirects to a new URL. - - redirect - org.apache.taglibs.standard.tag.rt.core.RedirectTag - JSP - - -The URL of the resource to redirect to. - - url - false - true - - - -Name of the context when redirecting to a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Removes a scoped variable (from a particular scope, if specified). - - remove - org.apache.taglibs.standard.tag.common.core.RemoveTag - empty - - -Name of the scoped variable to be removed. - - var - true - false - - - -Scope for var. - - scope - false - false - - - - - - Sets the result of an expression evaluation in a 'scope' - - set - org.apache.taglibs.standard.tag.rt.core.SetTag - JSP - - -Name of the exported scoped variable to hold the value -specified in the action. The type of the scoped variable is -whatever type the value expression evaluates to. - - var - false - false - - - -Expression to be evaluated. - - value - false - true - - java.lang.Object - - - - -Target object whose property will be set. Must evaluate to -a JavaBeans object with setter property property, or to a -java.util.Map object. - - target - false - true - - - -Name of the property to be set in the target object. - - property - false - true - - - -Scope for var. - - scope - false - false - - - - - - Creates a URL with optional query parameters. - - url - org.apache.taglibs.standard.tag.rt.core.UrlTag - JSP - - -Name of the exported scoped variable for the -processed url. The type of the scoped variable is -String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -URL to be processed. - - value - false - true - - - -Name of the context when specifying a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - - when - org.apache.taglibs.standard.tag.rt.core.WhenTag - JSP - - -The test condition that determines whether or not the -body content should be processed. - - test - true - true - boolean - - - - diff --git a/jsp_el_feb2015/src/com/training/amazon/servlets/ListCustomersServlet.java b/jsp_el_feb2015/src/com/training/amazon/servlets/ListCustomersServlet.java deleted file mode 100644 index 06d4682..0000000 --- a/jsp_el_feb2015/src/com/training/amazon/servlets/ListCustomersServlet.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.amazon.servlets; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.amazon.dao.Customer; -import com.training.amazon.dao.CustomerDAO; -import com.training.amazon.dao.CustomerDAOJDBCImpl; -import com.training.amazon.dao.DAOException; - -/** - * Servlet implementation class ListCustomersServlet - */ -public class ListCustomersServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - CustomerDAO dao = new CustomerDAOJDBCImpl(); - - try { - List customers = dao.getAllCustomers(); - - Customer fc = customers.get(0); - - request.setAttribute("firstCustomer", fc); - request.setAttribute("customerList", customers); - - //forward to JSP - RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/list_customers.jsp"); - dispatcher.forward(request, response); - - } catch (DAOException e) { - e.printStackTrace(); - } - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/jstl/.classpath b/jstl/.classpath deleted file mode 100644 index 700a9c5..0000000 --- a/jstl/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/jstl/.project b/jstl/.project deleted file mode 100644 index d8ea93b..0000000 --- a/jstl/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - jstl - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/jstl/.settings/.jsdtscope b/jstl/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/jstl/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jstl/.settings/org.eclipse.jdt.core.prefs b/jstl/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2f8d372..0000000 --- a/jstl/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Feb 16 19:29:26 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/jstl/.settings/org.eclipse.wst.common.component b/jstl/.settings/org.eclipse.wst.common.component deleted file mode 100644 index d015789..0000000 --- a/jstl/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/jstl/.settings/org.eclipse.wst.common.project.facet.core.xml b/jstl/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d62d1e5..0000000 --- a/jstl/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/jstl/.settings/org.eclipse.wst.jsdt.ui.superType.container b/jstl/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/jstl/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/jstl/.settings/org.eclipse.wst.jsdt.ui.superType.name b/jstl/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/jstl/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/jstl/WebContent/META-INF/MANIFEST.MF b/jstl/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/jstl/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/jstl/WebContent/WEB-INF/lib/jstl-api-1.2.jar b/jstl/WebContent/WEB-INF/lib/jstl-api-1.2.jar deleted file mode 100644 index 183ed63..0000000 Binary files a/jstl/WebContent/WEB-INF/lib/jstl-api-1.2.jar and /dev/null differ diff --git a/jstl/WebContent/WEB-INF/lib/jstl-impl-1.2.jar b/jstl/WebContent/WEB-INF/lib/jstl-impl-1.2.jar deleted file mode 100644 index 110ca51..0000000 Binary files a/jstl/WebContent/WEB-INF/lib/jstl-impl-1.2.jar and /dev/null differ diff --git a/jstl/WebContent/WEB-INF/student.jsp b/jstl/WebContent/WEB-INF/student.jsp deleted file mode 100644 index e57755a..0000000 --- a/jstl/WebContent/WEB-INF/student.jsp +++ /dev/null @@ -1,76 +0,0 @@ -<%@page import="java.util.Date"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> - - - - - -Insert title here - - - -

      - Student Details :
      -

      - - - Current = ${current}
      -
      - - - - - - - - - - - - - - -
      First NameLast NameCity
      ${current.firstName}${current.lastName}${current.city}
      - -
      - - The size is 3 - - -
      JSTL if else demo -
      - - - Size = 2 - - - - Size = 3 - - - - Size = 4 - - - - Size is not 2,3 and 4. - - - -
      JSTL core set demo -
      - - - - - - - -

      Current date =

      - - - \ No newline at end of file diff --git a/jstl/WebContent/WEB-INF/web.xml b/jstl/WebContent/WEB-INF/web.xml deleted file mode 100644 index 9d09fc6..0000000 --- a/jstl/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - jsp-el - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - StudentServlet - StudentServlet - com.training.java.jstl.web.StudentServlet - - - StudentServlet - /student - - \ No newline at end of file diff --git a/jstl/src/com/training/java/jstl/domain/DAOException.java b/jstl/src/com/training/java/jstl/domain/DAOException.java deleted file mode 100644 index e3325a7..0000000 --- a/jstl/src/com/training/java/jstl/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.jstl.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/jstl/src/com/training/java/jstl/domain/Student.java b/jstl/src/com/training/java/jstl/domain/Student.java deleted file mode 100644 index b4ff94c..0000000 --- a/jstl/src/com/training/java/jstl/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.jstl.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/jstl/src/com/training/java/jstl/domain/StudentDAO.java b/jstl/src/com/training/java/jstl/domain/StudentDAO.java deleted file mode 100644 index be91e52..0000000 --- a/jstl/src/com/training/java/jstl/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.jstl.domain; - -import java.util.List; - -interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/jstl/src/com/training/java/jstl/domain/StudentDAOJDBCImpl.java b/jstl/src/com/training/java/jstl/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index c911a49..0000000 --- a/jstl/src/com/training/java/jstl/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.jstl.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/jstl/src/com/training/java/jstl/domain/StudentService.java b/jstl/src/com/training/java/jstl/domain/StudentService.java deleted file mode 100644 index c4d1141..0000000 --- a/jstl/src/com/training/java/jstl/domain/StudentService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.jstl.domain; - -import java.util.List; - -public interface StudentService { - - List getAllStudents(); - void addStudent(Student student); - -} diff --git a/jstl/src/com/training/java/jstl/domain/StudentServiceImpl.java b/jstl/src/com/training/java/jstl/domain/StudentServiceImpl.java deleted file mode 100644 index aeec317..0000000 --- a/jstl/src/com/training/java/jstl/domain/StudentServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.jstl.domain; - -import java.util.List; - -public class StudentServiceImpl implements StudentService { - - @Override - public void addStudent(Student student) { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - dao.create(student); - - } - - @Override - public List getAllStudents() { - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - return dao.getAllStudents(); - } -} diff --git a/jstl/src/com/training/java/jstl/web/StudentServlet.java b/jstl/src/com/training/java/jstl/web/StudentServlet.java deleted file mode 100644 index 15c968a..0000000 --- a/jstl/src/com/training/java/jstl/web/StudentServlet.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.training.java.jstl.web; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.jstl.domain.Student; -import com.training.java.jstl.domain.StudentService; - -/** - * Servlet implementation class StudentServlet - */ -public class StudentServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public StudentServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - Student student = new Student(); - - student.setFirstName("Sasi"); - student.setLastName("Raj Kumar"); - student.setCity("Troy"); - - request.setAttribute("student", student); - - HttpSession session = request.getSession(); - session.setAttribute("street", "Corporate Dr"); - - List students = new ArrayList(); - - students.add(student); - - Student student2 = new Student(); - student2.setFirstName("Ronnie"); - student2.setLastName("Mac"); - student2.setCity("Rochester"); - - students.add(student2); - - request.setAttribute("students", students); - request.setAttribute("size", "3"); - - RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/student.jsp"); - dispatcher.forward(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/mvc1/.classpath b/mvc1/.classpath deleted file mode 100644 index 78413a7..0000000 --- a/mvc1/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/mvc1/.project b/mvc1/.project deleted file mode 100644 index 01ff33f..0000000 --- a/mvc1/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - mvc1 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/mvc1/.settings/.jsdtscope b/mvc1/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/mvc1/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/mvc1/.settings/org.eclipse.jdt.core.prefs b/mvc1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index fee0207..0000000 --- a/mvc1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sun Feb 12 08:42:57 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/mvc1/.settings/org.eclipse.wst.common.component b/mvc1/.settings/org.eclipse.wst.common.component deleted file mode 100644 index db96ab0..0000000 --- a/mvc1/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/mvc1/.settings/org.eclipse.wst.common.project.facet.core.xml b/mvc1/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index afe9e5e..0000000 --- a/mvc1/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/mvc1/.settings/org.eclipse.wst.jsdt.ui.superType.container b/mvc1/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/mvc1/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/mvc1/.settings/org.eclipse.wst.jsdt.ui.superType.name b/mvc1/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/mvc1/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/mvc1/WebContent/META-INF/MANIFEST.MF b/mvc1/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/mvc1/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/mvc1/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar b/mvc1/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar deleted file mode 100644 index cdee6a1..0000000 Binary files a/mvc1/WebContent/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar and /dev/null differ diff --git a/mvc1/WebContent/WEB-INF/list.jsp b/mvc1/WebContent/WEB-INF/list.jsp deleted file mode 100644 index b60eefe..0000000 --- a/mvc1/WebContent/WEB-INF/list.jsp +++ /dev/null @@ -1,37 +0,0 @@ -<%@page import="com.training.java.mvc1.domain.Student"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - - - - - - - - <% - List students = (List) request.getAttribute("students"); - for (Student current : students) { - %> - - - - - - - - <% - } - %> -
      First NameLast NamePhone Number
      <%= current.getFirstName() %> <%= current.getLastName() %> <%= current.getPhoneNumber() %>
      - - - \ No newline at end of file diff --git a/mvc1/WebContent/WEB-INF/web.xml b/mvc1/WebContent/WEB-INF/web.xml deleted file mode 100644 index 7e2ca91..0000000 --- a/mvc1/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - mvc1 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ListStudentServlet - ListStudentServlet - com.training.java.mvc1.web.ListStudentServlet - - - ListStudentServlet - /list - - \ No newline at end of file diff --git a/mvc1/lib/junit-4.8.2.jar b/mvc1/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb84..0000000 Binary files a/mvc1/lib/junit-4.8.2.jar and /dev/null differ diff --git a/mvc1/src/com/training/java/mvc1/domain/DAOException.java b/mvc1/src/com/training/java/mvc1/domain/DAOException.java deleted file mode 100644 index 9752b9c..0000000 --- a/mvc1/src/com/training/java/mvc1/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.mvc1.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/mvc1/src/com/training/java/mvc1/domain/Student.java b/mvc1/src/com/training/java/mvc1/domain/Student.java deleted file mode 100644 index 345b8ca..0000000 --- a/mvc1/src/com/training/java/mvc1/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.mvc1.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/mvc1/src/com/training/java/mvc1/domain/StudentDAO.java b/mvc1/src/com/training/java/mvc1/domain/StudentDAO.java deleted file mode 100644 index 35b6ea4..0000000 --- a/mvc1/src/com/training/java/mvc1/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.util.List; - -interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/mvc1/src/com/training/java/mvc1/domain/StudentDAOJDBCImpl.java b/mvc1/src/com/training/java/mvc1/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index 9a3b90e..0000000 --- a/mvc1/src/com/training/java/mvc1/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/mvc1/src/com/training/java/mvc1/domain/StudentDAOJDBCImplTest.java b/mvc1/src/com/training/java/mvc1/domain/StudentDAOJDBCImplTest.java deleted file mode 100644 index 999e05d..0000000 --- a/mvc1/src/com/training/java/mvc1/domain/StudentDAOJDBCImplTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.util.List; - -import org.junit.Ignore; -import org.junit.Test; - -public class StudentDAOJDBCImplTest { - - @Test - public void testGetAllStudents() { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - List students = dao.getAllStudents(); - - for(Student current : students) - { - System.out.println(current); - } - } - - @Ignore - public void testCreateStudent(){ - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/training", "root", "password"); - - Student student = new Student(); - student.setAge(20); - student.setCity("Sterling Heights"); - student.setEmail("priya@gmail.com"); - student.setFirstName("Priya"); - student.setId(7); - student.setLastName("Patel"); - student.setPhoneNumber("248-238-9874"); - - dao.create(student); - - //assert that your student is created - - //delete the student that you just created - } - -} diff --git a/mvc1/src/com/training/java/mvc1/domain/StudentService.java b/mvc1/src/com/training/java/mvc1/domain/StudentService.java deleted file mode 100644 index 4a67bd5..0000000 --- a/mvc1/src/com/training/java/mvc1/domain/StudentService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.util.List; - -public interface StudentService { - - List getAllStudents(); - void addStudent(Student student); - -} diff --git a/mvc1/src/com/training/java/mvc1/domain/StudentServiceImpl.java b/mvc1/src/com/training/java/mvc1/domain/StudentServiceImpl.java deleted file mode 100644 index 56cc233..0000000 --- a/mvc1/src/com/training/java/mvc1/domain/StudentServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.mvc1.domain; - -import java.util.List; - -public class StudentServiceImpl implements StudentService { - - @Override - public void addStudent(Student student) { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - dao.create(student); - - } - - @Override - public List getAllStudents() { - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - return dao.getAllStudents(); - } -} diff --git a/mvc1/src/com/training/java/mvc1/web/ListStudentServlet.java b/mvc1/src/com/training/java/mvc1/web/ListStudentServlet.java deleted file mode 100644 index 98dc025..0000000 --- a/mvc1/src/com/training/java/mvc1/web/ListStudentServlet.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.java.mvc1.web; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.mvc1.domain.Student; -import com.training.java.mvc1.domain.StudentService; -import com.training.java.mvc1.domain.StudentServiceImpl; - -/** - * Servlet implementation class ListStudentServlet - */ -public class ListStudentServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListStudentServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { - - StudentService service = new StudentServiceImpl(); - List students = service.getAllStudents(); - - //Put Model data in request as attribute to make this data available to view(JSP) - req.setAttribute("students", students); - - //Ask view (JSP) to render the fancy dynamic HTML - RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/list.jsp"); - dispatcher.forward(req, res); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - doGet(request, response); - } - -} diff --git a/mvc1_2015/.classpath b/mvc1_2015/.classpath deleted file mode 100644 index 26b8264..0000000 --- a/mvc1_2015/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/mvc1_2015/.project b/mvc1_2015/.project deleted file mode 100644 index 972b4ce..0000000 --- a/mvc1_2015/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - jsp_el_feb2015 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/mvc1_2015/.settings/.jsdtscope b/mvc1_2015/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/mvc1_2015/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/mvc1_2015/.settings/org.eclipse.jdt.core.prefs b/mvc1_2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 295926d..0000000 --- a/mvc1_2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/mvc1_2015/.settings/org.eclipse.wst.common.component b/mvc1_2015/.settings/org.eclipse.wst.common.component deleted file mode 100644 index b6bc621..0000000 --- a/mvc1_2015/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/mvc1_2015/.settings/org.eclipse.wst.common.project.facet.core.xml b/mvc1_2015/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index b00bde3..0000000 --- a/mvc1_2015/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/mvc1_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container b/mvc1_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/mvc1_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/mvc1_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name b/mvc1_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/mvc1_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/mvc1_2015/WebContent/META-INF/MANIFEST.MF b/mvc1_2015/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/mvc1_2015/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/mvc1_2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar b/mvc1_2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar deleted file mode 100644 index a86a365..0000000 Binary files a/mvc1_2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar and /dev/null differ diff --git a/mvc1_2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar b/mvc1_2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar deleted file mode 100644 index 4b3b433..0000000 Binary files a/mvc1_2015/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar and /dev/null differ diff --git a/mvc1_2015/WebContent/WEB-INF/lib/ojdbc6.jar b/mvc1_2015/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 767eba7..0000000 Binary files a/mvc1_2015/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/mvc1_2015/WebContent/WEB-INF/list_customers.jsp b/mvc1_2015/WebContent/WEB-INF/list_customers.jsp deleted file mode 100644 index eea4922..0000000 --- a/mvc1_2015/WebContent/WEB-INF/list_customers.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@page import="com.eshop.dao.Customer"%> -<%@page import="java.util.List"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - - - - - -
      First NameLast NameAddressCityStateZip
      ${customer.firstName}${customer.lastName}${customer.address}${customer.city}${customer.state}${customer.zipCode}
      - - \ No newline at end of file diff --git a/mvc1_2015/WebContent/WEB-INF/web.xml b/mvc1_2015/WebContent/WEB-INF/web.xml deleted file mode 100644 index f2fd358..0000000 --- a/mvc1_2015/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - mvc1_2015 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ListCustomersServlet - ListCustomersServlet - com.training.amazon.servlets.ListCustomersServlet - - - ListCustomersServlet - /list - - \ No newline at end of file diff --git a/mvc1_2015/src/com/training/amazon/dao/BaseDAO.java b/mvc1_2015/src/com/training/amazon/dao/BaseDAO.java deleted file mode 100644 index e833573..0000000 --- a/mvc1_2015/src/com/training/amazon/dao/BaseDAO.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.training.amazon.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException{ - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - //Nothing to be done, ignore it. - } - } - -} diff --git a/mvc1_2015/src/com/training/amazon/dao/Customer.java b/mvc1_2015/src/com/training/amazon/dao/Customer.java deleted file mode 100644 index d4aa2e3..0000000 --- a/mvc1_2015/src/com/training/amazon/dao/Customer.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.training.amazon.dao; - -public class Customer { - - private int id; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } -} diff --git a/mvc1_2015/src/com/training/amazon/dao/CustomerDAO.java b/mvc1_2015/src/com/training/amazon/dao/CustomerDAO.java deleted file mode 100644 index d496887..0000000 --- a/mvc1_2015/src/com/training/amazon/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.amazon.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/mvc1_2015/src/com/training/amazon/dao/CustomerDAOJDBCImpl.java b/mvc1_2015/src/com/training/amazon/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 4721d61..0000000 --- a/mvc1_2015/src/com/training/amazon/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.training.amazon.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customer"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customer values (customer_id_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customer " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customer where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/mvc1_2015/src/com/training/amazon/dao/DAOException.java b/mvc1_2015/src/com/training/amazon/dao/DAOException.java deleted file mode 100644 index 4aa69db..0000000 --- a/mvc1_2015/src/com/training/amazon/dao/DAOException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.amazon.dao; - -public class DAOException extends Exception { - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/mvc1_2015/src/com/training/amazon/dao/c.tld b/mvc1_2015/src/com/training/amazon/dao/c.tld deleted file mode 100644 index 089bfcb..0000000 --- a/mvc1_2015/src/com/training/amazon/dao/c.tld +++ /dev/null @@ -1,613 +0,0 @@ - - - - - - JSTL 1.2 core library - JSTL core - 1.2 - c - http://java.sun.com/jsp/jstl/core - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlCoreTLV - - - - - - Catches any Throwable that occurs in its body and optionally - exposes it. - - catch - org.apache.taglibs.standard.tag.common.core.CatchTag - JSP - - -Name of the exported scoped variable for the -exception thrown from a nested action. The type of the -scoped variable is the type of the exception thrown. - - var - false - false - - - - - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - - - - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - - if - org.apache.taglibs.standard.tag.rt.core.IfTag - JSP - - -The test condition that determines whether or -not the body content should be processed. - - test - true - true - boolean - - - -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - - var - false - false - - - -Scope for var. - - scope - false - false - - - - - - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - - import - org.apache.taglibs.standard.tag.rt.core.ImportTag - org.apache.taglibs.standard.tei.ImportTEI - JSP - - -The URL of the resource to import. - - url - true - true - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is Reader. - - varReader - false - false - - - -Name of the context when accessing a relative -URL resource that belongs to a foreign -context. - - context - false - true - - - -Character encoding of the content at the input -resource. - - charEncoding - false - true - - - - - - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - - forEach - org.apache.taglibs.standard.tag.rt.core.ForEachTag - org.apache.taglibs.standard.tei.ForEachTEI - JSP - - -Collection of items to iterate over. - - items - false - true - java.lang.Object - - java.lang.Object - - - - -If items specified: -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. -If items not specified: -Iteration begins with index set at the value -specified. - - begin - false - true - int - - - -If items specified: -Iteration ends at the item located at the -specified index (inclusive). -If items not specified: -Iteration ends when index reaches the value -specified. - - end - false - true - int - - - -Iteration will only process every step items of -the collection, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. Its type depends -on the object of the underlying collection. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Iterates over tokens, separated by the supplied delimeters - - forTokens - org.apache.taglibs.standard.tag.rt.core.ForTokensTag - JSP - - -String of tokens to iterate over. - - items - true - true - java.lang.String - - java.lang.String - - - - -The set of delimiters (the characters that -separate the tokens in the string). - - delims - true - true - java.lang.String - - - -Iteration begins at the token located at the -specified index. First token has index 0. - - begin - false - true - int - - - -Iteration ends at the token located at the -specified index (inclusive). - - end - false - true - int - - - -Iteration will only process every step tokens -of the string, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of -type -javax.servlet.jsp.jstl.core.LoopTag -Status. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Like <%= ... >, but for expressions. - - out - org.apache.taglibs.standard.tag.rt.core.OutTag - JSP - - -Expression to be evaluated. - - value - true - true - - - -Default value if the resulting value is null. - - default - false - true - - - -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default value is -true. - - escapeXml - false - true - - - - - - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - - - - Adds a parameter to a containing 'import' tag's URL. - - param - org.apache.taglibs.standard.tag.rt.core.ParamTag - JSP - - -Name of the query string parameter. - - name - true - true - - - -Value of the parameter. - - value - false - true - - - - - - Redirects to a new URL. - - redirect - org.apache.taglibs.standard.tag.rt.core.RedirectTag - JSP - - -The URL of the resource to redirect to. - - url - false - true - - - -Name of the context when redirecting to a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Removes a scoped variable (from a particular scope, if specified). - - remove - org.apache.taglibs.standard.tag.common.core.RemoveTag - empty - - -Name of the scoped variable to be removed. - - var - true - false - - - -Scope for var. - - scope - false - false - - - - - - Sets the result of an expression evaluation in a 'scope' - - set - org.apache.taglibs.standard.tag.rt.core.SetTag - JSP - - -Name of the exported scoped variable to hold the value -specified in the action. The type of the scoped variable is -whatever type the value expression evaluates to. - - var - false - false - - - -Expression to be evaluated. - - value - false - true - - java.lang.Object - - - - -Target object whose property will be set. Must evaluate to -a JavaBeans object with setter property property, or to a -java.util.Map object. - - target - false - true - - - -Name of the property to be set in the target object. - - property - false - true - - - -Scope for var. - - scope - false - false - - - - - - Creates a URL with optional query parameters. - - url - org.apache.taglibs.standard.tag.rt.core.UrlTag - JSP - - -Name of the exported scoped variable for the -processed url. The type of the scoped variable is -String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -URL to be processed. - - value - false - true - - - -Name of the context when specifying a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - - when - org.apache.taglibs.standard.tag.rt.core.WhenTag - JSP - - -The test condition that determines whether or not the -body content should be processed. - - test - true - true - boolean - - - - diff --git a/mvc1_2015/src/com/training/amazon/servlets/ListCustomersServlet.java b/mvc1_2015/src/com/training/amazon/servlets/ListCustomersServlet.java deleted file mode 100644 index 06d4682..0000000 --- a/mvc1_2015/src/com/training/amazon/servlets/ListCustomersServlet.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.amazon.servlets; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.amazon.dao.Customer; -import com.training.amazon.dao.CustomerDAO; -import com.training.amazon.dao.CustomerDAOJDBCImpl; -import com.training.amazon.dao.DAOException; - -/** - * Servlet implementation class ListCustomersServlet - */ -public class ListCustomersServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - CustomerDAO dao = new CustomerDAOJDBCImpl(); - - try { - List customers = dao.getAllCustomers(); - - Customer fc = customers.get(0); - - request.setAttribute("firstCustomer", fc); - request.setAttribute("customerList", customers); - - //forward to JSP - RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/list_customers.jsp"); - dispatcher.forward(request, response); - - } catch (DAOException e) { - e.printStackTrace(); - } - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/mvc2/.classpath b/mvc2/.classpath deleted file mode 100644 index 32a11af..0000000 --- a/mvc2/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/mvc2/.project b/mvc2/.project deleted file mode 100644 index 178edd4..0000000 --- a/mvc2/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - mvc2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/mvc2/.settings/.jsdtscope b/mvc2/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/mvc2/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/mvc2/.settings/org.eclipse.jdt.core.prefs b/mvc2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index cc2dd7d..0000000 --- a/mvc2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sat Mar 31 10:00:56 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/mvc2/.settings/org.eclipse.wst.common.component b/mvc2/.settings/org.eclipse.wst.common.component deleted file mode 100644 index bf96575..0000000 --- a/mvc2/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/mvc2/.settings/org.eclipse.wst.common.project.facet.core.xml b/mvc2/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index f2b0ce9..0000000 --- a/mvc2/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/mvc2/.settings/org.eclipse.wst.jsdt.ui.superType.container b/mvc2/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/mvc2/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/mvc2/.settings/org.eclipse.wst.jsdt.ui.superType.name b/mvc2/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/mvc2/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/mvc2/WebContent/META-INF/MANIFEST.MF b/mvc2/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/mvc2/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/mvc2/WebContent/WEB-INF/jsp/ListCars.jsp b/mvc2/WebContent/WEB-INF/jsp/ListCars.jsp deleted file mode 100644 index 9aa83c7..0000000 --- a/mvc2/WebContent/WEB-INF/jsp/ListCars.jsp +++ /dev/null @@ -1,39 +0,0 @@ -<%@page import="com.training.servlet.car.domain.Car"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - - - - - - - - - <% - List cars = (List) request.getAttribute("carsToDisplay"); - for (Car current : cars) { - %> - - - - - - - - - <% - } - %> -
      MakeModelYearPrice
      <%= current.getMake() %> <%= current.getModel() %> <%= current.getYear() %> <%= current.getPrice() %>
      - - - \ No newline at end of file diff --git a/mvc2/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/mvc2/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/mvc2/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/mvc2/WebContent/WEB-INF/web.xml b/mvc2/WebContent/WEB-INF/web.xml deleted file mode 100644 index 35210b1..0000000 --- a/mvc2/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - mvc2 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ListCarServlet - com.training.servlet.car.web.ListCarServlet - - - ListCarServlet - /list - - - - \ No newline at end of file diff --git a/mvc2/src/com/training/servlet/car/domain/Car.java b/mvc2/src/com/training/servlet/car/domain/Car.java deleted file mode 100644 index 9f8f9c7..0000000 --- a/mvc2/src/com/training/servlet/car/domain/Car.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.servlet.car.domain; - -public class Car { - private int id; - private String make; - private String model; - private int year; - private double price; - - public Car(int id,String make, String model, int year, double price) { - this.id = id; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - } - public int getId() { - return id; - } - public String getMake() { - return make; - } - public String getModel() { - return model; - } - public int getYear() { - return year; - } - public double getPrice() { - return price; - } -} diff --git a/mvc2/src/com/training/servlet/car/domain/CarDAO.java b/mvc2/src/com/training/servlet/car/domain/CarDAO.java deleted file mode 100644 index 6bf22a2..0000000 --- a/mvc2/src/com/training/servlet/car/domain/CarDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.servlet.car.domain; - -import java.util.List; - - -interface CarDAO { - void createCar(Car car); - List getAllCars(); - Car getCarById(int id); - void update(Car car); - void delete(int id); -} diff --git a/mvc2/src/com/training/servlet/car/domain/CarDAOJDBCImpl.java b/mvc2/src/com/training/servlet/car/domain/CarDAOJDBCImpl.java deleted file mode 100644 index 3e8c986..0000000 --- a/mvc2/src/com/training/servlet/car/domain/CarDAOJDBCImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.training.servlet.car.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class CarDAOJDBCImpl implements CarDAO { - - CarDAOJDBCImpl() { - try { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) { - throw new DAOException(e); - } - } - - @Override - public List getAllCars() { - - List cars = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from car"); - - while(rs.next()) { - int id = rs.getInt("id"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - Car car = new Car(id,make,model,year,price); - cars.add(car); - } - return cars; - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(rs,stmt,con); - } - } - - @Override - public void createCar(Car car) { - - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("insert into car values(?,?,?,?,?)"); - - stmt.setInt(1, car.getId()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(null,stmt,con); - } - } - - @Override - public Car getCarById(int id) { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Car car = null; - try { - con = getConnection(); - stmt = con.prepareStatement("select * from car where id = ?"); - stmt.setInt(1,id); - rs = stmt.executeQuery(); - - if (rs.next()) { - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - car = new Car(id,make,model,year,price); - } - return car; - - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(null,stmt,con); - } - } - - private Connection getConnection() throws SQLException { - return DriverManager.getConnection("jdbc:mysql://localhost/training","root","password"); - - } - - private void closeResources(ResultSet rs, Statement stmt, Connection con) { - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - } - - @Override - public void update(Car car) - { - { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("update car set make = ?, model= ?, year = ?, price = ? where id = ?"); - stmt.setString(1, car.getMake()); - stmt.setString(2, car.getModel()); - stmt.setInt(3, car.getYear()); - stmt.setDouble(4, car.getPrice()); - stmt.setInt(5, car.getId()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(null,stmt,con); - } - } - } - - @Override - public void delete(int id) - { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("delete from car where id = ?"); - stmt.setInt(1, id); - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } - finally { - closeResources(null,stmt,con); - } - } -} diff --git a/mvc2/src/com/training/servlet/car/domain/CarService.java b/mvc2/src/com/training/servlet/car/domain/CarService.java deleted file mode 100644 index ea1c767..0000000 --- a/mvc2/src/com/training/servlet/car/domain/CarService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.servlet.car.domain; - -import java.util.List; - -public interface CarService -{ - void create(Car car); - List getAllCars(); -} diff --git a/mvc2/src/com/training/servlet/car/domain/CarServiceImpl.java b/mvc2/src/com/training/servlet/car/domain/CarServiceImpl.java deleted file mode 100644 index 1b2cfaf..0000000 --- a/mvc2/src/com/training/servlet/car/domain/CarServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.servlet.car.domain; - -import java.util.List; - -public class CarServiceImpl implements CarService -{ - @Override - public void create(Car car) - { - CarDAO dao = new CarDAOJDBCImpl(); - dao.createCar(car); - } - - @Override - public List getAllCars() - { - CarDAO dao = new CarDAOJDBCImpl(); - return dao.getAllCars(); - } -} diff --git a/mvc2/src/com/training/servlet/car/domain/DAOException.java b/mvc2/src/com/training/servlet/car/domain/DAOException.java deleted file mode 100644 index 7a71d98..0000000 --- a/mvc2/src/com/training/servlet/car/domain/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.servlet.car.domain; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(Throwable ex) { - super(ex); - } -} diff --git a/mvc2/src/com/training/servlet/car/web/AddCarServlet.java b/mvc2/src/com/training/servlet/car/web/AddCarServlet.java deleted file mode 100644 index 75b74bd..0000000 --- a/mvc2/src/com/training/servlet/car/web/AddCarServlet.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.training.servlet.car.web; - -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.servlet.car.domain.Car; -import com.training.servlet.car.domain.CarService; -import com.training.servlet.car.domain.CarServiceImpl; - -/** - * Servlet implementation class AddCarServlet - */ -public class AddCarServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public AddCarServlet() { - super(); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String idStr = request.getParameter("id"); - String make = request.getParameter("make"); - String model = request.getParameter("model"); - String yearStr = request.getParameter("year"); - String priceStr = request.getParameter("price"); - - int id = Integer.parseInt(idStr); - int year = Integer.parseInt(yearStr); - double price = Double.parseDouble(priceStr); - - Car car = new Car(id, make, model, year, price); - - CarService service = new CarServiceImpl(); - service.create(car); - - response.sendRedirect("/carservlet/list"); - } - -} diff --git a/mvc2/src/com/training/servlet/car/web/ListCarServlet.java b/mvc2/src/com/training/servlet/car/web/ListCarServlet.java deleted file mode 100644 index cce4a41..0000000 --- a/mvc2/src/com/training/servlet/car/web/ListCarServlet.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.training.servlet.car.web; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.servlet.car.domain.Car; -import com.training.servlet.car.domain.CarService; -import com.training.servlet.car.domain.CarServiceImpl; - -/** - * Servlet implementation class ListCarServlet - */ -public class ListCarServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListCarServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - CarService service = new CarServiceImpl(); - List cars = service.getAllCars(); - - request.setAttribute("carsToDisplay", cars); - - RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/jsp/ListCars.jsp"); - dispatcher.forward(request, response); - } - -} diff --git a/redbox/.classpath b/redbox/.classpath deleted file mode 100644 index 23a27a7..0000000 --- a/redbox/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/redbox/.project b/redbox/.project deleted file mode 100644 index 8d69227..0000000 --- a/redbox/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - redbox - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/redbox/.settings/.jsdtscope b/redbox/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/redbox/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/redbox/.settings/org.eclipse.jdt.core.prefs b/redbox/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/redbox/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/redbox/.settings/org.eclipse.wst.common.component b/redbox/.settings/org.eclipse.wst.common.component deleted file mode 100644 index e08b329..0000000 --- a/redbox/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/redbox/.settings/org.eclipse.wst.common.project.facet.core.xml b/redbox/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 4a16dbb..0000000 --- a/redbox/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/redbox/.settings/org.eclipse.wst.jsdt.ui.superType.container b/redbox/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/redbox/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/redbox/.settings/org.eclipse.wst.jsdt.ui.superType.name b/redbox/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/redbox/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/redbox/WebContent/Checkout.jsp b/redbox/WebContent/Checkout.jsp deleted file mode 100644 index 4741697..0000000 --- a/redbox/WebContent/Checkout.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - <%@include file="Header.jsp"%>
      - - Please find below the movies you added to the cart.

      - - - - - - - - - <% - List movies = (List) request - .getAttribute("MoviesCart"); - - for(Movie movie : movies) - { - %> - - - - - - - <%} %> -
      TitleTypePrice
      <%= movie.getTitle()%><%= movie.getType()%><%= movie.getRentalPrice()%>
      - -
      - -
      - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox/WebContent/Footer.jsp b/redbox/WebContent/Footer.jsp deleted file mode 100644 index bf99545..0000000 --- a/redbox/WebContent/Footer.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -
      -
      -
      -
      -
      - - - -
      © 2014, Redbox Automated Retail, LLC. All rights reserved.
      - - - - \ No newline at end of file diff --git a/redbox/WebContent/Header.jsp b/redbox/WebContent/Header.jsp deleted file mode 100644 index 3e5fd7d..0000000 --- a/redbox/WebContent/Header.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - - - - - \ No newline at end of file diff --git a/redbox/WebContent/META-INF/MANIFEST.MF b/redbox/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/redbox/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/redbox/WebContent/ShowMovies.jsp b/redbox/WebContent/ShowMovies.jsp deleted file mode 100644 index e64d9d4..0000000 --- a/redbox/WebContent/ShowMovies.jsp +++ /dev/null @@ -1,69 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - <%@include file="Header.jsp"%> - - <% - int size = 0; - List cart = (List) session.getAttribute("cart"); - - if (cart != null) { - size = cart.size(); - } - %> - - - - - -
      - - - (<%=size%>) - -
      - - <% - List movies = (List) request.getAttribute("movies"); - %> - - - - <% - for (Movie movie : movies) { - %> - - - <% - } - %> - - - - <% - for (Movie movie : movies) { - %> - - - <% - } - %> - -
      Add to -
      - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox/WebContent/WEB-INF/lib/ojdbc6.jar b/redbox/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/redbox/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/redbox/WebContent/WEB-INF/web.xml b/redbox/WebContent/WEB-INF/web.xml deleted file mode 100644 index 93728bd..0000000 --- a/redbox/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - redbox - - index.jsp - - - - ListMoviesServlet - ListMoviesServlet - com.training.java.redbox.ListMoviesServlet - - - ListMoviesServlet - /listMovies - - - - AddToCartServlet - AddToCartServlet - com.training.java.redbox.AddToCartServlet - - - AddToCartServlet - /addToCart - - - - CheckoutServlet - CheckoutServlet - com.training.java.redbox.CheckoutServlet - - - CheckoutServlet - /checkout - - \ No newline at end of file diff --git a/redbox/WebContent/images/FreeBirdsMovie.jpg b/redbox/WebContent/images/FreeBirdsMovie.jpg deleted file mode 100644 index c3fca34..0000000 Binary files a/redbox/WebContent/images/FreeBirdsMovie.jpg and /dev/null differ diff --git a/redbox/WebContent/images/FrozenMovie.jpg b/redbox/WebContent/images/FrozenMovie.jpg deleted file mode 100644 index 811ebd3..0000000 Binary files a/redbox/WebContent/images/FrozenMovie.jpg and /dev/null differ diff --git a/redbox/WebContent/images/LegoMovie.jpg b/redbox/WebContent/images/LegoMovie.jpg deleted file mode 100644 index 1b1a7be..0000000 Binary files a/redbox/WebContent/images/LegoMovie.jpg and /dev/null differ diff --git a/redbox/WebContent/images/MandelaMovie.jpg b/redbox/WebContent/images/MandelaMovie.jpg deleted file mode 100644 index a172f73..0000000 Binary files a/redbox/WebContent/images/MandelaMovie.jpg and /dev/null differ diff --git a/redbox/WebContent/images/ThorMovie.jpg b/redbox/WebContent/images/ThorMovie.jpg deleted file mode 100644 index 2ac8ee8..0000000 Binary files a/redbox/WebContent/images/ThorMovie.jpg and /dev/null differ diff --git a/redbox/WebContent/images/cart.jpg b/redbox/WebContent/images/cart.jpg deleted file mode 100644 index a6c8488..0000000 Binary files a/redbox/WebContent/images/cart.jpg and /dev/null differ diff --git a/redbox/WebContent/images/checkout.jpg b/redbox/WebContent/images/checkout.jpg deleted file mode 100644 index f8f2bda..0000000 Binary files a/redbox/WebContent/images/checkout.jpg and /dev/null differ diff --git a/redbox/WebContent/images/login.jpg b/redbox/WebContent/images/login.jpg deleted file mode 100644 index 442c689..0000000 Binary files a/redbox/WebContent/images/login.jpg and /dev/null differ diff --git a/redbox/WebContent/images/logo.jpg b/redbox/WebContent/images/logo.jpg deleted file mode 100644 index 476dae1..0000000 Binary files a/redbox/WebContent/images/logo.jpg and /dev/null differ diff --git a/redbox/WebContent/images/signup.jpg b/redbox/WebContent/images/signup.jpg deleted file mode 100644 index 320d80a..0000000 Binary files a/redbox/WebContent/images/signup.jpg and /dev/null differ diff --git a/redbox/WebContent/images/signup2.jpg b/redbox/WebContent/images/signup2.jpg deleted file mode 100644 index 07d0696..0000000 Binary files a/redbox/WebContent/images/signup2.jpg and /dev/null differ diff --git a/redbox/WebContent/index.jsp b/redbox/WebContent/index.jsp deleted file mode 100644 index 4de9002..0000000 --- a/redbox/WebContent/index.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -<%response.sendRedirect("/redbox/listMovies"); %> - - - - \ No newline at end of file diff --git a/redbox/etc/dbscripts.sql b/redbox/etc/dbscripts.sql deleted file mode 100644 index f93d30e..0000000 --- a/redbox/etc/dbscripts.sql +++ /dev/null @@ -1,42 +0,0 @@ - - CREATE TABLE "CUSTOMERS" - ( "CUSTOMER_ID" NUMBER(9,0), - "FIRST_NAME" VARCHAR2(30 BYTE), - "LAST_NAME" VARCHAR2(30 BYTE), - "ADDRESS" VARCHAR2(30 BYTE), - "CITY" VARCHAR2(30 BYTE), - "STATE" VARCHAR2(20 BYTE), - "ZIPCODE" VARCHAR2(20 BYTE), - "USERNAME" VARCHAR2(30 BYTE), - "PASSWORD" VARCHAR2(30 BYTE), - PRIMARY KEY ("CUSTOMER_ID") - USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS - STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 - PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) - TABLESPACE "SYSTEM" ENABLE - ) SEGMENT CREATION IMMEDIATE - PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING - STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 - PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) - TABLESPACE "SYSTEM" ; - - - CREATE TABLE "MOVIE" - ( "ID" NUMBER, - "TYPE" VARCHAR2(10 BYTE), - "TITLE" VARCHAR2(40 BYTE), - "DIRECTOR" VARCHAR2(20 BYTE), - "GENRE" VARCHAR2(20 BYTE), - "RENTAL_PRICE" NUMBER(7,2), - "RATING" VARCHAR2(10 BYTE), - "IMAGE_LOCATION" VARCHAR2(100 BYTE), - PRIMARY KEY ("ID") - USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS - STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 - PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) - TABLESPACE "SYSTEM" ENABLE - ) SEGMENT CREATION IMMEDIATE - PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING - STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 - PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) - TABLESPACE "SYSTEM" ; diff --git a/redbox/src/com/training/java/redbox/AddToCartServlet.java b/redbox/src/com/training/java/redbox/AddToCartServlet.java deleted file mode 100644 index fbd6631..0000000 --- a/redbox/src/com/training/java/redbox/AddToCartServlet.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -/** - * Servlet implementation class AddToCartServlet - */ -public class AddToCartServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - - long id = Long.parseLong(request.getParameter("id")); - - HttpSession session = request.getSession(); - - List cart = (List) session.getAttribute("cart"); - - if (cart == null) { - cart = new ArrayList<>(); - cart.add(id); - - session.setAttribute("cart", cart); - } else { - cart.add(id); - } - - RequestDispatcher rd = request - .getRequestDispatcher("/listMovies"); - rd.forward(request, response); - - } - -} diff --git a/redbox/src/com/training/java/redbox/CheckoutServlet.java b/redbox/src/com/training/java/redbox/CheckoutServlet.java deleted file mode 100644 index 5dd3acc..0000000 --- a/redbox/src/com/training/java/redbox/CheckoutServlet.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class CheckoutServlet - */ -public class CheckoutServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - List ids = (List) session.getAttribute("cart"); - - List movies = new ArrayList<>(); - - MovieDAO dao = new MovieDAOJDBCImpl(); - - for(long id : ids) - { - try { - movies.add(dao.findByPrimaryKey(id)); - } catch (DAOException e) { - e.printStackTrace(); - } - } - - request.setAttribute("MoviesCart", movies); - - RequestDispatcher rd = request.getRequestDispatcher("/Checkout.jsp"); - rd.forward(request, response); - - } - -} diff --git a/redbox/src/com/training/java/redbox/ListMoviesServlet.java b/redbox/src/com/training/java/redbox/ListMoviesServlet.java deleted file mode 100644 index 2dffb9a..0000000 --- a/redbox/src/com/training/java/redbox/ListMoviesServlet.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class ListMoviesServlet - */ -public class ListMoviesServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - - MovieDAO dao = new MovieDAOJDBCImpl(); - try { - List movies = dao.getAllMovies(); - - request.setAttribute("movies", movies); - - RequestDispatcher rd = request - .getRequestDispatcher("/ShowMovies.jsp"); - rd.forward(request, response); - - } catch (DAOException e) { - e.printStackTrace(); - } - - } - -} diff --git a/redbox/src/com/training/java/redbox/domain/BaseDAO.java b/redbox/src/com/training/java/redbox/domain/BaseDAO.java deleted file mode 100644 index 5f2c545..0000000 --- a/redbox/src/com/training/java/redbox/domain/BaseDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - private static final String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE"; - private static final String username = "redbox"; - private static final String password = "redbox"; - - // getConnection method - - protected Connection getConnection() throws DAOException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - - } catch (ClassNotFoundException ex) { - throw new DAOException(ex, "Class Not Found"); - } catch (SQLException ex) { - throw new DAOException(ex); - } - - } - - /** - * Close all resources: - * - * Close connection Close statement Close resultSet - */ - protected void closeResources(Connection connection, Statement statement, - ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} - diff --git a/redbox/src/com/training/java/redbox/domain/Customer.java b/redbox/src/com/training/java/redbox/domain/Customer.java deleted file mode 100644 index c379ab1..0000000 --- a/redbox/src/com/training/java/redbox/domain/Customer.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java.redbox.domain; - -public class Customer { - - private long customerId; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private String userName; - private String password; - - public Customer() - { - - } - public Customer(long customerId,String firstName,String lastName) - { - this.customerId=customerId; - this.firstName=firstName; - this.lastName=lastName; - } - - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - public String getAddress() { - return address; - } - public void setAddress(String address) { - this.address = address; - } - public String getCity() { - return city; - } - public void setCity(String city) { - this.city = city; - } - public String getState() { - return state; - } - public void setState(String state) { - this.state = state; - } - public String getZipCode() { - return zipCode; - } - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - public long getCustomerId() { - return customerId; - } - public String getFirstName() { - return firstName; - } - public String getLastName() { - return lastName; - } - - - } diff --git a/redbox/src/com/training/java/redbox/domain/CustomerDAO.java b/redbox/src/com/training/java/redbox/domain/CustomerDAO.java deleted file mode 100644 index 4110ee5..0000000 --- a/redbox/src/com/training/java/redbox/domain/CustomerDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - void addCustomer(Customer customer)throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(String customerId) throws DAOException; - Customer findCustomerByCustomerId(String customerId)throws DAOException; - -} - - diff --git a/redbox/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java b/redbox/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java deleted file mode 100644 index 867fe6e..0000000 --- a/redbox/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - - -public class CustomerDaoJdbcImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - List customers = new ArrayList(); - - Connection con = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - con = getConnection(); - statement = con.createStatement(); - resultSet = statement.executeQuery("select * from customers"); - - while (resultSet.next()) { - long customerId = resultSet.getLong("customer_id"); - String username = resultSet.getString("username"); - String password = resultSet.getString("password"); - String firstname = resultSet.getString("first_name"); - String lastname = resultSet.getString("last_name"); - String address = resultSet.getString("address"); - String city = resultSet.getString("city"); - String state = resultSet.getString("state"); - String zipcode = resultSet.getString("zipcode"); - - - Customer customer = new Customer(customerId, firstname, lastname); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - customer.setUserName(username); - customer.setPassword(password); - - customers.add(customer); - - } - - } catch (SQLException e) { - throw new DAOException("An unexpected error occured while accessing the database.", e); - } finally { - - closeResources(con, statement, resultSet); - - } - - return customers; - - - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - try { - con = getConnection(); - statement = con.prepareStatement("insert into customers values(?,?,?,?,?,?,?,?,?)"); - - statement.setLong(1,customer.getCustomerId()); - statement.setString(2, customer.getFirstName()); - statement.setString(3, customer.getLastName()); - statement.setString(4, customer.getAddress()); - statement.setString(5, customer.getCity()); - statement.setString(6, customer.getState()); - statement.setString(7, customer.getZipCode()); - statement.setString(8, customer.getUserName()); - statement.setString(9, customer.getPassword()); - - statement.executeUpdate(); - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - - - - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - long customerId=customer.getCustomerId(); - String address= customer.getAddress(); - String city= customer.getCity(); - String state= customer.getState(); - String zipcode= customer.getZipCode(); - String username= customer.getUserName(); - String password= customer.getPassword(); - - try { - con = getConnection(); - statement = con.prepareStatement("update customers set address=?,city=?, state=?,zipcode=?,username=?,password=? where customer_id = ?"); - statement.setString(1,address); - statement.setString(2,city); - statement.setString(3,state ); - statement.setString(4,zipcode ); - statement.setString(5, username); - statement.setString(6,password ); - statement.setLong(7, customerId); - - int noOfRowsUpdated= statement.executeUpdate(); - System.out.println("noOfRowsUpdated= "+ noOfRowsUpdated); - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - - - - - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - - try { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id=?"); - statement.setString(1, customerId); - - statement.executeUpdate(); - // System.out.println("no of rows deleted: "+ noOfRowsDeleted ); - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - long customer_id=0 ; - String username =null; - String password=null ; - String firstname=null ; - String lastname=null ; - String address=null ; - String city=null ; - String state=null ; - String zipcode=null ; - - Customer customer; - - try{ - con = getConnection(); - statement = con.prepareStatement("Select * from customers where customer_id = ?"); - - statement.setString(1, customerId); - resultSet = statement.executeQuery(); - - if (resultSet.next()) - { - customer_id = resultSet.getLong("customer_id"); - username= resultSet.getString("username"); - password = resultSet.getString("password"); - firstname = resultSet.getString("first_name"); - lastname = resultSet.getString("last_name"); - address = resultSet.getString("address"); - city = resultSet.getString("city"); - state = resultSet.getString("state"); - zipcode = resultSet.getString("zipcode"); - } - - int noOfRowsUpdated = statement.executeUpdate(); - - customer = new Customer(customer_id,firstname,lastname); - customer.setUserName(username); - customer.setPassword(password); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode);; - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - closeResources(con, statement, resultSet); - } - - - return customer; - - - } - -} diff --git a/redbox/src/com/training/java/redbox/domain/DAOException.java b/redbox/src/com/training/java/redbox/domain/DAOException.java deleted file mode 100644 index 2469d7d..0000000 --- a/redbox/src/com/training/java/redbox/domain/DAOException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage, Exception ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/redbox/src/com/training/java/redbox/domain/Movie.java b/redbox/src/com/training/java/redbox/domain/Movie.java deleted file mode 100644 index a4522ed..0000000 --- a/redbox/src/com/training/java/redbox/domain/Movie.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.redbox.domain; - -public class Movie { - - private long id; - private String type; - private String title; - private double rentalPrice; - private String imageLocation; - - // constructor - - public Movie(long id, String type, String title, double rentalPrice, - String imageLocation) { - super(); - this.id = id; - this.type = type; - this.title = title; - this.rentalPrice = rentalPrice; - this.imageLocation = imageLocation; - } - - // getters - - public long getId() { - return id; - } - - public String getType() { - return type; - } - - public String getTitle() { - return title; - } - - public double rentalPrice() { - return rentalPrice; - } - - public double getRentalPrice() { - return rentalPrice; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getImageLocation() { - return imageLocation; - } - -} \ No newline at end of file diff --git a/redbox/src/com/training/java/redbox/domain/MovieDAO.java b/redbox/src/com/training/java/redbox/domain/MovieDAO.java deleted file mode 100644 index 1d57c9d..0000000 --- a/redbox/src/com/training/java/redbox/domain/MovieDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -/** - * This is a Data Access object Interface. - * - * @author Satya - * - */ - -public interface MovieDAO { - - // Contract - List getAllMovies() throws DAOException; - - void addMovie(Movie movie) throws DAOException; - - void updateMovie(Movie movie) throws DAOException; - - void deleteMovie(long id) throws DAOException; - - Movie findByPrimaryKey(long id) throws DAOException; - -} diff --git a/redbox/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java b/redbox/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index 3ed1e3c..0000000 --- a/redbox/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - - - -public class MovieDAOJDBCImpl extends BaseDAO implements MovieDAO { - - @Override - public List getAllMovies() throws DAOException { - - // Create a list of movie. - List movies = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - // Calling getConnection() - - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("Select * from Movie"); - - while (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - // Instantiate Movie object - Movie movie = new Movie(id, type, title, rentalPrice, imageLocation); - - // add movie object to list - - movies.add(movie); - - } - - } catch (SQLException ex) { - - throw new DAOException(ex, - "Error while selecting a record from database"); - - } finally { - // calling colseResources method to close all resources. - closeResources(connection, statement, resultSet); - - } - - return movies; - } - - - // adding record to movie table through DAO - @Override - public void addMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("insert into Movie values(?,?,?,?,?,?,?)"); - statement.setLong(1, id); - statement.setString(2, type); - statement.setString(3, title); - statement.setDouble(4,rentalPrice); - - int noOfRowsInserted = statement.executeUpdate(); - connection.commit(); - if (noOfRowsInserted != 1) { - throw new DAOException("Inserting a Movie failed"); - } - - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } - - - - - - - @Override - public void updateMovie( Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - - statement = connection - .prepareStatement("update Movie set type =?, title=?,director= ?,genre=?,rental_Price =?,rating=? where id = ?"); - - - statement.setString(1, type); - statement.setString(2, title); - statement.setDouble(5,rentalPrice); - - statement.setLong(7, id); - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - System.out.println("No Rows Updated"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while updating a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public void deleteMovie(long id) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("delete from movie where id = ?"); - - statement.setLong(1, id); - - int noOfRowsDeleted = statement.executeUpdate(); - - if (noOfRowsDeleted != 1) { - throw new DAOException("Delete failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while deleting a record from the Database"); - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public Movie findByPrimaryKey(long movieId) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - Movie movie = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("Select * from Movie where id = ?"); - - statement.setLong(1, movieId); - - resultSet = statement.executeQuery(); - - if (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - return new Movie(id, type, title, rentalPrice, imageLocation); - - } - - throw new DAOException("Invalid id provided"); - - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while selecting a record from the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - - - } - - } diff --git a/redbox/src/com/training/java/redbox/domain/Orders.java b/redbox/src/com/training/java/redbox/domain/Orders.java deleted file mode 100644 index e388506..0000000 --- a/redbox/src/com/training/java/redbox/domain/Orders.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.training.java.redbox.domain; - -public class Orders { - - private long id; - private long customer_id; - private long movie_id; - private long rental_days; - - public Orders(long id, long customer_id, long movie_id, long rental_days) { - super(); - this.id = id; - this.customer_id = customer_id; - this.movie_id = movie_id; - this.rental_days = rental_days; - } - - /** - * @return the id - */ - public long getId() { - return id; - } - - /** - * @return the customer_id - */ - public long getCustomer_id() { - return customer_id; - } - - /** - * @return the movie_id - */ - public long getMovie_id() { - return movie_id; - } - - /** - * @return the rental_days - */ - public long getRental_days() { - return rental_days; - } - -} diff --git a/redbox/src/com/training/java/redbox/domain/OrdersDAO.java b/redbox/src/com/training/java/redbox/domain/OrdersDAO.java deleted file mode 100644 index a5a793e..0000000 --- a/redbox/src/com/training/java/redbox/domain/OrdersDAO.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface OrdersDAO { - - void createOrders(Orders orders) throws DAOException; - - List getAllOrders() throws DAOException; - - Orders getOrdersById(long id) throws DAOException; - - void update(Orders orders) throws DAOException; - - void delete(long id) throws DAOException; -} diff --git a/redbox/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java b/redbox/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java deleted file mode 100644 index 9fc4ccf..0000000 --- a/redbox/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public List getAllOrders() throws DAOException { - - List order = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from Orders"); - - while (rs.next()) { - long id = rs.getLong("id"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - long rental_days = rs.getLong("rental_days"); - - Orders orders = new Orders(id, customer_id, movie_id, - rental_days); - order.add(orders); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - - @Override - public void createOrders(Orders orders) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("insert into orders values(?,?,?,?)"); - - stmt.setLong(1, orders.getId()); - stmt.setLong(2, orders.getCustomer_id()); - stmt.setLong(3, orders.getMovie_id()); - stmt.setLong(4, orders.getRental_days()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - - @Override - public Orders getOrdersById(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Orders order = null; - try { - con = getConnection(); - stmt = con.prepareStatement("select * from order where id = ?"); - stmt.setLong(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) { - long Id = rs.getLong("id"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - long rental_days = rs.getLong("rental_days"); - - order = new Orders(id, customer_id, movie_id, rental_days); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - } - - @Override - public void update(Orders orders) throws DAOException { - { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con - .prepareStatement("update orders set id = ?, customer_id= ?, movie_id = ?, rental_days = ? where id = ?"); - stmt.setLong(1, orders.getId()); - stmt.setLong(2, orders.getCustomer_id()); - stmt.setLong(3, orders.getMovie_id()); - stmt.setLong(4, orders.getRental_days()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - } - - } - - @Override - public void delete(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("delete from orders where id = ?"); - stmt.setLong(1, id); - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - -} diff --git a/redbox2/.classpath b/redbox2/.classpath deleted file mode 100644 index 23a27a7..0000000 --- a/redbox2/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/redbox2/.project b/redbox2/.project deleted file mode 100644 index 600b639..0000000 --- a/redbox2/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - redbox2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/redbox2/.settings/.jsdtscope b/redbox2/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/redbox2/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/redbox2/.settings/org.eclipse.jdt.core.prefs b/redbox2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/redbox2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/redbox2/.settings/org.eclipse.wst.common.component b/redbox2/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 2654c56..0000000 --- a/redbox2/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/redbox2/.settings/org.eclipse.wst.common.project.facet.core.xml b/redbox2/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 13db573..0000000 --- a/redbox2/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/redbox2/.settings/org.eclipse.wst.jsdt.ui.superType.container b/redbox2/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/redbox2/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/redbox2/.settings/org.eclipse.wst.jsdt.ui.superType.name b/redbox2/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/redbox2/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/redbox2/WebContent/META-INF/MANIFEST.MF b/redbox2/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/redbox2/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/redbox2/WebContent/WEB-INF/Checkout.jsp b/redbox2/WebContent/WEB-INF/Checkout.jsp deleted file mode 100644 index 7ce0677..0000000 --- a/redbox2/WebContent/WEB-INF/Checkout.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - -Insert title here - - - - <%@include file="Header.jsp"%>
      - - Please find below the movies you added to the cart.

      - - - - - - - - - - - - - - - -
      TitleTypePrice
      - -
      - -
      - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox2/WebContent/WEB-INF/Footer.jsp b/redbox2/WebContent/WEB-INF/Footer.jsp deleted file mode 100644 index bf99545..0000000 --- a/redbox2/WebContent/WEB-INF/Footer.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -
      -
      -
      -
      -
      - - - -
      © 2014, Redbox Automated Retail, LLC. All rights reserved.
      - - - - \ No newline at end of file diff --git a/redbox2/WebContent/WEB-INF/Header.jsp b/redbox2/WebContent/WEB-INF/Header.jsp deleted file mode 100644 index 3e5fd7d..0000000 --- a/redbox2/WebContent/WEB-INF/Header.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - - - - - \ No newline at end of file diff --git a/redbox2/WebContent/WEB-INF/ShowMovies.jsp b/redbox2/WebContent/WEB-INF/ShowMovies.jsp deleted file mode 100644 index 10c0f1b..0000000 --- a/redbox2/WebContent/WEB-INF/ShowMovies.jsp +++ /dev/null @@ -1,52 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> - - - - - - -Insert title here - - - - <%@include file="Header.jsp"%> - - - - - -
      - - - (${fn:length(cart)}) - -
      - - - - - - - - - - - - - -
      - -
      - Add to -
      - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox2/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar b/redbox2/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar deleted file mode 100644 index a86a365..0000000 Binary files a/redbox2/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar and /dev/null differ diff --git a/redbox2/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar b/redbox2/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar deleted file mode 100644 index 4b3b433..0000000 Binary files a/redbox2/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar and /dev/null differ diff --git a/redbox2/WebContent/WEB-INF/lib/ojdbc6.jar b/redbox2/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/redbox2/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/redbox2/WebContent/WEB-INF/web.xml b/redbox2/WebContent/WEB-INF/web.xml deleted file mode 100644 index 93728bd..0000000 --- a/redbox2/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - redbox - - index.jsp - - - - ListMoviesServlet - ListMoviesServlet - com.training.java.redbox.ListMoviesServlet - - - ListMoviesServlet - /listMovies - - - - AddToCartServlet - AddToCartServlet - com.training.java.redbox.AddToCartServlet - - - AddToCartServlet - /addToCart - - - - CheckoutServlet - CheckoutServlet - com.training.java.redbox.CheckoutServlet - - - CheckoutServlet - /checkout - - \ No newline at end of file diff --git a/redbox2/WebContent/images/FreeBirdsMovie.jpg b/redbox2/WebContent/images/FreeBirdsMovie.jpg deleted file mode 100644 index c3fca34..0000000 Binary files a/redbox2/WebContent/images/FreeBirdsMovie.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/FrozenMovie.jpg b/redbox2/WebContent/images/FrozenMovie.jpg deleted file mode 100644 index 811ebd3..0000000 Binary files a/redbox2/WebContent/images/FrozenMovie.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/LegoMovie.jpg b/redbox2/WebContent/images/LegoMovie.jpg deleted file mode 100644 index 1b1a7be..0000000 Binary files a/redbox2/WebContent/images/LegoMovie.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/MandelaMovie.jpg b/redbox2/WebContent/images/MandelaMovie.jpg deleted file mode 100644 index a172f73..0000000 Binary files a/redbox2/WebContent/images/MandelaMovie.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/ThorMovie.jpg b/redbox2/WebContent/images/ThorMovie.jpg deleted file mode 100644 index 2ac8ee8..0000000 Binary files a/redbox2/WebContent/images/ThorMovie.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/cart.jpg b/redbox2/WebContent/images/cart.jpg deleted file mode 100644 index a6c8488..0000000 Binary files a/redbox2/WebContent/images/cart.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/checkout.jpg b/redbox2/WebContent/images/checkout.jpg deleted file mode 100644 index f8f2bda..0000000 Binary files a/redbox2/WebContent/images/checkout.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/login.jpg b/redbox2/WebContent/images/login.jpg deleted file mode 100644 index 442c689..0000000 Binary files a/redbox2/WebContent/images/login.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/logo.jpg b/redbox2/WebContent/images/logo.jpg deleted file mode 100644 index 476dae1..0000000 Binary files a/redbox2/WebContent/images/logo.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/signup.jpg b/redbox2/WebContent/images/signup.jpg deleted file mode 100644 index 320d80a..0000000 Binary files a/redbox2/WebContent/images/signup.jpg and /dev/null differ diff --git a/redbox2/WebContent/images/signup2.jpg b/redbox2/WebContent/images/signup2.jpg deleted file mode 100644 index 07d0696..0000000 Binary files a/redbox2/WebContent/images/signup2.jpg and /dev/null differ diff --git a/redbox2/WebContent/index.jsp b/redbox2/WebContent/index.jsp deleted file mode 100644 index 59dbe99..0000000 --- a/redbox2/WebContent/index.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -<%response.sendRedirect("/redbox2/listMovies"); %> - - - - \ No newline at end of file diff --git a/redbox2/src/com/training/java/redbox/AddToCartServlet.java b/redbox2/src/com/training/java/redbox/AddToCartServlet.java deleted file mode 100644 index fbd6631..0000000 --- a/redbox2/src/com/training/java/redbox/AddToCartServlet.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -/** - * Servlet implementation class AddToCartServlet - */ -public class AddToCartServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - - long id = Long.parseLong(request.getParameter("id")); - - HttpSession session = request.getSession(); - - List cart = (List) session.getAttribute("cart"); - - if (cart == null) { - cart = new ArrayList<>(); - cart.add(id); - - session.setAttribute("cart", cart); - } else { - cart.add(id); - } - - RequestDispatcher rd = request - .getRequestDispatcher("/listMovies"); - rd.forward(request, response); - - } - -} diff --git a/redbox2/src/com/training/java/redbox/CheckoutServlet.java b/redbox2/src/com/training/java/redbox/CheckoutServlet.java deleted file mode 100644 index a3c7989..0000000 --- a/redbox2/src/com/training/java/redbox/CheckoutServlet.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class CheckoutServlet - */ -public class CheckoutServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - List ids = (List) session.getAttribute("cart"); - - List movies = new ArrayList<>(); - - MovieDAO dao = new MovieDAOJDBCImpl(); - - for(long id : ids) - { - try { - movies.add(dao.findByPrimaryKey(id)); - } catch (DAOException e) { - e.printStackTrace(); - } - } - - request.setAttribute("MoviesCart", movies); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Checkout.jsp"); - rd.forward(request, response); - - } - -} diff --git a/redbox2/src/com/training/java/redbox/ListMoviesServlet.java b/redbox2/src/com/training/java/redbox/ListMoviesServlet.java deleted file mode 100644 index 6eb32d7..0000000 --- a/redbox2/src/com/training/java/redbox/ListMoviesServlet.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class ListMoviesServlet - */ -public class ListMoviesServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse - * response) - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - - MovieDAO dao = new MovieDAOJDBCImpl(); - try { - List movies = dao.getAllMovies(); - - request.setAttribute("movies", movies); - - RequestDispatcher rd = request - .getRequestDispatcher("/WEB-INF/ShowMovies.jsp"); - rd.forward(request, response); - - } catch (DAOException e) { - e.printStackTrace(); - } - - } -} diff --git a/redbox2/src/com/training/java/redbox/domain/BaseDAO.java b/redbox2/src/com/training/java/redbox/domain/BaseDAO.java deleted file mode 100644 index 5f2c545..0000000 --- a/redbox2/src/com/training/java/redbox/domain/BaseDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - private static final String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE"; - private static final String username = "redbox"; - private static final String password = "redbox"; - - // getConnection method - - protected Connection getConnection() throws DAOException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - - } catch (ClassNotFoundException ex) { - throw new DAOException(ex, "Class Not Found"); - } catch (SQLException ex) { - throw new DAOException(ex); - } - - } - - /** - * Close all resources: - * - * Close connection Close statement Close resultSet - */ - protected void closeResources(Connection connection, Statement statement, - ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} - diff --git a/redbox2/src/com/training/java/redbox/domain/Customer.java b/redbox2/src/com/training/java/redbox/domain/Customer.java deleted file mode 100644 index c379ab1..0000000 --- a/redbox2/src/com/training/java/redbox/domain/Customer.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java.redbox.domain; - -public class Customer { - - private long customerId; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private String userName; - private String password; - - public Customer() - { - - } - public Customer(long customerId,String firstName,String lastName) - { - this.customerId=customerId; - this.firstName=firstName; - this.lastName=lastName; - } - - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - public String getAddress() { - return address; - } - public void setAddress(String address) { - this.address = address; - } - public String getCity() { - return city; - } - public void setCity(String city) { - this.city = city; - } - public String getState() { - return state; - } - public void setState(String state) { - this.state = state; - } - public String getZipCode() { - return zipCode; - } - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - public long getCustomerId() { - return customerId; - } - public String getFirstName() { - return firstName; - } - public String getLastName() { - return lastName; - } - - - } diff --git a/redbox2/src/com/training/java/redbox/domain/CustomerDAO.java b/redbox2/src/com/training/java/redbox/domain/CustomerDAO.java deleted file mode 100644 index 4110ee5..0000000 --- a/redbox2/src/com/training/java/redbox/domain/CustomerDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - void addCustomer(Customer customer)throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(String customerId) throws DAOException; - Customer findCustomerByCustomerId(String customerId)throws DAOException; - -} - - diff --git a/redbox2/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java b/redbox2/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java deleted file mode 100644 index 867fe6e..0000000 --- a/redbox2/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - - -public class CustomerDaoJdbcImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - List customers = new ArrayList(); - - Connection con = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - con = getConnection(); - statement = con.createStatement(); - resultSet = statement.executeQuery("select * from customers"); - - while (resultSet.next()) { - long customerId = resultSet.getLong("customer_id"); - String username = resultSet.getString("username"); - String password = resultSet.getString("password"); - String firstname = resultSet.getString("first_name"); - String lastname = resultSet.getString("last_name"); - String address = resultSet.getString("address"); - String city = resultSet.getString("city"); - String state = resultSet.getString("state"); - String zipcode = resultSet.getString("zipcode"); - - - Customer customer = new Customer(customerId, firstname, lastname); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - customer.setUserName(username); - customer.setPassword(password); - - customers.add(customer); - - } - - } catch (SQLException e) { - throw new DAOException("An unexpected error occured while accessing the database.", e); - } finally { - - closeResources(con, statement, resultSet); - - } - - return customers; - - - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - try { - con = getConnection(); - statement = con.prepareStatement("insert into customers values(?,?,?,?,?,?,?,?,?)"); - - statement.setLong(1,customer.getCustomerId()); - statement.setString(2, customer.getFirstName()); - statement.setString(3, customer.getLastName()); - statement.setString(4, customer.getAddress()); - statement.setString(5, customer.getCity()); - statement.setString(6, customer.getState()); - statement.setString(7, customer.getZipCode()); - statement.setString(8, customer.getUserName()); - statement.setString(9, customer.getPassword()); - - statement.executeUpdate(); - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - - - - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - long customerId=customer.getCustomerId(); - String address= customer.getAddress(); - String city= customer.getCity(); - String state= customer.getState(); - String zipcode= customer.getZipCode(); - String username= customer.getUserName(); - String password= customer.getPassword(); - - try { - con = getConnection(); - statement = con.prepareStatement("update customers set address=?,city=?, state=?,zipcode=?,username=?,password=? where customer_id = ?"); - statement.setString(1,address); - statement.setString(2,city); - statement.setString(3,state ); - statement.setString(4,zipcode ); - statement.setString(5, username); - statement.setString(6,password ); - statement.setLong(7, customerId); - - int noOfRowsUpdated= statement.executeUpdate(); - System.out.println("noOfRowsUpdated= "+ noOfRowsUpdated); - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - - - - - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - - try { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id=?"); - statement.setString(1, customerId); - - statement.executeUpdate(); - // System.out.println("no of rows deleted: "+ noOfRowsDeleted ); - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - long customer_id=0 ; - String username =null; - String password=null ; - String firstname=null ; - String lastname=null ; - String address=null ; - String city=null ; - String state=null ; - String zipcode=null ; - - Customer customer; - - try{ - con = getConnection(); - statement = con.prepareStatement("Select * from customers where customer_id = ?"); - - statement.setString(1, customerId); - resultSet = statement.executeQuery(); - - if (resultSet.next()) - { - customer_id = resultSet.getLong("customer_id"); - username= resultSet.getString("username"); - password = resultSet.getString("password"); - firstname = resultSet.getString("first_name"); - lastname = resultSet.getString("last_name"); - address = resultSet.getString("address"); - city = resultSet.getString("city"); - state = resultSet.getString("state"); - zipcode = resultSet.getString("zipcode"); - } - - int noOfRowsUpdated = statement.executeUpdate(); - - customer = new Customer(customer_id,firstname,lastname); - customer.setUserName(username); - customer.setPassword(password); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode);; - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - closeResources(con, statement, resultSet); - } - - - return customer; - - - } - -} diff --git a/redbox2/src/com/training/java/redbox/domain/DAOException.java b/redbox2/src/com/training/java/redbox/domain/DAOException.java deleted file mode 100644 index 2469d7d..0000000 --- a/redbox2/src/com/training/java/redbox/domain/DAOException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage, Exception ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/redbox2/src/com/training/java/redbox/domain/Movie.java b/redbox2/src/com/training/java/redbox/domain/Movie.java deleted file mode 100644 index a4522ed..0000000 --- a/redbox2/src/com/training/java/redbox/domain/Movie.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.redbox.domain; - -public class Movie { - - private long id; - private String type; - private String title; - private double rentalPrice; - private String imageLocation; - - // constructor - - public Movie(long id, String type, String title, double rentalPrice, - String imageLocation) { - super(); - this.id = id; - this.type = type; - this.title = title; - this.rentalPrice = rentalPrice; - this.imageLocation = imageLocation; - } - - // getters - - public long getId() { - return id; - } - - public String getType() { - return type; - } - - public String getTitle() { - return title; - } - - public double rentalPrice() { - return rentalPrice; - } - - public double getRentalPrice() { - return rentalPrice; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getImageLocation() { - return imageLocation; - } - -} \ No newline at end of file diff --git a/redbox2/src/com/training/java/redbox/domain/MovieDAO.java b/redbox2/src/com/training/java/redbox/domain/MovieDAO.java deleted file mode 100644 index 1d57c9d..0000000 --- a/redbox2/src/com/training/java/redbox/domain/MovieDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -/** - * This is a Data Access object Interface. - * - * @author Satya - * - */ - -public interface MovieDAO { - - // Contract - List getAllMovies() throws DAOException; - - void addMovie(Movie movie) throws DAOException; - - void updateMovie(Movie movie) throws DAOException; - - void deleteMovie(long id) throws DAOException; - - Movie findByPrimaryKey(long id) throws DAOException; - -} diff --git a/redbox2/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java b/redbox2/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index 3ed1e3c..0000000 --- a/redbox2/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - - - -public class MovieDAOJDBCImpl extends BaseDAO implements MovieDAO { - - @Override - public List getAllMovies() throws DAOException { - - // Create a list of movie. - List movies = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - // Calling getConnection() - - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("Select * from Movie"); - - while (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - // Instantiate Movie object - Movie movie = new Movie(id, type, title, rentalPrice, imageLocation); - - // add movie object to list - - movies.add(movie); - - } - - } catch (SQLException ex) { - - throw new DAOException(ex, - "Error while selecting a record from database"); - - } finally { - // calling colseResources method to close all resources. - closeResources(connection, statement, resultSet); - - } - - return movies; - } - - - // adding record to movie table through DAO - @Override - public void addMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("insert into Movie values(?,?,?,?,?,?,?)"); - statement.setLong(1, id); - statement.setString(2, type); - statement.setString(3, title); - statement.setDouble(4,rentalPrice); - - int noOfRowsInserted = statement.executeUpdate(); - connection.commit(); - if (noOfRowsInserted != 1) { - throw new DAOException("Inserting a Movie failed"); - } - - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } - - - - - - - @Override - public void updateMovie( Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - - statement = connection - .prepareStatement("update Movie set type =?, title=?,director= ?,genre=?,rental_Price =?,rating=? where id = ?"); - - - statement.setString(1, type); - statement.setString(2, title); - statement.setDouble(5,rentalPrice); - - statement.setLong(7, id); - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - System.out.println("No Rows Updated"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while updating a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public void deleteMovie(long id) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("delete from movie where id = ?"); - - statement.setLong(1, id); - - int noOfRowsDeleted = statement.executeUpdate(); - - if (noOfRowsDeleted != 1) { - throw new DAOException("Delete failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while deleting a record from the Database"); - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public Movie findByPrimaryKey(long movieId) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - Movie movie = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("Select * from Movie where id = ?"); - - statement.setLong(1, movieId); - - resultSet = statement.executeQuery(); - - if (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - return new Movie(id, type, title, rentalPrice, imageLocation); - - } - - throw new DAOException("Invalid id provided"); - - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while selecting a record from the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - - - } - - } diff --git a/redbox2/src/com/training/java/redbox/domain/Orders.java b/redbox2/src/com/training/java/redbox/domain/Orders.java deleted file mode 100644 index e388506..0000000 --- a/redbox2/src/com/training/java/redbox/domain/Orders.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.training.java.redbox.domain; - -public class Orders { - - private long id; - private long customer_id; - private long movie_id; - private long rental_days; - - public Orders(long id, long customer_id, long movie_id, long rental_days) { - super(); - this.id = id; - this.customer_id = customer_id; - this.movie_id = movie_id; - this.rental_days = rental_days; - } - - /** - * @return the id - */ - public long getId() { - return id; - } - - /** - * @return the customer_id - */ - public long getCustomer_id() { - return customer_id; - } - - /** - * @return the movie_id - */ - public long getMovie_id() { - return movie_id; - } - - /** - * @return the rental_days - */ - public long getRental_days() { - return rental_days; - } - -} diff --git a/redbox2/src/com/training/java/redbox/domain/OrdersDAO.java b/redbox2/src/com/training/java/redbox/domain/OrdersDAO.java deleted file mode 100644 index a5a793e..0000000 --- a/redbox2/src/com/training/java/redbox/domain/OrdersDAO.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface OrdersDAO { - - void createOrders(Orders orders) throws DAOException; - - List getAllOrders() throws DAOException; - - Orders getOrdersById(long id) throws DAOException; - - void update(Orders orders) throws DAOException; - - void delete(long id) throws DAOException; -} diff --git a/redbox2/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java b/redbox2/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java deleted file mode 100644 index 9fc4ccf..0000000 --- a/redbox2/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public List getAllOrders() throws DAOException { - - List order = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from Orders"); - - while (rs.next()) { - long id = rs.getLong("id"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - long rental_days = rs.getLong("rental_days"); - - Orders orders = new Orders(id, customer_id, movie_id, - rental_days); - order.add(orders); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - - @Override - public void createOrders(Orders orders) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("insert into orders values(?,?,?,?)"); - - stmt.setLong(1, orders.getId()); - stmt.setLong(2, orders.getCustomer_id()); - stmt.setLong(3, orders.getMovie_id()); - stmt.setLong(4, orders.getRental_days()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - - @Override - public Orders getOrdersById(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Orders order = null; - try { - con = getConnection(); - stmt = con.prepareStatement("select * from order where id = ?"); - stmt.setLong(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) { - long Id = rs.getLong("id"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - long rental_days = rs.getLong("rental_days"); - - order = new Orders(id, customer_id, movie_id, rental_days); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - } - - @Override - public void update(Orders orders) throws DAOException { - { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con - .prepareStatement("update orders set id = ?, customer_id= ?, movie_id = ?, rental_days = ? where id = ?"); - stmt.setLong(1, orders.getId()); - stmt.setLong(2, orders.getCustomer_id()); - stmt.setLong(3, orders.getMovie_id()); - stmt.setLong(4, orders.getRental_days()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - } - - } - - @Override - public void delete(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("delete from orders where id = ?"); - stmt.setLong(1, id); - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - -} diff --git a/redbox3/.classpath b/redbox3/.classpath deleted file mode 100644 index 23a27a7..0000000 --- a/redbox3/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/redbox3/.project b/redbox3/.project deleted file mode 100644 index 6ef4661..0000000 --- a/redbox3/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - redbox3 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/redbox3/.settings/.jsdtscope b/redbox3/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/redbox3/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/redbox3/.settings/org.eclipse.jdt.core.prefs b/redbox3/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/redbox3/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/redbox3/.settings/org.eclipse.wst.common.component b/redbox3/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 0cc7379..0000000 --- a/redbox3/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/redbox3/.settings/org.eclipse.wst.common.project.facet.core.xml b/redbox3/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 13db573..0000000 --- a/redbox3/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/redbox3/.settings/org.eclipse.wst.jsdt.ui.superType.container b/redbox3/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/redbox3/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/redbox3/.settings/org.eclipse.wst.jsdt.ui.superType.name b/redbox3/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/redbox3/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/redbox3/WebContent/META-INF/MANIFEST.MF b/redbox3/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/redbox3/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/redbox3/WebContent/WEB-INF/Checkout.jsp b/redbox3/WebContent/WEB-INF/Checkout.jsp deleted file mode 100644 index a53160d..0000000 --- a/redbox3/WebContent/WEB-INF/Checkout.jsp +++ /dev/null @@ -1,62 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - <%@include file="Header.jsp"%>
      - - - -

      - -

      - -
      - - Please find below the movies you added to the cart. -
      -
      - - - - - - - - - - - - - - - - - - - - - -
      TitleTypePrice
      - -
      - -
      - -
      - - - <%@include file="Footer.jsp"%> - - - - \ No newline at end of file diff --git a/redbox3/WebContent/WEB-INF/Footer.jsp b/redbox3/WebContent/WEB-INF/Footer.jsp deleted file mode 100644 index c8de0ed..0000000 --- a/redbox3/WebContent/WEB-INF/Footer.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -
      -
      -
      -
      -
      - - -
      © 2014, Redbox Automated Retail, LLC. All rights reserved.
      - - - \ No newline at end of file diff --git a/redbox3/WebContent/WEB-INF/Header.jsp b/redbox3/WebContent/WEB-INF/Header.jsp deleted file mode 100644 index 3bd784f..0000000 --- a/redbox3/WebContent/WEB-INF/Header.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Customer"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - Welcome - - - - - \ No newline at end of file diff --git a/redbox3/WebContent/WEB-INF/Login.jsp b/redbox3/WebContent/WEB-INF/Login.jsp deleted file mode 100644 index b709b07..0000000 --- a/redbox3/WebContent/WEB-INF/Login.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - -<%@include file="Header.jsp"%> - -
      - -
      - - - - -

      Please check username/password and try again.

      - - -
      - - - - - - - - - - - - - - - - - -
      Username:
      Password:
      - -
      - -<%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox3/WebContent/WEB-INF/ShowMovies.jsp b/redbox3/WebContent/WEB-INF/ShowMovies.jsp deleted file mode 100644 index 784b2a6..0000000 --- a/redbox3/WebContent/WEB-INF/ShowMovies.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%> -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - -Movie List - - - - <% - - System.out.println("Inside JSP"); - - %> - - <%@include file="Header.jsp"%> - - - - - - - - - - - - -
      - - - - - - - - - - () - -
      - - - - - - - - - - - - - - - - - - - - - - - -
      ${movie.title} -
      Add to
      - - - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox3/WebContent/WEB-INF/Signup.jsp b/redbox3/WebContent/WEB-INF/Signup.jsp deleted file mode 100644 index 5f2427b..0000000 --- a/redbox3/WebContent/WEB-INF/Signup.jsp +++ /dev/null @@ -1,80 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - -<%@include file="Header.jsp"%> - -
      - -
      -
      - - - -

      Username exists, please try another.

      - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      First Name:
      Last Name:
      Address:
      City:
      State:
      ZIP:
      Create a username:
      Create a password:
      - -
      - - - -<%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox3/WebContent/WEB-INF/ThankYou.jsp b/redbox3/WebContent/WEB-INF/ThankYou.jsp deleted file mode 100644 index 9847e5e..0000000 --- a/redbox3/WebContent/WEB-INF/ThankYou.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -Thank you. Your order has been placed. - - - \ No newline at end of file diff --git a/redbox3/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/redbox3/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/redbox3/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/redbox3/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/redbox3/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/redbox3/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/redbox3/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/commons-io-1.1.jar b/redbox3/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/redbox3/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/redbox3/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar b/redbox3/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar deleted file mode 100644 index a86a365..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar b/redbox3/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar deleted file mode 100644 index 4b3b433..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/redbox3/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/ojdbc6.jar b/redbox3/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/oro-2.0.8.jar b/redbox3/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/standard-1.0.6.jar b/redbox3/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/redbox3/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/redbox3/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/redbox3/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/redbox3/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/redbox3/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/redbox3/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/redbox3/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/redbox3/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/redbox3/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/redbox3/WebContent/WEB-INF/redbox-struts-config.xml b/redbox3/WebContent/WEB-INF/redbox-struts-config.xml deleted file mode 100644 index 604b290..0000000 --- a/redbox3/WebContent/WEB-INF/redbox-struts-config.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/redbox3/WebContent/WEB-INF/web.xml b/redbox3/WebContent/WEB-INF/web.xml deleted file mode 100644 index a94fefc..0000000 --- a/redbox3/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - redbox - - index.jsp - - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/redbox-struts-config.xml - - - - - - ActionServlet - *.do - - - \ No newline at end of file diff --git a/redbox3/WebContent/images/FreeBirdsMovie.jpg b/redbox3/WebContent/images/FreeBirdsMovie.jpg deleted file mode 100644 index c3fca34..0000000 Binary files a/redbox3/WebContent/images/FreeBirdsMovie.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/FrozenMovie.jpg b/redbox3/WebContent/images/FrozenMovie.jpg deleted file mode 100644 index 811ebd3..0000000 Binary files a/redbox3/WebContent/images/FrozenMovie.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/LegoMovie.jpg b/redbox3/WebContent/images/LegoMovie.jpg deleted file mode 100644 index 1b1a7be..0000000 Binary files a/redbox3/WebContent/images/LegoMovie.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/MandelaMovie.jpg b/redbox3/WebContent/images/MandelaMovie.jpg deleted file mode 100644 index a172f73..0000000 Binary files a/redbox3/WebContent/images/MandelaMovie.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/ThorMovie.jpg b/redbox3/WebContent/images/ThorMovie.jpg deleted file mode 100644 index 2ac8ee8..0000000 Binary files a/redbox3/WebContent/images/ThorMovie.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/cart.jpg b/redbox3/WebContent/images/cart.jpg deleted file mode 100644 index a6c8488..0000000 Binary files a/redbox3/WebContent/images/cart.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/checkout.jpg b/redbox3/WebContent/images/checkout.jpg deleted file mode 100644 index f8f2bda..0000000 Binary files a/redbox3/WebContent/images/checkout.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/login.jpg b/redbox3/WebContent/images/login.jpg deleted file mode 100644 index 442c689..0000000 Binary files a/redbox3/WebContent/images/login.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/logo.jpg b/redbox3/WebContent/images/logo.jpg deleted file mode 100644 index 476dae1..0000000 Binary files a/redbox3/WebContent/images/logo.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/signup.jpg b/redbox3/WebContent/images/signup.jpg deleted file mode 100644 index 320d80a..0000000 Binary files a/redbox3/WebContent/images/signup.jpg and /dev/null differ diff --git a/redbox3/WebContent/images/signup2.jpg b/redbox3/WebContent/images/signup2.jpg deleted file mode 100644 index 07d0696..0000000 Binary files a/redbox3/WebContent/images/signup2.jpg and /dev/null differ diff --git a/redbox3/WebContent/index.jsp b/redbox3/WebContent/index.jsp deleted file mode 100644 index 5a4a469..0000000 --- a/redbox3/WebContent/index.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -<%response.sendRedirect("/redbox/listMovies.do"); %> - - - \ No newline at end of file diff --git a/redbox3/doc/readme.txt b/redbox3/doc/readme.txt deleted file mode 100644 index e5823b4..0000000 --- a/redbox3/doc/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Struts is used in redbox application. \ No newline at end of file diff --git a/redbox3/src/com/training/java/redbox/AddToCartServlet.java b/redbox3/src/com/training/java/redbox/AddToCartServlet.java deleted file mode 100644 index cc4abe0..0000000 --- a/redbox3/src/com/training/java/redbox/AddToCartServlet.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -/** - * Servlet implementation class AddToCart - */ -public class AddToCartServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - long id = Long.parseLong(request.getParameter("id")); - - HttpSession session = request.getSession(); - - List cart = (List)session.getAttribute("cart"); - if(cart == null) - { - cart = new ArrayList<>(); - cart.add(id); - - session.setAttribute("cart", cart); - - }else{ - - cart.add(id); - } - - RequestDispatcher rd = request.getRequestDispatcher("/listMovies"); - rd.forward(request, response); - } - -} diff --git a/redbox3/src/com/training/java/redbox/CheckoutServlet.java b/redbox3/src/com/training/java/redbox/CheckoutServlet.java deleted file mode 100644 index 60462f7..0000000 --- a/redbox3/src/com/training/java/redbox/CheckoutServlet.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; -import com.training.java.redbox.domain.Orders; -import com.training.java.redbox.domain.OrdersDAO; -import com.training.java.redbox.domain.OrdersDAOJDBCImpl; - -/** - * Servlet implementation class CheckoutServlet - */ -public class CheckoutServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - List cart = (List) session.getAttribute("cart"); - - MovieDAO dao = new MovieDAOJDBCImpl(); - - List movies = new ArrayList<>(); - - for(long id : cart){ - - try { - movies.add(dao.findByPrimaryKey(id)); - - - } catch (DAOException e) { - e.printStackTrace(); - } - - } - - request.setAttribute("moviesCart", movies); - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Checkout.jsp"); - rd.forward(request, response); - - } - - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - - Customer customer = (Customer)session.getAttribute("customer"); - - if(customer!=null){ - - List ids = (List) session.getAttribute("cart"); - - OrdersDAO dao = new OrdersDAOJDBCImpl(); - long orderNum = 0; - - - try { - orderNum = dao.createOrderNumber(); - - for(long id : ids) - { - Orders order = new Orders(orderNum, 0, customer.getCustomerId(), id, "Rented"); - - dao.createOrders(order); - } - } catch (DAOException e) { - e.printStackTrace(); - } - - session.invalidate(); - response.sendRedirect("/redbox/thankyou"); - - } - else{ - - request.setAttribute("error", "Please login in order to checkout."); - doGet(request, response); - } - - } - -} diff --git a/redbox3/src/com/training/java/redbox/CustomerForm.java b/redbox3/src/com/training/java/redbox/CustomerForm.java deleted file mode 100644 index e440687..0000000 --- a/redbox3/src/com/training/java/redbox/CustomerForm.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.training.java.redbox; - -import org.apache.struts.action.ActionForm; - -public class CustomerForm extends ActionForm { - - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private String userName; - private String password; - private int age; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("First name = " + firstName); - sb.append("Last name = " + lastName); - - return sb.toString(); - } - -} diff --git a/redbox3/src/com/training/java/redbox/ListMoviesAction.java b/redbox3/src/com/training/java/redbox/ListMoviesAction.java deleted file mode 100644 index 1d4f1bf..0000000 --- a/redbox3/src/com/training/java/redbox/ListMoviesAction.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.java.redbox; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -public class ListMoviesAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - System.out.println("ListMoviesAction.execute called"); - - MovieDAO dao = new MovieDAOJDBCImpl(); - - try { - List movies = dao.getAllMovies(); - - request.setAttribute("movies", movies); - - } catch (DAOException e) { - e.printStackTrace(); - } - - return mapping.findForward("list"); - - } - - - -} diff --git a/redbox3/src/com/training/java/redbox/ListMoviesServlet.java b/redbox3/src/com/training/java/redbox/ListMoviesServlet.java deleted file mode 100644 index 9316218..0000000 --- a/redbox3/src/com/training/java/redbox/ListMoviesServlet.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class ListMoviesServlet - */ -public class ListMoviesServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - MovieDAO dao = new MovieDAOJDBCImpl(); - - try { - List movies = dao.getAllMovies(); - - request.setAttribute("movies", movies); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/ShowMovies.jsp"); - rd.forward(request, response); - - } catch (DAOException e) { - e.printStackTrace(); - } - - } - -} diff --git a/redbox3/src/com/training/java/redbox/LoginServlet.java b/redbox3/src/com/training/java/redbox/LoginServlet.java deleted file mode 100644 index b20e798..0000000 --- a/redbox3/src/com/training/java/redbox/LoginServlet.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.CustomerDAO; -import com.training.java.redbox.domain.CustomerDaoJdbcImpl; -import com.training.java.redbox.domain.DAOException; - -/** - * Servlet implementation class LoginServlet - */ -public class LoginServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Login.jsp"); - rd.forward(request, response); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String username = request.getParameter("username"); - String password = request.getParameter("password"); - Customer customer = null; - - CustomerDAO dao = new CustomerDaoJdbcImpl(); - - try { - - customer = dao.findByUsernameAndPassword(username, password); - - } catch (DAOException e) { - e.printStackTrace(); - } - - if (customer!=null) - { - HttpSession session = request.getSession(); - session.setAttribute("customer", customer); - - RequestDispatcher rd = request.getRequestDispatcher("/"); - rd.forward(request, response); - } - else - { - request.setAttribute("error", 1); - doGet(request, response); - } - - } - -} diff --git a/redbox3/src/com/training/java/redbox/SaveCustomerAction.java b/redbox3/src/com/training/java/redbox/SaveCustomerAction.java deleted file mode 100644 index 81bcdd1..0000000 --- a/redbox3/src/com/training/java/redbox/SaveCustomerAction.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.training.java.redbox; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.CustomerDAO; -import com.training.java.redbox.domain.CustomerDaoJdbcImpl; -import com.training.java.redbox.domain.DAOException; - -public class SaveCustomerAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - - CustomerForm customerForm = (CustomerForm) form; - - System.out.println(customerForm); - - CustomerDAO dao = new CustomerDaoJdbcImpl(); - - Customer customer = new Customer(0, customerForm.getFirstName(), customerForm.getLastName()); - customer.setAddress(customerForm.getAddress()); - customer.setCity(customerForm.getCity()); - customer.setState(customerForm.getState()); - customer.setZipCode(customerForm.getZipCode()); - customer.setUserName(customerForm.getUserName()); - customer.setPassword(customerForm.getPassword()); - - try { - dao.addCustomer(customer); - } catch (DAOException e) { - e.printStackTrace(); - } - - return mapping.findForward("login"); - - - } - -} diff --git a/redbox3/src/com/training/java/redbox/SignupAction.java b/redbox3/src/com/training/java/redbox/SignupAction.java deleted file mode 100644 index d009113..0000000 --- a/redbox3/src/com/training/java/redbox/SignupAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.redbox; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class SignupAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("signup"); - } - -} diff --git a/redbox3/src/com/training/java/redbox/SignupServlet.java b/redbox3/src/com/training/java/redbox/SignupServlet.java deleted file mode 100644 index 31135f6..0000000 --- a/redbox3/src/com/training/java/redbox/SignupServlet.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.CustomerDAO; -import com.training.java.redbox.domain.CustomerDaoJdbcImpl; -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class SignupServlet - */ -public class SignupServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Signup.jsp"); - rd.forward(request, response); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String address = request.getParameter("address"); - String city = request.getParameter("city"); - String state = request.getParameter("state"); - String zip = request.getParameter("zip"); - String username = request.getParameter("username"); - String password = request.getParameter("password"); - Customer customer = null; - - CustomerDAO dao = new CustomerDaoJdbcImpl(); - - try { - - customer = dao.findCustomerByUsername(username); - - } catch (DAOException e) { - e.printStackTrace(); - } - - if(customer==null){ - - customer = new Customer(0, firstName, lastName); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zip); - customer.setUserName(username); - customer.setPassword(password); - - try { - dao.addCustomer(customer); - } catch (DAOException e) { - e.printStackTrace(); - } - - RequestDispatcher rd = request.getRequestDispatcher("/"); - rd.forward(request, response); - - }else{ - - request.setAttribute("error", 1); - doGet(request, response); - - /*RequestDispatcher rd = request.getRequestDispatcher("/error"); - rd.forward(request, response); */ - } - - - } - -} diff --git a/redbox3/src/com/training/java/redbox/ThankYouServlet.java b/redbox3/src/com/training/java/redbox/ThankYouServlet.java deleted file mode 100644 index 6ac8f53..0000000 --- a/redbox3/src/com/training/java/redbox/ThankYouServlet.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class ThankYouServlet - */ -public class ThankYouServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/ThankYou.jsp"); - rd.forward(request, response); - - } - -} diff --git a/redbox3/src/com/training/java/redbox/domain/BaseDAO.java b/redbox3/src/com/training/java/redbox/domain/BaseDAO.java deleted file mode 100644 index 5f2c545..0000000 --- a/redbox3/src/com/training/java/redbox/domain/BaseDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - private static final String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE"; - private static final String username = "redbox"; - private static final String password = "redbox"; - - // getConnection method - - protected Connection getConnection() throws DAOException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - - } catch (ClassNotFoundException ex) { - throw new DAOException(ex, "Class Not Found"); - } catch (SQLException ex) { - throw new DAOException(ex); - } - - } - - /** - * Close all resources: - * - * Close connection Close statement Close resultSet - */ - protected void closeResources(Connection connection, Statement statement, - ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} - diff --git a/redbox3/src/com/training/java/redbox/domain/Customer.java b/redbox3/src/com/training/java/redbox/domain/Customer.java deleted file mode 100644 index c379ab1..0000000 --- a/redbox3/src/com/training/java/redbox/domain/Customer.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java.redbox.domain; - -public class Customer { - - private long customerId; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private String userName; - private String password; - - public Customer() - { - - } - public Customer(long customerId,String firstName,String lastName) - { - this.customerId=customerId; - this.firstName=firstName; - this.lastName=lastName; - } - - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - public String getAddress() { - return address; - } - public void setAddress(String address) { - this.address = address; - } - public String getCity() { - return city; - } - public void setCity(String city) { - this.city = city; - } - public String getState() { - return state; - } - public void setState(String state) { - this.state = state; - } - public String getZipCode() { - return zipCode; - } - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - public long getCustomerId() { - return customerId; - } - public String getFirstName() { - return firstName; - } - public String getLastName() { - return lastName; - } - - - } diff --git a/redbox3/src/com/training/java/redbox/domain/CustomerDAO.java b/redbox3/src/com/training/java/redbox/domain/CustomerDAO.java deleted file mode 100644 index aea1fda..0000000 --- a/redbox3/src/com/training/java/redbox/domain/CustomerDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - void addCustomer(Customer customer)throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(String customerId) throws DAOException; - Customer findCustomerByCustomerId(String customerId)throws DAOException; - Customer findCustomerByUsername(String username)throws DAOException; - Customer findByUsernameAndPassword(String username, String password)throws DAOException; - -} - - diff --git a/redbox3/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java b/redbox3/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java deleted file mode 100644 index 1979062..0000000 --- a/redbox3/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java +++ /dev/null @@ -1,410 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - - -public class CustomerDaoJdbcImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - List customers = new ArrayList(); - - Connection con = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - con = getConnection(); - statement = con.createStatement(); - resultSet = statement.executeQuery("select * from customers"); - - while (resultSet.next()) { - long customerId = resultSet.getLong("customer_id"); - String username = resultSet.getString("username"); - String password = resultSet.getString("password"); - String firstname = resultSet.getString("first_name"); - String lastname = resultSet.getString("last_name"); - String address = resultSet.getString("address"); - String city = resultSet.getString("city"); - String state = resultSet.getString("state"); - String zipcode = resultSet.getString("zipcode"); - - - Customer customer = new Customer(customerId, firstname, lastname); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - customer.setUserName(username); - customer.setPassword(password); - - customers.add(customer); - - } - - } catch (SQLException e) { - throw new DAOException("An unexpected error occured while accessing the database.", e); - } finally { - - closeResources(con, statement, resultSet); - - } - - return customers; - - - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - Statement statement1 = null; - long customerId = 0; - try { - con = getConnection(); - - statement1 = con.createStatement(); - ResultSet resultSet = statement1.executeQuery("select customer_seq.NEXTVAL from dual"); - - while (resultSet.next()) { - customerId = resultSet.getLong(1); - } - - statement = con.prepareStatement("insert into customers values(?,?,?,?,?,?,?,?,?)"); - - statement.setLong(1,customerId); - statement.setString(2, customer.getFirstName()); - statement.setString(3, customer.getLastName()); - statement.setString(4, customer.getAddress()); - statement.setString(5, customer.getCity()); - statement.setString(6, customer.getState()); - statement.setString(7, customer.getZipCode()); - statement.setString(8, customer.getUserName()); - statement.setString(9, customer.getPassword()); - - statement.executeUpdate(); - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (statement1 != null) { - try { - statement1.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - long customerId=customer.getCustomerId(); - String address= customer.getAddress(); - String city= customer.getCity(); - String state= customer.getState(); - String zipcode= customer.getZipCode(); - String username= customer.getUserName(); - String password= customer.getPassword(); - - try { - con = getConnection(); - statement = con.prepareStatement("update customers set address=?,city=?, state=?,zipcode=?,username=?,password=? where customer_id = ?"); - statement.setString(1,address); - statement.setString(2,city); - statement.setString(3,state ); - statement.setString(4,zipcode ); - statement.setString(5, username); - statement.setString(6,password ); - statement.setLong(7, customerId); - - int noOfRowsUpdated= statement.executeUpdate(); - System.out.println("noOfRowsUpdated= "+ noOfRowsUpdated); - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - - - - - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - - try { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id=?"); - statement.setString(1, customerId); - - statement.executeUpdate(); - // System.out.println("no of rows deleted: "+ noOfRowsDeleted ); - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - long customer_id=0 ; - String username =null; - String password=null ; - String firstname=null ; - String lastname=null ; - String address=null ; - String city=null ; - String state=null ; - String zipcode=null ; - - Customer customer; - - try{ - con = getConnection(); - statement = con.prepareStatement("Select * from customers where customer_id = ?"); - - statement.setString(1, customerId); - resultSet = statement.executeQuery(); - - if (resultSet.next()) - { - customer_id = resultSet.getLong("customer_id"); - username= resultSet.getString("username"); - password = resultSet.getString("password"); - firstname = resultSet.getString("first_name"); - lastname = resultSet.getString("last_name"); - address = resultSet.getString("address"); - city = resultSet.getString("city"); - state = resultSet.getString("state"); - zipcode = resultSet.getString("zipcode"); - } - - int noOfRowsUpdated = statement.executeUpdate(); - - customer = new Customer(customer_id,firstname,lastname); - customer.setUserName(username); - customer.setPassword(password); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode);; - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - closeResources(con, statement, resultSet); - } - - - return customer; - - - } - - @Override - public Customer findCustomerByUsername(String username) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - long customer_id=0 ; - String password=null ; - String firstname=null ; - String lastname=null ; - String address=null ; - String city=null ; - String state=null ; - String zipcode=null ; - - - Customer customer = null; - - try{ - con = getConnection(); - statement = con.prepareStatement("Select * from customers where username = ?"); - - statement.setString(1, username); - resultSet = statement.executeQuery(); - - if (resultSet.next()) - { - customer_id = resultSet.getLong("customer_id"); - password = resultSet.getString("password"); - firstname = resultSet.getString("first_name"); - lastname = resultSet.getString("last_name"); - address = resultSet.getString("address"); - city = resultSet.getString("city"); - state = resultSet.getString("state"); - zipcode = resultSet.getString("zipcode"); - - - customer = new Customer(customer_id,firstname,lastname); - customer.setUserName(username); - customer.setPassword(password); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - - } - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - closeResources(con, statement, resultSet); - } - - - return customer; - - - } - - @Override - public Customer findByUsernameAndPassword(String username, String password) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - long customer_id=0 ; - String firstname=null ; - String lastname=null ; - String address=null ; - String city=null ; - String state=null ; - String zipcode=null ; - - Customer customer = null; - - try{ - con = getConnection(); - statement = con.prepareStatement("Select * from customers where username = ? and password=?"); - - statement.setString(1, username); - statement.setString(2, password); - resultSet = statement.executeQuery(); - - if (resultSet.next()) - { - customer_id = resultSet.getLong("customer_id"); - - firstname = resultSet.getString("first_name"); - lastname = resultSet.getString("last_name"); - address = resultSet.getString("address"); - city = resultSet.getString("city"); - state = resultSet.getString("state"); - zipcode = resultSet.getString("zipcode"); - - - customer = new Customer(customer_id,firstname,lastname); - customer.setUserName(username); - customer.setPassword(password); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - - } - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - closeResources(con, statement, resultSet); - } - - - return customer; - } -} - - - - diff --git a/redbox3/src/com/training/java/redbox/domain/DAOException.java b/redbox3/src/com/training/java/redbox/domain/DAOException.java deleted file mode 100644 index 2469d7d..0000000 --- a/redbox3/src/com/training/java/redbox/domain/DAOException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage, Exception ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/redbox3/src/com/training/java/redbox/domain/Movie.java b/redbox3/src/com/training/java/redbox/domain/Movie.java deleted file mode 100644 index a4522ed..0000000 --- a/redbox3/src/com/training/java/redbox/domain/Movie.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.redbox.domain; - -public class Movie { - - private long id; - private String type; - private String title; - private double rentalPrice; - private String imageLocation; - - // constructor - - public Movie(long id, String type, String title, double rentalPrice, - String imageLocation) { - super(); - this.id = id; - this.type = type; - this.title = title; - this.rentalPrice = rentalPrice; - this.imageLocation = imageLocation; - } - - // getters - - public long getId() { - return id; - } - - public String getType() { - return type; - } - - public String getTitle() { - return title; - } - - public double rentalPrice() { - return rentalPrice; - } - - public double getRentalPrice() { - return rentalPrice; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getImageLocation() { - return imageLocation; - } - -} \ No newline at end of file diff --git a/redbox3/src/com/training/java/redbox/domain/MovieDAO.java b/redbox3/src/com/training/java/redbox/domain/MovieDAO.java deleted file mode 100644 index 1d57c9d..0000000 --- a/redbox3/src/com/training/java/redbox/domain/MovieDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -/** - * This is a Data Access object Interface. - * - * @author Satya - * - */ - -public interface MovieDAO { - - // Contract - List getAllMovies() throws DAOException; - - void addMovie(Movie movie) throws DAOException; - - void updateMovie(Movie movie) throws DAOException; - - void deleteMovie(long id) throws DAOException; - - Movie findByPrimaryKey(long id) throws DAOException; - -} diff --git a/redbox3/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java b/redbox3/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index 3ed1e3c..0000000 --- a/redbox3/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - - - -public class MovieDAOJDBCImpl extends BaseDAO implements MovieDAO { - - @Override - public List getAllMovies() throws DAOException { - - // Create a list of movie. - List movies = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - // Calling getConnection() - - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("Select * from Movie"); - - while (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - // Instantiate Movie object - Movie movie = new Movie(id, type, title, rentalPrice, imageLocation); - - // add movie object to list - - movies.add(movie); - - } - - } catch (SQLException ex) { - - throw new DAOException(ex, - "Error while selecting a record from database"); - - } finally { - // calling colseResources method to close all resources. - closeResources(connection, statement, resultSet); - - } - - return movies; - } - - - // adding record to movie table through DAO - @Override - public void addMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("insert into Movie values(?,?,?,?,?,?,?)"); - statement.setLong(1, id); - statement.setString(2, type); - statement.setString(3, title); - statement.setDouble(4,rentalPrice); - - int noOfRowsInserted = statement.executeUpdate(); - connection.commit(); - if (noOfRowsInserted != 1) { - throw new DAOException("Inserting a Movie failed"); - } - - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } - - - - - - - @Override - public void updateMovie( Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - - statement = connection - .prepareStatement("update Movie set type =?, title=?,director= ?,genre=?,rental_Price =?,rating=? where id = ?"); - - - statement.setString(1, type); - statement.setString(2, title); - statement.setDouble(5,rentalPrice); - - statement.setLong(7, id); - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - System.out.println("No Rows Updated"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while updating a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public void deleteMovie(long id) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("delete from movie where id = ?"); - - statement.setLong(1, id); - - int noOfRowsDeleted = statement.executeUpdate(); - - if (noOfRowsDeleted != 1) { - throw new DAOException("Delete failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while deleting a record from the Database"); - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public Movie findByPrimaryKey(long movieId) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - Movie movie = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("Select * from Movie where id = ?"); - - statement.setLong(1, movieId); - - resultSet = statement.executeQuery(); - - if (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - return new Movie(id, type, title, rentalPrice, imageLocation); - - } - - throw new DAOException("Invalid id provided"); - - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while selecting a record from the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - - - } - - } diff --git a/redbox3/src/com/training/java/redbox/domain/Orders.java b/redbox3/src/com/training/java/redbox/domain/Orders.java deleted file mode 100644 index 0616961..0000000 --- a/redbox3/src/com/training/java/redbox/domain/Orders.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.training.java.redbox.domain; - -public class Orders { - - private long orderId; - private long orderNumber; - private long customer_id; - private long movie_id; - private String status; - - public Orders(long orderNumber, long orderId, long customer_id, long movie_id, String status) { - super(); - this.orderNumber = orderNumber; - this.orderId = orderId; - this.customer_id = customer_id; - this.movie_id = movie_id; - this.status = status; - } - - /** - * @return the id - */ - public long getOrderId() { - return orderId; - } - - /** - * @return the customer_id - */ - public long getCustomer_id() { - return customer_id; - } - - /** - * @return the movie_id - */ - public long getMovie_id() { - return movie_id; - } - - /** - * @return the rental_days - */ - public String getStatus() { - return status; - } - - public long getOrderNumber() { - return orderNumber; - } - -} diff --git a/redbox3/src/com/training/java/redbox/domain/OrdersDAO.java b/redbox3/src/com/training/java/redbox/domain/OrdersDAO.java deleted file mode 100644 index 11999dd..0000000 --- a/redbox3/src/com/training/java/redbox/domain/OrdersDAO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface OrdersDAO { - - void createOrders(Orders orders) throws DAOException; - - List getAllOrders() throws DAOException; - - Orders getOrdersById(long id) throws DAOException; - - void update(Orders orders) throws DAOException; - - void delete(long id) throws DAOException; - - long createOrderNumber() throws DAOException; - -} diff --git a/redbox3/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java b/redbox3/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java deleted file mode 100644 index f2dbe14..0000000 --- a/redbox3/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public List getAllOrders() throws DAOException { - - List order = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from Orders"); - - while (rs.next()) { - long orderNumber = rs.getLong("orderNumber"); - long orderId = rs.getLong("orderId"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - String status = rs.getString("status"); - - Orders orders = new Orders(orderNumber, orderId, customer_id, movie_id, - status); - order.add(orders); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - - @Override - public void createOrders(Orders orders) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - - try { - con = getConnection(); - stmt = con.prepareStatement("insert into orders values(?,?,?,?,?)"); - - stmt.setLong(1, getOrderId()); - stmt.setLong(2, orders.getOrderNumber()); - stmt.setLong(3, orders.getCustomer_id()); - stmt.setLong(4, orders.getMovie_id()); - stmt.setString(5, orders.getStatus()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - - @Override - public Orders getOrdersById(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Orders order = null; - try { - con = getConnection(); - stmt = con.prepareStatement("select * from order where orderId = ?"); - stmt.setLong(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) { - long orderNumber = rs.getLong("orderNumber"); - long orderId = rs.getLong("orderId"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - String status = rs.getString("status"); - - order = new Orders(orderNumber, orderId, customer_id, movie_id, status); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - } - - @Override - public void update(Orders orders) throws DAOException { - { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con - .prepareStatement("update orders set order_number = ?, order_id = ?, customer_id= ?, movie_id = ?, status = ? where id = ?"); - stmt.setLong(1, orders.getOrderNumber()); - stmt.setLong(2, orders.getOrderId()); - stmt.setLong(3, orders.getCustomer_id()); - stmt.setLong(4, orders.getMovie_id()); - stmt.setString(5, orders.getStatus()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - } - - } - - @Override - public void delete(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("delete from orders where id = ?"); - stmt.setLong(1, id); - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - - - @Override - public long createOrderNumber() throws DAOException { - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - long orderNumber = 0; - - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select order_num_seq.nextval from dual"); - - while (rs.next()) { - orderNumber = rs.getLong(1); - } - return orderNumber; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - -private long getOrderId() throws DAOException { - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - long orderId = 0; - - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select order_id_seq.nextval from dual"); - - while (rs.next()) { - orderId = rs.getLong(1); - } - return orderId; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - -} diff --git a/redbox4/.classpath b/redbox4/.classpath deleted file mode 100644 index 23a27a7..0000000 --- a/redbox4/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/redbox4/.project b/redbox4/.project deleted file mode 100644 index 5a48c66..0000000 --- a/redbox4/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - redbox4 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/redbox4/.settings/.jsdtscope b/redbox4/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/redbox4/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/redbox4/.settings/org.eclipse.jdt.core.prefs b/redbox4/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/redbox4/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/redbox4/.settings/org.eclipse.wst.common.component b/redbox4/.settings/org.eclipse.wst.common.component deleted file mode 100644 index fbb905a..0000000 --- a/redbox4/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/redbox4/.settings/org.eclipse.wst.common.project.facet.core.xml b/redbox4/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 13db573..0000000 --- a/redbox4/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/redbox4/.settings/org.eclipse.wst.jsdt.ui.superType.container b/redbox4/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/redbox4/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/redbox4/.settings/org.eclipse.wst.jsdt.ui.superType.name b/redbox4/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/redbox4/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/redbox4/WebContent/META-INF/MANIFEST.MF b/redbox4/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/redbox4/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/redbox4/WebContent/WEB-INF/Checkout.jsp b/redbox4/WebContent/WEB-INF/Checkout.jsp deleted file mode 100644 index a53160d..0000000 --- a/redbox4/WebContent/WEB-INF/Checkout.jsp +++ /dev/null @@ -1,62 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - <%@include file="Header.jsp"%>
      - - - -

      - -

      - -
      - - Please find below the movies you added to the cart. -
      -
      - - - - - - - - - - - - - - - - - - - - - -
      TitleTypePrice
      - -
      - -
      - -
      - - - <%@include file="Footer.jsp"%> - - - - \ No newline at end of file diff --git a/redbox4/WebContent/WEB-INF/Footer.jsp b/redbox4/WebContent/WEB-INF/Footer.jsp deleted file mode 100644 index c8de0ed..0000000 --- a/redbox4/WebContent/WEB-INF/Footer.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -
      -
      -
      -
      -
      - - -
      © 2014, Redbox Automated Retail, LLC. All rights reserved.
      - - - \ No newline at end of file diff --git a/redbox4/WebContent/WEB-INF/Header.jsp b/redbox4/WebContent/WEB-INF/Header.jsp deleted file mode 100644 index 3bd784f..0000000 --- a/redbox4/WebContent/WEB-INF/Header.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Customer"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - Welcome - - - - - \ No newline at end of file diff --git a/redbox4/WebContent/WEB-INF/Login.jsp b/redbox4/WebContent/WEB-INF/Login.jsp deleted file mode 100644 index b709b07..0000000 --- a/redbox4/WebContent/WEB-INF/Login.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - -<%@include file="Header.jsp"%> - -
      - -
      - - - - -

      Please check username/password and try again.

      - - -
      - - - - - - - - - - - - - - - - - -
      Username:
      Password:
      - -
      - -<%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox4/WebContent/WEB-INF/ShowMovies.jsp b/redbox4/WebContent/WEB-INF/ShowMovies.jsp deleted file mode 100644 index 784b2a6..0000000 --- a/redbox4/WebContent/WEB-INF/ShowMovies.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%> -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - -Movie List - - - - <% - - System.out.println("Inside JSP"); - - %> - - <%@include file="Header.jsp"%> - - - - - - - - - - - - -
      - - - - - - - - - - () - -
      - - - - - - - - - - - - - - - - - - - - - - - -
      ${movie.title} -
      Add to
      - - - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox4/WebContent/WEB-INF/Signup.jsp b/redbox4/WebContent/WEB-INF/Signup.jsp deleted file mode 100644 index 96f2c64..0000000 --- a/redbox4/WebContent/WEB-INF/Signup.jsp +++ /dev/null @@ -1,86 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> - - - - - - -Insert title here - - - -<%@include file="Header.jsp"%> - - - - - -
      -
      - - - -

      Username exists, please try another.

      - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      First Name:
      Last Name:
      Address:
      City:
      State:
      ZIP:
      Create a username:
      Create a password:
      - -
      - - -<%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox4/WebContent/WEB-INF/ThankYou.jsp b/redbox4/WebContent/WEB-INF/ThankYou.jsp deleted file mode 100644 index 9847e5e..0000000 --- a/redbox4/WebContent/WEB-INF/ThankYou.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -Thank you. Your order has been placed. - - - \ No newline at end of file diff --git a/redbox4/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/redbox4/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/aopalliance-1.0.jar b/redbox4/WebContent/WEB-INF/lib/aopalliance-1.0.jar deleted file mode 100644 index 578b1a0..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/aopalliance-1.0.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/redbox4/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/redbox4/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/redbox4/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/redbox4/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/redbox4/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/commons-io-1.1.jar b/redbox4/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/redbox4/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar b/redbox4/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar deleted file mode 100644 index ab51254..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/redbox4/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar b/redbox4/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar deleted file mode 100644 index 9d5fe16..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar b/redbox4/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar deleted file mode 100644 index a86a365..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar b/redbox4/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar deleted file mode 100644 index 4b3b433..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/redbox4/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/junit-4.11.jar b/redbox4/WebContent/WEB-INF/lib/junit-4.11.jar deleted file mode 100644 index aaf7444..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/junit-4.11.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/ojdbc6.jar b/redbox4/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/oro-2.0.8.jar b/redbox4/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar b/redbox4/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar deleted file mode 100644 index 941485e..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar b/redbox4/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar deleted file mode 100644 index cfa5696..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar b/redbox4/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar deleted file mode 100644 index 9936474..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar b/redbox4/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar deleted file mode 100644 index fa08986..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar b/redbox4/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar deleted file mode 100644 index b8f346e..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar b/redbox4/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar deleted file mode 100644 index 87cf842..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/standard-1.0.6.jar b/redbox4/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/redbox4/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/redbox4/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/redbox4/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/redbox4/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/redbox4/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/redbox4/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/redbox4/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/redbox4/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/redbox4/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/redbox4/WebContent/WEB-INF/redbox-struts-config.xml b/redbox4/WebContent/WEB-INF/redbox-struts-config.xml deleted file mode 100644 index bd18664..0000000 --- a/redbox4/WebContent/WEB-INF/redbox-struts-config.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/redbox4/WebContent/WEB-INF/spring-config.xml b/redbox4/WebContent/WEB-INF/spring-config.xml deleted file mode 100644 index 5256175..0000000 --- a/redbox4/WebContent/WEB-INF/spring-config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/redbox4/WebContent/WEB-INF/web.xml b/redbox4/WebContent/WEB-INF/web.xml deleted file mode 100644 index 6b4a4da..0000000 --- a/redbox4/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - redbox - - index.jsp - - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/redbox-struts-config.xml - - 1 - - - - ActionServlet - *.do - - - - contextConfigLocation - /WEB-INF/spring-config.xml - - - - org.springframework.web.context.ContextLoaderListener - - - \ No newline at end of file diff --git a/redbox4/WebContent/images/FreeBirdsMovie.jpg b/redbox4/WebContent/images/FreeBirdsMovie.jpg deleted file mode 100644 index c3fca34..0000000 Binary files a/redbox4/WebContent/images/FreeBirdsMovie.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/FrozenMovie.jpg b/redbox4/WebContent/images/FrozenMovie.jpg deleted file mode 100644 index 811ebd3..0000000 Binary files a/redbox4/WebContent/images/FrozenMovie.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/LegoMovie.jpg b/redbox4/WebContent/images/LegoMovie.jpg deleted file mode 100644 index 1b1a7be..0000000 Binary files a/redbox4/WebContent/images/LegoMovie.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/MandelaMovie.jpg b/redbox4/WebContent/images/MandelaMovie.jpg deleted file mode 100644 index a172f73..0000000 Binary files a/redbox4/WebContent/images/MandelaMovie.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/ThorMovie.jpg b/redbox4/WebContent/images/ThorMovie.jpg deleted file mode 100644 index 2ac8ee8..0000000 Binary files a/redbox4/WebContent/images/ThorMovie.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/cart.jpg b/redbox4/WebContent/images/cart.jpg deleted file mode 100644 index a6c8488..0000000 Binary files a/redbox4/WebContent/images/cart.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/checkout.jpg b/redbox4/WebContent/images/checkout.jpg deleted file mode 100644 index f8f2bda..0000000 Binary files a/redbox4/WebContent/images/checkout.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/login.jpg b/redbox4/WebContent/images/login.jpg deleted file mode 100644 index 442c689..0000000 Binary files a/redbox4/WebContent/images/login.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/logo.jpg b/redbox4/WebContent/images/logo.jpg deleted file mode 100644 index 476dae1..0000000 Binary files a/redbox4/WebContent/images/logo.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/signup.jpg b/redbox4/WebContent/images/signup.jpg deleted file mode 100644 index 320d80a..0000000 Binary files a/redbox4/WebContent/images/signup.jpg and /dev/null differ diff --git a/redbox4/WebContent/images/signup2.jpg b/redbox4/WebContent/images/signup2.jpg deleted file mode 100644 index 07d0696..0000000 Binary files a/redbox4/WebContent/images/signup2.jpg and /dev/null differ diff --git a/redbox4/WebContent/index.jsp b/redbox4/WebContent/index.jsp deleted file mode 100644 index 5a4a469..0000000 --- a/redbox4/WebContent/index.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -<%response.sendRedirect("/redbox/listMovies.do"); %> - - - \ No newline at end of file diff --git a/redbox4/src/com/training/java/redbox/AddToCartServlet.java b/redbox4/src/com/training/java/redbox/AddToCartServlet.java deleted file mode 100644 index cc4abe0..0000000 --- a/redbox4/src/com/training/java/redbox/AddToCartServlet.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -/** - * Servlet implementation class AddToCart - */ -public class AddToCartServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - long id = Long.parseLong(request.getParameter("id")); - - HttpSession session = request.getSession(); - - List cart = (List)session.getAttribute("cart"); - if(cart == null) - { - cart = new ArrayList<>(); - cart.add(id); - - session.setAttribute("cart", cart); - - }else{ - - cart.add(id); - } - - RequestDispatcher rd = request.getRequestDispatcher("/listMovies"); - rd.forward(request, response); - } - -} diff --git a/redbox4/src/com/training/java/redbox/CheckoutServlet.java b/redbox4/src/com/training/java/redbox/CheckoutServlet.java deleted file mode 100644 index 60462f7..0000000 --- a/redbox4/src/com/training/java/redbox/CheckoutServlet.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; -import com.training.java.redbox.domain.Orders; -import com.training.java.redbox.domain.OrdersDAO; -import com.training.java.redbox.domain.OrdersDAOJDBCImpl; - -/** - * Servlet implementation class CheckoutServlet - */ -public class CheckoutServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - List cart = (List) session.getAttribute("cart"); - - MovieDAO dao = new MovieDAOJDBCImpl(); - - List movies = new ArrayList<>(); - - for(long id : cart){ - - try { - movies.add(dao.findByPrimaryKey(id)); - - - } catch (DAOException e) { - e.printStackTrace(); - } - - } - - request.setAttribute("moviesCart", movies); - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Checkout.jsp"); - rd.forward(request, response); - - } - - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - - Customer customer = (Customer)session.getAttribute("customer"); - - if(customer!=null){ - - List ids = (List) session.getAttribute("cart"); - - OrdersDAO dao = new OrdersDAOJDBCImpl(); - long orderNum = 0; - - - try { - orderNum = dao.createOrderNumber(); - - for(long id : ids) - { - Orders order = new Orders(orderNum, 0, customer.getCustomerId(), id, "Rented"); - - dao.createOrders(order); - } - } catch (DAOException e) { - e.printStackTrace(); - } - - session.invalidate(); - response.sendRedirect("/redbox/thankyou"); - - } - else{ - - request.setAttribute("error", "Please login in order to checkout."); - doGet(request, response); - } - - } - -} diff --git a/redbox4/src/com/training/java/redbox/CustomerForm.java b/redbox4/src/com/training/java/redbox/CustomerForm.java deleted file mode 100644 index d98fe1c..0000000 --- a/redbox4/src/com/training/java/redbox/CustomerForm.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.training.java.redbox; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.Globals; -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class CustomerForm extends ActionForm { - - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private String userName; - private String password; - private int age; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("First name = " + firstName); - sb.append("Last name = " + lastName); - - return sb.toString(); - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { - - ActionErrors errors = new ActionErrors(); - - if(firstName == null || firstName.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("firstname.required")); - } - if(lastName == null || lastName.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("lastName.required")); - } - if(zipCode == null || zipCode.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("zipCode.required")); - } - if(userName == null || userName.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("userName.required")); - } - if(password == null || password.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("password.required")); - } - - return errors; - } - -} diff --git a/redbox4/src/com/training/java/redbox/ListMoviesAction.java b/redbox4/src/com/training/java/redbox/ListMoviesAction.java deleted file mode 100644 index 1d4f1bf..0000000 --- a/redbox4/src/com/training/java/redbox/ListMoviesAction.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.java.redbox; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -public class ListMoviesAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - System.out.println("ListMoviesAction.execute called"); - - MovieDAO dao = new MovieDAOJDBCImpl(); - - try { - List movies = dao.getAllMovies(); - - request.setAttribute("movies", movies); - - } catch (DAOException e) { - e.printStackTrace(); - } - - return mapping.findForward("list"); - - } - - - -} diff --git a/redbox4/src/com/training/java/redbox/ListMoviesServlet.java b/redbox4/src/com/training/java/redbox/ListMoviesServlet.java deleted file mode 100644 index 9316218..0000000 --- a/redbox4/src/com/training/java/redbox/ListMoviesServlet.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class ListMoviesServlet - */ -public class ListMoviesServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - MovieDAO dao = new MovieDAOJDBCImpl(); - - try { - List movies = dao.getAllMovies(); - - request.setAttribute("movies", movies); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/ShowMovies.jsp"); - rd.forward(request, response); - - } catch (DAOException e) { - e.printStackTrace(); - } - - } - -} diff --git a/redbox4/src/com/training/java/redbox/LoginServlet.java b/redbox4/src/com/training/java/redbox/LoginServlet.java deleted file mode 100644 index b20e798..0000000 --- a/redbox4/src/com/training/java/redbox/LoginServlet.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.CustomerDAO; -import com.training.java.redbox.domain.CustomerDaoJdbcImpl; -import com.training.java.redbox.domain.DAOException; - -/** - * Servlet implementation class LoginServlet - */ -public class LoginServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Login.jsp"); - rd.forward(request, response); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String username = request.getParameter("username"); - String password = request.getParameter("password"); - Customer customer = null; - - CustomerDAO dao = new CustomerDaoJdbcImpl(); - - try { - - customer = dao.findByUsernameAndPassword(username, password); - - } catch (DAOException e) { - e.printStackTrace(); - } - - if (customer!=null) - { - HttpSession session = request.getSession(); - session.setAttribute("customer", customer); - - RequestDispatcher rd = request.getRequestDispatcher("/"); - rd.forward(request, response); - } - else - { - request.setAttribute("error", 1); - doGet(request, response); - } - - } - -} diff --git a/redbox4/src/com/training/java/redbox/SaveCustomerAction.java b/redbox4/src/com/training/java/redbox/SaveCustomerAction.java deleted file mode 100644 index aa638d8..0000000 --- a/redbox4/src/com/training/java/redbox/SaveCustomerAction.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.training.java.redbox; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.CustomerService; -import com.training.java.redbox.domain.ServiceException; - -public class SaveCustomerAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - CustomerForm customerForm = (CustomerForm) form; - - Customer customer = new Customer(0, customerForm.getFirstName(), - customerForm.getLastName()); - customer.setAddress(customerForm.getAddress()); - customer.setCity(customerForm.getCity()); - customer.setState(customerForm.getState()); - customer.setZipCode(customerForm.getZipCode()); - customer.setUserName(customerForm.getUserName()); - customer.setPassword(customerForm.getPassword()); - - System.out.println(customerForm); - - WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServlet().getServletContext()); - CustomerService service = context.getBean(CustomerService.class); - - try { - service.addCustomer(customer); - } catch (ServiceException e) { - e.printStackTrace(); - } - - return mapping.findForward("login"); - - } - -} diff --git a/redbox4/src/com/training/java/redbox/SignupAction.java b/redbox4/src/com/training/java/redbox/SignupAction.java deleted file mode 100644 index d009113..0000000 --- a/redbox4/src/com/training/java/redbox/SignupAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.redbox; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class SignupAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("signup"); - } - -} diff --git a/redbox4/src/com/training/java/redbox/SignupServlet.java b/redbox4/src/com/training/java/redbox/SignupServlet.java deleted file mode 100644 index 31135f6..0000000 --- a/redbox4/src/com/training/java/redbox/SignupServlet.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.CustomerDAO; -import com.training.java.redbox.domain.CustomerDaoJdbcImpl; -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class SignupServlet - */ -public class SignupServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Signup.jsp"); - rd.forward(request, response); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String address = request.getParameter("address"); - String city = request.getParameter("city"); - String state = request.getParameter("state"); - String zip = request.getParameter("zip"); - String username = request.getParameter("username"); - String password = request.getParameter("password"); - Customer customer = null; - - CustomerDAO dao = new CustomerDaoJdbcImpl(); - - try { - - customer = dao.findCustomerByUsername(username); - - } catch (DAOException e) { - e.printStackTrace(); - } - - if(customer==null){ - - customer = new Customer(0, firstName, lastName); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zip); - customer.setUserName(username); - customer.setPassword(password); - - try { - dao.addCustomer(customer); - } catch (DAOException e) { - e.printStackTrace(); - } - - RequestDispatcher rd = request.getRequestDispatcher("/"); - rd.forward(request, response); - - }else{ - - request.setAttribute("error", 1); - doGet(request, response); - - /*RequestDispatcher rd = request.getRequestDispatcher("/error"); - rd.forward(request, response); */ - } - - - } - -} diff --git a/redbox4/src/com/training/java/redbox/ThankYouServlet.java b/redbox4/src/com/training/java/redbox/ThankYouServlet.java deleted file mode 100644 index 6ac8f53..0000000 --- a/redbox4/src/com/training/java/redbox/ThankYouServlet.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class ThankYouServlet - */ -public class ThankYouServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/ThankYou.jsp"); - rd.forward(request, response); - - } - -} diff --git a/redbox4/src/com/training/java/redbox/domain/BaseDAO.java b/redbox4/src/com/training/java/redbox/domain/BaseDAO.java deleted file mode 100644 index 5f2c545..0000000 --- a/redbox4/src/com/training/java/redbox/domain/BaseDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - private static final String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE"; - private static final String username = "redbox"; - private static final String password = "redbox"; - - // getConnection method - - protected Connection getConnection() throws DAOException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - - } catch (ClassNotFoundException ex) { - throw new DAOException(ex, "Class Not Found"); - } catch (SQLException ex) { - throw new DAOException(ex); - } - - } - - /** - * Close all resources: - * - * Close connection Close statement Close resultSet - */ - protected void closeResources(Connection connection, Statement statement, - ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} - diff --git a/redbox4/src/com/training/java/redbox/domain/Customer.java b/redbox4/src/com/training/java/redbox/domain/Customer.java deleted file mode 100644 index c379ab1..0000000 --- a/redbox4/src/com/training/java/redbox/domain/Customer.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java.redbox.domain; - -public class Customer { - - private long customerId; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private String userName; - private String password; - - public Customer() - { - - } - public Customer(long customerId,String firstName,String lastName) - { - this.customerId=customerId; - this.firstName=firstName; - this.lastName=lastName; - } - - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - public String getAddress() { - return address; - } - public void setAddress(String address) { - this.address = address; - } - public String getCity() { - return city; - } - public void setCity(String city) { - this.city = city; - } - public String getState() { - return state; - } - public void setState(String state) { - this.state = state; - } - public String getZipCode() { - return zipCode; - } - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - public long getCustomerId() { - return customerId; - } - public String getFirstName() { - return firstName; - } - public String getLastName() { - return lastName; - } - - - } diff --git a/redbox4/src/com/training/java/redbox/domain/CustomerDAO.java b/redbox4/src/com/training/java/redbox/domain/CustomerDAO.java deleted file mode 100644 index aea1fda..0000000 --- a/redbox4/src/com/training/java/redbox/domain/CustomerDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - void addCustomer(Customer customer)throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(String customerId) throws DAOException; - Customer findCustomerByCustomerId(String customerId)throws DAOException; - Customer findCustomerByUsername(String username)throws DAOException; - Customer findByUsernameAndPassword(String username, String password)throws DAOException; - -} - - diff --git a/redbox4/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java b/redbox4/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java deleted file mode 100644 index c2bd5c8..0000000 --- a/redbox4/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java +++ /dev/null @@ -1,413 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - - - -@Repository -public class CustomerDaoJdbcImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - List customers = new ArrayList(); - - Connection con = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - con = getConnection(); - statement = con.createStatement(); - resultSet = statement.executeQuery("select * from customers"); - - while (resultSet.next()) { - long customerId = resultSet.getLong("customer_id"); - String username = resultSet.getString("username"); - String password = resultSet.getString("password"); - String firstname = resultSet.getString("first_name"); - String lastname = resultSet.getString("last_name"); - String address = resultSet.getString("address"); - String city = resultSet.getString("city"); - String state = resultSet.getString("state"); - String zipcode = resultSet.getString("zipcode"); - - - Customer customer = new Customer(customerId, firstname, lastname); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - customer.setUserName(username); - customer.setPassword(password); - - customers.add(customer); - - } - - } catch (SQLException e) { - throw new DAOException("An unexpected error occured while accessing the database.", e); - } finally { - - closeResources(con, statement, resultSet); - - } - - return customers; - - - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - Statement statement1 = null; - long customerId = 0; - try { - con = getConnection(); - - statement1 = con.createStatement(); - ResultSet resultSet = statement1.executeQuery("select customer_seq.NEXTVAL from dual"); - - while (resultSet.next()) { - customerId = resultSet.getLong(1); - } - - statement = con.prepareStatement("insert into customers values(?,?,?,?,?,?,?,?,?)"); - - statement.setLong(1,customerId); - statement.setString(2, customer.getFirstName()); - statement.setString(3, customer.getLastName()); - statement.setString(4, customer.getAddress()); - statement.setString(5, customer.getCity()); - statement.setString(6, customer.getState()); - statement.setString(7, customer.getZipCode()); - statement.setString(8, customer.getUserName()); - statement.setString(9, customer.getPassword()); - - statement.executeUpdate(); - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (statement1 != null) { - try { - statement1.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - long customerId=customer.getCustomerId(); - String address= customer.getAddress(); - String city= customer.getCity(); - String state= customer.getState(); - String zipcode= customer.getZipCode(); - String username= customer.getUserName(); - String password= customer.getPassword(); - - try { - con = getConnection(); - statement = con.prepareStatement("update customers set address=?,city=?, state=?,zipcode=?,username=?,password=? where customer_id = ?"); - statement.setString(1,address); - statement.setString(2,city); - statement.setString(3,state ); - statement.setString(4,zipcode ); - statement.setString(5, username); - statement.setString(6,password ); - statement.setLong(7, customerId); - - int noOfRowsUpdated= statement.executeUpdate(); - System.out.println("noOfRowsUpdated= "+ noOfRowsUpdated); - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - - - - - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - - try { - con = getConnection(); - statement = con.prepareStatement("delete from customers where customer_id=?"); - statement.setString(1, customerId); - - statement.executeUpdate(); - // System.out.println("no of rows deleted: "+ noOfRowsDeleted ); - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if (con != null) { - try { - con.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - Connection con = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - long customer_id=0 ; - String username =null; - String password=null ; - String firstname=null ; - String lastname=null ; - String address=null ; - String city=null ; - String state=null ; - String zipcode=null ; - - Customer customer; - - try{ - con = getConnection(); - statement = con.prepareStatement("Select * from customers where customer_id = ?"); - - statement.setString(1, customerId); - resultSet = statement.executeQuery(); - - if (resultSet.next()) - { - customer_id = resultSet.getLong("customer_id"); - username= resultSet.getString("username"); - password = resultSet.getString("password"); - firstname = resultSet.getString("first_name"); - lastname = resultSet.getString("last_name"); - address = resultSet.getString("address"); - city = resultSet.getString("city"); - state = resultSet.getString("state"); - zipcode = resultSet.getString("zipcode"); - } - - int noOfRowsUpdated = statement.executeUpdate(); - - customer = new Customer(customer_id,firstname,lastname); - customer.setUserName(username); - customer.setPassword(password); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode);; - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - closeResources(con, statement, resultSet); - } - - - return customer; - - - } - - @Override - public Customer findCustomerByUsername(String username) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - long customer_id=0 ; - String password=null ; - String firstname=null ; - String lastname=null ; - String address=null ; - String city=null ; - String state=null ; - String zipcode=null ; - - - Customer customer = null; - - try{ - con = getConnection(); - statement = con.prepareStatement("Select * from customers where username = ?"); - - statement.setString(1, username); - resultSet = statement.executeQuery(); - - if (resultSet.next()) - { - customer_id = resultSet.getLong("customer_id"); - password = resultSet.getString("password"); - firstname = resultSet.getString("first_name"); - lastname = resultSet.getString("last_name"); - address = resultSet.getString("address"); - city = resultSet.getString("city"); - state = resultSet.getString("state"); - zipcode = resultSet.getString("zipcode"); - - - customer = new Customer(customer_id,firstname,lastname); - customer.setUserName(username); - customer.setPassword(password); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - - } - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - closeResources(con, statement, resultSet); - } - - - return customer; - - - } - - @Override - public Customer findByUsernameAndPassword(String username, String password) - throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - long customer_id=0 ; - String firstname=null ; - String lastname=null ; - String address=null ; - String city=null ; - String state=null ; - String zipcode=null ; - - Customer customer = null; - - try{ - con = getConnection(); - statement = con.prepareStatement("Select * from customers where username = ? and password=?"); - - statement.setString(1, username); - statement.setString(2, password); - resultSet = statement.executeQuery(); - - if (resultSet.next()) - { - customer_id = resultSet.getLong("customer_id"); - - firstname = resultSet.getString("first_name"); - lastname = resultSet.getString("last_name"); - address = resultSet.getString("address"); - city = resultSet.getString("city"); - state = resultSet.getString("state"); - zipcode = resultSet.getString("zipcode"); - - - customer = new Customer(customer_id,firstname,lastname); - customer.setUserName(username); - customer.setPassword(password); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - - } - - - } catch (SQLException ex) { - throw new DAOException("unable to execute operation", ex); - } finally - { - closeResources(con, statement, resultSet); - } - - - return customer; - } -} - - - - diff --git a/redbox4/src/com/training/java/redbox/domain/CustomerService.java b/redbox4/src/com/training/java/redbox/domain/CustomerService.java deleted file mode 100644 index 6a6572a..0000000 --- a/redbox4/src/com/training/java/redbox/domain/CustomerService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.java.redbox.domain; - -public interface CustomerService { - - void addCustomer(Customer customer) throws ServiceException; - -} diff --git a/redbox4/src/com/training/java/redbox/domain/CustomerServiceImpl.java b/redbox4/src/com/training/java/redbox/domain/CustomerServiceImpl.java deleted file mode 100644 index f489e4e..0000000 --- a/redbox4/src/com/training/java/redbox/domain/CustomerServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.redbox.domain; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -@Service -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO dao; - - @Override - public void addCustomer(Customer customer) throws ServiceException { - try { - dao.addCustomer(customer); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - -} diff --git a/redbox4/src/com/training/java/redbox/domain/DAOException.java b/redbox4/src/com/training/java/redbox/domain/DAOException.java deleted file mode 100644 index 2469d7d..0000000 --- a/redbox4/src/com/training/java/redbox/domain/DAOException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage, Exception ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/redbox4/src/com/training/java/redbox/domain/Movie.java b/redbox4/src/com/training/java/redbox/domain/Movie.java deleted file mode 100644 index a4522ed..0000000 --- a/redbox4/src/com/training/java/redbox/domain/Movie.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.redbox.domain; - -public class Movie { - - private long id; - private String type; - private String title; - private double rentalPrice; - private String imageLocation; - - // constructor - - public Movie(long id, String type, String title, double rentalPrice, - String imageLocation) { - super(); - this.id = id; - this.type = type; - this.title = title; - this.rentalPrice = rentalPrice; - this.imageLocation = imageLocation; - } - - // getters - - public long getId() { - return id; - } - - public String getType() { - return type; - } - - public String getTitle() { - return title; - } - - public double rentalPrice() { - return rentalPrice; - } - - public double getRentalPrice() { - return rentalPrice; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getImageLocation() { - return imageLocation; - } - -} \ No newline at end of file diff --git a/redbox4/src/com/training/java/redbox/domain/MovieDAO.java b/redbox4/src/com/training/java/redbox/domain/MovieDAO.java deleted file mode 100644 index 1d57c9d..0000000 --- a/redbox4/src/com/training/java/redbox/domain/MovieDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -/** - * This is a Data Access object Interface. - * - * @author Satya - * - */ - -public interface MovieDAO { - - // Contract - List getAllMovies() throws DAOException; - - void addMovie(Movie movie) throws DAOException; - - void updateMovie(Movie movie) throws DAOException; - - void deleteMovie(long id) throws DAOException; - - Movie findByPrimaryKey(long id) throws DAOException; - -} diff --git a/redbox4/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java b/redbox4/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index 3ed1e3c..0000000 --- a/redbox4/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - - - -public class MovieDAOJDBCImpl extends BaseDAO implements MovieDAO { - - @Override - public List getAllMovies() throws DAOException { - - // Create a list of movie. - List movies = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - // Calling getConnection() - - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("Select * from Movie"); - - while (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - // Instantiate Movie object - Movie movie = new Movie(id, type, title, rentalPrice, imageLocation); - - // add movie object to list - - movies.add(movie); - - } - - } catch (SQLException ex) { - - throw new DAOException(ex, - "Error while selecting a record from database"); - - } finally { - // calling colseResources method to close all resources. - closeResources(connection, statement, resultSet); - - } - - return movies; - } - - - // adding record to movie table through DAO - @Override - public void addMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("insert into Movie values(?,?,?,?,?,?,?)"); - statement.setLong(1, id); - statement.setString(2, type); - statement.setString(3, title); - statement.setDouble(4,rentalPrice); - - int noOfRowsInserted = statement.executeUpdate(); - connection.commit(); - if (noOfRowsInserted != 1) { - throw new DAOException("Inserting a Movie failed"); - } - - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } - - - - - - - @Override - public void updateMovie( Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - - statement = connection - .prepareStatement("update Movie set type =?, title=?,director= ?,genre=?,rental_Price =?,rating=? where id = ?"); - - - statement.setString(1, type); - statement.setString(2, title); - statement.setDouble(5,rentalPrice); - - statement.setLong(7, id); - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - System.out.println("No Rows Updated"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while updating a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public void deleteMovie(long id) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("delete from movie where id = ?"); - - statement.setLong(1, id); - - int noOfRowsDeleted = statement.executeUpdate(); - - if (noOfRowsDeleted != 1) { - throw new DAOException("Delete failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while deleting a record from the Database"); - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public Movie findByPrimaryKey(long movieId) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - Movie movie = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("Select * from Movie where id = ?"); - - statement.setLong(1, movieId); - - resultSet = statement.executeQuery(); - - if (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - return new Movie(id, type, title, rentalPrice, imageLocation); - - } - - throw new DAOException("Invalid id provided"); - - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while selecting a record from the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - - - } - - } diff --git a/redbox4/src/com/training/java/redbox/domain/Orders.java b/redbox4/src/com/training/java/redbox/domain/Orders.java deleted file mode 100644 index 0616961..0000000 --- a/redbox4/src/com/training/java/redbox/domain/Orders.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.training.java.redbox.domain; - -public class Orders { - - private long orderId; - private long orderNumber; - private long customer_id; - private long movie_id; - private String status; - - public Orders(long orderNumber, long orderId, long customer_id, long movie_id, String status) { - super(); - this.orderNumber = orderNumber; - this.orderId = orderId; - this.customer_id = customer_id; - this.movie_id = movie_id; - this.status = status; - } - - /** - * @return the id - */ - public long getOrderId() { - return orderId; - } - - /** - * @return the customer_id - */ - public long getCustomer_id() { - return customer_id; - } - - /** - * @return the movie_id - */ - public long getMovie_id() { - return movie_id; - } - - /** - * @return the rental_days - */ - public String getStatus() { - return status; - } - - public long getOrderNumber() { - return orderNumber; - } - -} diff --git a/redbox4/src/com/training/java/redbox/domain/OrdersDAO.java b/redbox4/src/com/training/java/redbox/domain/OrdersDAO.java deleted file mode 100644 index 11999dd..0000000 --- a/redbox4/src/com/training/java/redbox/domain/OrdersDAO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface OrdersDAO { - - void createOrders(Orders orders) throws DAOException; - - List getAllOrders() throws DAOException; - - Orders getOrdersById(long id) throws DAOException; - - void update(Orders orders) throws DAOException; - - void delete(long id) throws DAOException; - - long createOrderNumber() throws DAOException; - -} diff --git a/redbox4/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java b/redbox4/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java deleted file mode 100644 index f2dbe14..0000000 --- a/redbox4/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public List getAllOrders() throws DAOException { - - List order = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from Orders"); - - while (rs.next()) { - long orderNumber = rs.getLong("orderNumber"); - long orderId = rs.getLong("orderId"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - String status = rs.getString("status"); - - Orders orders = new Orders(orderNumber, orderId, customer_id, movie_id, - status); - order.add(orders); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - - @Override - public void createOrders(Orders orders) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - - try { - con = getConnection(); - stmt = con.prepareStatement("insert into orders values(?,?,?,?,?)"); - - stmt.setLong(1, getOrderId()); - stmt.setLong(2, orders.getOrderNumber()); - stmt.setLong(3, orders.getCustomer_id()); - stmt.setLong(4, orders.getMovie_id()); - stmt.setString(5, orders.getStatus()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - - @Override - public Orders getOrdersById(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Orders order = null; - try { - con = getConnection(); - stmt = con.prepareStatement("select * from order where orderId = ?"); - stmt.setLong(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) { - long orderNumber = rs.getLong("orderNumber"); - long orderId = rs.getLong("orderId"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - String status = rs.getString("status"); - - order = new Orders(orderNumber, orderId, customer_id, movie_id, status); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - } - - @Override - public void update(Orders orders) throws DAOException { - { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con - .prepareStatement("update orders set order_number = ?, order_id = ?, customer_id= ?, movie_id = ?, status = ? where id = ?"); - stmt.setLong(1, orders.getOrderNumber()); - stmt.setLong(2, orders.getOrderId()); - stmt.setLong(3, orders.getCustomer_id()); - stmt.setLong(4, orders.getMovie_id()); - stmt.setString(5, orders.getStatus()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - } - - } - - @Override - public void delete(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("delete from orders where id = ?"); - stmt.setLong(1, id); - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - - - @Override - public long createOrderNumber() throws DAOException { - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - long orderNumber = 0; - - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select order_num_seq.nextval from dual"); - - while (rs.next()) { - orderNumber = rs.getLong(1); - } - return orderNumber; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - -private long getOrderId() throws DAOException { - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - long orderId = 0; - - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select order_id_seq.nextval from dual"); - - while (rs.next()) { - orderId = rs.getLong(1); - } - return orderId; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - -} diff --git a/redbox4/src/com/training/java/redbox/domain/ServiceException.java b/redbox4/src/com/training/java/redbox/domain/ServiceException.java deleted file mode 100644 index 7d908df..0000000 --- a/redbox4/src/com/training/java/redbox/domain/ServiceException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.redbox.domain; - -public class ServiceException extends Exception { - - public ServiceException(Exception ex) { - super(ex); - } - -} diff --git a/redbox4/src/redbox.properties b/redbox4/src/redbox.properties deleted file mode 100644 index d37b4e0..0000000 --- a/redbox4/src/redbox.properties +++ /dev/null @@ -1,10 +0,0 @@ -errors.header=

      Validation Errors

        -errors.prefix=
      1. -errors.suffix=
      2. -errors.footer=
      - -firstname.required=First name is mandatory -lastName.required=Last name is mandatory -zipCode.required=Please enter zip -userName.required=Please enter username, it must be at least be 8 characters -password.required=PLease enter password \ No newline at end of file diff --git a/redbox4/src/spring-config.xml b/redbox4/src/spring-config.xml deleted file mode 100644 index 5256175..0000000 --- a/redbox4/src/spring-config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/redbox5/.classpath b/redbox5/.classpath deleted file mode 100644 index 23a27a7..0000000 --- a/redbox5/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/redbox5/.project b/redbox5/.project deleted file mode 100644 index 93d6811..0000000 --- a/redbox5/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - redbox5 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/redbox5/.settings/.jsdtscope b/redbox5/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/redbox5/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/redbox5/.settings/org.eclipse.jdt.core.prefs b/redbox5/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/redbox5/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/redbox5/.settings/org.eclipse.wst.common.component b/redbox5/.settings/org.eclipse.wst.common.component deleted file mode 100644 index a14b202..0000000 --- a/redbox5/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/redbox5/.settings/org.eclipse.wst.common.project.facet.core.xml b/redbox5/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 69b9da3..0000000 --- a/redbox5/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/redbox5/.settings/org.eclipse.wst.jsdt.ui.superType.container b/redbox5/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/redbox5/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/redbox5/.settings/org.eclipse.wst.jsdt.ui.superType.name b/redbox5/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/redbox5/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/redbox5/WebContent/META-INF/MANIFEST.MF b/redbox5/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/redbox5/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/redbox5/WebContent/WEB-INF/Checkout.jsp b/redbox5/WebContent/WEB-INF/Checkout.jsp deleted file mode 100644 index a53160d..0000000 --- a/redbox5/WebContent/WEB-INF/Checkout.jsp +++ /dev/null @@ -1,62 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - <%@include file="Header.jsp"%>
      - - - -

      - -

      - -
      - - Please find below the movies you added to the cart. -
      -
      - - - - - - - - - - - - - - - - - - - - - -
      TitleTypePrice
      - -
      - -
      - -
      - - - <%@include file="Footer.jsp"%> - - - - \ No newline at end of file diff --git a/redbox5/WebContent/WEB-INF/Footer.jsp b/redbox5/WebContent/WEB-INF/Footer.jsp deleted file mode 100644 index c8de0ed..0000000 --- a/redbox5/WebContent/WEB-INF/Footer.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -
      -
      -
      -
      -
      - - -
      © 2014, Redbox Automated Retail, LLC. All rights reserved.
      - - - \ No newline at end of file diff --git a/redbox5/WebContent/WEB-INF/Header.jsp b/redbox5/WebContent/WEB-INF/Header.jsp deleted file mode 100644 index 3bd784f..0000000 --- a/redbox5/WebContent/WEB-INF/Header.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%@page import="com.training.java.redbox.domain.Customer"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - Welcome - - - - - \ No newline at end of file diff --git a/redbox5/WebContent/WEB-INF/Login.jsp b/redbox5/WebContent/WEB-INF/Login.jsp deleted file mode 100644 index b709b07..0000000 --- a/redbox5/WebContent/WEB-INF/Login.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - -<%@include file="Header.jsp"%> - -
      - -
      - - - - -

      Please check username/password and try again.

      - - -
      - - - - - - - - - - - - - - - - - -
      Username:
      Password:
      - -
      - -<%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox5/WebContent/WEB-INF/ShowMovies.jsp b/redbox5/WebContent/WEB-INF/ShowMovies.jsp deleted file mode 100644 index 784b2a6..0000000 --- a/redbox5/WebContent/WEB-INF/ShowMovies.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%> -<%@page import="com.training.java.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - -Movie List - - - - <% - - System.out.println("Inside JSP"); - - %> - - <%@include file="Header.jsp"%> - - - - - - - - - - - - -
      - - - - - - - - - - () - -
      - - - - - - - - - - - - - - - - - - - - - - - -
      ${movie.title} -
      Add to
      - - - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox5/WebContent/WEB-INF/Signup.jsp b/redbox5/WebContent/WEB-INF/Signup.jsp deleted file mode 100644 index 96f2c64..0000000 --- a/redbox5/WebContent/WEB-INF/Signup.jsp +++ /dev/null @@ -1,86 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> - - - - - - -Insert title here - - - -<%@include file="Header.jsp"%> - - - - - -
      -
      - - - -

      Username exists, please try another.

      - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      First Name:
      Last Name:
      Address:
      City:
      State:
      ZIP:
      Create a username:
      Create a password:
      - -
      - - -<%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redbox5/WebContent/WEB-INF/ThankYou.jsp b/redbox5/WebContent/WEB-INF/ThankYou.jsp deleted file mode 100644 index 9847e5e..0000000 --- a/redbox5/WebContent/WEB-INF/ThankYou.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -Thank you. Your order has been placed. - - - \ No newline at end of file diff --git a/redbox5/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/redbox5/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/aopalliance-1.0.jar b/redbox5/WebContent/WEB-INF/lib/aopalliance-1.0.jar deleted file mode 100644 index 578b1a0..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/aopalliance-1.0.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/redbox5/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/redbox5/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/redbox5/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-dbcp2-2.0.jar b/redbox5/WebContent/WEB-INF/lib/commons-dbcp2-2.0.jar deleted file mode 100644 index 5ce4662..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-dbcp2-2.0.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/redbox5/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/redbox5/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-io-1.1.jar b/redbox5/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/redbox5/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar b/redbox5/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar deleted file mode 100644 index ab51254..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-pool2-2.2.jar b/redbox5/WebContent/WEB-INF/lib/commons-pool2-2.2.jar deleted file mode 100644 index 6a3eb38..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-pool2-2.2.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/redbox5/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar b/redbox5/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar deleted file mode 100644 index 9d5fe16..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar b/redbox5/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar deleted file mode 100644 index a86a365..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar b/redbox5/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar deleted file mode 100644 index 4b3b433..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/redbox5/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/junit-4.11.jar b/redbox5/WebContent/WEB-INF/lib/junit-4.11.jar deleted file mode 100644 index aaf7444..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/junit-4.11.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/ojdbc6.jar b/redbox5/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/oro-2.0.8.jar b/redbox5/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar b/redbox5/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar deleted file mode 100644 index 941485e..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar b/redbox5/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar deleted file mode 100644 index cfa5696..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar b/redbox5/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar deleted file mode 100644 index 9936474..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar b/redbox5/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar deleted file mode 100644 index fa08986..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar b/redbox5/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar deleted file mode 100644 index b8f346e..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/spring-jdbc-3.2.8.RELEASE.jar b/redbox5/WebContent/WEB-INF/lib/spring-jdbc-3.2.8.RELEASE.jar deleted file mode 100644 index a8224e3..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/spring-jdbc-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/spring-tx-3.2.8.RELEASE.jar b/redbox5/WebContent/WEB-INF/lib/spring-tx-3.2.8.RELEASE.jar deleted file mode 100644 index 13d7f4f..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/spring-tx-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar b/redbox5/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar deleted file mode 100644 index 87cf842..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/standard-1.0.6.jar b/redbox5/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/redbox5/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/redbox5/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/redbox5/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/redbox5/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/redbox5/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/redbox5/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/redbox5/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/redbox5/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/redbox5/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/redbox5/WebContent/WEB-INF/redbox-struts-config.xml b/redbox5/WebContent/WEB-INF/redbox-struts-config.xml deleted file mode 100644 index bd18664..0000000 --- a/redbox5/WebContent/WEB-INF/redbox-struts-config.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/redbox5/WebContent/WEB-INF/spring-config.xml b/redbox5/WebContent/WEB-INF/spring-config.xml deleted file mode 100644 index 6a38f37..0000000 --- a/redbox5/WebContent/WEB-INF/spring-config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/redbox5/WebContent/WEB-INF/web.xml b/redbox5/WebContent/WEB-INF/web.xml deleted file mode 100644 index 6b4a4da..0000000 --- a/redbox5/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - redbox - - index.jsp - - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/redbox-struts-config.xml - - 1 - - - - ActionServlet - *.do - - - - contextConfigLocation - /WEB-INF/spring-config.xml - - - - org.springframework.web.context.ContextLoaderListener - - - \ No newline at end of file diff --git a/redbox5/WebContent/images/FreeBirdsMovie.jpg b/redbox5/WebContent/images/FreeBirdsMovie.jpg deleted file mode 100644 index c3fca34..0000000 Binary files a/redbox5/WebContent/images/FreeBirdsMovie.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/FrozenMovie.jpg b/redbox5/WebContent/images/FrozenMovie.jpg deleted file mode 100644 index 811ebd3..0000000 Binary files a/redbox5/WebContent/images/FrozenMovie.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/LegoMovie.jpg b/redbox5/WebContent/images/LegoMovie.jpg deleted file mode 100644 index 1b1a7be..0000000 Binary files a/redbox5/WebContent/images/LegoMovie.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/MandelaMovie.jpg b/redbox5/WebContent/images/MandelaMovie.jpg deleted file mode 100644 index a172f73..0000000 Binary files a/redbox5/WebContent/images/MandelaMovie.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/ThorMovie.jpg b/redbox5/WebContent/images/ThorMovie.jpg deleted file mode 100644 index 2ac8ee8..0000000 Binary files a/redbox5/WebContent/images/ThorMovie.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/cart.jpg b/redbox5/WebContent/images/cart.jpg deleted file mode 100644 index a6c8488..0000000 Binary files a/redbox5/WebContent/images/cart.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/checkout.jpg b/redbox5/WebContent/images/checkout.jpg deleted file mode 100644 index f8f2bda..0000000 Binary files a/redbox5/WebContent/images/checkout.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/login.jpg b/redbox5/WebContent/images/login.jpg deleted file mode 100644 index 442c689..0000000 Binary files a/redbox5/WebContent/images/login.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/logo.jpg b/redbox5/WebContent/images/logo.jpg deleted file mode 100644 index 476dae1..0000000 Binary files a/redbox5/WebContent/images/logo.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/signup.jpg b/redbox5/WebContent/images/signup.jpg deleted file mode 100644 index 320d80a..0000000 Binary files a/redbox5/WebContent/images/signup.jpg and /dev/null differ diff --git a/redbox5/WebContent/images/signup2.jpg b/redbox5/WebContent/images/signup2.jpg deleted file mode 100644 index 07d0696..0000000 Binary files a/redbox5/WebContent/images/signup2.jpg and /dev/null differ diff --git a/redbox5/WebContent/index.jsp b/redbox5/WebContent/index.jsp deleted file mode 100644 index 5a4a469..0000000 --- a/redbox5/WebContent/index.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -<%response.sendRedirect("/redbox/listMovies.do"); %> - - - \ No newline at end of file diff --git a/redbox5/readme.txt b/redbox5/readme.txt deleted file mode 100644 index 88d5806..0000000 --- a/redbox5/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Redbox application using Struts,Spring and Spring JDBC \ No newline at end of file diff --git a/redbox5/src/com/training/java/redbox/AddToCartServlet.java b/redbox5/src/com/training/java/redbox/AddToCartServlet.java deleted file mode 100644 index cc4abe0..0000000 --- a/redbox5/src/com/training/java/redbox/AddToCartServlet.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -/** - * Servlet implementation class AddToCart - */ -public class AddToCartServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - long id = Long.parseLong(request.getParameter("id")); - - HttpSession session = request.getSession(); - - List cart = (List)session.getAttribute("cart"); - if(cart == null) - { - cart = new ArrayList<>(); - cart.add(id); - - session.setAttribute("cart", cart); - - }else{ - - cart.add(id); - } - - RequestDispatcher rd = request.getRequestDispatcher("/listMovies"); - rd.forward(request, response); - } - -} diff --git a/redbox5/src/com/training/java/redbox/CheckoutServlet.java b/redbox5/src/com/training/java/redbox/CheckoutServlet.java deleted file mode 100644 index 60462f7..0000000 --- a/redbox5/src/com/training/java/redbox/CheckoutServlet.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; -import com.training.java.redbox.domain.Orders; -import com.training.java.redbox.domain.OrdersDAO; -import com.training.java.redbox.domain.OrdersDAOJDBCImpl; - -/** - * Servlet implementation class CheckoutServlet - */ -public class CheckoutServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - List cart = (List) session.getAttribute("cart"); - - MovieDAO dao = new MovieDAOJDBCImpl(); - - List movies = new ArrayList<>(); - - for(long id : cart){ - - try { - movies.add(dao.findByPrimaryKey(id)); - - - } catch (DAOException e) { - e.printStackTrace(); - } - - } - - request.setAttribute("moviesCart", movies); - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Checkout.jsp"); - rd.forward(request, response); - - } - - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - - Customer customer = (Customer)session.getAttribute("customer"); - - if(customer!=null){ - - List ids = (List) session.getAttribute("cart"); - - OrdersDAO dao = new OrdersDAOJDBCImpl(); - long orderNum = 0; - - - try { - orderNum = dao.createOrderNumber(); - - for(long id : ids) - { - Orders order = new Orders(orderNum, 0, customer.getCustomerId(), id, "Rented"); - - dao.createOrders(order); - } - } catch (DAOException e) { - e.printStackTrace(); - } - - session.invalidate(); - response.sendRedirect("/redbox/thankyou"); - - } - else{ - - request.setAttribute("error", "Please login in order to checkout."); - doGet(request, response); - } - - } - -} diff --git a/redbox5/src/com/training/java/redbox/CustomerForm.java b/redbox5/src/com/training/java/redbox/CustomerForm.java deleted file mode 100644 index d98fe1c..0000000 --- a/redbox5/src/com/training/java/redbox/CustomerForm.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.training.java.redbox; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.Globals; -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class CustomerForm extends ActionForm { - - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private String userName; - private String password; - private int age; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - sb.append("First name = " + firstName); - sb.append("Last name = " + lastName); - - return sb.toString(); - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { - - ActionErrors errors = new ActionErrors(); - - if(firstName == null || firstName.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("firstname.required")); - } - if(lastName == null || lastName.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("lastName.required")); - } - if(zipCode == null || zipCode.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("zipCode.required")); - } - if(userName == null || userName.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("userName.required")); - } - if(password == null || password.trim().equals("")) - { - errors.add(Globals.MESSAGES_KEY, new ActionMessage("password.required")); - } - - return errors; - } - -} diff --git a/redbox5/src/com/training/java/redbox/ListMoviesAction.java b/redbox5/src/com/training/java/redbox/ListMoviesAction.java deleted file mode 100644 index 1d4f1bf..0000000 --- a/redbox5/src/com/training/java/redbox/ListMoviesAction.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.java.redbox; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -public class ListMoviesAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - System.out.println("ListMoviesAction.execute called"); - - MovieDAO dao = new MovieDAOJDBCImpl(); - - try { - List movies = dao.getAllMovies(); - - request.setAttribute("movies", movies); - - } catch (DAOException e) { - e.printStackTrace(); - } - - return mapping.findForward("list"); - - } - - - -} diff --git a/redbox5/src/com/training/java/redbox/ListMoviesServlet.java b/redbox5/src/com/training/java/redbox/ListMoviesServlet.java deleted file mode 100644 index 9316218..0000000 --- a/redbox5/src/com/training/java/redbox/ListMoviesServlet.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.Movie; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class ListMoviesServlet - */ -public class ListMoviesServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - MovieDAO dao = new MovieDAOJDBCImpl(); - - try { - List movies = dao.getAllMovies(); - - request.setAttribute("movies", movies); - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/ShowMovies.jsp"); - rd.forward(request, response); - - } catch (DAOException e) { - e.printStackTrace(); - } - - } - -} diff --git a/redbox5/src/com/training/java/redbox/LoginServlet.java b/redbox5/src/com/training/java/redbox/LoginServlet.java deleted file mode 100644 index b20e798..0000000 --- a/redbox5/src/com/training/java/redbox/LoginServlet.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.CustomerDAO; -import com.training.java.redbox.domain.CustomerDaoJdbcImpl; -import com.training.java.redbox.domain.DAOException; - -/** - * Servlet implementation class LoginServlet - */ -public class LoginServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Login.jsp"); - rd.forward(request, response); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String username = request.getParameter("username"); - String password = request.getParameter("password"); - Customer customer = null; - - CustomerDAO dao = new CustomerDaoJdbcImpl(); - - try { - - customer = dao.findByUsernameAndPassword(username, password); - - } catch (DAOException e) { - e.printStackTrace(); - } - - if (customer!=null) - { - HttpSession session = request.getSession(); - session.setAttribute("customer", customer); - - RequestDispatcher rd = request.getRequestDispatcher("/"); - rd.forward(request, response); - } - else - { - request.setAttribute("error", 1); - doGet(request, response); - } - - } - -} diff --git a/redbox5/src/com/training/java/redbox/SaveCustomerAction.java b/redbox5/src/com/training/java/redbox/SaveCustomerAction.java deleted file mode 100644 index f0b0a7f..0000000 --- a/redbox5/src/com/training/java/redbox/SaveCustomerAction.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.java.redbox; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.sql.rowset.serial.SerialException; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.CustomerDAO; -import com.training.java.redbox.domain.CustomerDaoJdbcImpl; -import com.training.java.redbox.domain.CustomerService; -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.ServiceException; - -public class SaveCustomerAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - - CustomerForm customerForm = (CustomerForm) form; - - System.out.println(customerForm); - - Customer customer = new Customer(0, customerForm.getFirstName(), customerForm.getLastName()); - customer.setAddress(customerForm.getAddress()); - customer.setCity(customerForm.getCity()); - customer.setState(customerForm.getState()); - customer.setZipCode(customerForm.getZipCode()); - customer.setUserName(customerForm.getUserName()); - customer.setPassword(customerForm.getPassword()); - - - ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServlet().getServletContext()); - CustomerService service = context.getBean(CustomerService.class); - - - try { - service.addCustomer(customer); - } catch (ServiceException e) { - e.printStackTrace(); - } - - return mapping.findForward("login"); - - - } - -} diff --git a/redbox5/src/com/training/java/redbox/SignupAction.java b/redbox5/src/com/training/java/redbox/SignupAction.java deleted file mode 100644 index d009113..0000000 --- a/redbox5/src/com/training/java/redbox/SignupAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.redbox; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class SignupAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("signup"); - } - -} diff --git a/redbox5/src/com/training/java/redbox/SignupServlet.java b/redbox5/src/com/training/java/redbox/SignupServlet.java deleted file mode 100644 index 31135f6..0000000 --- a/redbox5/src/com/training/java/redbox/SignupServlet.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.redbox.domain.Customer; -import com.training.java.redbox.domain.CustomerDAO; -import com.training.java.redbox.domain.CustomerDaoJdbcImpl; -import com.training.java.redbox.domain.DAOException; -import com.training.java.redbox.domain.MovieDAO; -import com.training.java.redbox.domain.MovieDAOJDBCImpl; - -/** - * Servlet implementation class SignupServlet - */ -public class SignupServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/Signup.jsp"); - rd.forward(request, response); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String address = request.getParameter("address"); - String city = request.getParameter("city"); - String state = request.getParameter("state"); - String zip = request.getParameter("zip"); - String username = request.getParameter("username"); - String password = request.getParameter("password"); - Customer customer = null; - - CustomerDAO dao = new CustomerDaoJdbcImpl(); - - try { - - customer = dao.findCustomerByUsername(username); - - } catch (DAOException e) { - e.printStackTrace(); - } - - if(customer==null){ - - customer = new Customer(0, firstName, lastName); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zip); - customer.setUserName(username); - customer.setPassword(password); - - try { - dao.addCustomer(customer); - } catch (DAOException e) { - e.printStackTrace(); - } - - RequestDispatcher rd = request.getRequestDispatcher("/"); - rd.forward(request, response); - - }else{ - - request.setAttribute("error", 1); - doGet(request, response); - - /*RequestDispatcher rd = request.getRequestDispatcher("/error"); - rd.forward(request, response); */ - } - - - } - -} diff --git a/redbox5/src/com/training/java/redbox/ThankYouServlet.java b/redbox5/src/com/training/java/redbox/ThankYouServlet.java deleted file mode 100644 index 6ac8f53..0000000 --- a/redbox5/src/com/training/java/redbox/ThankYouServlet.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.redbox; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class ThankYouServlet - */ -public class ThankYouServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/ThankYou.jsp"); - rd.forward(request, response); - - } - -} diff --git a/redbox5/src/com/training/java/redbox/domain/BaseDAO.java b/redbox5/src/com/training/java/redbox/domain/BaseDAO.java deleted file mode 100644 index 5f2c545..0000000 --- a/redbox5/src/com/training/java/redbox/domain/BaseDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - private static final String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE"; - private static final String username = "redbox"; - private static final String password = "redbox"; - - // getConnection method - - protected Connection getConnection() throws DAOException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - - } catch (ClassNotFoundException ex) { - throw new DAOException(ex, "Class Not Found"); - } catch (SQLException ex) { - throw new DAOException(ex); - } - - } - - /** - * Close all resources: - * - * Close connection Close statement Close resultSet - */ - protected void closeResources(Connection connection, Statement statement, - ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} - diff --git a/redbox5/src/com/training/java/redbox/domain/Customer.java b/redbox5/src/com/training/java/redbox/domain/Customer.java deleted file mode 100644 index c379ab1..0000000 --- a/redbox5/src/com/training/java/redbox/domain/Customer.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java.redbox.domain; - -public class Customer { - - private long customerId; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private String userName; - private String password; - - public Customer() - { - - } - public Customer(long customerId,String firstName,String lastName) - { - this.customerId=customerId; - this.firstName=firstName; - this.lastName=lastName; - } - - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - public String getAddress() { - return address; - } - public void setAddress(String address) { - this.address = address; - } - public String getCity() { - return city; - } - public void setCity(String city) { - this.city = city; - } - public String getState() { - return state; - } - public void setState(String state) { - this.state = state; - } - public String getZipCode() { - return zipCode; - } - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - public long getCustomerId() { - return customerId; - } - public String getFirstName() { - return firstName; - } - public String getLastName() { - return lastName; - } - - - } diff --git a/redbox5/src/com/training/java/redbox/domain/CustomerDAO.java b/redbox5/src/com/training/java/redbox/domain/CustomerDAO.java deleted file mode 100644 index aea1fda..0000000 --- a/redbox5/src/com/training/java/redbox/domain/CustomerDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - void addCustomer(Customer customer)throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(String customerId) throws DAOException; - Customer findCustomerByCustomerId(String customerId)throws DAOException; - Customer findCustomerByUsername(String username)throws DAOException; - Customer findByUsernameAndPassword(String username, String password)throws DAOException; - -} - - diff --git a/redbox5/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java b/redbox5/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java deleted file mode 100644 index 080c9b5..0000000 --- a/redbox5/src/com/training/java/redbox/domain/CustomerDaoJdbcImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDaoJdbcImpl implements CustomerDAO { - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getAllCustomers() throws DAOException { - return jdbcTemplate.query("select * from customers", - new CustomerRowMapper()); - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("insert into customers values(customer_seq.NEXTVAL,?,?,?,?,?,?,?,?)", - customer.getFirstName(), customer.getLastName(), - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword()); - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("update customers set address=?,city=?, state=?,zipcode=?,username=?,password=? where customer_id = ?", - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword(), - customer.getCustomerId()); - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - jdbcTemplate.update("delete from customers where customer_id=?", - customerId); - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where customer_id = ?", - new CustomerRowMapper(), customerId); - } - - @Override - public Customer findCustomerByUsername(String username) throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ?", - new CustomerRowMapper(), username); - } - - @Override - public Customer findByUsernameAndPassword(String username, String password) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ? and password=?", - new CustomerRowMapper(), username, password); - } - - private static final class CustomerRowMapper implements RowMapper { - @Override - public Customer mapRow(ResultSet resultSet, int rowNum) - throws SQLException { - - long customerId = resultSet.getLong("customer_id"); - String username = resultSet.getString("username"); - String password = resultSet.getString("password"); - String firstname = resultSet.getString("first_name"); - String lastname = resultSet.getString("last_name"); - String address = resultSet.getString("address"); - String city = resultSet.getString("city"); - String state = resultSet.getString("state"); - String zipcode = resultSet.getString("zipcode"); - - Customer customer = new Customer(customerId, firstname, lastname); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - customer.setUserName(username); - customer.setPassword(password); - - return customer; - } - - } -} diff --git a/redbox5/src/com/training/java/redbox/domain/CustomerService.java b/redbox5/src/com/training/java/redbox/domain/CustomerService.java deleted file mode 100644 index 6a6572a..0000000 --- a/redbox5/src/com/training/java/redbox/domain/CustomerService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.java.redbox.domain; - -public interface CustomerService { - - void addCustomer(Customer customer) throws ServiceException; - -} diff --git a/redbox5/src/com/training/java/redbox/domain/CustomerServiceImpl.java b/redbox5/src/com/training/java/redbox/domain/CustomerServiceImpl.java deleted file mode 100644 index f489e4e..0000000 --- a/redbox5/src/com/training/java/redbox/domain/CustomerServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.redbox.domain; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -@Service -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO dao; - - @Override - public void addCustomer(Customer customer) throws ServiceException { - try { - dao.addCustomer(customer); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - -} diff --git a/redbox5/src/com/training/java/redbox/domain/DAOException.java b/redbox5/src/com/training/java/redbox/domain/DAOException.java deleted file mode 100644 index 2469d7d..0000000 --- a/redbox5/src/com/training/java/redbox/domain/DAOException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage, Exception ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/redbox5/src/com/training/java/redbox/domain/Movie.java b/redbox5/src/com/training/java/redbox/domain/Movie.java deleted file mode 100644 index a4522ed..0000000 --- a/redbox5/src/com/training/java/redbox/domain/Movie.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.java.redbox.domain; - -public class Movie { - - private long id; - private String type; - private String title; - private double rentalPrice; - private String imageLocation; - - // constructor - - public Movie(long id, String type, String title, double rentalPrice, - String imageLocation) { - super(); - this.id = id; - this.type = type; - this.title = title; - this.rentalPrice = rentalPrice; - this.imageLocation = imageLocation; - } - - // getters - - public long getId() { - return id; - } - - public String getType() { - return type; - } - - public String getTitle() { - return title; - } - - public double rentalPrice() { - return rentalPrice; - } - - public double getRentalPrice() { - return rentalPrice; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getImageLocation() { - return imageLocation; - } - -} \ No newline at end of file diff --git a/redbox5/src/com/training/java/redbox/domain/MovieDAO.java b/redbox5/src/com/training/java/redbox/domain/MovieDAO.java deleted file mode 100644 index 1d57c9d..0000000 --- a/redbox5/src/com/training/java/redbox/domain/MovieDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -/** - * This is a Data Access object Interface. - * - * @author Satya - * - */ - -public interface MovieDAO { - - // Contract - List getAllMovies() throws DAOException; - - void addMovie(Movie movie) throws DAOException; - - void updateMovie(Movie movie) throws DAOException; - - void deleteMovie(long id) throws DAOException; - - Movie findByPrimaryKey(long id) throws DAOException; - -} diff --git a/redbox5/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java b/redbox5/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index 3ed1e3c..0000000 --- a/redbox5/src/com/training/java/redbox/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - - - -public class MovieDAOJDBCImpl extends BaseDAO implements MovieDAO { - - @Override - public List getAllMovies() throws DAOException { - - // Create a list of movie. - List movies = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - // Calling getConnection() - - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("Select * from Movie"); - - while (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - // Instantiate Movie object - Movie movie = new Movie(id, type, title, rentalPrice, imageLocation); - - // add movie object to list - - movies.add(movie); - - } - - } catch (SQLException ex) { - - throw new DAOException(ex, - "Error while selecting a record from database"); - - } finally { - // calling colseResources method to close all resources. - closeResources(connection, statement, resultSet); - - } - - return movies; - } - - - // adding record to movie table through DAO - @Override - public void addMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("insert into Movie values(?,?,?,?,?,?,?)"); - statement.setLong(1, id); - statement.setString(2, type); - statement.setString(3, title); - statement.setDouble(4,rentalPrice); - - int noOfRowsInserted = statement.executeUpdate(); - connection.commit(); - if (noOfRowsInserted != 1) { - throw new DAOException("Inserting a Movie failed"); - } - - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } - - - - - - - @Override - public void updateMovie( Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - - statement = connection - .prepareStatement("update Movie set type =?, title=?,director= ?,genre=?,rental_Price =?,rating=? where id = ?"); - - - statement.setString(1, type); - statement.setString(2, title); - statement.setDouble(5,rentalPrice); - - statement.setLong(7, id); - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - System.out.println("No Rows Updated"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while updating a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public void deleteMovie(long id) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("delete from movie where id = ?"); - - statement.setLong(1, id); - - int noOfRowsDeleted = statement.executeUpdate(); - - if (noOfRowsDeleted != 1) { - throw new DAOException("Delete failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while deleting a record from the Database"); - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public Movie findByPrimaryKey(long movieId) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - Movie movie = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("Select * from Movie where id = ?"); - - statement.setLong(1, movieId); - - resultSet = statement.executeQuery(); - - if (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - return new Movie(id, type, title, rentalPrice, imageLocation); - - } - - throw new DAOException("Invalid id provided"); - - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while selecting a record from the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - - - } - - } diff --git a/redbox5/src/com/training/java/redbox/domain/Orders.java b/redbox5/src/com/training/java/redbox/domain/Orders.java deleted file mode 100644 index 0616961..0000000 --- a/redbox5/src/com/training/java/redbox/domain/Orders.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.training.java.redbox.domain; - -public class Orders { - - private long orderId; - private long orderNumber; - private long customer_id; - private long movie_id; - private String status; - - public Orders(long orderNumber, long orderId, long customer_id, long movie_id, String status) { - super(); - this.orderNumber = orderNumber; - this.orderId = orderId; - this.customer_id = customer_id; - this.movie_id = movie_id; - this.status = status; - } - - /** - * @return the id - */ - public long getOrderId() { - return orderId; - } - - /** - * @return the customer_id - */ - public long getCustomer_id() { - return customer_id; - } - - /** - * @return the movie_id - */ - public long getMovie_id() { - return movie_id; - } - - /** - * @return the rental_days - */ - public String getStatus() { - return status; - } - - public long getOrderNumber() { - return orderNumber; - } - -} diff --git a/redbox5/src/com/training/java/redbox/domain/OrdersDAO.java b/redbox5/src/com/training/java/redbox/domain/OrdersDAO.java deleted file mode 100644 index 11999dd..0000000 --- a/redbox5/src/com/training/java/redbox/domain/OrdersDAO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.java.redbox.domain; - -import java.util.List; - -public interface OrdersDAO { - - void createOrders(Orders orders) throws DAOException; - - List getAllOrders() throws DAOException; - - Orders getOrdersById(long id) throws DAOException; - - void update(Orders orders) throws DAOException; - - void delete(long id) throws DAOException; - - long createOrderNumber() throws DAOException; - -} diff --git a/redbox5/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java b/redbox5/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java deleted file mode 100644 index f2dbe14..0000000 --- a/redbox5/src/com/training/java/redbox/domain/OrdersDAOJDBCImpl.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.training.java.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class OrdersDAOJDBCImpl extends BaseDAO implements OrdersDAO { - - @Override - public List getAllOrders() throws DAOException { - - List order = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from Orders"); - - while (rs.next()) { - long orderNumber = rs.getLong("orderNumber"); - long orderId = rs.getLong("orderId"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - String status = rs.getString("status"); - - Orders orders = new Orders(orderNumber, orderId, customer_id, movie_id, - status); - order.add(orders); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - - @Override - public void createOrders(Orders orders) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - - try { - con = getConnection(); - stmt = con.prepareStatement("insert into orders values(?,?,?,?,?)"); - - stmt.setLong(1, getOrderId()); - stmt.setLong(2, orders.getOrderNumber()); - stmt.setLong(3, orders.getCustomer_id()); - stmt.setLong(4, orders.getMovie_id()); - stmt.setString(5, orders.getStatus()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - - @Override - public Orders getOrdersById(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Orders order = null; - try { - con = getConnection(); - stmt = con.prepareStatement("select * from order where orderId = ?"); - stmt.setLong(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) { - long orderNumber = rs.getLong("orderNumber"); - long orderId = rs.getLong("orderId"); - long customer_id = rs.getLong("customer_id"); - long movie_id = rs.getLong("movie_id"); - String status = rs.getString("status"); - - order = new Orders(orderNumber, orderId, customer_id, movie_id, status); - } - return order; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - } - - @Override - public void update(Orders orders) throws DAOException { - { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con - .prepareStatement("update orders set order_number = ?, order_id = ?, customer_id= ?, movie_id = ?, status = ? where id = ?"); - stmt.setLong(1, orders.getOrderNumber()); - stmt.setLong(2, orders.getOrderId()); - stmt.setLong(3, orders.getCustomer_id()); - stmt.setLong(4, orders.getMovie_id()); - stmt.setString(5, orders.getStatus()); - - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - } - - } - - @Override - public void delete(long id) throws DAOException { - Connection con = null; - PreparedStatement stmt = null; - - try { - con = getConnection(); - stmt = con.prepareStatement("delete from orders where id = ?"); - stmt.setLong(1, id); - stmt.execute(); - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, null); - } - - } - - - @Override - public long createOrderNumber() throws DAOException { - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - long orderNumber = 0; - - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select order_num_seq.nextval from dual"); - - while (rs.next()) { - orderNumber = rs.getLong(1); - } - return orderNumber; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - -private long getOrderId() throws DAOException { - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - long orderId = 0; - - - try { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select order_id_seq.nextval from dual"); - - while (rs.next()) { - orderId = rs.getLong(1); - } - return orderId; - - } catch (SQLException e) { - throw new DAOException(e); - } finally { - closeResources(con, stmt, rs); - } - - } - -} diff --git a/redbox5/src/com/training/java/redbox/domain/ServiceException.java b/redbox5/src/com/training/java/redbox/domain/ServiceException.java deleted file mode 100644 index 7d908df..0000000 --- a/redbox5/src/com/training/java/redbox/domain/ServiceException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.redbox.domain; - -public class ServiceException extends Exception { - - public ServiceException(Exception ex) { - super(ex); - } - -} diff --git a/redboxspringmvc/.classpath b/redboxspringmvc/.classpath deleted file mode 100644 index 5f2c364..0000000 --- a/redboxspringmvc/.classpath +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/redboxspringmvc/.project b/redboxspringmvc/.project deleted file mode 100644 index 2a86495..0000000 --- a/redboxspringmvc/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - redboxspringmvc - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/redboxspringmvc/.settings/.jsdtscope b/redboxspringmvc/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/redboxspringmvc/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/redboxspringmvc/.settings/org.eclipse.jdt.core.prefs b/redboxspringmvc/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c788ee3..0000000 --- a/redboxspringmvc/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/redboxspringmvc/.settings/org.eclipse.m2e.core.prefs b/redboxspringmvc/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/redboxspringmvc/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/redboxspringmvc/.settings/org.eclipse.wst.common.component b/redboxspringmvc/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 985edbd..0000000 --- a/redboxspringmvc/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/redboxspringmvc/.settings/org.eclipse.wst.common.project.facet.core.xml b/redboxspringmvc/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 47c8f48..0000000 --- a/redboxspringmvc/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/redboxspringmvc/.settings/org.eclipse.wst.jsdt.ui.superType.container b/redboxspringmvc/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/redboxspringmvc/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/redboxspringmvc/.settings/org.eclipse.wst.jsdt.ui.superType.name b/redboxspringmvc/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/redboxspringmvc/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/redboxspringmvc/.springBeans b/redboxspringmvc/.springBeans deleted file mode 100644 index c834b76..0000000 --- a/redboxspringmvc/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/webapp/WEB-INF/redbox-servlet.xml - - - - diff --git a/redboxspringmvc/pom.xml b/redboxspringmvc/pom.xml deleted file mode 100644 index 8b414aa..0000000 --- a/redboxspringmvc/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - 4.0.0 - com.training.venkat - redboxspringmvc - war - 1.0 - redboxspringmvc Maven Webapp - http://maven.apache.org - - - - junit - junit - 4.11 - test - - - org.springframework - spring-context - 3.2.8.RELEASE - - - org.springframework - spring-web - 3.2.8.RELEASE - - - org.springframework - spring-webmvc - 3.2.8.RELEASE - - - org.springframework - spring-jdbc - 3.2.8.RELEASE - - - com.oracle - ojdbc - 6.0 - - - org.hibernate - hibernate-validator - 4.3.1.Final - - - jstl - jstl - 1.2 - - - commons-dbcp - commons-dbcp - 1.4 - - - commons-pool - commons-pool - 1.6 - - - - - redboxspringmvc - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - - diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/BaseDAO.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/BaseDAO.java deleted file mode 100644 index 00c80ef..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/BaseDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - private static final String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE"; - private static final String username = "redbox"; - private static final String password = "redbox"; - - // getConnection method - - protected Connection getConnection() throws DAOException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - - } catch (ClassNotFoundException ex) { - throw new DAOException(ex, "Class Not Found"); - } catch (SQLException ex) { - throw new DAOException(ex); - } - - } - - /** - * Close all resources: - * - * Close connection Close statement Close resultSet - */ - protected void closeResources(Connection connection, Statement statement, - ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} - diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/Customer.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/Customer.java deleted file mode 100644 index aaadfb7..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/Customer.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.training.redbox.domain; - -import javax.validation.constraints.Pattern; - -import org.hibernate.validator.constraints.NotEmpty; - -public class Customer { - - private long customerId; - - @NotEmpty - @Pattern(regexp="[a-z-A-Z]*", message="First name must contain only characters") - private String firstName; - - @NotEmpty - @Pattern(regexp="[a-z-A-Z]*", message="Last name must contain only characters") - private String lastName; - - private String address; - private String city; - private String state; - - @NotEmpty - @Pattern(regexp="[0-9]*", message="Zip code must contain only numbers") - private String zipCode; - - @NotEmpty - private String userName; - - @NotEmpty - private String password; - - public Customer() { - - } - - public Customer(long customerId, String firstName, String lastName) { - this.customerId = customerId; - this.firstName = firstName; - this.lastName = lastName; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public long getCustomerId() { - return customerId; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerDAO.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerDAO.java deleted file mode 100644 index c56632c..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - void addCustomer(Customer customer)throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(String customerId) throws DAOException; - Customer findCustomerByCustomerId(String customerId)throws DAOException; - Customer findCustomerByUsername(String username)throws DAOException; - Customer findByUsernameAndPassword(String username, String password)throws DAOException; - -} - - diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerDaoJdbcImpl.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerDaoJdbcImpl.java deleted file mode 100644 index f2f2026..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerDaoJdbcImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDaoJdbcImpl implements CustomerDAO { - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getAllCustomers() throws DAOException { - return jdbcTemplate.query("select * from customers", - new CustomerRowMapper()); - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("insert into customers values(customer_seq.NEXTVAL,?,?,?,?,?,?,?,?)", - customer.getFirstName(), customer.getLastName(), - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword()); - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("update customers set address=?,city=?, state=?,zipcode=?,username=?,password=? where customer_id = ?", - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword(), - customer.getCustomerId()); - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - jdbcTemplate.update("delete from customers where customer_id=?", - customerId); - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where customer_id = ?", - new CustomerRowMapper(), customerId); - } - - @Override - public Customer findCustomerByUsername(String username) throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ?", - new CustomerRowMapper(), username); - } - - @Override - public Customer findByUsernameAndPassword(String username, String password) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ? and password=?", - new CustomerRowMapper(), username, password); - } - - private static final class CustomerRowMapper implements RowMapper { - @Override - public Customer mapRow(ResultSet resultSet, int rowNum) - throws SQLException { - - long customerId = resultSet.getLong("customer_id"); - String username = resultSet.getString("username"); - String password = resultSet.getString("password"); - String firstname = resultSet.getString("first_name"); - String lastname = resultSet.getString("last_name"); - String address = resultSet.getString("address"); - String city = resultSet.getString("city"); - String state = resultSet.getString("state"); - String zipcode = resultSet.getString("zipcode"); - - Customer customer = new Customer(customerId, firstname, lastname); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - customer.setUserName(username); - customer.setPassword(password); - - return customer; - } - - } -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerService.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerService.java deleted file mode 100644 index f65356d..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.redbox.domain; - -public interface CustomerService { - - void addCustomer(Customer customer) throws ServiceException; - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerServiceImpl.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerServiceImpl.java deleted file mode 100644 index 0d872d2..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/CustomerServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.redbox.domain; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -@Service -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO dao; - - @Override - public void addCustomer(Customer customer) throws ServiceException { - try { - dao.addCustomer(customer); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/DAOException.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/DAOException.java deleted file mode 100644 index 26d4e28..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/DAOException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage, Exception ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/Movie.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/Movie.java deleted file mode 100644 index 221b65c..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/Movie.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.redbox.domain; - -public class Movie { - - private long id; - private String type; - private String title; - private double rentalPrice; - private String imageLocation; - - // constructor - - public Movie(long id, String type, String title, double rentalPrice, - String imageLocation) { - super(); - this.id = id; - this.type = type; - this.title = title; - this.rentalPrice = rentalPrice; - this.imageLocation = imageLocation; - } - - // getters - - public long getId() { - return id; - } - - public String getType() { - return type; - } - - public String getTitle() { - return title; - } - - public double rentalPrice() { - return rentalPrice; - } - - public double getRentalPrice() { - return rentalPrice; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getImageLocation() { - return imageLocation; - } - -} \ No newline at end of file diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieDAO.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieDAO.java deleted file mode 100644 index cb227e4..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -/** - * This is a Data Access object Interface. - * - * @author Satya - * - */ - -public interface MovieDAO { - - // Contract - List getAllMovies() throws DAOException; - - void addMovie(Movie movie) throws DAOException; - - void updateMovie(Movie movie) throws DAOException; - - void deleteMovie(long id) throws DAOException; - - Movie findByPrimaryKey(long id) throws DAOException; - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieDAOJDBCImpl.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index 84034bd..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class MovieDAOJDBCImpl extends BaseDAO implements MovieDAO { - - @Override - public List getAllMovies() throws DAOException { - - // Create a list of movie. - List movies = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - // Calling getConnection() - - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("Select * from Movie"); - - while (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - // Instantiate Movie object - Movie movie = new Movie(id, type, title, rentalPrice, - imageLocation); - - // add movie object to list - - movies.add(movie); - - } - - } catch (SQLException ex) { - - throw new DAOException(ex, - "Error while selecting a record from database"); - - } finally { - // calling colseResources method to close all resources. - closeResources(connection, statement, resultSet); - - } - - return movies; - } - - // adding record to movie table through DAO - @Override - public void addMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("insert into Movie values(?,?,?,?,?,?,?)"); - statement.setLong(1, id); - statement.setString(2, type); - statement.setString(3, title); - statement.setDouble(4, rentalPrice); - - int noOfRowsInserted = statement.executeUpdate(); - connection.commit(); - if (noOfRowsInserted != 1) { - throw new DAOException("Inserting a Movie failed"); - } - - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } - - @Override - public void updateMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("update Movie set type =?, title=?,director= ?,genre=?,rental_Price =?,rating=? where id = ?"); - - statement.setString(1, type); - statement.setString(2, title); - statement.setDouble(5, rentalPrice); - - statement.setLong(7, id); - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - System.out.println("No Rows Updated"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while updating a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public void deleteMovie(long id) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("delete from movie where id = ?"); - - statement.setLong(1, id); - - int noOfRowsDeleted = statement.executeUpdate(); - - if (noOfRowsDeleted != 1) { - throw new DAOException("Delete failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while deleting a record from the Database"); - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public Movie findByPrimaryKey(long movieId) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - Movie movie = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("Select * from Movie where id = ?"); - - statement.setLong(1, movieId); - - resultSet = statement.executeQuery(); - - if (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - return new Movie(id, type, title, rentalPrice, imageLocation); - - } - - throw new DAOException("Invalid id provided"); - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while selecting a record from the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieService.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieService.java deleted file mode 100644 index aef9e17..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -public interface MovieService { - - List getAllMovies() throws ServiceException; - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieServiceImpl.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieServiceImpl.java deleted file mode 100644 index df0da97..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/MovieServiceImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class MovieServiceImpl implements MovieService { - - @Autowired - private MovieDAO dao; - - @Override - public List getAllMovies() throws ServiceException { - - try { - return dao.getAllMovies(); - } catch (DAOException e) { - e.printStackTrace(); - throw new ServiceException(e); - } - - - } - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/domain/ServiceException.java b/redboxspringmvc/src/main/java/com/training/redbox/domain/ServiceException.java deleted file mode 100644 index b239cda..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/domain/ServiceException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.redbox.domain; - -public class ServiceException extends Exception { - - public ServiceException(Exception ex) { - super(ex); - } - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/web/HomeController.java b/redboxspringmvc/src/main/java/com/training/redbox/web/HomeController.java deleted file mode 100644 index e4ea67e..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/web/HomeController.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.redbox.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class HomeController { - - @RequestMapping("/") - public String showHomePage() { - System.out.println("In home controller"); - return "redirect:/movies/list"; - } - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/web/LoginController.java b/redboxspringmvc/src/main/java/com/training/redbox/web/LoginController.java deleted file mode 100644 index cb5affe..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/web/LoginController.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.redbox.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class LoginController { - - @RequestMapping(value = "/login", method = RequestMethod.GET) - public String getEmptyForm() { - return "Login"; - } - - @RequestMapping(value = "/login", method = RequestMethod.POST) - public String login(@RequestParam("username") String username, - @RequestParam("password") String password) { - - System.out.println("username = " + username); - System.out.println("password = " + password); - - return "Login"; - } - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/web/MovieController.java b/redboxspringmvc/src/main/java/com/training/redbox/web/MovieController.java deleted file mode 100644 index d773aed..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/web/MovieController.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.redbox.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.training.redbox.domain.Movie; -import com.training.redbox.domain.MovieService; -import com.training.redbox.domain.ServiceException; - -@Controller -@RequestMapping("/movies") -public class MovieController { - - @Autowired - private MovieService service; - - @RequestMapping("/list") - public ModelAndView displayMovies() { - - ModelAndView mv = new ModelAndView("ShowMovies"); - - try { - List movies = service.getAllMovies(); - - mv.addObject("movies", movies); - - } catch (ServiceException e) { - e.printStackTrace(); - } - - return mv; - } - -} diff --git a/redboxspringmvc/src/main/java/com/training/redbox/web/SignupController.java b/redboxspringmvc/src/main/java/com/training/redbox/web/SignupController.java deleted file mode 100644 index f88ee6f..0000000 --- a/redboxspringmvc/src/main/java/com/training/redbox/web/SignupController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.training.redbox.web; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.training.redbox.domain.Customer; -import com.training.redbox.domain.CustomerService; -import com.training.redbox.domain.ServiceException; - -@Controller -public class SignupController { - - @Autowired - private CustomerService service; - - @RequestMapping(value = "/signup", method = RequestMethod.GET) - public ModelAndView getEmptyForm() { - ModelAndView modelAndView = new ModelAndView("SignupForm"); - - Customer customer = new Customer(); - - modelAndView.addObject("customer", customer); - - return modelAndView; - } - - @RequestMapping(value = "/signup", method = RequestMethod.POST) - public String saveForm(@Valid Customer customer, BindingResult result) { - - if (result.hasErrors()) { - - System.out.println("has errors"); - - return "SignupForm"; - } else { - System.out.println(customer); - - try { - service.addCustomer(customer); - } catch (ServiceException e) { - e.printStackTrace(); - } - - return "Login"; - } - - } - -} diff --git a/redboxspringmvc/src/main/resources/redbox.properties b/redboxspringmvc/src/main/resources/redbox.properties deleted file mode 100644 index 7c15bcc..0000000 --- a/redboxspringmvc/src/main/resources/redbox.properties +++ /dev/null @@ -1,7 +0,0 @@ -NotEmpty.customer.firstName = First name is mandatory -NotEmpty.customer.lastName = Last name is mandatory -NotEmpty.customer.zipCode = Zip is mandatory -NotEmpty.customer.userName = Username is mandatory -NotEmpty.customer.password = Password is mandatory - -Range.customer.age = Age must be greater than or equal to 20 diff --git a/redboxspringmvc/src/main/webapp/WEB-INF/redbox-servlet.xml b/redboxspringmvc/src/main/webapp/WEB-INF/redbox-servlet.xml deleted file mode 100644 index 53fb35e..0000000 --- a/redboxspringmvc/src/main/webapp/WEB-INF/redbox-servlet.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/redboxspringmvc/src/main/webapp/WEB-INF/views/Footer.jsp b/redboxspringmvc/src/main/webapp/WEB-INF/views/Footer.jsp deleted file mode 100644 index c8de0ed..0000000 --- a/redboxspringmvc/src/main/webapp/WEB-INF/views/Footer.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -
      -
      -
      -
      -
      - - -
      © 2014, Redbox Automated Retail, LLC. All rights reserved.
      - - - \ No newline at end of file diff --git a/redboxspringmvc/src/main/webapp/WEB-INF/views/Header.jsp b/redboxspringmvc/src/main/webapp/WEB-INF/views/Header.jsp deleted file mode 100644 index 18e6740..0000000 --- a/redboxspringmvc/src/main/webapp/WEB-INF/views/Header.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%@page import="com.training.redbox.domain.Customer"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - Welcome - - - - - \ No newline at end of file diff --git a/redboxspringmvc/src/main/webapp/WEB-INF/views/Login.jsp b/redboxspringmvc/src/main/webapp/WEB-INF/views/Login.jsp deleted file mode 100644 index d0bf7a2..0000000 --- a/redboxspringmvc/src/main/webapp/WEB-INF/views/Login.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - -<%@include file="Header.jsp"%> - -
      - -
      - - - - -

      Please check username/password and try again.

      - - -
      - - - - - - - - - - - - - - - - - -
      Username:
      Password:
      - -
      - -<%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redboxspringmvc/src/main/webapp/WEB-INF/views/ShowMovies.jsp b/redboxspringmvc/src/main/webapp/WEB-INF/views/ShowMovies.jsp deleted file mode 100644 index df57f09..0000000 --- a/redboxspringmvc/src/main/webapp/WEB-INF/views/ShowMovies.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%> -<%@page import="com.training.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - -Movie List - - - - <% - - System.out.println("Inside JSP"); - - %> - - <%@include file="Header.jsp"%> - - - - - - - - - - - - -
      - - - - - - - - - - () - - -
      - - - - - - - - - - - - - - - - - - - - - - - -
      ${movie.title} -
      Add to
      - - - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redboxspringmvc/src/main/webapp/WEB-INF/views/SignupForm.jsp b/redboxspringmvc/src/main/webapp/WEB-INF/views/SignupForm.jsp deleted file mode 100644 index 5f4c16d..0000000 --- a/redboxspringmvc/src/main/webapp/WEB-INF/views/SignupForm.jsp +++ /dev/null @@ -1,98 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%> - - - - - - -Insert title here - - - - - - - - <%@include file="Header.jsp"%> - - - - - -
      -
      - - - -

      - Username exists, please try another. -

      - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      First Name:
      Last Name:
      Address:
      City:
      State:
      ZIP:
      Create a username:
      Create a password:
      - -
      - - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redboxspringmvc/src/main/webapp/WEB-INF/web.xml b/redboxspringmvc/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 0c465cf..0000000 --- a/redboxspringmvc/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - Redbox with Spring MVC - - - index.jsp - - - - redbox - org.springframework.web.servlet.DispatcherServlet - - - - redbox - / - - - diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/FreeBirdsMovie.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/FreeBirdsMovie.jpg deleted file mode 100644 index c3fca34..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/FreeBirdsMovie.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/FrozenMovie.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/FrozenMovie.jpg deleted file mode 100644 index 811ebd3..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/FrozenMovie.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/LegoMovie.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/LegoMovie.jpg deleted file mode 100644 index 1b1a7be..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/LegoMovie.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/MandelaMovie.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/MandelaMovie.jpg deleted file mode 100644 index a172f73..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/MandelaMovie.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/ThorMovie.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/ThorMovie.jpg deleted file mode 100644 index 2ac8ee8..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/ThorMovie.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/cart.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/cart.jpg deleted file mode 100644 index a6c8488..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/cart.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/checkout.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/checkout.jpg deleted file mode 100644 index f8f2bda..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/checkout.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/login.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/login.jpg deleted file mode 100644 index 442c689..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/login.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/logo.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/logo.jpg deleted file mode 100644 index 476dae1..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/logo.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/signup.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/signup.jpg deleted file mode 100644 index 320d80a..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/signup.jpg and /dev/null differ diff --git a/redboxspringmvc/src/main/webapp/staticcontent/images/signup2.jpg b/redboxspringmvc/src/main/webapp/staticcontent/images/signup2.jpg deleted file mode 100644 index 07d0696..0000000 Binary files a/redboxspringmvc/src/main/webapp/staticcontent/images/signup2.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/.classpath b/redboxspringmvcjpa/.classpath deleted file mode 100644 index 8d4ae2e..0000000 --- a/redboxspringmvcjpa/.classpath +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/redboxspringmvcjpa/.project b/redboxspringmvcjpa/.project deleted file mode 100644 index 7b2d7ea..0000000 --- a/redboxspringmvcjpa/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - redboxspringmvcjpa - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/redboxspringmvcjpa/.settings/.jsdtscope b/redboxspringmvcjpa/.settings/.jsdtscope deleted file mode 100644 index b0f9c37..0000000 --- a/redboxspringmvcjpa/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/redboxspringmvcjpa/.settings/org.eclipse.jdt.core.prefs b/redboxspringmvcjpa/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c788ee3..0000000 --- a/redboxspringmvcjpa/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/redboxspringmvcjpa/.settings/org.eclipse.m2e.core.prefs b/redboxspringmvcjpa/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/redboxspringmvcjpa/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/redboxspringmvcjpa/.settings/org.eclipse.wst.common.component b/redboxspringmvcjpa/.settings/org.eclipse.wst.common.component deleted file mode 100644 index f8fd009..0000000 --- a/redboxspringmvcjpa/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/redboxspringmvcjpa/.settings/org.eclipse.wst.common.project.facet.core.xml b/redboxspringmvcjpa/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 4d51476..0000000 --- a/redboxspringmvcjpa/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/redboxspringmvcjpa/.settings/org.eclipse.wst.jsdt.ui.superType.container b/redboxspringmvcjpa/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/redboxspringmvcjpa/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/redboxspringmvcjpa/.settings/org.eclipse.wst.jsdt.ui.superType.name b/redboxspringmvcjpa/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/redboxspringmvcjpa/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/BaseDAO.java b/redboxspringmvcjpa/java/com/training/redbox/domain/BaseDAO.java deleted file mode 100644 index 00c80ef..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/BaseDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - private static final String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE"; - private static final String username = "redbox"; - private static final String password = "redbox"; - - // getConnection method - - protected Connection getConnection() throws DAOException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - - } catch (ClassNotFoundException ex) { - throw new DAOException(ex, "Class Not Found"); - } catch (SQLException ex) { - throw new DAOException(ex); - } - - } - - /** - * Close all resources: - * - * Close connection Close statement Close resultSet - */ - protected void closeResources(Connection connection, Statement statement, - ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} - diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/Customer.java b/redboxspringmvcjpa/java/com/training/redbox/domain/Customer.java deleted file mode 100644 index aaadfb7..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/Customer.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.training.redbox.domain; - -import javax.validation.constraints.Pattern; - -import org.hibernate.validator.constraints.NotEmpty; - -public class Customer { - - private long customerId; - - @NotEmpty - @Pattern(regexp="[a-z-A-Z]*", message="First name must contain only characters") - private String firstName; - - @NotEmpty - @Pattern(regexp="[a-z-A-Z]*", message="Last name must contain only characters") - private String lastName; - - private String address; - private String city; - private String state; - - @NotEmpty - @Pattern(regexp="[0-9]*", message="Zip code must contain only numbers") - private String zipCode; - - @NotEmpty - private String userName; - - @NotEmpty - private String password; - - public Customer() { - - } - - public Customer(long customerId, String firstName, String lastName) { - this.customerId = customerId; - this.firstName = firstName; - this.lastName = lastName; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public long getCustomerId() { - return customerId; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerDAO.java b/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerDAO.java deleted file mode 100644 index c56632c..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - void addCustomer(Customer customer)throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(String customerId) throws DAOException; - Customer findCustomerByCustomerId(String customerId)throws DAOException; - Customer findCustomerByUsername(String username)throws DAOException; - Customer findByUsernameAndPassword(String username, String password)throws DAOException; - -} - - diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerDaoJdbcImpl.java b/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerDaoJdbcImpl.java deleted file mode 100644 index f2f2026..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerDaoJdbcImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDaoJdbcImpl implements CustomerDAO { - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getAllCustomers() throws DAOException { - return jdbcTemplate.query("select * from customers", - new CustomerRowMapper()); - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("insert into customers values(customer_seq.NEXTVAL,?,?,?,?,?,?,?,?)", - customer.getFirstName(), customer.getLastName(), - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword()); - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("update customers set address=?,city=?, state=?,zipcode=?,username=?,password=? where customer_id = ?", - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword(), - customer.getCustomerId()); - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - jdbcTemplate.update("delete from customers where customer_id=?", - customerId); - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where customer_id = ?", - new CustomerRowMapper(), customerId); - } - - @Override - public Customer findCustomerByUsername(String username) throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ?", - new CustomerRowMapper(), username); - } - - @Override - public Customer findByUsernameAndPassword(String username, String password) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ? and password=?", - new CustomerRowMapper(), username, password); - } - - private static final class CustomerRowMapper implements RowMapper { - @Override - public Customer mapRow(ResultSet resultSet, int rowNum) - throws SQLException { - - long customerId = resultSet.getLong("customer_id"); - String username = resultSet.getString("username"); - String password = resultSet.getString("password"); - String firstname = resultSet.getString("first_name"); - String lastname = resultSet.getString("last_name"); - String address = resultSet.getString("address"); - String city = resultSet.getString("city"); - String state = resultSet.getString("state"); - String zipcode = resultSet.getString("zipcode"); - - Customer customer = new Customer(customerId, firstname, lastname); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - customer.setUserName(username); - customer.setPassword(password); - - return customer; - } - - } -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerService.java b/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerService.java deleted file mode 100644 index f65356d..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.redbox.domain; - -public interface CustomerService { - - void addCustomer(Customer customer) throws ServiceException; - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerServiceImpl.java b/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerServiceImpl.java deleted file mode 100644 index 0d872d2..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/CustomerServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.redbox.domain; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -@Service -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO dao; - - @Override - public void addCustomer(Customer customer) throws ServiceException { - try { - dao.addCustomer(customer); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/DAOException.java b/redboxspringmvcjpa/java/com/training/redbox/domain/DAOException.java deleted file mode 100644 index 26d4e28..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/DAOException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage, Exception ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/Movie.java b/redboxspringmvcjpa/java/com/training/redbox/domain/Movie.java deleted file mode 100644 index 221b65c..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/Movie.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.training.redbox.domain; - -public class Movie { - - private long id; - private String type; - private String title; - private double rentalPrice; - private String imageLocation; - - // constructor - - public Movie(long id, String type, String title, double rentalPrice, - String imageLocation) { - super(); - this.id = id; - this.type = type; - this.title = title; - this.rentalPrice = rentalPrice; - this.imageLocation = imageLocation; - } - - // getters - - public long getId() { - return id; - } - - public String getType() { - return type; - } - - public String getTitle() { - return title; - } - - public double rentalPrice() { - return rentalPrice; - } - - public double getRentalPrice() { - return rentalPrice; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getImageLocation() { - return imageLocation; - } - -} \ No newline at end of file diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/MovieDAO.java b/redboxspringmvcjpa/java/com/training/redbox/domain/MovieDAO.java deleted file mode 100644 index cb227e4..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/MovieDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -/** - * This is a Data Access object Interface. - * - * @author Satya - * - */ - -public interface MovieDAO { - - // Contract - List getAllMovies() throws DAOException; - - void addMovie(Movie movie) throws DAOException; - - void updateMovie(Movie movie) throws DAOException; - - void deleteMovie(long id) throws DAOException; - - Movie findByPrimaryKey(long id) throws DAOException; - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/MovieDAOJDBCImpl.java b/redboxspringmvcjpa/java/com/training/redbox/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index 84034bd..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class MovieDAOJDBCImpl extends BaseDAO implements MovieDAO { - - @Override - public List getAllMovies() throws DAOException { - - // Create a list of movie. - List movies = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - // Calling getConnection() - - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("Select * from Movie"); - - while (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - // Instantiate Movie object - Movie movie = new Movie(id, type, title, rentalPrice, - imageLocation); - - // add movie object to list - - movies.add(movie); - - } - - } catch (SQLException ex) { - - throw new DAOException(ex, - "Error while selecting a record from database"); - - } finally { - // calling colseResources method to close all resources. - closeResources(connection, statement, resultSet); - - } - - return movies; - } - - // adding record to movie table through DAO - @Override - public void addMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("insert into Movie values(?,?,?,?,?,?,?)"); - statement.setLong(1, id); - statement.setString(2, type); - statement.setString(3, title); - statement.setDouble(4, rentalPrice); - - int noOfRowsInserted = statement.executeUpdate(); - connection.commit(); - if (noOfRowsInserted != 1) { - throw new DAOException("Inserting a Movie failed"); - } - - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } - - @Override - public void updateMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("update Movie set type =?, title=?,director= ?,genre=?,rental_Price =?,rating=? where id = ?"); - - statement.setString(1, type); - statement.setString(2, title); - statement.setDouble(5, rentalPrice); - - statement.setLong(7, id); - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - System.out.println("No Rows Updated"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while updating a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public void deleteMovie(long id) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("delete from movie where id = ?"); - - statement.setLong(1, id); - - int noOfRowsDeleted = statement.executeUpdate(); - - if (noOfRowsDeleted != 1) { - throw new DAOException("Delete failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while deleting a record from the Database"); - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public Movie findByPrimaryKey(long movieId) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - Movie movie = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("Select * from Movie where id = ?"); - - statement.setLong(1, movieId); - - resultSet = statement.executeQuery(); - - if (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - return new Movie(id, type, title, rentalPrice, imageLocation); - - } - - throw new DAOException("Invalid id provided"); - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while selecting a record from the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/MovieService.java b/redboxspringmvcjpa/java/com/training/redbox/domain/MovieService.java deleted file mode 100644 index aef9e17..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/MovieService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -public interface MovieService { - - List getAllMovies() throws ServiceException; - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/MovieServiceImpl.java b/redboxspringmvcjpa/java/com/training/redbox/domain/MovieServiceImpl.java deleted file mode 100644 index df0da97..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/MovieServiceImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class MovieServiceImpl implements MovieService { - - @Autowired - private MovieDAO dao; - - @Override - public List getAllMovies() throws ServiceException { - - try { - return dao.getAllMovies(); - } catch (DAOException e) { - e.printStackTrace(); - throw new ServiceException(e); - } - - - } - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/domain/ServiceException.java b/redboxspringmvcjpa/java/com/training/redbox/domain/ServiceException.java deleted file mode 100644 index b239cda..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/domain/ServiceException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.redbox.domain; - -public class ServiceException extends Exception { - - public ServiceException(Exception ex) { - super(ex); - } - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/web/HomeController.java b/redboxspringmvcjpa/java/com/training/redbox/web/HomeController.java deleted file mode 100644 index e4ea67e..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/web/HomeController.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.redbox.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class HomeController { - - @RequestMapping("/") - public String showHomePage() { - System.out.println("In home controller"); - return "redirect:/movies/list"; - } - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/web/LoginController.java b/redboxspringmvcjpa/java/com/training/redbox/web/LoginController.java deleted file mode 100644 index cb5affe..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/web/LoginController.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.redbox.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class LoginController { - - @RequestMapping(value = "/login", method = RequestMethod.GET) - public String getEmptyForm() { - return "Login"; - } - - @RequestMapping(value = "/login", method = RequestMethod.POST) - public String login(@RequestParam("username") String username, - @RequestParam("password") String password) { - - System.out.println("username = " + username); - System.out.println("password = " + password); - - return "Login"; - } - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/web/MovieController.java b/redboxspringmvcjpa/java/com/training/redbox/web/MovieController.java deleted file mode 100644 index d773aed..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/web/MovieController.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.redbox.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.training.redbox.domain.Movie; -import com.training.redbox.domain.MovieService; -import com.training.redbox.domain.ServiceException; - -@Controller -@RequestMapping("/movies") -public class MovieController { - - @Autowired - private MovieService service; - - @RequestMapping("/list") - public ModelAndView displayMovies() { - - ModelAndView mv = new ModelAndView("ShowMovies"); - - try { - List movies = service.getAllMovies(); - - mv.addObject("movies", movies); - - } catch (ServiceException e) { - e.printStackTrace(); - } - - return mv; - } - -} diff --git a/redboxspringmvcjpa/java/com/training/redbox/web/SignupController.java b/redboxspringmvcjpa/java/com/training/redbox/web/SignupController.java deleted file mode 100644 index f88ee6f..0000000 --- a/redboxspringmvcjpa/java/com/training/redbox/web/SignupController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.training.redbox.web; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.training.redbox.domain.Customer; -import com.training.redbox.domain.CustomerService; -import com.training.redbox.domain.ServiceException; - -@Controller -public class SignupController { - - @Autowired - private CustomerService service; - - @RequestMapping(value = "/signup", method = RequestMethod.GET) - public ModelAndView getEmptyForm() { - ModelAndView modelAndView = new ModelAndView("SignupForm"); - - Customer customer = new Customer(); - - modelAndView.addObject("customer", customer); - - return modelAndView; - } - - @RequestMapping(value = "/signup", method = RequestMethod.POST) - public String saveForm(@Valid Customer customer, BindingResult result) { - - if (result.hasErrors()) { - - System.out.println("has errors"); - - return "SignupForm"; - } else { - System.out.println(customer); - - try { - service.addCustomer(customer); - } catch (ServiceException e) { - e.printStackTrace(); - } - - return "Login"; - } - - } - -} diff --git a/redboxspringmvcjpa/pom.xml b/redboxspringmvcjpa/pom.xml deleted file mode 100644 index 631ed9f..0000000 --- a/redboxspringmvcjpa/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - 4.0.0 - com.training.venkat - redboxspringmvcjpa - war - 1.0 - redboxspringmvcjpa Maven Webapp - http://maven.apache.org - - - junit - junit - 4.11 - test - - - org.springframework - spring-context - 3.2.8.RELEASE - - - org.springframework - spring-web - 3.2.8.RELEASE - - - org.springframework - spring-webmvc - 3.2.8.RELEASE - - - org.springframework - spring-orm - 3.2.8.RELEASE - - - org.springframework - spring-jdbc - 3.2.8.RELEASE - - - com.oracle - ojdbc - 6.0 - - - org.hibernate - hibernate-validator - 4.3.1.Final - - - jstl - jstl - 1.2 - - - commons-dbcp - commons-dbcp - 1.4 - - - commons-pool - commons-pool - 1.6 - - - org.hibernate - hibernate-core - 4.3.5.Final - - - org.hibernate - hibernate-entitymanager - 4.3.5.Final - - - - - redboxspringmvcjpa - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - diff --git a/redboxspringmvcjpa/resources/redbox.properties b/redboxspringmvcjpa/resources/redbox.properties deleted file mode 100644 index 7c15bcc..0000000 --- a/redboxspringmvcjpa/resources/redbox.properties +++ /dev/null @@ -1,7 +0,0 @@ -NotEmpty.customer.firstName = First name is mandatory -NotEmpty.customer.lastName = Last name is mandatory -NotEmpty.customer.zipCode = Zip is mandatory -NotEmpty.customer.userName = Username is mandatory -NotEmpty.customer.password = Password is mandatory - -Range.customer.age = Age must be greater than or equal to 20 diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/BaseDAO.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/BaseDAO.java deleted file mode 100644 index 00c80ef..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/BaseDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - private static final String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE"; - private static final String username = "redbox"; - private static final String password = "redbox"; - - // getConnection method - - protected Connection getConnection() throws DAOException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - - } catch (ClassNotFoundException ex) { - throw new DAOException(ex, "Class Not Found"); - } catch (SQLException ex) { - throw new DAOException(ex); - } - - } - - /** - * Close all resources: - * - * Close connection Close statement Close resultSet - */ - protected void closeResources(Connection connection, Statement statement, - ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} - diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/Customer.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/Customer.java deleted file mode 100644 index f745ab5..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/Customer.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.training.redbox.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; -import javax.validation.constraints.Pattern; - -import org.hibernate.validator.constraints.NotEmpty; - -@Entity -@Table(name = "customers") -@SequenceGenerator(name = "customerIdSeq", sequenceName = "customer_seq", allocationSize = 1) -public class Customer { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "customerIdSeq") - @Column(name="customer_id") - private long customerId; - - @NotEmpty - @Pattern(regexp = "[a-z-A-Z]*", message = "First name must contain only characters") - @Column(name="first_name") - private String firstName; - - @NotEmpty - @Pattern(regexp = "[a-z-A-Z]*", message = "Last name must contain only characters") - @Column(name="last_name") - private String lastName; - - private String address; - private String city; - private String state; - - @NotEmpty - @Pattern(regexp = "[0-9]*", message = "Zip code must contain only numbers") - private String zipCode; - - @NotEmpty - private String userName; - - @NotEmpty - private String password; - - public Customer() { - - } - - public Customer(long customerId, String firstName, String lastName) { - this.customerId = customerId; - this.firstName = firstName; - this.lastName = lastName; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public long getCustomerId() { - return customerId; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerDAO.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerDAO.java deleted file mode 100644 index c56632c..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - void addCustomer(Customer customer)throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(String customerId) throws DAOException; - Customer findCustomerByCustomerId(String customerId)throws DAOException; - Customer findCustomerByUsername(String username)throws DAOException; - Customer findByUsernameAndPassword(String username, String password)throws DAOException; - -} - - diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerDAOJPAImpl.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerDAOJPAImpl.java deleted file mode 100644 index 030cf78..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerDAOJPAImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; - -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDAOJPAImpl implements CustomerDAO { - - @PersistenceContext - private EntityManager em; - - @Override - public List getAllCustomers() throws DAOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - em.persist(customer); - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - // TODO Auto-generated method stub - - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - // TODO Auto-generated method stub - - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Customer findCustomerByUsername(String username) throws DAOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Customer findByUsernameAndPassword(String username, String password) - throws DAOException { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerDaoJdbcImpl.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerDaoJdbcImpl.java deleted file mode 100644 index f2f2026..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerDaoJdbcImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDaoJdbcImpl implements CustomerDAO { - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getAllCustomers() throws DAOException { - return jdbcTemplate.query("select * from customers", - new CustomerRowMapper()); - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("insert into customers values(customer_seq.NEXTVAL,?,?,?,?,?,?,?,?)", - customer.getFirstName(), customer.getLastName(), - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword()); - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("update customers set address=?,city=?, state=?,zipcode=?,username=?,password=? where customer_id = ?", - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword(), - customer.getCustomerId()); - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - jdbcTemplate.update("delete from customers where customer_id=?", - customerId); - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where customer_id = ?", - new CustomerRowMapper(), customerId); - } - - @Override - public Customer findCustomerByUsername(String username) throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ?", - new CustomerRowMapper(), username); - } - - @Override - public Customer findByUsernameAndPassword(String username, String password) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ? and password=?", - new CustomerRowMapper(), username, password); - } - - private static final class CustomerRowMapper implements RowMapper { - @Override - public Customer mapRow(ResultSet resultSet, int rowNum) - throws SQLException { - - long customerId = resultSet.getLong("customer_id"); - String username = resultSet.getString("username"); - String password = resultSet.getString("password"); - String firstname = resultSet.getString("first_name"); - String lastname = resultSet.getString("last_name"); - String address = resultSet.getString("address"); - String city = resultSet.getString("city"); - String state = resultSet.getString("state"); - String zipcode = resultSet.getString("zipcode"); - - Customer customer = new Customer(customerId, firstname, lastname); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - customer.setUserName(username); - customer.setPassword(password); - - return customer; - } - - } -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerService.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerService.java deleted file mode 100644 index f65356d..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.redbox.domain; - -public interface CustomerService { - - void addCustomer(Customer customer) throws ServiceException; - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerServiceImpl.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerServiceImpl.java deleted file mode 100644 index 9c736a3..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/CustomerServiceImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.redbox.domain; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - - -@Service -public class CustomerServiceImpl implements CustomerService { - - @Autowired - @Qualifier("customerDAOJPAImpl") - private CustomerDAO dao; - - @Override - @Transactional - public void addCustomer(Customer customer) throws ServiceException { - try { - dao.addCustomer(customer); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/DAOException.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/DAOException.java deleted file mode 100644 index 26d4e28..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/DAOException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage, Exception ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/Movie.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/Movie.java deleted file mode 100644 index 888012f..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/Movie.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.training.redbox.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.SequenceGenerator; - -@Entity -@SequenceGenerator(name="movieIdGenerator", sequenceName="movie_id_seq", allocationSize=1) -@NamedQuery(name="selectAllMovies", query="from Movie") -public class Movie { - - @Id - @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="movieIdGenerator") - private long id; - private String type; - private String title; - - @Column(name = "rental_price") - private double rentalPrice; - - @Column(name = "image_location") - private String imageLocation; - - // constructor - public Movie() { - } - - public Movie(long id, String type, String title, double rentalPrice, - String imageLocation) { - super(); - this.id = id; - this.type = type; - this.title = title; - this.rentalPrice = rentalPrice; - this.imageLocation = imageLocation; - } - - // getters - - public long getId() { - return id; - } - - public String getType() { - return type; - } - - public String getTitle() { - return title; - } - - public double rentalPrice() { - return rentalPrice; - } - - public double getRentalPrice() { - return rentalPrice; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getImageLocation() { - return imageLocation; - } - - public void setId(long id) { - this.id = id; - } - - public void setType(String type) { - this.type = type; - } - - public void setRentalPrice(double rentalPrice) { - this.rentalPrice = rentalPrice; - } - - public void setImageLocation(String imageLocation) { - this.imageLocation = imageLocation; - } -} \ No newline at end of file diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieDAO.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieDAO.java deleted file mode 100644 index cb227e4..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -/** - * This is a Data Access object Interface. - * - * @author Satya - * - */ - -public interface MovieDAO { - - // Contract - List getAllMovies() throws DAOException; - - void addMovie(Movie movie) throws DAOException; - - void updateMovie(Movie movie) throws DAOException; - - void deleteMovie(long id) throws DAOException; - - Movie findByPrimaryKey(long id) throws DAOException; - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieDAOJDBCImpl.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieDAOJDBCImpl.java deleted file mode 100644 index 84034bd..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.training.redbox.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -public class MovieDAOJDBCImpl extends BaseDAO implements MovieDAO { - - @Override - public List getAllMovies() throws DAOException { - - // Create a list of movie. - List movies = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - - // Calling getConnection() - - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("Select * from Movie"); - - while (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - // Instantiate Movie object - Movie movie = new Movie(id, type, title, rentalPrice, - imageLocation); - - // add movie object to list - - movies.add(movie); - - } - - } catch (SQLException ex) { - - throw new DAOException(ex, - "Error while selecting a record from database"); - - } finally { - // calling colseResources method to close all resources. - closeResources(connection, statement, resultSet); - - } - - return movies; - } - - // adding record to movie table through DAO - @Override - public void addMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("insert into Movie values(?,?,?,?,?,?,?)"); - statement.setLong(1, id); - statement.setString(2, type); - statement.setString(3, title); - statement.setDouble(4, rentalPrice); - - int noOfRowsInserted = statement.executeUpdate(); - connection.commit(); - if (noOfRowsInserted != 1) { - throw new DAOException("Inserting a Movie failed"); - } - - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex, - "Error while adding a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } - - @Override - public void updateMovie(Movie movie) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - long id = movie.getId(); - String type = movie.getType(); - String title = movie.getTitle(); - double rentalPrice = movie.getRentalPrice(); - - statement = connection - .prepareStatement("update Movie set type =?, title=?,director= ?,genre=?,rental_Price =?,rating=? where id = ?"); - - statement.setString(1, type); - statement.setString(2, title); - statement.setDouble(5, rentalPrice); - - statement.setLong(7, id); - - int noOfRowsUpdated = statement.executeUpdate(); - - if (noOfRowsUpdated != 1) { - System.out.println("No Rows Updated"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while updating a record to the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public void deleteMovie(long id) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("delete from movie where id = ?"); - - statement.setLong(1, id); - - int noOfRowsDeleted = statement.executeUpdate(); - - if (noOfRowsDeleted != 1) { - throw new DAOException("Delete failed"); - } - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while deleting a record from the Database"); - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - } - - @Override - public Movie findByPrimaryKey(long movieId) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - Movie movie = null; - - try { - // Calling getConnecting method to get connection - connection = getConnection(); - - statement = connection - .prepareStatement("Select * from Movie where id = ?"); - - statement.setLong(1, movieId); - - resultSet = statement.executeQuery(); - - if (resultSet.next()) { - - long id = resultSet.getLong("ID"); - String type = resultSet.getString("TYPE"); - String title = resultSet.getString("TITLE"); - double rentalPrice = resultSet.getDouble("RENTAL_PRICE"); - String imageLocation = resultSet.getString("image_location"); - - return new Movie(id, type, title, rentalPrice, imageLocation); - - } - - throw new DAOException("Invalid id provided"); - - } catch (SQLException ex) { - // ex.printStackTrace(); - throw new DAOException(ex, - "Error while selecting a record from the Database"); - - } finally { - // calling close Resources method to close all resources - closeResources(connection, statement, resultSet); - } - - } -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieDAOJPAImpl.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieDAOJPAImpl.java deleted file mode 100644 index b8bf8cf..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieDAOJPAImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; - -import org.springframework.stereotype.Repository; - -@Repository -public class MovieDAOJPAImpl implements MovieDAO { - - @PersistenceContext - private EntityManager em; - - @Override - public List getAllMovies() throws DAOException { - - Query query = em.createNamedQuery("selectAllMovies"); - return (List) query.getResultList(); - } - - @Override - public void addMovie(Movie movie) throws DAOException { - em.persist(movie); - } - - @Override - public void updateMovie(Movie movie) throws DAOException { - em.merge(movie); - } - - @Override - public void deleteMovie(long id) throws DAOException { - Movie movie = em.find(Movie.class, id); - em.remove(movie); - } - - @Override - public Movie findByPrimaryKey(long id) throws DAOException { - return em.find(Movie.class, id); - } - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieService.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieService.java deleted file mode 100644 index aef9e17..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -public interface MovieService { - - List getAllMovies() throws ServiceException; - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieServiceImpl.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieServiceImpl.java deleted file mode 100644 index 08193c6..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/MovieServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.redbox.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class MovieServiceImpl implements MovieService { - - @Autowired - @Qualifier("movieDAOJPAImpl") - private MovieDAO dao; - - @Override - @Transactional - public List getAllMovies() throws ServiceException { - - try { - return dao.getAllMovies(); - } catch (DAOException e) { - e.printStackTrace(); - throw new ServiceException(e); - } - } - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/ServiceException.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/ServiceException.java deleted file mode 100644 index b239cda..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/domain/ServiceException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.redbox.domain; - -public class ServiceException extends Exception { - - public ServiceException(Exception ex) { - super(ex); - } - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/web/HomeController.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/web/HomeController.java deleted file mode 100644 index e4ea67e..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/web/HomeController.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.redbox.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class HomeController { - - @RequestMapping("/") - public String showHomePage() { - System.out.println("In home controller"); - return "redirect:/movies/list"; - } - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/web/LoginController.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/web/LoginController.java deleted file mode 100644 index cb5affe..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/web/LoginController.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.redbox.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class LoginController { - - @RequestMapping(value = "/login", method = RequestMethod.GET) - public String getEmptyForm() { - return "Login"; - } - - @RequestMapping(value = "/login", method = RequestMethod.POST) - public String login(@RequestParam("username") String username, - @RequestParam("password") String password) { - - System.out.println("username = " + username); - System.out.println("password = " + password); - - return "Login"; - } - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/web/MovieController.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/web/MovieController.java deleted file mode 100644 index d773aed..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/web/MovieController.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.redbox.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.training.redbox.domain.Movie; -import com.training.redbox.domain.MovieService; -import com.training.redbox.domain.ServiceException; - -@Controller -@RequestMapping("/movies") -public class MovieController { - - @Autowired - private MovieService service; - - @RequestMapping("/list") - public ModelAndView displayMovies() { - - ModelAndView mv = new ModelAndView("ShowMovies"); - - try { - List movies = service.getAllMovies(); - - mv.addObject("movies", movies); - - } catch (ServiceException e) { - e.printStackTrace(); - } - - return mv; - } - -} diff --git a/redboxspringmvcjpa/src/main/java/com/training/redbox/web/SignupController.java b/redboxspringmvcjpa/src/main/java/com/training/redbox/web/SignupController.java deleted file mode 100644 index f88ee6f..0000000 --- a/redboxspringmvcjpa/src/main/java/com/training/redbox/web/SignupController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.training.redbox.web; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.training.redbox.domain.Customer; -import com.training.redbox.domain.CustomerService; -import com.training.redbox.domain.ServiceException; - -@Controller -public class SignupController { - - @Autowired - private CustomerService service; - - @RequestMapping(value = "/signup", method = RequestMethod.GET) - public ModelAndView getEmptyForm() { - ModelAndView modelAndView = new ModelAndView("SignupForm"); - - Customer customer = new Customer(); - - modelAndView.addObject("customer", customer); - - return modelAndView; - } - - @RequestMapping(value = "/signup", method = RequestMethod.POST) - public String saveForm(@Valid Customer customer, BindingResult result) { - - if (result.hasErrors()) { - - System.out.println("has errors"); - - return "SignupForm"; - } else { - System.out.println(customer); - - try { - service.addCustomer(customer); - } catch (ServiceException e) { - e.printStackTrace(); - } - - return "Login"; - } - - } - -} diff --git a/redboxspringmvcjpa/src/main/resources/META-INF/persistence.xml b/redboxspringmvcjpa/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 9563c28..0000000 --- a/redboxspringmvcjpa/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - org.hibernate.ejb.HibernatePersistence - - com.training.redbox.domain.Movie - com.training.redbox.domain.Customer - - - - - - - - \ No newline at end of file diff --git a/redboxspringmvcjpa/src/main/resources/redbox.properties b/redboxspringmvcjpa/src/main/resources/redbox.properties deleted file mode 100644 index 7c15bcc..0000000 --- a/redboxspringmvcjpa/src/main/resources/redbox.properties +++ /dev/null @@ -1,7 +0,0 @@ -NotEmpty.customer.firstName = First name is mandatory -NotEmpty.customer.lastName = Last name is mandatory -NotEmpty.customer.zipCode = Zip is mandatory -NotEmpty.customer.userName = Username is mandatory -NotEmpty.customer.password = Password is mandatory - -Range.customer.age = Age must be greater than or equal to 20 diff --git a/redboxspringmvcjpa/src/main/webapp/META-INF/MANIFEST.MF b/redboxspringmvcjpa/src/main/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/redboxspringmvcjpa/src/main/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/redboxspringmvcjpa/src/main/webapp/WEB-INF/redbox-servlet.xml b/redboxspringmvcjpa/src/main/webapp/WEB-INF/redbox-servlet.xml deleted file mode 100644 index daeda1f..0000000 --- a/redboxspringmvcjpa/src/main/webapp/WEB-INF/redbox-servlet.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/Footer.jsp b/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/Footer.jsp deleted file mode 100644 index c8de0ed..0000000 --- a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/Footer.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -
      -
      -
      -
      -
      - - -
      © 2014, Redbox Automated Retail, LLC. All rights reserved.
      - - - \ No newline at end of file diff --git a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/Header.jsp b/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/Header.jsp deleted file mode 100644 index 18e6740..0000000 --- a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/Header.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%@page import="com.training.redbox.domain.Customer"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - Welcome - - - - - \ No newline at end of file diff --git a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/Login.jsp b/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/Login.jsp deleted file mode 100644 index d0bf7a2..0000000 --- a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/Login.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - -<%@include file="Header.jsp"%> - -
      - -
      - - - - -

      Please check username/password and try again.

      - - -
      - - - - - - - - - - - - - - - - - -
      Username:
      Password:
      - -
      - -<%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/ShowMovies.jsp b/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/ShowMovies.jsp deleted file mode 100644 index 06d779f..0000000 --- a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/ShowMovies.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%> -<%@page import="com.training.redbox.domain.Movie"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - -Movie List - - - - <% - - System.out.println("Inside JSP"); - - %> - - <%@include file="Header.jsp"%> - - - - - - - - - - - - -
      - - - - - - - - - - () - - -
      - - - - - - - - - - - - - - - - - - - - - - - -
      ${movie.title} -
      Add to
      - - - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/SignupForm.jsp b/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/SignupForm.jsp deleted file mode 100644 index def0b3d..0000000 --- a/redboxspringmvcjpa/src/main/webapp/WEB-INF/views/SignupForm.jsp +++ /dev/null @@ -1,98 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%> - - - - - - -Insert title here - - - - - - - - <%@include file="Header.jsp"%> - - - - - -
      -
      - - - -

      - Username exists, please try another. -

      - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      First Name:
      Last Name:
      Address:
      City:
      State:
      ZIP:
      Create a username:
      Create a password:
      - -
      - - - <%@include file="Footer.jsp"%> - - - \ No newline at end of file diff --git a/redboxspringmvcjpa/src/main/webapp/WEB-INF/web.xml b/redboxspringmvcjpa/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 0c465cf..0000000 --- a/redboxspringmvcjpa/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - Redbox with Spring MVC - - - index.jsp - - - - redbox - org.springframework.web.servlet.DispatcherServlet - - - - redbox - / - - - diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/FreeBirdsMovie.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/FreeBirdsMovie.jpg deleted file mode 100644 index c3fca34..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/FreeBirdsMovie.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/FrozenMovie.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/FrozenMovie.jpg deleted file mode 100644 index 811ebd3..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/FrozenMovie.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/LegoMovie.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/LegoMovie.jpg deleted file mode 100644 index 1b1a7be..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/LegoMovie.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/MandelaMovie.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/MandelaMovie.jpg deleted file mode 100644 index a172f73..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/MandelaMovie.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/ThorMovie.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/ThorMovie.jpg deleted file mode 100644 index 2ac8ee8..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/ThorMovie.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/cart.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/cart.jpg deleted file mode 100644 index a6c8488..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/cart.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/checkout.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/checkout.jpg deleted file mode 100644 index f8f2bda..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/checkout.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/login.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/login.jpg deleted file mode 100644 index 442c689..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/login.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/logo.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/logo.jpg deleted file mode 100644 index 476dae1..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/logo.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/signup.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/signup.jpg deleted file mode 100644 index 320d80a..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/signup.jpg and /dev/null differ diff --git a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/signup2.jpg b/redboxspringmvcjpa/src/main/webapp/staticcontent/images/signup2.jpg deleted file mode 100644 index 07d0696..0000000 Binary files a/redboxspringmvcjpa/src/main/webapp/staticcontent/images/signup2.jpg and /dev/null differ diff --git a/restfulws/.classpath b/restfulws/.classpath deleted file mode 100644 index 42119b1..0000000 --- a/restfulws/.classpath +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/restfulws/.project b/restfulws/.project deleted file mode 100644 index 075cba5..0000000 --- a/restfulws/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - restfulws - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/restfulws/.settings/.jsdtscope b/restfulws/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/restfulws/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/restfulws/.settings/org.eclipse.jdt.core.prefs b/restfulws/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 716728f..0000000 --- a/restfulws/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sun Mar 18 06:12:30 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/restfulws/.settings/org.eclipse.m2e.core.prefs b/restfulws/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 017e750..0000000 --- a/restfulws/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 18 06:08:05 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/restfulws/.settings/org.eclipse.wst.common.component b/restfulws/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 5b4171e..0000000 --- a/restfulws/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/restfulws/.settings/org.eclipse.wst.common.project.facet.core.xml b/restfulws/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 6b007af..0000000 --- a/restfulws/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/restfulws/.settings/org.eclipse.wst.jsdt.ui.superType.container b/restfulws/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/restfulws/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/restfulws/.settings/org.eclipse.wst.jsdt.ui.superType.name b/restfulws/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/restfulws/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/restfulws/pom.xml b/restfulws/pom.xml deleted file mode 100644 index 2533b0c..0000000 --- a/restfulws/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - 4.0.0 - com.training - restfulws - war - 1.0 - - 3.0.6.RELEASE - - - - - javax.servlet - jstl - 1.2 - - - org.springframework - spring-webmvc - 3.0.6.RELEASE - - - org.springframework - spring-jdbc - 3.0.6.RELEASE - - - org.springframework - spring-oxm - 3.0.6.RELEASE - - - mysql - mysql-connector-java - 5.1.17 - - - commons-dbcp - commons-dbcp - 1.4 - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.2.0.Final - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.5 - - - - javax.servlet - servlet-api - 2.5 - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - - - junit - junit - 4.7 - test - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-dependency-plugin - - - install - install - - sources - - - - - - - \ No newline at end of file diff --git a/restfulws/src/main/java/com/training/java/springmvc3/domain/DAOException.java b/restfulws/src/main/java/com/training/java/springmvc3/domain/DAOException.java deleted file mode 100644 index a92d425..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.springmvc3.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/restfulws/src/main/java/com/training/java/springmvc3/domain/Student.java b/restfulws/src/main/java/com/training/java/springmvc3/domain/Student.java deleted file mode 100644 index e95d3a1..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/domain/Student.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.training.java.springmvc3.domain; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class Student { - - - private int id; - - @NotNull - @Size(min=5, max=10, message="First name must be between 5 and 10 characters") - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentDAO.java b/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentDAO.java deleted file mode 100644 index 55688bf..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.util.List; - -interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentDAOJDBCImpl.java b/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index 0cf51d7..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -@Repository -class StudentDAOJDBCImpl implements StudentDAO { - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getAllStudents() { - return jdbcTemplate.query("select * from students", - new StudentRowMapper()); - } - - @Override - public void create(Student student) { - - jdbcTemplate.update("insert into students values(?, ?, ?, ?, ?, ?, ?)", - student.getFirstName(), student.getLastName(), - student.getPhoneNumber(), student.getEmail(), student.getAge(), - student.getCity(), student.getId()); - - } -} diff --git a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentList.java b/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentList.java deleted file mode 100644 index 0a80f7e..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentList.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.util.List; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "employees") -public class StudentList -{ - private List students; - - @XmlElement(name="student") - public List getStudents() - { - return students; - } - - public void setStudents(List students) - { - this.students = students; - } - -} diff --git a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentRowMapper.java b/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentRowMapper.java deleted file mode 100644 index 9ff52ef..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentRowMapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.springframework.jdbc.core.RowMapper; - -public class StudentRowMapper implements RowMapper { - - @Override - public Student mapRow(ResultSet resultSet, int rowNum) throws SQLException { - - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - return student; - } - -} diff --git a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentService.java b/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentService.java deleted file mode 100644 index 9936084..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.util.List; - -public interface StudentService { - - List getAllStudents(); - void addStudent(Student student); - -} diff --git a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentServiceImpl.java b/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentServiceImpl.java deleted file mode 100644 index 80681ad..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/domain/StudentServiceImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.util.Arrays; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class StudentServiceImpl implements StudentService { - - @Autowired - StudentDAO dao; - - @Override - public void addStudent(Student student) { - dao.create(student); - } - - @Override - public List getAllStudents() { - Student student1 = new Student(); - - student1.setFirstName("Venkat"); - student1.setLastName("Hari"); - - return Arrays.asList(student1); - - //return dao.getAllStudents(); - } - -} diff --git a/restfulws/src/main/java/com/training/java/springmvc3/web/SearchController.java b/restfulws/src/main/java/com/training/java/springmvc3/web/SearchController.java deleted file mode 100644 index 741fd3f..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/web/SearchController.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.java.springmvc3.web; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class SearchController { - - @RequestMapping("/searchhome") - public String search() { - return "Search"; - } - - @RequestMapping("/search") - public List search(@RequestParam String searchKey) { - - System.out.println("Search key = " + searchKey); - - List allProducts = getAllProducts(); - - List result = new ArrayList(); - - for(String product : allProducts) { - if(product.startsWith(searchKey)) { - result.add(product); - } - } - - return result; - } - - private List getAllProducts() { - return Arrays.asList("iPad", "iPhone", "Apple Watch", "Apple Watch pro", "Apple watch gold", "Apple watch new"); - } -} \ No newline at end of file diff --git a/restfulws/src/main/java/com/training/java/springmvc3/web/StudentController.java b/restfulws/src/main/java/com/training/java/springmvc3/web/StudentController.java deleted file mode 100644 index 3f20de5..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/web/StudentController.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.training.java.springmvc3.web; - -import java.util.List; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.training.java.springmvc3.domain.Student; -import com.training.java.springmvc3.domain.StudentList; -import com.training.java.springmvc3.domain.StudentService; - -@Controller -@RequestMapping("/students") -public class StudentController { - - @Autowired - StudentService service; - - @RequestMapping - public ModelAndView getAllStudents() - { - StudentList sl = new StudentList(); - sl.setStudents(service.getAllStudents()); - - return new ModelAndView("students", "students", sl); - } - - @RequestMapping(value="/{studentId}") - public ModelAndView getStudentById(@PathVariable int studentId) - { - Student s = new Student(); - s.setFirstName("Venkat"); - - return new ModelAndView("student", "student", s); - } - - @RequestMapping(value="/new", method=RequestMethod.GET) - public String createStudentForm(Model model) - { - model.addAttribute(new Student()); - - return "Add"; - } - - @RequestMapping(value="/new", method=RequestMethod.POST) - public String addStudent(@Valid Student student, BindingResult bindingResult) - { - System.out.println("Errors = " + bindingResult.hasErrors()); - List errors = bindingResult.getFieldErrors(); - for(FieldError error : errors) - { - System.out.println("error = " + error.getDefaultMessage()); - } - - if(bindingResult.hasErrors()) - { - return "Add"; - } - else - { - try { - service.addStudent(student); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return "Acknowledgement"; - } - } - -} diff --git a/restfulws/src/main/java/com/training/java/springmvc3/web/client/StudentControllerClient.java b/restfulws/src/main/java/com/training/java/springmvc3/web/client/StudentControllerClient.java deleted file mode 100644 index 336f379..0000000 --- a/restfulws/src/main/java/com/training/java/springmvc3/web/client/StudentControllerClient.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.springmvc3.web.client; - -import org.springframework.web.client.RestTemplate; - -public class StudentControllerClient -{ - public static void main(String[] args) - { - RestTemplate template = new RestTemplate(); - String response = template.getForObject("http://localhost:8080/restfulws/students", String.class); - System.out.println("Response = " + response); - } -} diff --git a/restfulws/src/main/resources/spring-config.xml b/restfulws/src/main/resources/spring-config.xml deleted file mode 100644 index 96e3e5f..0000000 --- a/restfulws/src/main/resources/spring-config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/restfulws/src/main/webapp/WEB-INF/restfulws-servlet.xml b/restfulws/src/main/webapp/WEB-INF/restfulws-servlet.xml deleted file mode 100644 index 783555e..0000000 --- a/restfulws/src/main/webapp/WEB-INF/restfulws-servlet.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - com.training.java.springmvc3.domain.StudentList - com.training.java.springmvc3.domain.Student - - - - - - - - - - - - - diff --git a/restfulws/src/main/webapp/WEB-INF/views/Acknowledgement.jsp b/restfulws/src/main/webapp/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 51e7b22..0000000 --- a/restfulws/src/main/webapp/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1 +0,0 @@ -

      Your details have been saved successfully in database.

      \ No newline at end of file diff --git a/restfulws/src/main/webapp/WEB-INF/views/Add.jsp b/restfulws/src/main/webapp/WEB-INF/views/Add.jsp deleted file mode 100644 index 14852ba..0000000 --- a/restfulws/src/main/webapp/WEB-INF/views/Add.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@page import="org.springframework.validation.BindingResult"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf" %> - - - -Insert title here - - - -

      Please fill the details below and press Submit...

      - - Id :
      -
      - First name :
      - Last name :
      - Age :
      - Phone :
      - Email :
      - City :
      - -
      - - -
      - - \ No newline at end of file diff --git a/restfulws/src/main/webapp/WEB-INF/views/Search.jsp b/restfulws/src/main/webapp/WEB-INF/views/Search.jsp deleted file mode 100644 index fb08592..0000000 --- a/restfulws/src/main/webapp/WEB-INF/views/Search.jsp +++ /dev/null @@ -1,25 +0,0 @@ - - - - -Insert title here - - - - - -
      -
      -
      - -
      -
      -
      - - - - - - - \ No newline at end of file diff --git a/restfulws/src/main/webapp/WEB-INF/views/students.jsp b/restfulws/src/main/webapp/WEB-INF/views/students.jsp deleted file mode 100644 index 307ce72..0000000 --- a/restfulws/src/main/webapp/WEB-INF/views/students.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - - - - - - - - - - -
      First NameLast NameCity
      ${current.firstName}${current.lastName}${current.city}
      diff --git a/restfulws/src/main/webapp/WEB-INF/web.xml b/restfulws/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 8d4cde4..0000000 --- a/restfulws/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - restfulws - org.springframework.web.servlet.DispatcherServlet - 1 - - - - restfulws - / - - \ No newline at end of file diff --git a/restfulws/src/main/webapp/index.jsp b/restfulws/src/main/webapp/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/restfulws/src/main/webapp/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ - - -

      Hello World!

      - - diff --git a/restfulws/src/main/webapp/js/main.js b/restfulws/src/main/webapp/js/main.js deleted file mode 100644 index ed742a9..0000000 --- a/restfulws/src/main/webapp/js/main.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * - */ - -$(document).ready(function() { - - $('#fruitsDiv').hide(); - - $('button').on('click', function() { - - $('h1#greeting').html("Changed Text"); - - }); - - $('button#removeGreeting').on('click', function() { - - $('h1#greeting').remove(); - - }); - - $('button#changeCSS').on('click', function() { - - console.log($('h1#greeting2').css('background-color')); - - $('h1#greeting2').css({ - 'color' : 'red', - 'background-color' : 'blue' - }); - }); - - $('button#changeAttributes').on('click', function() { - - $('h1#greeting').attr('align', 'center'); - - }); - - $('button#changeColorForFirst').on('click', function() { - - $('li:first').css('color', 'blue'); - - }); - - $('button#showFruits').on('click', function() { - - $('#fruitsDiv').slideDown(1000).delay(800).fadeIn(400); - - }); - - $('button#addLast').on('click', function() { - - var grapes = $('
    • Grapes
    • '); - - $('li:last').prev().prev().append(grapes); - - }); - - $('#search').keyup(function(){ - var searchKey = $('#search').val(); - - if(searchKey == '') { - $('#update').html(""); - return; - } - - var data = {searchKey: searchKey}; - - $.getJSON('http://localhost:9090/restfulws/search.json', data, function(data) { - - //var output = '
        '; - var output = ""; - var results = data.stringList; - $.each(results, function(index, value) { - output += "" + value + "
        "; - }); - - //output += "
      "; - $('#update').html(output); - }); - }); -}); - -function copyToBox(id) { - var selectedContent = $("#searchResult_" + id).text(); - $('#search').val(selectedContent); -} - - - diff --git a/restfulws/target/classes/com/training/java/springmvc3/domain/DAOException.class b/restfulws/target/classes/com/training/java/springmvc3/domain/DAOException.class deleted file mode 100644 index 2e41529..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/domain/DAOException.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/domain/Student.class b/restfulws/target/classes/com/training/java/springmvc3/domain/Student.class deleted file mode 100644 index c2762f2..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/domain/Student.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentDAO.class b/restfulws/target/classes/com/training/java/springmvc3/domain/StudentDAO.class deleted file mode 100644 index f396831..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentDAO.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentDAOJDBCImpl.class b/restfulws/target/classes/com/training/java/springmvc3/domain/StudentDAOJDBCImpl.class deleted file mode 100644 index 508f732..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentDAOJDBCImpl.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentList.class b/restfulws/target/classes/com/training/java/springmvc3/domain/StudentList.class deleted file mode 100644 index 836dec3..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentList.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentRowMapper.class b/restfulws/target/classes/com/training/java/springmvc3/domain/StudentRowMapper.class deleted file mode 100644 index f8c934a..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentRowMapper.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentService.class b/restfulws/target/classes/com/training/java/springmvc3/domain/StudentService.class deleted file mode 100644 index 0f15640..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentService.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentServiceImpl.class b/restfulws/target/classes/com/training/java/springmvc3/domain/StudentServiceImpl.class deleted file mode 100644 index 3943eba..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/domain/StudentServiceImpl.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/web/SearchController.class b/restfulws/target/classes/com/training/java/springmvc3/web/SearchController.class deleted file mode 100644 index 4bb3dc9..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/web/SearchController.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/web/StudentController.class b/restfulws/target/classes/com/training/java/springmvc3/web/StudentController.class deleted file mode 100644 index 632625b..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/web/StudentController.class and /dev/null differ diff --git a/restfulws/target/classes/com/training/java/springmvc3/web/client/StudentControllerClient.class b/restfulws/target/classes/com/training/java/springmvc3/web/client/StudentControllerClient.class deleted file mode 100644 index 9fb53f6..0000000 Binary files a/restfulws/target/classes/com/training/java/springmvc3/web/client/StudentControllerClient.class and /dev/null differ diff --git a/restfulws/target/classes/spring-config.xml b/restfulws/target/classes/spring-config.xml deleted file mode 100644 index 96e3e5f..0000000 --- a/restfulws/target/classes/spring-config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/restfulws/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF b/restfulws/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF deleted file mode 100644 index 4d6ca1d..0000000 --- a/restfulws/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: venkat -Build-Jdk: 1.8.0_40 -Created-By: Maven Integration for Eclipse - diff --git a/restfulws/target/m2e-wtp/web-resources/META-INF/maven/com.training/restfulws/pom.properties b/restfulws/target/m2e-wtp/web-resources/META-INF/maven/com.training/restfulws/pom.properties deleted file mode 100644 index ab3b485..0000000 --- a/restfulws/target/m2e-wtp/web-resources/META-INF/maven/com.training/restfulws/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Thu Jun 18 17:18:43 EDT 2015 -version=1.0 -groupId=com.training -m2e.projectName=restfulws -m2e.projectLocation=D\:\\javatraining\\projects\\restfulws -artifactId=restfulws diff --git a/restfulws/target/m2e-wtp/web-resources/META-INF/maven/com.training/restfulws/pom.xml b/restfulws/target/m2e-wtp/web-resources/META-INF/maven/com.training/restfulws/pom.xml deleted file mode 100644 index 2533b0c..0000000 --- a/restfulws/target/m2e-wtp/web-resources/META-INF/maven/com.training/restfulws/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - 4.0.0 - com.training - restfulws - war - 1.0 - - 3.0.6.RELEASE - - - - - javax.servlet - jstl - 1.2 - - - org.springframework - spring-webmvc - 3.0.6.RELEASE - - - org.springframework - spring-jdbc - 3.0.6.RELEASE - - - org.springframework - spring-oxm - 3.0.6.RELEASE - - - mysql - mysql-connector-java - 5.1.17 - - - commons-dbcp - commons-dbcp - 1.4 - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.2.0.Final - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.5 - - - - javax.servlet - servlet-api - 2.5 - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - - - junit - junit - 4.7 - test - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-dependency-plugin - - - install - install - - sources - - - - - - - \ No newline at end of file diff --git a/servlet1/.classpath b/servlet1/.classpath deleted file mode 100644 index 32a11af..0000000 --- a/servlet1/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/servlet1/.project b/servlet1/.project deleted file mode 100644 index db48b58..0000000 --- a/servlet1/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - servlet1 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/servlet1/.settings/.jsdtscope b/servlet1/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/servlet1/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/servlet1/.settings/org.eclipse.jdt.core.prefs b/servlet1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index a526463..0000000 --- a/servlet1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Mar 21 20:07:52 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/servlet1/.settings/org.eclipse.wst.common.component b/servlet1/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 2f3a8af..0000000 --- a/servlet1/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/servlet1/.settings/org.eclipse.wst.common.project.facet.core.xml b/servlet1/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 0873c6e..0000000 --- a/servlet1/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/servlet1/.settings/org.eclipse.wst.jsdt.ui.superType.container b/servlet1/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/servlet1/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/servlet1/.settings/org.eclipse.wst.jsdt.ui.superType.name b/servlet1/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/servlet1/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/servlet1/WebContent/META-INF/MANIFEST.MF b/servlet1/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/servlet1/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/servlet1/WebContent/WEB-INF/web.xml b/servlet1/WebContent/WEB-INF/web.xml deleted file mode 100644 index 32a989b..0000000 --- a/servlet1/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - servlet1 - - index.html - - - HelloWorld - com.training.java.servlet.HelloWorldServlet - - - HelloWorld - /hello - - - - RegisttrationServlet - RegisttrationServlet - - com.training.java.servlet.RegisttrationServlet - - - RegisttrationServlet - /signup - - \ No newline at end of file diff --git a/servlet1/WebContent/index.html b/servlet1/WebContent/index.html deleted file mode 100644 index 3dae08c..0000000 --- a/servlet1/WebContent/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - -Insert title here - - - -

      Welcome to my website, it is going to be fun!

      - - - \ No newline at end of file diff --git a/servlet1/WebContent/registration.html b/servlet1/WebContent/registration.html deleted file mode 100644 index c302a33..0000000 --- a/servlet1/WebContent/registration.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - -Insert title here - - - -
      - -First Name :
      -Last Name :
      -City :
      -State :
      -Zip :
      - -
      -
      - - - -
      - - - - - - \ No newline at end of file diff --git a/servlet1/src/com/training/java/servlet/HelloWorldServlet.java b/servlet1/src/com/training/java/servlet/HelloWorldServlet.java deleted file mode 100644 index 3986309..0000000 --- a/servlet1/src/com/training/java/servlet/HelloWorldServlet.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.servlet; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Date; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class HelloWorldServlet extends HttpServlet -{ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - PrintWriter out = response.getWriter(); - - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - - out.write(""); - out.write("

      Welcome " + lastName + " , " + firstName + "

      "); - out.write("

      Current time here on server is " + new Date() + "

      "); - out.write(""); - } - -} diff --git a/servlet1/src/com/training/java/servlet/RegisttrationServlet.java b/servlet1/src/com/training/java/servlet/RegisttrationServlet.java deleted file mode 100644 index af288b7..0000000 --- a/servlet1/src/com/training/java/servlet/RegisttrationServlet.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.training.java.servlet; - -import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet implementation class RegisttrationServlet - */ -public class RegisttrationServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public RegisttrationServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - System.out.println("doGet has been called"); - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String city = request.getParameter("city"); - String state = request.getParameter("state"); - String zipcode = request.getParameter("zipcode"); - - System.out.println("first name = " + firstName); - System.out.println("last name = " + lastName); - System.out.println("city = " + city); - System.out.println("state = " + state); - System.out.println("ZIP = " + zipcode); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - System.out.println("doPost has been called"); - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String city = request.getParameter("city"); - String state = request.getParameter("state"); - String zipcode = request.getParameter("zipcode"); - - System.out.println("first name = " + firstName); - System.out.println("last name = " + lastName); - System.out.println("city = " + city); - System.out.println("state = " + state); - System.out.println("ZIP = " + zipcode); - - } - -} diff --git a/servlet2/.classpath b/servlet2/.classpath deleted file mode 100644 index 07b2c3a..0000000 --- a/servlet2/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/servlet2/.project b/servlet2/.project deleted file mode 100644 index db0ae5d..0000000 --- a/servlet2/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - servlet2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/servlet2/.settings/.jsdtscope b/servlet2/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/servlet2/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/servlet2/.settings/org.eclipse.jdt.core.prefs b/servlet2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/servlet2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/servlet2/.settings/org.eclipse.wst.common.component b/servlet2/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 670dc65..0000000 --- a/servlet2/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/servlet2/.settings/org.eclipse.wst.common.project.facet.core.xml b/servlet2/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index b554271..0000000 --- a/servlet2/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/servlet2/.settings/org.eclipse.wst.jsdt.ui.superType.container b/servlet2/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/servlet2/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/servlet2/.settings/org.eclipse.wst.jsdt.ui.superType.name b/servlet2/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/servlet2/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/servlet2/WebContent/AddBook.html b/servlet2/WebContent/AddBook.html deleted file mode 100644 index 01d03a5..0000000 --- a/servlet2/WebContent/AddBook.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - -Insert title here - - - -
      - - Title :
      - Author :
      - Pages :
      - ISBN :
      - Pub Date :
      - Pub Id :
      - - - -
      - - - - \ No newline at end of file diff --git a/servlet2/WebContent/META-INF/MANIFEST.MF b/servlet2/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/servlet2/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/servlet2/WebContent/WEB-INF/lib/commons-lang-2.6.jar b/servlet2/WebContent/WEB-INF/lib/commons-lang-2.6.jar deleted file mode 100644 index 98467d3..0000000 Binary files a/servlet2/WebContent/WEB-INF/lib/commons-lang-2.6.jar and /dev/null differ diff --git a/servlet2/WebContent/WEB-INF/lib/ojdbc6.jar b/servlet2/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/servlet2/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/servlet2/WebContent/WEB-INF/web.xml b/servlet2/WebContent/WEB-INF/web.xml deleted file mode 100644 index 56be669..0000000 --- a/servlet2/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - servlet2 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ListBooks - ListBooks - com.training.java.servlet.bookstore.web.ListBooksServlet - - - ListBooks - /list - - - - AddBookServlet - AddBookServlet - com.training.java.servlet.bookstore.web.AddBookServlet - - - AddBookServlet - /add - - - - DisplayBooksServlet - DisplayBooksServlet - com.training.java.servlet.bookstore.web.DisplayBooksServlet - - - DisplayBooksServlet - /display - - \ No newline at end of file diff --git a/servlet2/WebContent/index.html b/servlet2/WebContent/index.html deleted file mode 100644 index 6d1692a..0000000 --- a/servlet2/WebContent/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - -Insert title here - - - -

      Welcome to our bookstore!!

      - - If you want to add a book, please click here
      - If you want to list all the books, please click here
      - - - \ No newline at end of file diff --git a/servlet2/WebContent/test.html b/servlet2/WebContent/test.html deleted file mode 100644 index 3f61294..0000000 --- a/servlet2/WebContent/test.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - -Insert title here - - -
      - - \ No newline at end of file diff --git a/servlet2/src/com/training/java/jdbc/dao/two/Book.java b/servlet2/src/com/training/java/jdbc/dao/two/Book.java deleted file mode 100644 index 3f3020c..0000000 --- a/servlet2/src/com/training/java/jdbc/dao/two/Book.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.training.java.jdbc.dao.two; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } - - public int getPages() { - return pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - -} diff --git a/servlet2/src/com/training/java/jdbc/dao/two/BookDAO.java b/servlet2/src/com/training/java/jdbc/dao/two/BookDAO.java deleted file mode 100644 index 970b7db..0000000 --- a/servlet2/src/com/training/java/jdbc/dao/two/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.jdbc.dao.two; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/servlet2/src/com/training/java/jdbc/dao/two/BookDAOJDBCImpl.java b/servlet2/src/com/training/java/jdbc/dao/two/BookDAOJDBCImpl.java deleted file mode 100644 index 8ee7b60..0000000 --- a/servlet2/src/com/training/java/jdbc/dao/two/BookDAOJDBCImpl.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.training.java.jdbc.dao.two; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class BookDAOJDBCImpl implements BookDAO { - - private String jdbcURL; - private String username; - private String password; - - public BookDAOJDBCImpl(String jdbcURL, String username, String password) - { - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(book_id_seq.nextval, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - statement.setInt(6, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } - - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/servlet2/src/com/training/java/jdbc/dao/two/DAOException.java b/servlet2/src/com/training/java/jdbc/dao/two/DAOException.java deleted file mode 100644 index 7e2de2e..0000000 --- a/servlet2/src/com/training/java/jdbc/dao/two/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.jdbc.dao.two; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/servlet2/src/com/training/java/jdbc/dao/two/package-info.java b/servlet2/src/com/training/java/jdbc/dao/two/package-info.java deleted file mode 100644 index ee89873..0000000 --- a/servlet2/src/com/training/java/jdbc/dao/two/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.jdbc.dao.two; \ No newline at end of file diff --git a/servlet2/src/com/training/java/servlet/bookstore/web/AddBookServlet.java b/servlet2/src/com/training/java/servlet/bookstore/web/AddBookServlet.java deleted file mode 100644 index 83b73ca..0000000 --- a/servlet2/src/com/training/java/servlet/bookstore/web/AddBookServlet.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java.servlet.bookstore.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.jdbc.dao.two.Book; -import com.training.java.jdbc.dao.two.BookDAO; -import com.training.java.jdbc.dao.two.BookDAOJDBCImpl; -import com.training.java.jdbc.dao.two.DAOException; - -/** - * Servlet implementation class AddBookServlet - */ -public class AddBookServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public AddBookServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String isbn = request.getParameter("isbn"); - String pubDate = request.getParameter("pubDate"); - - String title = request.getParameter("title"); - String author = request.getParameter("author"); - String pages = request.getParameter("pages"); - - DateFormat format = new SimpleDateFormat("mmDDyyyy"); - Date publishedDate = null; - try { - publishedDate = format.parse(pubDate); - } catch (ParseException ex) { - ex.printStackTrace(); - } - - Book book = new Book(0, title, author, isbn, Integer.parseInt(pages), publishedDate); - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - try { - dao.addBook(book); - } catch (DAOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - PrintWriter out = response.getWriter(); - out.println("

      Your details have been successfuly saved!!!

      "); - } - -} diff --git a/servlet2/src/com/training/java/servlet/bookstore/web/ListBooksServlet.java b/servlet2/src/com/training/java/servlet/bookstore/web/ListBooksServlet.java deleted file mode 100644 index 4a6c32d..0000000 --- a/servlet2/src/com/training/java/servlet/bookstore/web/ListBooksServlet.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.training.java.servlet.bookstore.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Collections; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.jdbc.dao.two.Book; -import com.training.java.jdbc.dao.two.BookDAO; -import com.training.java.jdbc.dao.two.BookDAOJDBCImpl; -import com.training.java.jdbc.dao.two.DAOException; - -/** - * Servlet implementation class ListMoviesServlet - */ -public class ListBooksServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListBooksServlet() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - BookDAO dao = new BookDAOJDBCImpl("jdbc:oracle:thin:@localhost:1521:XE", "bookstore", "password"); - - List books = Collections.emptyList(); - try { - books = dao.getAllBooks(); - } catch (DAOException e) { - e.printStackTrace(); - } - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - - for(Book aBook : books) - { - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - } - - out.println("
      TitleAuthorPagesPub date.
      " + aBook.getTitle() + "" + aBook.getAuthor() + "" + aBook.getPages() + "" + aBook.getPublisherDate() + "
      "); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - System.out.println("doPost called on ListBook"); - - - } - -} diff --git a/servlet2/src/com/training/java/servlet/bookstore/web/package-info.java b/servlet2/src/com/training/java/servlet/bookstore/web/package-info.java deleted file mode 100644 index 0cc03fa..0000000 --- a/servlet2/src/com/training/java/servlet/bookstore/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.bookstore.web; \ No newline at end of file diff --git a/servlet2_2015/.classpath b/servlet2_2015/.classpath deleted file mode 100644 index 26b8264..0000000 --- a/servlet2_2015/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/servlet2_2015/.project b/servlet2_2015/.project deleted file mode 100644 index ef9256b..0000000 --- a/servlet2_2015/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - servlet2_2015 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/servlet2_2015/.settings/.jsdtscope b/servlet2_2015/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/servlet2_2015/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/servlet2_2015/.settings/org.eclipse.jdt.core.prefs b/servlet2_2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 295926d..0000000 --- a/servlet2_2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/servlet2_2015/.settings/org.eclipse.wst.common.component b/servlet2_2015/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 8677058..0000000 --- a/servlet2_2015/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/servlet2_2015/.settings/org.eclipse.wst.common.project.facet.core.xml b/servlet2_2015/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 1fd6a47..0000000 --- a/servlet2_2015/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/servlet2_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container b/servlet2_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/servlet2_2015/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/servlet2_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name b/servlet2_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/servlet2_2015/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/servlet2_2015/WebContent/AddCustomer.html b/servlet2_2015/WebContent/AddCustomer.html deleted file mode 100644 index ca81033..0000000 --- a/servlet2_2015/WebContent/AddCustomer.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -Insert title here - - - -
      - - First Name :
      - Last Name :
      - Address :
      - City :
      - State :
      - Zip :
      - - - -
      - - - - - \ No newline at end of file diff --git a/servlet2_2015/WebContent/AddCustomer2.html b/servlet2_2015/WebContent/AddCustomer2.html deleted file mode 100644 index 71b3d7f..0000000 --- a/servlet2_2015/WebContent/AddCustomer2.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -Insert title here - - - -
      - - First Name :
      - Last Name :
      - Address :
      - City :
      - State :
      - Zip :
      - - - -
      - - - - - \ No newline at end of file diff --git a/servlet2_2015/WebContent/META-INF/MANIFEST.MF b/servlet2_2015/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/servlet2_2015/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/servlet2_2015/WebContent/WEB-INF/lib/ojdbc6.jar b/servlet2_2015/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 767eba7..0000000 Binary files a/servlet2_2015/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/servlet2_2015/WebContent/WEB-INF/web.xml b/servlet2_2015/WebContent/WEB-INF/web.xml deleted file mode 100644 index 18a0936..0000000 --- a/servlet2_2015/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - servlet2_2015 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ListCustomersServlet - ListCustomersServlet - com.training.amazon.servlets.ListCustomersServlet - - - ListCustomersServlet - /list - - - AddCustomerServlet - com.training.amazon.servlets.AddCustomerServlet - - - AddCustomerServlet - /add - - - - DeleteCustomerServlet - DeleteCustomerServlet - com.training.amazon.servlets.DeleteCustomerServlet - - - DeleteCustomerServlet - /delete - - \ No newline at end of file diff --git a/servlet2_2015/WebContent/add_customer.jsp b/servlet2_2015/WebContent/add_customer.jsp deleted file mode 100644 index 369be16..0000000 --- a/servlet2_2015/WebContent/add_customer.jsp +++ /dev/null @@ -1,29 +0,0 @@ -<%@page import="com.training.amazon.dao.Customer"%> -<%@page import="com.training.amazon.dao.CustomerDAOJDBCImpl"%> -<%@page import="com.training.amazon.dao.CustomerDAO"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - <% - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String address = request.getParameter("address"); - String city = request.getParameter("city"); - String state = request.getParameter("state"); - String zip = request.getParameter("zip"); - - CustomerDAO dao = new CustomerDAOJDBCImpl(); - - Customer customer = new Customer(0, firstName, lastName, address, city, state, zip); - dao.createCustomer(customer); - %> - - - \ No newline at end of file diff --git a/servlet2_2015/WebContent/hello.jsp b/servlet2_2015/WebContent/hello.jsp deleted file mode 100644 index 43dcd85..0000000 --- a/servlet2_2015/WebContent/hello.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@page import="java.util.Date"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

      Hello, how are you doing?

      -

      Today's date is <%=new Date()%>

      - -

      If you want to add a customer, please click here

      - - \ No newline at end of file diff --git a/servlet2_2015/WebContent/index.html b/servlet2_2015/WebContent/index.html deleted file mode 100644 index bac62d5..0000000 --- a/servlet2_2015/WebContent/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - -Insert title here - - - -

      Welcome to amazon, the earth's biggest store

      - -

      If you want to look at our customrers, please click here

      - -

      If you want to add a new customer, please click here

      - - - - \ No newline at end of file diff --git a/servlet2_2015/WebContent/list_customers.jsp b/servlet2_2015/WebContent/list_customers.jsp deleted file mode 100644 index 996c6ff..0000000 --- a/servlet2_2015/WebContent/list_customers.jsp +++ /dev/null @@ -1,58 +0,0 @@ -<%@page import="com.training.amazon.dao.Customer"%> -<%@page import="java.util.List"%> -<%@page import="com.training.amazon.dao.CustomerDAOJDBCImpl"%> -<%@page import="com.training.amazon.dao.CustomerDAO"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - <% - CustomerDAO dao = new CustomerDAOJDBCImpl(); - List customers = dao.getAllCustomers(); - - for(Customer customer : customers) - { - %> - - - - - - - - - - - <% - } - %> -
      First NameLast NameAddressCityStateZip
      <%=customer.getFirstName()%><%=customer.getLastName()%><%=customer.getAddress()%><%=customer.getCity()%><%=customer.getState()%><%=customer.getZipCode()%>
      - - \ No newline at end of file diff --git a/servlet2_2015/src/com/training/amazon/dao/BaseDAO.java b/servlet2_2015/src/com/training/amazon/dao/BaseDAO.java deleted file mode 100644 index e833573..0000000 --- a/servlet2_2015/src/com/training/amazon/dao/BaseDAO.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.training.amazon.dao; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class BaseDAO { - - protected Connection getConnection() throws SQLException{ - - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "oms", "oms"); - } - - protected void closeResources(ResultSet rs, Statement statement, - Connection con) { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - - if (con != null) { - con.close(); - } - } catch (SQLException ex) { - //Nothing to be done, ignore it. - } - } - -} diff --git a/servlet2_2015/src/com/training/amazon/dao/Customer.java b/servlet2_2015/src/com/training/amazon/dao/Customer.java deleted file mode 100644 index d4aa2e3..0000000 --- a/servlet2_2015/src/com/training/amazon/dao/Customer.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.training.amazon.dao; - -public class Customer { - - private int id; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - - public Customer(int id, String firstName, String lastName, String address, - String city, String state, String zipCode) { - super(); - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.city = city; - this.state = state; - this.zipCode = zipCode; - } - - public int getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getAddress() { - return address; - } - - public String getCity() { - return city; - } - - public String getState() { - return state; - } - - public String getZipCode() { - return zipCode; - } -} diff --git a/servlet2_2015/src/com/training/amazon/dao/CustomerDAO.java b/servlet2_2015/src/com/training/amazon/dao/CustomerDAO.java deleted file mode 100644 index d496887..0000000 --- a/servlet2_2015/src/com/training/amazon/dao/CustomerDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.amazon.dao; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - Customer findByPrimaryKey(int id) throws DAOException; - void createCustomer(Customer customer) throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(int customerId) throws DAOException; - -} diff --git a/servlet2_2015/src/com/training/amazon/dao/CustomerDAOJDBCImpl.java b/servlet2_2015/src/com/training/amazon/dao/CustomerDAOJDBCImpl.java deleted file mode 100644 index 4721d61..0000000 --- a/servlet2_2015/src/com/training/amazon/dao/CustomerDAOJDBCImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.training.amazon.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -public class CustomerDAOJDBCImpl extends BaseDAO implements CustomerDAO { - - @Override - public List getAllCustomers() throws DAOException { - - Connection con = null; - Statement statement = null; - ResultSet rs = null; - - List customers = new ArrayList(); - - try - { - con = getConnection(); - statement = con.createStatement(); - - rs = statement.executeQuery("select * from customer"); - - while(rs.next()) - { - int custId = rs.getInt("customer_id"); - String firstName = rs.getString("first_name"); - String lastName = rs.getString("last_name"); - String address = rs.getString("address"); - String city = rs.getString("city"); - String state = rs.getString("state"); - String zip = rs.getString("zip"); - - Customer customer = new Customer(custId, firstName, lastName, address, city, state, zip); - customers.add(customer); - } - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while selecting", ex); - } finally { - closeResources(rs, statement, con); - } - - return customers; - } - - @Override - public void createCustomer(Customer customer) throws DAOException { - - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "insert into customer values (customer_id_seq.nextval,?,?,?,?,?,?)"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - - System.out.println(sql.toString()); - - int rowsInserted = statement.executeUpdate(); - - System.out.println("rowsInserted = " + rowsInserted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while creating the customer", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - - String sql = "update customer " + - "set first_name = ?, " + - " last_name = ?, " + - " address = ?, " + - " city = ?, "+ - " state = ?, " + - " zip = ? " + - "where customer_id = ?"; - - statement = con.prepareStatement(sql); - - statement.setString(1, customer.getFirstName()); - statement.setString(2, customer.getLastName()); - statement.setString(3, customer.getAddress()); - statement.setString(4, customer.getCity()); - statement.setString(5, customer.getState()); - statement.setString(6, customer.getZipCode()); - statement.setInt(7, customer.getId()); - - int rowsUpdated = statement.executeUpdate(); - - System.out.println("rowsUpdated = " + rowsUpdated); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while updating", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public void deleteCustomer(int customerId) throws DAOException { - Connection con = null; - PreparedStatement statement = null; - - try - { - con = getConnection(); - statement = con.prepareStatement("delete from customer where customer_id = ?"); - - statement.setInt(1, customerId); - - int rowsDeleted = statement.executeUpdate(); - - System.out.println("rowsDeleted = " + rowsDeleted); - } catch(SQLException ex) { - ex.printStackTrace(); - throw new DAOException("Error occured while deleting", ex); - } finally { - closeResources(null, statement, con); - } - } - - @Override - public Customer findByPrimaryKey(int id) throws DAOException { - // TODO Auto-generated method stub - return null; - } -} diff --git a/servlet2_2015/src/com/training/amazon/dao/DAOException.java b/servlet2_2015/src/com/training/amazon/dao/DAOException.java deleted file mode 100644 index 4aa69db..0000000 --- a/servlet2_2015/src/com/training/amazon/dao/DAOException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.amazon.dao; - -public class DAOException extends Exception { - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/servlet2_2015/src/com/training/amazon/servlets/AddCustomerServlet.java b/servlet2_2015/src/com/training/amazon/servlets/AddCustomerServlet.java deleted file mode 100644 index 75e4c3d..0000000 --- a/servlet2_2015/src/com/training/amazon/servlets/AddCustomerServlet.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.training.amazon.servlets; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.amazon.dao.Customer; -import com.training.amazon.dao.CustomerDAO; -import com.training.amazon.dao.CustomerDAOJDBCImpl; -import com.training.amazon.dao.DAOException; - -public class AddCustomerServlet extends HttpServlet { - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - System.out.println("I am in doGet"); - } - - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - System.out.println("I am in doPost"); - - String firstName = request.getParameter("firstName"); - String lastName = request.getParameter("lastName"); - String address = request.getParameter("address"); - String city = request.getParameter("city"); - String state = request.getParameter("state"); - String zip = request.getParameter("zip"); - - CustomerDAO dao = new CustomerDAOJDBCImpl(); - - Customer customer = new Customer(0, firstName, lastName, address, city, state, zip); - - try { - dao.createCustomer(customer); - } catch (DAOException e) { - e.printStackTrace(); - } - - System.out.println("first name = " + firstName); - System.out.println("last name = " + lastName); - System.out.println("city = " + city); - System.out.println("zip = " + zip); - } - -} diff --git a/servlet2_2015/src/com/training/amazon/servlets/DeleteCustomerServlet.java b/servlet2_2015/src/com/training/amazon/servlets/DeleteCustomerServlet.java deleted file mode 100644 index cf0716c..0000000 --- a/servlet2_2015/src/com/training/amazon/servlets/DeleteCustomerServlet.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.amazon.servlets; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.amazon.dao.CustomerDAO; -import com.training.amazon.dao.CustomerDAOJDBCImpl; -import com.training.amazon.dao.DAOException; - -/** - * Servlet implementation class DeleteCustomerServlet - */ -public class DeleteCustomerServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - String idStr = request.getParameter("id"); - int id = Integer.parseInt(idStr); - - CustomerDAO dao = new CustomerDAOJDBCImpl(); - try { - dao.deleteCustomer(id); - } catch (DAOException e) { - e.printStackTrace(); - } - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - // TODO Auto-generated method stub - } - -} diff --git a/servlet2_2015/src/com/training/amazon/servlets/ListCustomersServlet.java b/servlet2_2015/src/com/training/amazon/servlets/ListCustomersServlet.java deleted file mode 100644 index a182c8a..0000000 --- a/servlet2_2015/src/com/training/amazon/servlets/ListCustomersServlet.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.training.amazon.servlets; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.amazon.dao.Customer; -import com.training.amazon.dao.CustomerDAO; -import com.training.amazon.dao.CustomerDAOJDBCImpl; -import com.training.amazon.dao.DAOException; - -/** - * Servlet implementation class ListCustomersServlet - */ -public class ListCustomersServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - CustomerDAO dao = new CustomerDAOJDBCImpl(); - - try { - List customers = dao.getAllCustomers(); - - PrintWriter out = response.getWriter(); - - out.write(""); - - out.write(""); - out.write(""); - - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - - for(Customer customer : customers) - { - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - } - - out.write("
      First NameLast NameAddressCityStateZipDelete
      " + customer.getFirstName() + "" + customer.getLastName() + "" + customer.getAddress() + "" + customer.getCity() + "" + customer.getState() + "" + customer.getZipCode() + "Click"); - out.write("
      "); - out.write(""); - } catch (DAOException e) { - e.printStackTrace(); - } - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - } - -} diff --git a/servlet3/.classpath b/servlet3/.classpath deleted file mode 100644 index 07b2c3a..0000000 --- a/servlet3/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/servlet3/.project b/servlet3/.project deleted file mode 100644 index 3fbd975..0000000 --- a/servlet3/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - servlet3 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/servlet3/.settings/.jsdtscope b/servlet3/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/servlet3/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/servlet3/.settings/org.eclipse.jdt.core.prefs b/servlet3/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/servlet3/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/servlet3/.settings/org.eclipse.wst.common.component b/servlet3/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 33e2405..0000000 --- a/servlet3/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/servlet3/.settings/org.eclipse.wst.common.project.facet.core.xml b/servlet3/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index b554271..0000000 --- a/servlet3/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/servlet3/.settings/org.eclipse.wst.jsdt.ui.superType.container b/servlet3/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/servlet3/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/servlet3/.settings/org.eclipse.wst.jsdt.ui.superType.name b/servlet3/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/servlet3/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/servlet3/WebContent/AddBook.html b/servlet3/WebContent/AddBook.html deleted file mode 100644 index 59524e2..0000000 --- a/servlet3/WebContent/AddBook.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - -Insert title here - - - -
      - - Title :
      - Author :
      - Pages :
      - ISBN :
      - Pub Date :
      - Pub Id :
      - - - -
      - - - - \ No newline at end of file diff --git a/servlet3/WebContent/META-INF/MANIFEST.MF b/servlet3/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/servlet3/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/servlet3/WebContent/WEB-INF/lib/commons-lang-2.6.jar b/servlet3/WebContent/WEB-INF/lib/commons-lang-2.6.jar deleted file mode 100644 index 98467d3..0000000 Binary files a/servlet3/WebContent/WEB-INF/lib/commons-lang-2.6.jar and /dev/null differ diff --git a/servlet3/WebContent/WEB-INF/lib/ojdbc6.jar b/servlet3/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/servlet3/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/servlet3/WebContent/WEB-INF/web.xml b/servlet3/WebContent/WEB-INF/web.xml deleted file mode 100644 index 5a5541c..0000000 --- a/servlet3/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - servlet2 - - index.html - - - - ListBooks - ListBooks - com.training.java.servlet.servlet3.web.ListBooksServlet - - maxBooksDisplayed - 100 - - - - ListBooks - /list - - - - AddBookServlet - AddBookServlet - com.training.java.servlet.servlet3.web.AddBookServlet - - - AddBookServlet - /add - - - jdbcURL - jdbc:oracle:thin:@localhost:1521:XE - - - dbUsername - bookstore - - - dbPassword - password - - - - DisplayBooksServlet - DisplayBooksServlet - com.training.java.servlet.servlet3.web.DisplayBooksServlet - - - DisplayBooksServlet - /display - - \ No newline at end of file diff --git a/servlet3/WebContent/index.html b/servlet3/WebContent/index.html deleted file mode 100644 index 426afe5..0000000 --- a/servlet3/WebContent/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - -Insert title here - - - -

      Welcome to our bookstore!!

      - - If you want to add a book, please click here
      - If you want to list all the books, please click here
      - - - \ No newline at end of file diff --git a/servlet3/src/com/training/java/servlet/servlet3/domain/Book.java b/servlet3/src/com/training/java/servlet/servlet3/domain/Book.java deleted file mode 100644 index 4f12023..0000000 --- a/servlet3/src/com/training/java/servlet/servlet3/domain/Book.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.java.servlet.servlet3.domain; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - public void init() - { - - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } - - public int getPages() { - return pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - -} diff --git a/servlet3/src/com/training/java/servlet/servlet3/domain/BookDAO.java b/servlet3/src/com/training/java/servlet/servlet3/domain/BookDAO.java deleted file mode 100644 index 0522aa7..0000000 --- a/servlet3/src/com/training/java/servlet/servlet3/domain/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.servlet.servlet3.domain; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/servlet3/src/com/training/java/servlet/servlet3/domain/BookDAOJDBCImpl.java b/servlet3/src/com/training/java/servlet/servlet3/domain/BookDAOJDBCImpl.java deleted file mode 100644 index 938670c..0000000 --- a/servlet3/src/com/training/java/servlet/servlet3/domain/BookDAOJDBCImpl.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.training.java.servlet.servlet3.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class BookDAOJDBCImpl implements BookDAO { - - private String jdbcURL; - private String username; - private String password; - - public BookDAOJDBCImpl(String jdbcURL, String username, String password) - { - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(book_id_seq.nextval, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - statement.setInt(6, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } - - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/servlet3/src/com/training/java/servlet/servlet3/domain/DAOException.java b/servlet3/src/com/training/java/servlet/servlet3/domain/DAOException.java deleted file mode 100644 index 483b320..0000000 --- a/servlet3/src/com/training/java/servlet/servlet3/domain/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.servlet.servlet3.domain; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/servlet3/src/com/training/java/servlet/servlet3/domain/package-info.java b/servlet3/src/com/training/java/servlet/servlet3/domain/package-info.java deleted file mode 100644 index 67d4b87..0000000 --- a/servlet3/src/com/training/java/servlet/servlet3/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.servlet3.domain; \ No newline at end of file diff --git a/servlet3/src/com/training/java/servlet/servlet3/web/AddBookServlet.java b/servlet3/src/com/training/java/servlet/servlet3/web/AddBookServlet.java deleted file mode 100644 index 5de8467..0000000 --- a/servlet3/src/com/training/java/servlet/servlet3/web/AddBookServlet.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.training.java.servlet.servlet3.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.text.ParseException; -import java.util.Date; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.lang.time.DateUtils; - -import com.training.java.servlet.servlet3.domain.Book; -import com.training.java.servlet.servlet3.domain.BookDAO; -import com.training.java.servlet.servlet3.domain.BookDAOJDBCImpl; -import com.training.java.servlet.servlet3.domain.DAOException; - -/** - * Servlet implementation class AddBookServlet - */ -public class AddBookServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public AddBookServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String isbn = request.getParameter("isbn"); - String publishedDateStr = request.getParameter("pubDate"); - - String title = request.getParameter("title"); - String author = request.getParameter("author"); - String pages = request.getParameter("pages"); - - String[] formats = {"mmDDyyyy"}; - - Date publishedDate = null; - try { - publishedDate = DateUtils.parseDate(publishedDateStr, formats); - } catch (ParseException e1) { - e1.printStackTrace(); - } - - Book book = new Book(0, title, author, isbn, Integer.parseInt(pages), publishedDate); - - String jdbcURL = getServletContext().getInitParameter("jdbcURL"); - String dbUsername = getServletContext().getInitParameter("dbUsername"); - String dbPassword = getServletContext().getInitParameter("dbPassword"); - - BookDAO dao = new BookDAOJDBCImpl(jdbcURL, dbUsername, dbPassword); - try { - dao.addBook(book); - } catch (DAOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - response.sendRedirect("/servlet3/list"); - - } - -} diff --git a/servlet3/src/com/training/java/servlet/servlet3/web/DisplayBooksServlet.java b/servlet3/src/com/training/java/servlet/servlet3/web/DisplayBooksServlet.java deleted file mode 100644 index d28d1e1..0000000 --- a/servlet3/src/com/training/java/servlet/servlet3/web/DisplayBooksServlet.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.training.java.servlet.servlet3.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.servlet3.domain.Book; - -/** - * Servlet implementation class DisplayBooksServlet - */ -public class DisplayBooksServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public DisplayBooksServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - List books = (List) request.getAttribute("BOOKS_TO_DISPLAY"); - int maxBooksDisplayed = (Integer) request.getAttribute("MAX_BOOKS_DISPLAYED"); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - - if(maxBooksDisplayed > books.size()) - { - maxBooksDisplayed = books.size(); - } - - - for(int i=0; i"); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - } - - out.println("
      TitleAuthorPagesPub date.
      " + aBook.getTitle() + "" + aBook.getAuthor() + "" + aBook.getPages() + "" + aBook.getPublisherDate() + "
      "); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - } - -} diff --git a/servlet3/src/com/training/java/servlet/servlet3/web/ListBooksServlet.java b/servlet3/src/com/training/java/servlet/servlet3/web/ListBooksServlet.java deleted file mode 100644 index 9972b4c..0000000 --- a/servlet3/src/com/training/java/servlet/servlet3/web/ListBooksServlet.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.training.java.servlet.servlet3.web; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.servlet3.domain.Book; -import com.training.java.servlet.servlet3.domain.BookDAO; -import com.training.java.servlet.servlet3.domain.BookDAOJDBCImpl; -import com.training.java.servlet.servlet3.domain.DAOException; - -/** - * Servlet implementation class ListMoviesServlet - */ -public class ListBooksServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListBooksServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String maxBooksDisplayedStr = getServletConfig().getInitParameter("maxBooksDisplayed"); - int maxBooksDisplayed = Integer.parseInt(maxBooksDisplayedStr); - - String jdbcURL = getServletContext().getInitParameter("jdbcURL"); - String dbUsername = getServletContext().getInitParameter("dbUsername"); - String dbPassword = getServletContext().getInitParameter("dbPassword"); - - BookDAO dao = new BookDAOJDBCImpl(jdbcURL, dbUsername, dbPassword); - - List books = Collections.emptyList(); - try { - books = dao.getAllBooks(); - } catch (DAOException e) { - e.printStackTrace(); - } - - request.setAttribute("BOOKS_TO_DISPLAY", books); - request.setAttribute("MAX_BOOKS_DISPLAYED", maxBooksDisplayed); - - RequestDispatcher requestDispatcher = request.getRequestDispatcher("/display"); - requestDispatcher.forward(request, response); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - System.out.println("doPost called on ListBook"); - - - } - -} diff --git a/servlet3/src/com/training/java/servlet/servlet3/web/package-info.java b/servlet3/src/com/training/java/servlet/servlet3/web/package-info.java deleted file mode 100644 index 724285a..0000000 --- a/servlet3/src/com/training/java/servlet/servlet3/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.servlet3.web; \ No newline at end of file diff --git a/servlet4/.classpath b/servlet4/.classpath deleted file mode 100644 index 4fd4016..0000000 --- a/servlet4/.classpath +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/servlet4/.project b/servlet4/.project deleted file mode 100644 index 93ad23d..0000000 --- a/servlet4/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - servlet4 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/servlet4/.settings/.jsdtscope b/servlet4/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/servlet4/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/servlet4/.settings/org.eclipse.jdt.core.prefs b/servlet4/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/servlet4/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/servlet4/.settings/org.eclipse.wst.common.component b/servlet4/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 2966351..0000000 --- a/servlet4/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/servlet4/.settings/org.eclipse.wst.common.project.facet.core.xml b/servlet4/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index acf76ca..0000000 --- a/servlet4/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.container b/servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.name b/servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/servlet4/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/servlet4/WebContent/AddBook.html b/servlet4/WebContent/AddBook.html deleted file mode 100644 index 01d03a5..0000000 --- a/servlet4/WebContent/AddBook.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - -Insert title here - - - -
      - - Title :
      - Author :
      - Pages :
      - ISBN :
      - Pub Date :
      - Pub Id :
      - - - -
      - - - - \ No newline at end of file diff --git a/servlet4/WebContent/META-INF/MANIFEST.MF b/servlet4/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/servlet4/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/servlet4/WebContent/WEB-INF/lib/commons-lang-2.6.jar b/servlet4/WebContent/WEB-INF/lib/commons-lang-2.6.jar deleted file mode 100644 index 98467d3..0000000 Binary files a/servlet4/WebContent/WEB-INF/lib/commons-lang-2.6.jar and /dev/null differ diff --git a/servlet4/WebContent/WEB-INF/lib/ojdbc6.jar b/servlet4/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/servlet4/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/servlet4/WebContent/WEB-INF/web.xml b/servlet4/WebContent/WEB-INF/web.xml deleted file mode 100644 index fe34b65..0000000 --- a/servlet4/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - servlet2 - - index.html - - - - ListBooks - ListBooks - com.training.java.servlet.servlet3.web.ListBooksServlet - - maxBooksDisplayed - 100 - - - - ListBooks - /list - - - - AddBookServlet - AddBookServlet - com.training.java.servlet.servlet3.web.AddBookServlet - - - AddBookServlet - /add - - - jdbcURL - jdbc:oracle:thin:@localhost:1521:XE - - - dbUsername - bookstore - - - dbPassword - password - - - - DisplayBooksServlet - DisplayBooksServlet - com.training.java.servlet.servlet3.web.DisplayBooksServlet - - - DisplayBooksServlet - /display - - - - BuyBookServlet - BuyBookServlet - com.training.java.servlet.servlet3.web.BuyBookServlet - - - BuyBookServlet - /buy - - - - ShopingCartServlet - ShopingCartServlet - com.training.java.servlet.servlet3.web.ShopingCartServlet - - - ShopingCartServlet - /cart - - \ No newline at end of file diff --git a/servlet4/WebContent/index.html b/servlet4/WebContent/index.html deleted file mode 100644 index 40a9c93..0000000 --- a/servlet4/WebContent/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - -Insert title here - - - -

      Welcome to our bookstore!!

      - - If you want to add a book, please click here
      - If you want to list all the books, please click here
      - - - \ No newline at end of file diff --git a/servlet4/src/com/training/java/servlet/servlet3/domain/Book.java b/servlet4/src/com/training/java/servlet/servlet3/domain/Book.java deleted file mode 100644 index 4f12023..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/domain/Book.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.java.servlet.servlet3.domain; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - public void init() - { - - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } - - public int getPages() { - return pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - -} diff --git a/servlet4/src/com/training/java/servlet/servlet3/domain/BookDAO.java b/servlet4/src/com/training/java/servlet/servlet3/domain/BookDAO.java deleted file mode 100644 index 0522aa7..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/domain/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.servlet.servlet3.domain; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/servlet4/src/com/training/java/servlet/servlet3/domain/BookDAOJDBCImpl.java b/servlet4/src/com/training/java/servlet/servlet3/domain/BookDAOJDBCImpl.java deleted file mode 100644 index 938670c..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/domain/BookDAOJDBCImpl.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.training.java.servlet.servlet3.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class BookDAOJDBCImpl implements BookDAO { - - private String jdbcURL; - private String username; - private String password; - - public BookDAOJDBCImpl(String jdbcURL, String username, String password) - { - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(book_id_seq.nextval, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - statement.setInt(6, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } - - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/servlet4/src/com/training/java/servlet/servlet3/domain/DAOException.java b/servlet4/src/com/training/java/servlet/servlet3/domain/DAOException.java deleted file mode 100644 index 483b320..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/domain/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.servlet.servlet3.domain; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/servlet4/src/com/training/java/servlet/servlet3/domain/package-info.java b/servlet4/src/com/training/java/servlet/servlet3/domain/package-info.java deleted file mode 100644 index 67d4b87..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.servlet3.domain; \ No newline at end of file diff --git a/servlet4/src/com/training/java/servlet/servlet3/web/AddBookServlet.java b/servlet4/src/com/training/java/servlet/servlet3/web/AddBookServlet.java deleted file mode 100644 index c655112..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/web/AddBookServlet.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.training.java.servlet.servlet3.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.text.ParseException; -import java.util.Date; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.lang.time.DateUtils; - -import com.training.java.servlet.servlet3.domain.Book; -import com.training.java.servlet.servlet3.domain.BookDAO; -import com.training.java.servlet.servlet3.domain.BookDAOJDBCImpl; -import com.training.java.servlet.servlet3.domain.DAOException; - -/** - * Servlet implementation class AddBookServlet - */ -public class AddBookServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public AddBookServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String isbn = request.getParameter("isbn"); - String publishedDateStr = request.getParameter("pubDate"); - - String title = request.getParameter("title"); - String author = request.getParameter("author"); - String pages = request.getParameter("pages"); - - String[] formats = {"mmDDyyyy"}; - - Date publishedDate = null; - try { - publishedDate = DateUtils.parseDate(publishedDateStr, formats); - } catch (ParseException e1) { - e1.printStackTrace(); - } - - Book book = new Book(0, title, author, isbn, Integer.parseInt(pages), publishedDate); - - String jdbcURL = getServletContext().getInitParameter("jdbcURL"); - String dbUsername = getServletContext().getInitParameter("dbUsername"); - String dbPassword = getServletContext().getInitParameter("dbPassword"); - - BookDAO dao = new BookDAOJDBCImpl(jdbcURL, dbUsername, dbPassword); - try { - dao.addBook(book); - } catch (DAOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - response.sendRedirect("/bookstore/list"); - - } - -} diff --git a/servlet4/src/com/training/java/servlet/servlet3/web/BuyBookServlet.java b/servlet4/src/com/training/java/servlet/servlet3/web/BuyBookServlet.java deleted file mode 100644 index e0fc9ae..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/web/BuyBookServlet.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.servlet.servlet3.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.servlet.servlet3.domain.Book; -import com.training.java.servlet.servlet3.domain.BookDAO; -import com.training.java.servlet.servlet3.domain.BookDAOJDBCImpl; -import com.training.java.servlet.servlet3.domain.DAOException; - -/** - * Servlet implementation class BuyBookServlet - */ -public class BuyBookServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public BuyBookServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String idStr = request.getParameter("id"); - int id = Integer.parseInt(idStr); - - String jdbcURL = getServletContext().getInitParameter("jdbcURL"); - String dbUsername = getServletContext().getInitParameter("dbUsername"); - String dbPassword = getServletContext().getInitParameter("dbPassword"); - - BookDAO dao = new BookDAOJDBCImpl(jdbcURL, dbUsername, dbPassword); - Book bookBought = null; - - try { - bookBought = dao.findByPrimaryKey(id); - } catch (DAOException e) { - e.printStackTrace(); - } - - HttpSession session = request.getSession(); - - List booksBought = null; - if(session.isNew()) - { - booksBought = new ArrayList<>(); - booksBought.add(bookBought); - - session.setAttribute("PurchasedBooks", booksBought); - } - else - { - booksBought = (List) session.getAttribute("PurchasedBooks"); - booksBought.add(bookBought); - } - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println("

      Your book has been added to the Cart(" + booksBought.size() + ")

      "); - - out.println("

      Please click here to go to the list of books

      "); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - } - -} diff --git a/servlet4/src/com/training/java/servlet/servlet3/web/DisplayBooksServlet.java b/servlet4/src/com/training/java/servlet/servlet3/web/DisplayBooksServlet.java deleted file mode 100644 index d86744d..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/web/DisplayBooksServlet.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.training.java.servlet.servlet3.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.servlet3.domain.Book; - -/** - * Servlet implementation class DisplayBooksServlet - */ -public class DisplayBooksServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public DisplayBooksServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - List books = (List) request.getAttribute("BOOKS_TO_DISPLAY"); - int maxBooksDisplayed = (Integer) request.getAttribute("MAX_BOOKS_DISPLAYED"); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - - if(maxBooksDisplayed > books.size()) - { - maxBooksDisplayed = books.size(); - } - - - for(int i=0; i"); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - - out.println(""); - } - - out.println("
      TitleAuthorPagesPub date.Buy Link
      " + aBook.getTitle() + "" + aBook.getAuthor() + "" + aBook.getPages() + "" + aBook.getPublisherDate() + " Buy
      "); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - } - -} diff --git a/servlet4/src/com/training/java/servlet/servlet3/web/ListBooksServlet.java b/servlet4/src/com/training/java/servlet/servlet3/web/ListBooksServlet.java deleted file mode 100644 index 9972b4c..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/web/ListBooksServlet.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.training.java.servlet.servlet3.web; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.training.java.servlet.servlet3.domain.Book; -import com.training.java.servlet.servlet3.domain.BookDAO; -import com.training.java.servlet.servlet3.domain.BookDAOJDBCImpl; -import com.training.java.servlet.servlet3.domain.DAOException; - -/** - * Servlet implementation class ListMoviesServlet - */ -public class ListBooksServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ListBooksServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String maxBooksDisplayedStr = getServletConfig().getInitParameter("maxBooksDisplayed"); - int maxBooksDisplayed = Integer.parseInt(maxBooksDisplayedStr); - - String jdbcURL = getServletContext().getInitParameter("jdbcURL"); - String dbUsername = getServletContext().getInitParameter("dbUsername"); - String dbPassword = getServletContext().getInitParameter("dbPassword"); - - BookDAO dao = new BookDAOJDBCImpl(jdbcURL, dbUsername, dbPassword); - - List books = Collections.emptyList(); - try { - books = dao.getAllBooks(); - } catch (DAOException e) { - e.printStackTrace(); - } - - request.setAttribute("BOOKS_TO_DISPLAY", books); - request.setAttribute("MAX_BOOKS_DISPLAYED", maxBooksDisplayed); - - RequestDispatcher requestDispatcher = request.getRequestDispatcher("/display"); - requestDispatcher.forward(request, response); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - System.out.println("doPost called on ListBook"); - - - } - -} diff --git a/servlet4/src/com/training/java/servlet/servlet3/web/ShopingCartServlet.java b/servlet4/src/com/training/java/servlet/servlet3/web/ShopingCartServlet.java deleted file mode 100644 index 2d137ad..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/web/ShopingCartServlet.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.training.java.servlet.servlet3.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import com.training.java.servlet.servlet3.domain.Book; - -/** - * Servlet implementation class ShopingCartServlet - */ -public class ShopingCartServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ShopingCartServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - - List booksPurchased = (List) session.getAttribute("PurchasedBooks"); - - PrintWriter out = response.getWriter(); - - out.println(""); - out.println("

      These are the books in your cart so far

      "); - out.println("
        "); - - for(Book aBook : booksPurchased) - { - out.println("
      • " + aBook.getTitle() + "
      • "); - } - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - } - -} diff --git a/servlet4/src/com/training/java/servlet/servlet3/web/package-info.java b/servlet4/src/com/training/java/servlet/servlet3/web/package-info.java deleted file mode 100644 index 724285a..0000000 --- a/servlet4/src/com/training/java/servlet/servlet3/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.servlet.servlet3.web; \ No newline at end of file diff --git a/servlet5/.classpath b/servlet5/.classpath deleted file mode 100644 index 700a9c5..0000000 --- a/servlet5/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/servlet5/.project b/servlet5/.project deleted file mode 100644 index 13e2c02..0000000 --- a/servlet5/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - servlet5 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/servlet5/.settings/.jsdtscope b/servlet5/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/servlet5/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/servlet5/.settings/org.eclipse.jdt.core.prefs b/servlet5/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c9aed53..0000000 --- a/servlet5/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Feb 09 20:14:34 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/servlet5/.settings/org.eclipse.wst.common.component b/servlet5/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 4542067..0000000 --- a/servlet5/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/servlet5/.settings/org.eclipse.wst.common.project.facet.core.xml b/servlet5/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d62d1e5..0000000 --- a/servlet5/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/servlet5/.settings/org.eclipse.wst.jsdt.ui.superType.container b/servlet5/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/servlet5/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/servlet5/.settings/org.eclipse.wst.jsdt.ui.superType.name b/servlet5/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/servlet5/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/servlet5/WebContent/META-INF/MANIFEST.MF b/servlet5/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/servlet5/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/servlet5/WebContent/WEB-INF/web.xml b/servlet5/WebContent/WEB-INF/web.xml deleted file mode 100644 index 497ff62..0000000 --- a/servlet5/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - servlet5 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ShoppingCartServlet - ShoppingCartServlet - com.training.java.servlet5.web.ShoppingCartServlet - - - ShoppingCartServlet - /cart - - \ No newline at end of file diff --git a/servlet5/WebContent/index.html b/servlet5/WebContent/index.html deleted file mode 100644 index 9b79fbd..0000000 --- a/servlet5/WebContent/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - -Insert title here - - - - Welcome to BookStore!! - -
        -

        Please enter the book that you want to buy : - - - - - - \ No newline at end of file diff --git a/servlet5/src/com/training/java/servlet5/web/ShoppingCartServlet.java b/servlet5/src/com/training/java/servlet5/web/ShoppingCartServlet.java deleted file mode 100644 index 2da465f..0000000 --- a/servlet5/src/com/training/java/servlet5/web/ShoppingCartServlet.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.training.java.servlet5.web; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -/** - * Servlet implementation class ShoppingCartServlet - */ -public class ShoppingCartServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - /** - * @see HttpServlet#HttpServlet() - */ - public ShoppingCartServlet() { - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - doPost(request, response); - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - HttpSession session = request.getSession(); - boolean isNewSession = session.isNew(); - System.out.println("Is new session? " + isNewSession); - - String bookName = request.getParameter("bookName"); - - PrintWriter out = response.getWriter(); - - if(isNewSession) - { - List books = new ArrayList(); - books.add(bookName); - - session.setAttribute("booksBought", books); - - out.print("

        Welcome to our store, you just bought " + bookName); - } - else - { - List booksBought = (List) session.getAttribute("booksBought"); - booksBought.add(bookName); - - out.print("

        Welcome back, you bought.."); - out.println("
        "); - - for(String current : booksBought) - { - out.println("Book = " + current); - out.println("
        "); - } - } - } - -} diff --git a/shoppingcart/.classpath b/shoppingcart/.classpath deleted file mode 100644 index 26b8264..0000000 --- a/shoppingcart/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/shoppingcart/.project b/shoppingcart/.project deleted file mode 100644 index 2f82ea0..0000000 --- a/shoppingcart/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - shoppingcart - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/shoppingcart/.settings/.jsdtscope b/shoppingcart/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/shoppingcart/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/shoppingcart/.settings/org.eclipse.jdt.core.prefs b/shoppingcart/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 295926d..0000000 --- a/shoppingcart/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/shoppingcart/.settings/org.eclipse.wst.common.component b/shoppingcart/.settings/org.eclipse.wst.common.component deleted file mode 100644 index b7937ae..0000000 --- a/shoppingcart/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/shoppingcart/.settings/org.eclipse.wst.common.project.facet.core.xml b/shoppingcart/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index a24a7de..0000000 --- a/shoppingcart/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/shoppingcart/.settings/org.eclipse.wst.jsdt.ui.superType.container b/shoppingcart/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/shoppingcart/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/shoppingcart/.settings/org.eclipse.wst.jsdt.ui.superType.name b/shoppingcart/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/shoppingcart/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/shoppingcart/WebContent/META-INF/MANIFEST.MF b/shoppingcart/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/shoppingcart/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/shoppingcart/WebContent/WEB-INF/jsp/shoppingcart.jsp b/shoppingcart/WebContent/WEB-INF/jsp/shoppingcart.jsp deleted file mode 100644 index 9b62252..0000000 --- a/shoppingcart/WebContent/WEB-INF/jsp/shoppingcart.jsp +++ /dev/null @@ -1,44 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - -Insert title here - - - - - -

        Welcome to eShop, world's best shop :)

        - -
        - Please add your book : -

        - -
        - -

        By the way, you have the following items in the cart.

        - - - - - - - - - - -
        Books bought
        ${book}
        - - - \ No newline at end of file diff --git a/shoppingcart/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar b/shoppingcart/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar deleted file mode 100644 index a86a365..0000000 Binary files a/shoppingcart/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar and /dev/null differ diff --git a/shoppingcart/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar b/shoppingcart/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar deleted file mode 100644 index 4b3b433..0000000 Binary files a/shoppingcart/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar and /dev/null differ diff --git a/shoppingcart/WebContent/WEB-INF/web.xml b/shoppingcart/WebContent/WEB-INF/web.xml deleted file mode 100644 index f18e898..0000000 --- a/shoppingcart/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - shoppingcart - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ShoppingCartServlet - com.training.servlets.shoppingcart.ShoppingCartServlet - - - - ShoppingCartServlet - /cart - - - - \ No newline at end of file diff --git a/shoppingcart/src/com/training/servlets/shoppingcart/ShoppingCartServlet.java b/shoppingcart/src/com/training/servlets/shoppingcart/ShoppingCartServlet.java deleted file mode 100644 index f67a06d..0000000 --- a/shoppingcart/src/com/training/servlets/shoppingcart/ShoppingCartServlet.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.servlets.shoppingcart; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -public class ShoppingCartServlet extends HttpServlet { - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - - HttpSession session = req.getSession(); - - if(session.isNew()) { - List books = new ArrayList(); - session.setAttribute("BooksBoughtSoFar", books); - } - - RequestDispatcher rd = req.getRequestDispatcher("/WEB-INF/jsp/shoppingcart.jsp"); - rd.forward(req, resp); - } - - @Override - protected void doPost(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - - String purchasedBook = req.getParameter("purchasedBook"); - String name = req.getParameter("name"); - - System.out.println("Book purchased = " + purchasedBook); - System.out.println("name = " + name); - - HttpSession session = req.getSession(); - - if(session.isNew()) { - List books = new ArrayList(); - session.setAttribute("BooksBoughtSoFar", books); - } else { - List books = (List) session.getAttribute("BooksBoughtSoFar"); - books.add(purchasedBook); - - System.out.println("Books bought so far " + books); - } - - RequestDispatcher rd = req.getRequestDispatcher("/WEB-INF/jsp/shoppingcart.jsp"); - rd.forward(req, resp); - } - -} diff --git a/sonicvision/.classpath b/sonicvision/.classpath deleted file mode 100644 index c34c54b..0000000 --- a/sonicvision/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sonicvision/.project b/sonicvision/.project deleted file mode 100644 index 4b4dedf..0000000 --- a/sonicvision/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - sonicvision - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/sonicvision/.settings/.jsdtscope b/sonicvision/.settings/.jsdtscope deleted file mode 100644 index 585c967..0000000 --- a/sonicvision/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/sonicvision/.settings/org.eclipse.jdt.core.prefs b/sonicvision/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c788ee3..0000000 --- a/sonicvision/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/sonicvision/.settings/org.eclipse.m2e.core.prefs b/sonicvision/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/sonicvision/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/sonicvision/.settings/org.eclipse.wst.common.component b/sonicvision/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 5fc881e..0000000 --- a/sonicvision/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/sonicvision/.settings/org.eclipse.wst.common.project.facet.core.xml b/sonicvision/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 8988a5e..0000000 --- a/sonicvision/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/sonicvision/.settings/org.eclipse.wst.jsdt.ui.superType.container b/sonicvision/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/sonicvision/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/sonicvision/.settings/org.eclipse.wst.jsdt.ui.superType.name b/sonicvision/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/sonicvision/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/sonicvision/.settings/org.eclipse.wst.validation.prefs b/sonicvision/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 6f1cba6..0000000 --- a/sonicvision/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/sonicvision/pom.xml b/sonicvision/pom.xml deleted file mode 100644 index 73bec6d..0000000 --- a/sonicvision/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - 4.0.0 - com.sonicvisionllc - sonicvision - war - 0.0.1-SNAPSHOT - sonicvision Maven Webapp - http://maven.apache.org - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - org.springframework - spring-web - 3.2.13.RELEASE - - - org.springframework - spring-oxm - 3.2.13.RELEASE - - - org.springframework - spring-webmvc - 3.2.13.RELEASE - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.3.1.Final - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.5 - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - - sonicvision - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.7 - 1.7 - - - - - - diff --git a/sonicvision/src/main/java/com/sonicvision/web/MainMenuController.java b/sonicvision/src/main/java/com/sonicvision/web/MainMenuController.java deleted file mode 100644 index f0985a9..0000000 --- a/sonicvision/src/main/java/com/sonicvision/web/MainMenuController.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sonicvision.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class MainMenuController { - - @RequestMapping({ "/", "/home" }) - public String homePage() { - return "Home"; - } - - @RequestMapping("/about") - public String aboutPage() { - return "About"; - } - - @RequestMapping("/solutions") - public String solutionsPage() { - return "Solutions"; - } - - @RequestMapping("/services") - public String servicesPage() { - return "Services"; - } - - @RequestMapping("/careers") - public String careersPage() { - return "Careers"; - } - - @RequestMapping("/contact") - public String contactPage() { - return "Contact"; - } -} diff --git a/sonicvision/src/main/webapp/WEB-INF/jsp/About.jsp b/sonicvision/src/main/webapp/WEB-INF/jsp/About.jsp deleted file mode 100644 index c17eeda..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/jsp/About.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - -
        -
        -
        -

        About

        -

        Sonic Vision is one of the leading Companies delivering high quality Information Technology Solutions and Services. - Our technologists focus on delivering solutions and services to support current and future business needs of our clients. - Our consultants are highly talented, self-motivated and goal oriented who are dedicated - to their work and provide high quality work on time, with in project/program costs. - Sonic Vision has developed a team, which possesses skills necessary to plan, build, and launch business solutions - for a diverse clientele in a broad range of industries.

        - -

        We currently serve in the areas of Healthcare, Banking, Insurance, Telecommunications and Consumer Products. - Our employees are equipped with higher degrees in education and most of them are certified in their respective fields. - Our dedicated team of professionals have been instrumental in developing substantive solutions - for our customers primarily in the USA and India. - Our dedicated development group has all the expertise needed for developing customized applications - and providing complete solutions to the customers. - Our development team carries out research continuously in tune with the changing needs of the global market - while our project management staff has developed methods and structures that allow us to manage complex projects.

        -
        -
        -

        Our Mission

        - -

        At Sonic Vision, our mission is to create an outstanding value to our customers and stakeholders. - We strive to provide innovative, affordable solutions and enhanced business processes which inturn - deliver long term benefits to our clients. - Sonic Vision is fostering a corporate culture that attracts - and retains innovative and energetic employees who are driven to deliver client needs.

        -
        -
        - -
        - - \ No newline at end of file diff --git a/sonicvision/src/main/webapp/WEB-INF/jsp/AllScripts.jsp b/sonicvision/src/main/webapp/WEB-INF/jsp/AllScripts.jsp deleted file mode 100644 index 685ae29..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/jsp/AllScripts.jsp +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/sonicvision/src/main/webapp/WEB-INF/jsp/Careers.jsp b/sonicvision/src/main/webapp/WEB-INF/jsp/Careers.jsp deleted file mode 100644 index b5b18a5..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/jsp/Careers.jsp +++ /dev/null @@ -1,87 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - - -
        -
        -
        -

        Careers

        -

        At Sonic Vision, we provide opportunities that offer both challenges and rewards. - Put your knowledge and skills to work on a team that encourages initiative, fosters innovation, endorses accountability, and promotes integrity. - We value our associates and respect our customers— always striving to enable them to achieve the measurable results that support their success

        - -

        Are you a person of exemplary character and integrity...committed to growth and excellence...and driven to deliver superior solutions? - Are you tenacious, flexible, and creative - a person who thrives on challenges?

        - -

        Then work with us!

        - - Current Oppertunities - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Job #Job TitleLocationDuration
        SV10Java DeveloperAuburn Hills, MIlong-term
        SV11QA ANALYSTDetroit, MIlong-term
        SV12Java TesterLivonia, MIlong-term
        SV13Java ArchitectAuburn Hills, MIlong-term
        - -
        -
        -
        -

        Solutions

        - -
        - -
        -

        Vision

        - -

        We understand the importance of functionality, security, robustness and performance, and we do our best - utilizing industry proven development technologies and tools. - Our Vision is to provide excellent management of technology and support to our clients.

        -
        -
        -
        - -
        - - \ No newline at end of file diff --git a/sonicvision/src/main/webapp/WEB-INF/jsp/Contact.jsp b/sonicvision/src/main/webapp/WEB-INF/jsp/Contact.jsp deleted file mode 100644 index 5de60b5..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/jsp/Contact.jsp +++ /dev/null @@ -1,41 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - - -
        -
        -
        -

        - -

        - -

        - 72 Crestfield Ave
        - Troy, MI 48085
        - info@sonicvisonllc.com -

        -
        -
        -

        -
        -
        -
        -
        - - -<%@include file="AllScripts.jsp" %> - - - \ No newline at end of file diff --git a/sonicvision/src/main/webapp/WEB-INF/jsp/Header.jsp b/sonicvision/src/main/webapp/WEB-INF/jsp/Header.jsp deleted file mode 100644 index 5ca4573..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/jsp/Header.jsp +++ /dev/null @@ -1,44 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - -Header - - - - - - - -
        -
        - -
        - -
        -
        -
        -
        -
        -
        -
        - -
        -
        - -<%@include file="AllScripts.jsp" %> - - - \ No newline at end of file diff --git a/sonicvision/src/main/webapp/WEB-INF/jsp/Home.jsp b/sonicvision/src/main/webapp/WEB-INF/jsp/Home.jsp deleted file mode 100644 index 4b78da5..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/jsp/Home.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - -
        -
        -
        -

        Welcome

        - -

        We seek to provide top IT expertise - and technical assistance to help - clients in the implementation of their solutions.

        -
        -
        -

        Quality Management

        - -

        We offer the right commitment and focus while - partenering with our clients in their growth endeavors.

        -
        -
        -

        Our technologists

        - -

        Our technologists focus on delivering solutions - and services to support current and future business needs of our clients.

        -
        -
        -
        - -<%@include file="AllScripts.jsp" %> - - - \ No newline at end of file diff --git a/sonicvision/src/main/webapp/WEB-INF/jsp/Services.jsp b/sonicvision/src/main/webapp/WEB-INF/jsp/Services.jsp deleted file mode 100644 index e04d33d..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/jsp/Services.jsp +++ /dev/null @@ -1,73 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - - -
        -
        -
        -

        Services

        -

        From providing Staffing, Consulting and Systems Integration Services to managing IT and business functions - on behalf of our clients, Sonic Vision provides an all-encompassing offering that includes the planning, design, - implementation and management of highly effective IT environments. - Our global delivery capabilities include onsite and off-shore options, giving our clients the flexibility to choose - the model that best meets their needs and requirements.

        - - - -

        Through our vertical expertise in financial services, government and healthcare, telecommunications and utilities, - retail and distribution and manufacturing, we provide clients with a partner that is not only expert in IT, - but also expert in their industries. This combination of business knowledge and technology expertise allows us - to help our clients adapt as their industries change, and in the process, allows us to help evolve the industries in which we operate.

        - -

        More importantly, Sonic Vision has a large pool of employees and associate consultants, who provide a diverse - skill set in Internet, Client Server, ERP/CRM, and Network Infrastructure technologies. - Their diverse experience, education and backgrounds have helped us create a deep collective pool of talent and knowledge, - and ensures that Sonic Vision brings strong domain and product knowledge to our services.

        -
        -
        -
        -

        Why Choose Us?

        -
          -
        • Service quality is our high priority
        • -
        • Creating a positive atmosphere
        • -
        • High performance culture
        • -
        • Honesty and integrity.
        • -
        • Find expert professionals in all careers
        • -
        • Credibility
        • -
        • Excellence
        • -
        -
        -
        -

        Technologies

        -
          -
        • Healthcare
        • -
        • Project Management
        • -
        • Reality
        • -
        • Financial
        • -
        • Retail
        • -
        • Testing
        • -
        • Energy
        • -
        • Banking
        • -
        • Business Analysis
        • -
        • Construction
        • -
        • Tele Communication
        • -
        • Development
        • -
        -
        -
        -
        -
        - - \ No newline at end of file diff --git a/sonicvision/src/main/webapp/WEB-INF/jsp/Solutions.jsp b/sonicvision/src/main/webapp/WEB-INF/jsp/Solutions.jsp deleted file mode 100644 index 12f020b..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/jsp/Solutions.jsp +++ /dev/null @@ -1,98 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - -
        -
        -
        -

        Solutions

        -

        Sonic Vision works with leading companies in a range of industries to provide world-class services. - Our specialized industry focus allows us to understand the issues and challenges within competitive space, - and gives us the ability to meet your needs with solutions that will propel your organization to the next level.

        - - -
        - - Telecom - -

        Time-to-market and customer loyalty in the Telecommunications world is crucial. You need effective information systems that will strengthen your business as it changes and grows. You need a partner with extensive global experience who has access to expertise relating to every aspect of telecommunications and understand your operations and software requirements.

        - -

        Sonic Vision's leading edge systems and best-practice processes allow you to:

        - -
          -
        • Manage your customers through interactive customer contact centers or Web-enabled call centers equipped with the latest tools in CRM;
        • -
        • Serve your customers through automated Order Management, gateway and provisioning systems;
        • -
        • Manage your business through flexible billing, and credit risk collection systems.
        • -
        - - Pharma & Healthcare - -

        Organizations within the Healthcare industry are constantly looking for new ways to - leverage information technology in order to reduce medical errors, promote patient safety - and improve service. - In addition, compliance with the Health Insurance Portability and Accountability Act (HIPAA) - is a top concern for IT healthcare executives. - With tight budgets and other constraints, the industry needs solutions that are cost effective and flexible.

        -

        Our position as the leading information technology resource management (ITRM) company provides - us with the experience and resources necessary to meet the needs of today's healthcare organizations. - Sonic Vision is dedicated to providing you with innovative, technical and management services. - We provide a full range of critical information technology services and solutions. - Our capabilities span a broad spectrum of value-added information technology services.

        - - Technology - -

        Sonic Vision is keenly aware that aggressive go-to-market cycles, extreme competitive pressures, - an ever-changing technology landscape and the paucity of skilled resources are facts of life in the technology - and services industry. Engaged in either developing products or providing consulting and support services, - our technology and services customer-partners leverage our broad and deep expertise across technologies - and platforms to better serve their own customers. - The more effectively your employees use technology – the more efficiently your business will run. - Sonic Vision is your one-stop resource for complete solutions-related staff augmentation services. - Our team provides an extensive mix of services that help companies who rely on technology gain - and sustain competitive advantage.

        - - Government -

        As societies and economies evolve, largely due to the influence of globalization, changing demographics, - and the rise of the digital economy, governments are “reinventing� themselves to meet new expectations and the priorities of businesses. - These dynamics are compelling the government to create a new vision that recognizes the different ways - that people interact with their government: - As taxpayers who expect value and results;As clients who expect accessible, quality services; - As citizens who participate in the democratic process. - The government’s challenge is to meet these issues by reassessing the substantial resources it has in IS/IT assets and leveraging these investments - to make government more responsive and affordable.

        -

        We provide the best value IT consulting; combining high-quality IT consultants expected of top primes/integrators without - the overhead cost of the fixed-bid infrastructure. - Sonic Vision will help you meet your budget, quality, and deadline goals – not just provide IT staff. - We can also help with qualified project managers, senior architects and planners. - Regardless of the level of IT Project Support required, you’ll get the best value from Sonic Vision.

        -
        -
        -
        -

        Solutions

        - -
        - -
        -

        Vision

        - -

        We understand the importance of functionality, security, robustness and performance, and we do our best - utilizing industry proven development technologies and tools. - Our Vision is to provide excellent management of technology and support to our clients.

        -
        -
        -
        - -
        - - \ No newline at end of file diff --git a/sonicvision/src/main/webapp/WEB-INF/sonicvision-servlet.xml b/sonicvision/src/main/webapp/WEB-INF/sonicvision-servlet.xml deleted file mode 100644 index 01094dd..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/sonicvision-servlet.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sonicvision/src/main/webapp/WEB-INF/web.xml b/sonicvision/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 8630f35..0000000 --- a/sonicvision/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - sonicvision - - sonicvision - org.springframework.web.servlet.DispatcherServlet - - - sonicvision - / - - \ No newline at end of file diff --git a/sonicvision/src/main/webapp/images/Contact.jpg b/sonicvision/src/main/webapp/images/Contact.jpg deleted file mode 100644 index de32299..0000000 Binary files a/sonicvision/src/main/webapp/images/Contact.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/OurTechnologies.jpg b/sonicvision/src/main/webapp/images/OurTechnologies.jpg deleted file mode 100644 index 4297819..0000000 Binary files a/sonicvision/src/main/webapp/images/OurTechnologies.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/QualityManagement.jpg b/sonicvision/src/main/webapp/images/QualityManagement.jpg deleted file mode 100644 index 9d95c91..0000000 Binary files a/sonicvision/src/main/webapp/images/QualityManagement.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/Services.jpg b/sonicvision/src/main/webapp/images/Services.jpg deleted file mode 100644 index 73b7e15..0000000 Binary files a/sonicvision/src/main/webapp/images/Services.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/Slider1.jpg b/sonicvision/src/main/webapp/images/Slider1.jpg deleted file mode 100644 index e90c399..0000000 Binary files a/sonicvision/src/main/webapp/images/Slider1.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/Slider2.jpg b/sonicvision/src/main/webapp/images/Slider2.jpg deleted file mode 100644 index 9373439..0000000 Binary files a/sonicvision/src/main/webapp/images/Slider2.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/Slider3.jpg b/sonicvision/src/main/webapp/images/Slider3.jpg deleted file mode 100644 index 9cf9488..0000000 Binary files a/sonicvision/src/main/webapp/images/Slider3.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/Solutions1.jpg b/sonicvision/src/main/webapp/images/Solutions1.jpg deleted file mode 100644 index 6b31d24..0000000 Binary files a/sonicvision/src/main/webapp/images/Solutions1.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/Solutions2.jpg b/sonicvision/src/main/webapp/images/Solutions2.jpg deleted file mode 100644 index 8e514f3..0000000 Binary files a/sonicvision/src/main/webapp/images/Solutions2.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/Welcome.jpg b/sonicvision/src/main/webapp/images/Welcome.jpg deleted file mode 100644 index 13fd343..0000000 Binary files a/sonicvision/src/main/webapp/images/Welcome.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/mission.jpg b/sonicvision/src/main/webapp/images/mission.jpg deleted file mode 100644 index f7738ad..0000000 Binary files a/sonicvision/src/main/webapp/images/mission.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/solutions.jpg b/sonicvision/src/main/webapp/images/solutions.jpg deleted file mode 100644 index 7c335d3..0000000 Binary files a/sonicvision/src/main/webapp/images/solutions.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/sonicvision.png b/sonicvision/src/main/webapp/images/sonicvision.png deleted file mode 100644 index 8d460f8..0000000 Binary files a/sonicvision/src/main/webapp/images/sonicvision.png and /dev/null differ diff --git a/sonicvision/src/main/webapp/images/vision.jpg b/sonicvision/src/main/webapp/images/vision.jpg deleted file mode 100644 index 2f47e29..0000000 Binary files a/sonicvision/src/main/webapp/images/vision.jpg and /dev/null differ diff --git a/sonicvision/src/main/webapp/scripts/application.js b/sonicvision/src/main/webapp/scripts/application.js deleted file mode 100644 index 6547d9e..0000000 --- a/sonicvision/src/main/webapp/scripts/application.js +++ /dev/null @@ -1,22 +0,0 @@ -jQuery(document).ready(function ($) { - - //Make the current Menu link active - var currentPage = $("body").data("currentpage"); - var currentMenuLi = $(".nav-pills li#" + currentPage); - $(currentMenuLi).addClass("active"); - - var options = { $AutoPlay: true }; - var jssor_slider1 = new $JssorSlider$('slider1_container', options); -}); - -function initialize() { - var mapCanvas = document.getElementById('map-canvas'); - var mapOptions = { - center: new google.maps.LatLng(42.577805, -83.146400), - zoom: 15, - mapTypeId: google.maps.MapTypeId.ROADMAP - } - var map = new google.maps.Map(mapCanvas, mapOptions) -}; - -google.maps.event.addDomListener(window, 'load', initialize); diff --git a/sonicvision/src/main/webapp/scripts/jssor.slider.mini.js b/sonicvision/src/main/webapp/scripts/jssor.slider.mini.js deleted file mode 100644 index 0649f9d..0000000 --- a/sonicvision/src/main/webapp/scripts/jssor.slider.mini.js +++ /dev/null @@ -1,2 +0,0 @@ -(function(h,e,b,i,c,g,j){/*! Jssor */ -new(function(){});var d=h.$JssorEasing$={$EaseSwing:function(a){return-b.cos(a*b.PI)/2+.5},$EaseLinear:function(a){return a},$EaseInQuad:function(a){return a*a},$EaseOutQuad:function(a){return-a*(a-2)},$EaseInOutQuad:function(a){return(a*=2)<1?1/2*a*a:-1/2*(--a*(a-2)-1)},$EaseInCubic:function(a){return a*a*a},$EaseOutCubic:function(a){return(a-=1)*a*a+1},$EaseInOutCubic:function(a){return(a*=2)<1?1/2*a*a*a:1/2*((a-=2)*a*a+2)},$EaseInQuart:function(a){return a*a*a*a},$EaseOutQuart:function(a){return-((a-=1)*a*a*a-1)},$EaseInOutQuart:function(a){return(a*=2)<1?1/2*a*a*a*a:-1/2*((a-=2)*a*a*a-2)},$EaseInQuint:function(a){return a*a*a*a*a},$EaseOutQuint:function(a){return(a-=1)*a*a*a*a+1},$EaseInOutQuint:function(a){return(a*=2)<1?1/2*a*a*a*a*a:1/2*((a-=2)*a*a*a*a+2)},$EaseInSine:function(a){return 1-b.cos(a*b.PI/2)},$EaseOutSine:function(a){return b.sin(a*b.PI/2)},$EaseInOutSine:function(a){return-1/2*(b.cos(b.PI*a)-1)},$EaseInExpo:function(a){return a==0?0:b.pow(2,10*(a-1))},$EaseOutExpo:function(a){return a==1?1:-b.pow(2,-10*a)+1},$EaseInOutExpo:function(a){return a==0||a==1?a:(a*=2)<1?1/2*b.pow(2,10*(a-1)):1/2*(-b.pow(2,-10*--a)+2)},$EaseInCirc:function(a){return-(b.sqrt(1-a*a)-1)},$EaseOutCirc:function(a){return b.sqrt(1-(a-=1)*a)},$EaseInOutCirc:function(a){return(a*=2)<1?-1/2*(b.sqrt(1-a*a)-1):1/2*(b.sqrt(1-(a-=2)*a)+1)},$EaseInElastic:function(a){if(!a||a==1)return a;var c=.3,d=.075;return-(b.pow(2,10*(a-=1))*b.sin((a-d)*2*b.PI/c))},$EaseOutElastic:function(a){if(!a||a==1)return a;var c=.3,d=.075;return b.pow(2,-10*a)*b.sin((a-d)*2*b.PI/c)+1},$EaseInOutElastic:function(a){if(!a||a==1)return a;var c=.45,d=.1125;return(a*=2)<1?-.5*b.pow(2,10*(a-=1))*b.sin((a-d)*2*b.PI/c):b.pow(2,-10*(a-=1))*b.sin((a-d)*2*b.PI/c)*.5+1},$EaseInBack:function(a){var b=1.70158;return a*a*((b+1)*a-b)},$EaseOutBack:function(a){var b=1.70158;return(a-=1)*a*((b+1)*a+b)+1},$EaseInOutBack:function(a){var b=1.70158;return(a*=2)<1?1/2*a*a*(((b*=1.525)+1)*a-b):1/2*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},$EaseInBounce:function(a){return 1-d.$EaseOutBounce(1-a)},$EaseOutBounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},$EaseInOutBounce:function(a){return a<1/2?d.$EaseInBounce(a*2)*.5:d.$EaseOutBounce(a*2-1)*.5+.5},$EaseGoBack:function(a){return 1-b.abs(2-1)},$EaseInWave:function(a){return 1-b.cos(a*b.PI*2)},$EaseOutWave:function(a){return b.sin(a*b.PI*2)},$EaseOutJump:function(a){return 1-((a*=2)<1?(a=1-a)*a*a:(a-=1)*a*a)},$EaseInJump:function(a){return(a*=2)<1?a*a*a:(a=2-a)*a*a}};var a=new function(){var f=this,xb=/\S+/g,T=1,fb=2,kb=3,jb=4,ob=5,L,s=0,l=0,p=0,bb=0,A=0,B=navigator,tb=B.appName,k=B.userAgent,z;function Eb(){if(!L){L={ie:"ontouchstart"in h||"createTouch"in e};var a;if(B.pointerEnabled||(a=B.msPointerEnabled))L.dd=a?"msTouchAction":"touchAction"}return L}function v(i){if(!s){s=-1;if(tb=="Microsoft Internet Explorer"&&!!h.attachEvent&&!!h.ActiveXObject){var f=k.indexOf("MSIE");s=T;p=n(k.substring(f+5,k.indexOf(";",f)));/*@cc_on bb=@_jscript_version@*/;l=e.documentMode||p}else if(tb=="Netscape"&&!!h.addEventListener){var d=k.indexOf("Firefox"),b=k.indexOf("Safari"),g=k.indexOf("Chrome"),c=k.indexOf("AppleWebKit");if(d>=0){s=fb;l=n(k.substring(d+8))}else if(b>=0){var j=k.substring(0,b).lastIndexOf("/");s=g>=0?jb:kb;l=n(k.substring(j+1,b))}else{var a=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i.exec(k);if(a){s=T;l=p=n(a[1])}}if(c>=0)A=n(k.substring(c+12))}else{var a=/(opera)(?:.*version|)[ \/]([\w.]+)/i.exec(k);if(a){s=ob;l=n(a[2])}}}return i==s}function q(){return v(T)}function O(){return q()&&(l<6||e.compatMode=="BackCompat")}function ib(){return v(kb)}function hb(){return v(jb)}function nb(){return v(ob)}function cb(){return ib()&&A>534&&A<535}function M(){return q()&&l<9}function t(a){if(!z){m(["transform","WebkitTransform","msTransform","MozTransform","OTransform"],function(b){if(a.style[b]!=j){z=b;return c}});z=z||"transform"}return z}function sb(a){return{}.toString.call(a)}var K;function Cb(){if(!K){K={};m(["Boolean","Number","String","Function","Array","Date","RegExp","Object"],function(a){K["[object "+a+"]"]=a.toLowerCase()})}return K}function m(a,d){if(sb(a)=="[object Array]"){for(var b=0;b535&&"ontouchstart"in h)k+=" perspective(2000px)";e.style[g]=k}}}f.me=function(b,a){if(cb())vb(f.F(i,ab,b,a));else ab(b,a)};f.le=function(b,c){var a=t(b);if(a)b.style[a+"Origin"]=c};f.oe=function(a,c){if(q()&&p<9||p<10&&O())a.style.zoom=c==1?"":c;else{var b=t(a);if(b){var f="scale("+c+")",e=a.style[b],g=new RegExp(/[\s]*scale\(.*?\)/g),d=I(e,[g],f);a.style[b]=d}}};f.ne=function(a){if(!a.style[t(a)]||a.style[t(a)]=="none")a.style[t(a)]="perspective(2000px)"};f.Rb=function(b,a){return function(c){c=r(c);var e=c.type,d=c.relatedTarget||(e=="mouseout"?c.toElement:c.fromElement);(!d||d!==a&&!f.nf(a,d))&&b(c)}};f.c=function(a,c,d,b){a=f.hb(a);if(a.addEventListener){c=="mousewheel"&&a.addEventListener("DOMMouseScroll",d,b);a.addEventListener(c,d,b)}else if(a.attachEvent){a.attachEvent("on"+c,d);b&&a.setCapture&&a.setCapture()}};f.I=function(a,c,d,b){a=f.hb(a);if(a.removeEventListener){c=="mousewheel"&&a.removeEventListener("DOMMouseScroll",d,b);a.removeEventListener(c,d,b)}else if(a.detachEvent){a.detachEvent("on"+c,d);b&&a.releaseCapture&&a.releaseCapture()}};f.Fb=function(a){a=r(a);a.preventDefault&&a.preventDefault();a.cancel=c;a.returnValue=g};f.af=function(a){a=r(a);a.stopPropagation&&a.stopPropagation();a.cancelBubble=c};f.F=function(d,c){var a=[].slice.call(arguments,2),b=function(){var b=a.concat([].slice.call(arguments,0));return c.apply(d,b)};return b};f.gf=function(a,b){if(b==j)return a.textContent||a.innerText;var c=e.createTextNode(b);f.jc(a);a.appendChild(c)};f.V=function(d,c){for(var b=[],a=d.firstChild;a;a=a.nextSibling)(c||a.nodeType==1)&&b.push(a);return b};function rb(a,c,e,b){b=b||"u";for(a=a?a.firstChild:i;a;a=a.nextSibling)if(a.nodeType==1){if(S(a,b)==c)return a;if(!e){var d=rb(a,c,e,b);if(d)return d}}}f.C=rb;function Q(a,d,f,b){b=b||"u";var c=[];for(a=a?a.firstChild:i;a;a=a.nextSibling)if(a.nodeType==1){S(a,b)==d&&c.push(a);if(!f){var e=Q(a,d,f,b);if(e.length)c=c.concat(e)}}return c}function lb(a,c,d){for(a=a?a.firstChild:i;a;a=a.nextSibling)if(a.nodeType==1){if(a.tagName==c)return a;if(!d){var b=lb(a,c,d);if(b)return b}}}f.cf=lb;function db(a,c,e){var b=[];for(a=a?a.firstChild:i;a;a=a.nextSibling)if(a.nodeType==1){(!c||a.tagName==c)&&b.push(a);if(!e){var d=db(a,c,e);if(d.length)b=b.concat(d)}}return b}f.of=db;f.mf=function(b,a){return b.getElementsByTagName(a)};function C(){var e=arguments,d,c,b,a,g=1&e[0],f=1+g;d=e[f-1]||{};for(;f-1;f--){var d=c[f],e=V(i);w(e,w(d));a.Vb(e,d.style.cssText);a.Wb(e,d);a.wb(d)}return b};function Db(b){var q=this,o="",r=["av","pv","ds","dn"],g=[],p,k=0,h=0,d=0;function i(){H(b,p,g[d||k||h&2||h]);a.cb(b,"pointer-events",d?"none":"")}function c(){k=0;i();f.I(e,"mouseup",c);f.I(e,"touchend",c);f.I(e,"touchcancel",c)}function n(a){if(d)f.Fb(a);else{k=4;i();f.c(e,"mouseup",c);f.c(e,"touchend",c);f.c(e,"touchcancel",c)}}q.Ic=function(a){if(a!=j){h=a&2||a&1;i()}else return h};q.$Enable=function(a){if(a==j)return!d;d=a?0:3;i()};b=f.hb(b);var l=a.Oe(w(b));if(l)o=l.shift();m(r,function(a){g.push(o+a)});p=Z(" ",g);g.unshift("");f.c(b,"mousedown",n);f.c(b,"touchstart",n)}f.Ub=function(a){return new Db(a)};f.cb=E;f.ab=o("overflow");f.B=o("top",2);f.z=o("left",2);f.o=o("width",2);f.n=o("height",2);f.Vc=o("marginLeft",2);f.Uc=o("marginTop",2);f.E=o("position");f.N=o("display");f.H=o("zIndex",1);f.rb=function(b,a,c){if(a!=j)Bb(b,a,c);else return Ab(b)};f.Vb=function(a,b){if(b!=j)a.style.cssText=b;else return a.style.cssText};var R={$Opacity:f.rb,$Top:f.B,$Left:f.z,db:f.o,eb:f.n,xb:f.E,yg:f.N,$ZIndex:f.H},u;function J(){if(!u)u=C({zg:f.Uc,Ag:f.Vc,$Clip:f.Ve,kc:f.me},R);return u}function pb(){J();u.kc=u.kc;return u}f.ce=J;f.Wd=pb;f.Vd=function(c,b){J();var a={};m(b,function(d,b){if(R[b])a[b]=R[b](c)});return a};f.L=function(c,b){var a=J();m(b,function(d,b){a[b]&&a[b](c,d)})};f.Ad=function(b,a){pb();f.L(b,a)};var F=new function(){var a=this;function b(d,g){for(var j=d[0].length,i=d.length,h=g[0].length,f=[],c=0;c=j||d<=f))d=((d-f)%r+r)%r+f;if(!E||x||i||l!=d){var g=b.min(d,j);g=b.max(g,f);if(!E||x||i||g!=n){if(K){var h=(g-m)/(z||1);if(k.$Reverse)h=1-h;var p=a.td(P,K,h,I,H,J,k);a.e(p,function(b,a){C[a]&&C[a](R,b)})}e.rc(n-m,g-m);n=g;a.e(y,function(b,c){var a=o=p*q)c=p;w(c);if(!x&&c*q>=p*q)N(D);else t(L)}}function v(d,g,h){if(!s){s=c;x=h;D=g;d=b.max(d,f);d=b.min(d,j);p=d;q=p=0&&b=0&&h=0&&b=0&&cf||d>h){switch(e){case j:case m:a++;break;case k:case l:case o:case i:b++;break;case p:case n:default:a--}if(a<0||b<0||a>f||b>h){switch(e){case j:case m:a=f;b++;break;case o:case i:b=h;a++;break;case k:case l:b=h;a--;break;case p:case n:default:a=0;b++}if(b>h)b=h;else if(b<0)b=0;else if(a>f)a=f;else if(a<0)a=0}d=b;c=a}}return r};h.$FormationSquare=function(i){var a=i.$Cols||1,c=i.$Rows||1,j=[],d,e,f,h,k;f=ac?(a-c)/2:0;k=b.round(b.max(a/2,c/2))+1;for(d=0;d1||d.$Clip;if(d.$Zoom||d.$Rotate){var H=c;if(a.Q())if(d.$Cols*d.$Rows>1)H=g;else I=g;if(H){e.$Zoom=d.$Zoom?d.$Zoom-1:1;f.$Zoom=1;if(a.Q()||a.vc())e.$Zoom=b.min(e.$Zoom,2);var N=d.$Rotate;e.$Rotate=N*360*(x?-1:1);f.$Rotate=0}}if(I){if(d.$Clip){var w=d.$ScaleClip||1,i=t.Bb={};if(C&&z){i.$Top=h.eb/2*w;i.$Bottom=-i.$Top}else if(C)i.$Bottom=-h.eb*w;else if(z)i.$Top=h.eb*w;if(B&&A){i.$Left=h.db/2*w;i.$Right=-i.$Left}else if(B)i.$Right=-h.db*w;else if(A)i.$Left=h.db*w}r.$Clip=t;f.$Clip=h[v]}var L=o?1:-1,M=s?1:-1;if(d.x)e.$Left+=n*d.x*L;if(d.y)e.$Top+=l*d.y*M;a.e(e,function(b,c){if(a.Pc(b))if(b!=f[c])r[c]=b-f[c]});u[v]=k?f:e;var D=d.Od,y=b.round(m*d.$Delay/d.$Interval);j[v]=new Array(y);j[v].Cd=y;j[v].zd=y+D-1;for(var F=0;F<=D;F++){var E=a.td(f,r,F/D,d.$Easing,d.$During,d.$Round,{$Move:d.$Move,$OriginalWidth:n,$OriginalHeight:l});E.$ZIndex=E.$ZIndex||1;j[v].push(E)}})});o.reverse();a.e(o,function(b){a.e(b,function(c){var f=c[0],e=c[1],d=f+","+e,b=i;if(e||f)b=a.O(i);a.L(b,u[d]);a.ab(b,"hidden");a.E(b,"absolute");A.Zd(b);m[d]=b;a.A(b,!k)})})}function v(){var a=this,b=0;k.call(a,0,u);a.Gb=function(c,a){if(a-b>j){b=a;e&&e.Ob(a);h&&h.Ob(a)}};a.nb=r}f.Hd=function(){var a=0,c=t.$Transitions,d=c.length;if(w)a=x++%d;else a=b.floor(b.random()*d);c[a]&&(c[a].Z=a);return c[a]};f.Dd=function(w,x,i,k,a){r=a;a=m(a,j);var g=k.id,d=i.id;g["no-image"]=!k.Tb;d["no-image"]=!i.Tb;var l=g,n=d,v=a,c=a.$Brother||m({},j);if(!a.$SlideOut){l=d;n=g}var t=c.$Shift||0;h=new p(o,n,c,b.max(t-c.$Interval,0),s,q);e=new p(o,l,v,b.max(c.$Interval-t,0),s,q);h.Ob(0);e.Ob(0);u=b.max(h.Mc,e.Mc);f.Z=w};f.Db=function(){o.Db();h=i;e=i};f.Jd=function(){var a=i;if(e)a=new v;return a};if(a.Q()||a.vc()||y&&a.oc()<537)j=16;l.call(f);k.call(f,-1e7,1e7)};var f=h.$JssorSlider$=function(q,ec){var n=this;function Dc(){var a=this;k.call(a,-1e8,2e8);a.Td=function(){var c=a.Eb(),d=b.floor(c),f=s(d),e=c-b.floor(c);return{Z:f,Md:d,xb:e}};a.Gb=function(d,a){var e=b.floor(a);if(e!=a&&a>d)e++;Tb(e,c);n.i(f.$EVT_POSITION_CHANGE,s(a),s(d),a,d)}}function Cc(){var b=this;k.call(b,0,0,{ed:r});a.e(D,function(a){A&1&&a.Fd(r);b.nc(a);a.$Shift(hb/ac)})}function Bc(){var a=this,b=Sb.$Elmt;k.call(a,-1,2,{$Easing:d.$EaseLinear,wc:{xb:Yb},ed:r},b,{xb:1},{xb:-2});a.Nb=b}function pc(m,l){var a=this,d,e,h,j,b;k.call(a,-1e8,2e8,{md:100});a.ld=function(){Q=c;U=i;n.i(f.$EVT_SWIPE_START,s(w.T()),w.T())};a.kd=function(){Q=g;j=g;var a=w.Td();n.i(f.$EVT_SWIPE_END,s(w.T()),w.T());!a.xb&&Fc(a.Md,t)};a.Gb=function(g,f){var a;if(j)a=b;else{a=e;if(h){var c=f/h;a=p.$SlideEasing(c)*(e-d)+d}}w.v(a)};a.Qb=function(b,f,c,g){d=b;e=f;h=c;w.v(b);a.v(0);a.fd(c,g)};a.Nd=function(d){j=c;b=d;a.$Play(d,i,c)};a.Sd=function(a){b=a};w=new Dc;w.X(m);w.X(l)}function qc(){var c=this,b=Wb();a.H(b,0);a.cb(b,"pointerEvents","none");c.$Elmt=b;c.Zd=function(c){a.D(b,c);a.A(b)};c.Db=function(){a.K(b);a.jc(b)}}function zc(o,e){var d=this,q,x,N,y,j,C=[],H,v,W,K,Q,G,h,w,m;k.call(d,-u,u+1,{});function F(a){x&&x.Sb();q&&q.Sb();V(o,a);G=c;q=new L.$Class(o,L,1);x=new L.$Class(o,L);x.v(0);q.v(0)}function Y(){q.ZbJ||b>I)){var i=g,q=J/I*b/h;if(p.$FillMode&1)i=q>1;else if(p.$FillMode&2)i=q<1;l=i?h*I/b:J;k=i?I:b*J/h}a.o(j,l);a.n(j,k);a.B(j,(I-k)/2);a.z(j,(J-l)/2)}a.E(j,"absolute");n.i(f.$EVT_LOAD_END,e)}}a.K(r);o&&o(d)}function X(b,c,f,g){if(g==U&&t==e&&R)if(!Ec){var a=s(b);B.Dd(a,e,c,d,f);c.Xe();ab.Jb(a,1);ab.v(a);z.Qb(b,b,0)}}function bb(b){if(b==U&&t==e){if(!h){var a=i;if(B)if(B.Z==e)a=B.Jd();else B.Db();Y();h=new xc(o,e,a,d.Te(),d.Le());h.Jc(m)}!h.$IsPlaying()&&h.zc()}}function T(f,c,g){if(f==e){if(f!=c)D[c]&&D[c].Ue();else!g&&h&&h.Ye();m&&m.$Enable();var j=U=a.J();d.Ab(a.F(i,bb,j))}else{var l=b.abs(e-f),k=u+p.$LazyLoading-1;(!Q||l<=k)&&d.Ab()}}function cb(){if(t==e&&h){h.W();m&&m.$Quit();m&&m.$Disable();h.Oc()}}function fb(){t==e&&h&&h.W()}function Z(a){!M&&n.i(f.$EVT_CLICK,e,a)}function P(){m=w.pInstance;h&&h.Jc(m)}d.Ab=function(d,b){b=b||y;if(C.length&&!K){a.A(b);if(!W){W=c;n.i(f.$EVT_LOAD_START,e);a.e(C,function(b){if(!a.M(b,"src")){b.src=a.t(b,"src2");a.N(b,b["display-origin"])}})}a.bf(C,j,a.F(i,O,d,b))}else O(d,b)};d.df=function(){var g=e;if(p.$AutoPlaySteps<0)g-=r;var c=g+p.$AutoPlaySteps*vc;if(A&2)c=s(c);if(!(A&1))c=b.max(0,b.min(c,r-u));if(c!=e){if(B){var d=B.Hd(r);if(d){var h=U=a.J(),f=D[s(c)];return f.Ab(a.F(i,X,c,f,d,h),y)}}pb(c)}};d.bc=function(){T(e,e,c)};d.Ue=function(){m&&m.$Quit();m&&m.$Disable();d.rd();h&&h.ff();h=i;F()};d.Xe=function(){a.K(o)};d.rd=function(){a.A(o)};d.ef=function(){m&&m.$Enable()};function V(b,e,d){if(a.M(b,"jssor-slider"))return;d=d||0;if(!G){if(b.tagName=="IMG"){C.push(b);if(!a.M(b,"src")){Q=c;b["display-origin"]=a.N(b);a.K(b)}}a.Q()&&a.H(b,(a.H(b)||0)+1);if(p.$HWA&&a.oc())(a.oc()<534||!eb&&!a.ee())&&a.ne(b)}var f=a.V(b);a.e(f,function(f){var i=f.tagName,k=a.t(f,"u");if(k=="player"&&!w){w=f;if(w.pInstance)P();else a.c(w,"dataavailable",P)}if(k=="caption"){if(!a.Wc()&&!e){var h=a.O(f,g,c);a.Wb(h,f,b);a.wb(f,b);f=h;e=c}}else if(!G&&!d&&!j){if(i=="A"){if(a.t(f,"u")=="image")j=a.cf(f,"IMG");else j=a.C(f,"image",c);if(j){H=f;a.L(H,S);v=a.O(H,c);a.N(v,"block");a.L(v,S);a.rb(v,0);a.cb(v,"backgroundColor","#000")}}else if(i=="IMG"&&a.t(f,"u")=="image")j=f;if(j){j.border=0;a.L(j,S)}}V(f,e,d+1)})}d.rc=function(c,b){var a=u-b;Yb(N,a)};d.Te=function(){return q};d.Le=function(){return x};d.Z=e;l.call(d);var E=a.C(o,"thumb",c);if(E){d.hf=a.O(E);a.Kc(E,"id");a.K(E)}a.A(o);y=a.O(db);a.H(y,1e3);a.c(o,"click",Z);F(c);d.Tb=j;d.qd=v;d.id=o;d.Nb=N=o;a.D(N,y);n.$On(203,T);n.$On(28,fb);n.$On(24,cb)}function xc(G,i,p,u,s){var b=this,l=0,w=0,m,h,d,e,j,q,v,r,o=D[i];k.call(b,0,0);function x(){a.jc(O);cc&&j&&o.qd&&a.D(O,o.qd);a.A(O,!j&&o.Tb)}function y(){if(q){q=g;n.i(f.$EVT_ROLLBACK_END,i,d,l,h,d,e);b.v(h)}b.zc()}function z(a){r=a;b.W();b.zc()}b.zc=function(){var a=b.Eb();if(!C&&!Q&&!r&&t==i){if(!a){if(m&&!j){j=c;b.Oc(c);n.i(f.$EVT_SLIDESHOW_START,i,l,w,m,e)}x()}var g,p=f.$EVT_STATE_CHANGE;if(a!=e)if(a==d)g=e;else if(a==h)g=d;else if(!a)g=h;else if(a>d){q=c;g=d;p=f.$EVT_ROLLBACK_START}else g=b.jd();n.i(p,i,a,l,h,d,e);var k=R&&(!E||F);if(a==e)(d!=e&&!(E&12)||k)&&o.df();else(k||a!=d)&&b.fd(g,y)}};b.Ye=function(){d==e&&d==b.Eb()&&b.v(h)};b.ff=function(){B&&B.Z==i&&B.Db();var a=b.Eb();a=m){j=g;x();o.rd();B.Db();n.i(f.$EVT_SLIDESHOW_END,i,l,w,m,e)}n.i(f.$EVT_PROGRESS_CHANGE,i,a,l,h,d,e)};b.Jc=function(a){if(a&&!v){v=a;a.$On($JssorPlayer$.be,z)}};p&&b.nc(p);m=b.Y();b.Y();b.nc(u);h=u.Y();d=h+(a.ec(a.t(G,"idle"))||oc);s.$Shift(d);b.X(s);e=b.Y()}function Yb(g,f){var e=x>0?x:ib,c=Bb*f*(e&1),d=Cb*f*(e>>1&1);c=b.round(c);d=b.round(d);a.z(g,c);a.B(g,d)}function Ob(){rb=Q;Kb=z.jd();G=w.T()}function fc(){Ob();if(C||!F&&E&12){z.W();n.i(f.de)}}function dc(e){if(!C&&(F||!(E&12))&&!z.$IsPlaying()){var c=w.T(),a=b.ceil(G);if(e&&b.abs(H)>=p.$MinDragOffsetToSlide){a=b.ceil(c);a+=gb}if(!(A&1))a=b.min(r-u,b.max(a,0));var d=b.abs(a-c);d=1-b.pow(1-d,5);if(!M&&rb)z.Kd(Kb);else if(c==a){vb.ef();vb.bc()}else z.Qb(c,a,d*Ub)}}function Ib(b){!a.t(a.Ac(b),"nodrag")&&a.Fb(b)}function tc(a){Xb(a,1)}function Xb(b,d){b=a.Xc(b);var k=a.Ac(b);if(!K&&!a.t(k,"nodrag")&&uc()&&(!d||b.touches.length==1)){C=c;Ab=g;U=i;a.c(e,d?"touchmove":"mousemove",Db);a.J();M=0;fc();if(!rb)x=0;if(d){var j=b.touches[0];wb=j.clientX;xb=j.clientY}else{var h=a.Yc(b);wb=h.x;xb=h.y}H=0;cb=0;gb=0;n.i(f.$EVT_DRAG_START,s(G),G,b)}}function Db(e){if(C){e=a.Xc(e);var f;if(e.type!="mousemove"){var l=e.touches[0];f={x:l.clientX,y:l.clientY}}else f=a.Yc(e);if(f){var j=f.x-wb,k=f.y-xb;if(b.floor(G)!=G)x=x||ib&K;if((j||k)&&!x){if(K==3)if(b.abs(k)>b.abs(j))x=2;else x=1;else x=K;if(lb&&x==1&&b.abs(k)-b.abs(j)>3)Ab=c}if(x){var d=k,i=Cb;if(x==1){d=j;i=Bb}if(!(A&1)){if(d>0){var g=i*t,h=d-g;if(h>0)d=g+b.sqrt(h)*5}if(d<0){var g=i*(r-u-t),h=-d-g;if(h>0)d=-g-b.sqrt(h)*5}}if(H-cb<-2)gb=0;else if(H-cb>2)gb=-1;cb=H;H=d;ub=G-H/i/(Z||1);if(H&&x&&!Ab){a.Fb(e);if(!Q)z.Nd(ub);else z.Sd(ub)}}}}}function ob(){rc();if(C){C=g;a.J();a.I(e,"mousemove",Db);a.I(e,"touchmove",Db);M=H;z.W();var b=w.T();n.i(f.$EVT_DRAG_END,s(b),b,s(G),G);E&12&&Ob();dc(c)}}function jc(c){if(M){a.af(c);var b=a.Ac(c);while(b&&v!==b){b.tagName=="A"&&a.Fb(c);try{b=b.parentNode}catch(d){break}}}}function nc(a){D[t];t=s(a);vb=D[t];Tb(a);return t}function Fc(a,b){x=0;nc(a);n.i(f.$EVT_PARK,s(a),b)}function Tb(b,c){N=b;a.e(P,function(a){a.qc(s(b),b,c)})}function uc(){var b=f.pd||0,a=Y;if(lb)a&1&&(a&=1);f.pd|=a;return K=a&~b}function rc(){if(K){f.pd&=~Y;K=0}}function Wb(){var b=a.bb();a.L(b,S);a.E(b,"absolute");return b}function s(a){return(a%r+r)%r}function kc(d,c){var a=d;if(c){if(!A){a=b.min(b.max(a+N,0),r-u);c=g}else if(A&2){a=s(a+N);c=g}}else if(A)a=n.od(a);pb(a,p.$SlideDuration,c)}function zb(){a.e(P,function(a){a.Bc(a.Xb.$ChanceToShow<=F)})}function hc(){if(!F){F=1;zb();if(!C){E&12&&dc();E&3&&D[t].bc()}}}function gc(){if(F){F=0;zb();C||!(E&12)||fc()}}function ic(){S={db:J,eb:I,$Top:0,$Left:0};a.e(V,function(b){a.L(b,S);a.E(b,"absolute");a.ab(b,"hidden");a.K(b)});a.L(db,S)}function nb(b,a){pb(b,a,c)}function pb(f,e,k){if(Qb&&(!C&&(F||!(E&12))||p.$NaviQuitDrag)){Q=c;C=g;z.W();if(e==j)e=Ub;var d=Eb.Eb(),a=f;if(k){a=d+f;if(f>0)a=b.ceil(a);else a=b.floor(a)}if(A&2)a=s(a);if(!(A&1))a=b.max(0,b.min(a,r-u));var i=(a-d)%r;a=d+i;var h=d==a?0:e*b.abs(i);h=b.min(h,e*u*1.5);z.Qb(d,a,h||1)}}n.$PlayTo=pb;n.$GoTo=function(a){w.v(a)};n.$Next=function(){nb(1)};n.$Prev=function(){nb(-1)};n.$Pause=function(){R=g};n.$Play=function(){if(!R){R=c;D[t]&&D[t].bc()}};n.$SetSlideshowTransitions=function(a){p.$SlideshowOptions.$Transitions=a};n.$SetCaptionTransitions=function(b){L.$CaptionTransitions=b;L.Zb=a.J()};n.$SlidesCount=function(){return V.length};n.$CurrentIndex=function(){return t};n.$IsAutoPlaying=function(){return R};n.$IsDragging=function(){return C};n.$IsSliding=function(){return Q};n.$IsMouseOver=function(){return!F};n.$LastDragSucceded=function(){return M};function X(){return a.o(y||q)}function kb(){return a.n(y||q)}n.$OriginalWidth=n.$GetOriginalWidth=X;n.$OriginalHeight=n.$GetOriginalHeight=kb;function Gb(c,d){if(c==j)return a.o(q);if(!y){var b=a.bb(e);a.Ec(b,a.Ec(q));a.Vb(b,a.Vb(q));a.N(b,"block");a.E(b,"relative");a.B(b,0);a.z(b,0);a.ab(b,"visible");y=a.bb(e);a.E(y,"absolute");a.B(y,0);a.z(y,0);a.o(y,a.o(q));a.n(y,a.n(q));a.le(y,"0 0");a.D(y,b);var h=a.V(q);a.D(q,y);a.cb(q,"backgroundImage","");a.e(h,function(c){a.D(a.t(c,"noscale")?q:b,c)})}Z=c/(d?a.n:a.o)(y);a.oe(y,Z);var g=d?Z*X():c,f=d?c:Z*kb();a.o(q,g);a.n(q,f);a.e(P,function(a){a.hc(g,f)})}n.$ScaleHeight=n.$GetScaleHeight=function(b){if(b==j)return a.n(q);Gb(b,c)};n.$ScaleWidth=n.$SetScaleWidth=n.$GetScaleWidth=Gb;n.od=function(a){var d=b.ceil(s(hb/ac)),c=s(a-N+d);if(c>u){if(a-N>r/2)a-=r;else if(a-N<=-r/2)a+=r}else a=N+c-d;return a};l.call(n);n.$Elmt=q=a.hb(q);var p=a.l({$FillMode:0,$LazyLoading:1,$StartIndex:0,$AutoPlay:g,$Loop:1,$HWA:c,$NaviQuitDrag:c,$AutoPlaySteps:1,$AutoPlayInterval:3e3,$PauseOnHover:1,$SlideDuration:500,$SlideEasing:d.$EaseOutQuad,$MinDragOffsetToSlide:20,$SlideSpacing:0,$DisplayPieces:1,$ParkingPosition:0,$UISearchMode:1,$PlayOrientation:1,$DragOrientation:1},ec);if(p.$Idle!=j)p.$AutoPlayInterval=p.$Idle;if(p.$Cols!=j)p.$DisplayPieces=p.$Cols;var ib=p.$PlayOrientation&3,vc=(p.$PlayOrientation&4)/-4||1,fb=p.$SlideshowOptions,L=a.l({$Class:o,$PlayInMode:1,$PlayOutMode:1},p.$CaptionSliderOptions),sb=p.$BulletNavigatorOptions,W=p.$ArrowNavigatorOptions,bb=p.$ThumbnailNavigatorOptions,T=!p.$UISearchMode,y,v=a.C(q,"slides",T),db=a.C(q,"loading",T)||a.bb(e),Jb=a.C(q,"navigator",T),bc=a.C(q,"arrowleft",T),Zb=a.C(q,"arrowright",T),Hb=a.C(q,"thumbnavigator",T),mc=a.o(v),lc=a.n(v),S,V=[],wc=a.V(v);a.e(wc,function(b){if(b.tagName=="DIV"&&!a.t(b,"u"))V.push(b);else a.Q()&&a.H(b,(a.H(b)||0)+1)});var t=-1,N,vb,r=V.length,J=p.$SlideWidth||mc,I=p.$SlideHeight||lc,Vb=p.$SlideSpacing,Bb=J+Vb,Cb=I+Vb,ac=ib&1?Bb:Cb,u=b.min(p.$DisplayPieces,r),jb,x,K,Ab,P=[],Pb,Rb,Nb,cc,Ec,R,E=p.$PauseOnHover,oc=p.$AutoPlayInterval,Ub=p.$SlideDuration,tb,eb,hb,Qb=u1&&tb&&(!a.Wc()||a.Sc()>=8)}hb=eb||u>=r||!(A&1)?0:p.$ParkingPosition;Y=(u>1||hb?ib:-1)&p.$DragOrientation;var yb=v,D=[],B,O,Fb=a.he(),lb=Fb.ie,G,rb,Kb,ub;Fb.dd&&a.cb(yb,Fb.dd,([i,"pan-y","pan-x","none"])[Y]||"");ab=new Bc;if(eb)B=new tb(Sb,J,I,fb,lb);a.D(jb,ab.Nb);a.ab(v,"hidden");O=Wb();a.cb(O,"backgroundColor","#000");a.rb(O,0);a.Wb(O,yb.firstChild,yb);for(var qb=0;qb=t-j.$DisplayPieces);u=c}d.qc=function(b,a,c){if(c)e=a;else{e=b;r(u)}};d.Bc=r;var s;d.hc=function(i,d){if(!s||h.$Scale==g){var e=a.tb(b).clientWidth,d=a.tb(b).clientHeight;if(h.$AutoCenter&1){a.z(b,(e-q)/2);a.z(f,(e-q)/2)}if(h.$AutoCenter&2){a.B(b,(d-o)/2);a.B(f,(d-o)/2)}s=c}};var p;d.gc=function(d){t=d;e=0;if(!p){a.c(b,"click",a.F(i,n,-k));a.c(f,"click",a.F(i,n,k));a.Ub(b);a.Ub(f);p=c}};d.Xb=h=a.l({$Steps:1},j);k=h.$Steps;if(h.$Scale==g){a.M(b,"noscale",c);a.M(f,"noscale",c)}};h.$JssorThumbnailNavigator$=function(k,C){var h=this,z,q,d,w=[],A,y,n,r,s,u,t,p,v,e,o;l.call(h);k=a.hb(k);function B(l,e){var f=this,b,k,j;function n(){k.Ic(q==e)}function g(a){(a||!v.$LastDragSucceded())&&h.i(m.Mb,e)}f.Z=e;f.Hc=n;j=l.hf||l.Tb||a.bb();f.Nb=b=a.Dc(o,"thumbnailtemplate",j,c);k=a.Ub(b);d.$ActionMode&1&&a.c(b,"click",a.F(i,g,0));d.$ActionMode&2&&a.c(b,"mouseover",a.Rb(a.F(i,g,1),b))}h.qc=function(c,d,e){var a=q;q=c;a!=-1&&w[a].Hc();w[c].Hc();!e&&v.$PlayTo(v.od(b.floor(d/n)))};h.Bc=function(b){a.A(k,b)};h.hc=a.ac;var x;h.gc=function(F,C){if(!x){z=F;b.ceil(z/n);q=-1;p=b.min(p,C.length);var h=d.$Orientation&1,l=u+(u+r)*(n-1)*(1-h),j=t+(t+s)*(n-1)*h,o=l+(l+r)*(p-1)*h,m=j+(j+s)*(p-1)*(1-h);a.E(e,"absolute");a.ab(e,"hidden");d.$AutoCenter&1&&a.z(e,(A-o)/2);d.$AutoCenter&2&&a.B(e,(y-m)/2);a.o(e,o);a.n(e,m);var i=[];a.e(C,function(k,f){var g=new B(k,f),d=g.Nb,c=b.floor(f/n),j=f%n;a.z(d,(u+r)*j*(1-h));a.B(d,(t+s)*j*h);if(!i[c]){i[c]=a.bb();a.D(e,i[c])}a.D(i[c],d);w.push(g)});var E=a.l({$HWA:g,$AutoPlay:g,$NaviQuitDrag:g,$SlideWidth:l,$SlideHeight:j,$SlideSpacing:r*h+s*(1-h),$MinDragOffsetToSlide:12,$SlideDuration:200,$PauseOnHover:1,$PlayOrientation:d.$Orientation,$DragOrientation:d.$DisableDrag?0:d.$Orientation},d);v=new f(k,E);x=c}};h.Xb=d=a.l({$SpacingX:3,$SpacingY:3,$DisplayPieces:1,$Orientation:1,$AutoCenter:3,$ActionMode:1},C);if(d.$Rows!=j)d.$Lanes=d.$Rows;A=a.o(k);y=a.n(k);e=a.C(k,"slides",c);o=a.C(e,"prototype");u=a.o(o);t=a.n(o);a.wb(o,e);n=d.$Lanes||1;r=d.$SpacingX;s=d.$SpacingY;p=d.$DisplayPieces;d.$Scale==g&&a.M(k,"noscale",c)};function o(){k.call(this,0,0);this.Sb=a.ac}h.$JssorCaptionSlider$=function(p,h,f){var c=this,g,n=f?h.$PlayInMode:h.$PlayOutMode,e=h.$CaptionTransitions,o={nb:"t",$Delay:"d",$Duration:"du",x:"x",y:"y",$Rotate:"r",$Zoom:"z",$Opacity:"f",lb:"b"},d={Cb:function(b,a){if(!isNaN(a.ob))b=a.ob;else b*=a.ze;return b},$Opacity:function(b,a){return this.Cb(b-1,a)}};d.$Zoom=d.$Opacity;k.call(c,0,0);function l(r,m){var k=[],i,j=[],c=[];function h(c,d){var b={};a.e(o,function(g,h){var e=a.t(c,g+(d||""));if(e){var f={};if(g=="t")f.ob=e;else if(e.indexOf("%")+1)f.ze=a.ec(e)/100;else f.ob=a.ec(e);b[h]=f}});return b}function p(){return e[b.floor(b.random()*e.length)]}function g(f){var h;if(f=="*")h=p();else if(f){var d=e[a.Me(f)]||e[f];if(a.mc(d)){if(f!=i){i=f;c[f]=0;j[f]=d[b.floor(b.random()*d.length)]}else c[f]++;d=j[f];if(a.mc(d)){d=d.length&&d[c[f]%d.length];if(a.mc(d))d=d[b.floor(b.random()*d.length)]}}h=d;if(a.cd(h))h=g(h)}return h}var q=a.V(r);a.e(q,function(b){var c=[];c.$Elmt=b;var e=a.t(b,"u")=="caption";a.e(f?[0,3]:[2],function(k,o){if(e){var j,f;if(k!=2||!a.t(b,"t3")){f=h(b,k);if(k==2&&!f.nb){f.$Delay=f.$Delay||{ob:0};f=a.l(h(b,0),f)}}if(f&&f.nb){j=g(f.nb.ob);if(j){var i=a.l({$Delay:0},j);a.e(f,function(c,a){var b=(d[a]||d.Cb).apply(d,[i[a],f[a]]);if(!isNaN(b))i[a]=b});if(!o)if(f.lb)i.lb=f.lb.ob||0;else if(n&2)i.lb=0}}c.push(i)}if(m%2&&!o)c.V=l(b,m+1)});k.push(c)});return k}function m(w,c,z){var g={$Easing:c.$Easing,$Round:c.$Round,$During:c.$During,$Reverse:f&&!z},m=w,r=a.tb(w),l=a.o(m),j=a.n(m),y=a.o(r),x=a.n(r),h={},e={},i=c.$ScaleClip||1;if(c.$Opacity)e.$Opacity=1-c.$Opacity;g.$OriginalWidth=l;g.$OriginalHeight=j;if(c.$Zoom||c.$Rotate){e.$Zoom=(c.$Zoom||2)-2;if(a.Q()||a.vc())e.$Zoom=b.min(e.$Zoom,1);h.$Zoom=1;var B=c.$Rotate||0;e.$Rotate=B*360;h.$Rotate=0}else if(c.$Clip){var s={$Top:0,$Right:l,$Bottom:j,$Left:0},v=a.l({},s),d=v.Bb={},u=c.$Clip&4,p=c.$Clip&8,t=c.$Clip&1,q=c.$Clip&2;if(u&&p){d.$Top=j/2*i;d.$Bottom=-d.$Top}else if(u)d.$Bottom=-j*i;else if(p)d.$Top=j*i;if(t&&q){d.$Left=l/2*i;d.$Right=-d.$Left}else if(t)d.$Right=-l*i;else if(q)d.$Left=l*i;g.$Move=c.$Move;e.$Clip=v;h.$Clip=s}var n=0,o=0;if(c.x)n-=y*c.x;if(c.y)o-=x*c.y;if(n||o||g.$Move){e.$Left=n;e.$Top=o}var A=c.$Duration;h=a.l(h,a.Vd(m,e));g.wc=a.Wd();return new k(c.$Delay,A,g,m,h,e)}function i(b,d){a.e(d,function(a){var e,h=a.$Elmt,d=a[0],k=a[1];if(d){e=m(h,d);b=e.Jb(d.lb==j?b:d.lb,1)}b=i(b,a.V);if(k){var f=m(h,k,1);f.Jb(b,1);c.X(f);g.X(f)}e&&c.X(e)});return b}c.Sb=function(){c.v(c.Y()*(f||0));g.v(0)};g=new k(0,0);i(0,n?l(p,1):[])};})(window,document,Math,null,true,false) \ No newline at end of file diff --git a/sonicvision/src/main/webapp/styles/application.css b/sonicvision/src/main/webapp/styles/application.css deleted file mode 100644 index 9e79f79..0000000 --- a/sonicvision/src/main/webapp/styles/application.css +++ /dev/null @@ -1,23 +0,0 @@ -th{ -background-color:#0073be; - background-image:-webkit-gradient(linear, left top, left bottom, from(#585858), to(#3d3d3d)); - background-image:-webkit-linear-gradient(top, #0073be, #005a95); - background-image:-moz-linear-gradient(top, #0073be, #005a95); - background-image:-ms-linear-gradient(top, #0073be, #005a95); - background-image:-o-linear-gradient(top, #0073be, #005a95); - background-image:linear-gradient(top, #0073be, #005a95); - clear:both; - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#585858, endColorstr=#3d3d3d); - margin:0 auto; -color:#FFF; -} - -th, td, table { - border: 1px solid #ddd; -} - -#map-canvas { - width: 350px; - height: 300px; - background-color: #CCC; -} diff --git a/spring-annotations/.classpath b/spring-annotations/.classpath deleted file mode 100644 index 9923da8..0000000 --- a/spring-annotations/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring-annotations/.project b/spring-annotations/.project deleted file mode 100644 index 6905826..0000000 --- a/spring-annotations/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - spring-annotations - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/spring-annotations/.settings/org.eclipse.core.resources.prefs b/spring-annotations/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 365bbd6..0000000 --- a/spring-annotations/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/spring-annotations/.settings/org.eclipse.jdt.core.prefs b/spring-annotations/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index bbcbc93..0000000 --- a/spring-annotations/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/spring-annotations/.settings/org.eclipse.m2e.core.prefs b/spring-annotations/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/spring-annotations/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/spring-annotations/.springBeans b/spring-annotations/.springBeans deleted file mode 100644 index 82ca6b5..0000000 --- a/spring-annotations/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/spring-annotations/pom.xml b/spring-annotations/pom.xml deleted file mode 100644 index 6c9a1f6..0000000 --- a/spring-annotations/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - 4.0.0 - - com.training.venkat - spring-annotations - 1.0 - jar - - spring-annotations - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.11 - test - - - org.springframework - spring-context - 3.2.8.RELEASE - - - org.springframework - spring-web - 3.2.8.RELEASE - - - org.springframework - spring-jdbc - 3.2.8.RELEASE - - - com.oracle - ojdbc - 6.0 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.8 - - - copy-dependencies - package - - copy-dependencies - - - ${project.build.directory}/alternateLocation - false - false - true - - - - - - - - diff --git a/spring-annotations/src/main/java/com/training/venkat/spring1/Movie.java b/spring-annotations/src/main/java/com/training/venkat/spring1/Movie.java deleted file mode 100644 index 60e43cf..0000000 --- a/spring-annotations/src/main/java/com/training/venkat/spring1/Movie.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.venkat.spring1; - -public class Movie { - - private String title; - private String type; - private double rentalPrice; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public double getRentalPrice() { - return rentalPrice; - } - - public void setRentalPrice(double rentalPrice) { - this.rentalPrice = rentalPrice; - } - -} diff --git a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieDAO.java b/spring-annotations/src/main/java/com/training/venkat/spring1/MovieDAO.java deleted file mode 100644 index 21c4efa..0000000 --- a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieDAO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.venkat.spring1; - -import java.util.List; - -public interface MovieDAO { - - List getMovies(); - -} diff --git a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieDAODummyImpl.java b/spring-annotations/src/main/java/com/training/venkat/spring1/MovieDAODummyImpl.java deleted file mode 100644 index 1a9b7ab..0000000 --- a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieDAODummyImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.venkat.spring1; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository("dummy") -public class MovieDAODummyImpl implements MovieDAO { - - public List getMovies() { - - Movie movie1 = new Movie(); - - movie1.setTitle("Lego"); - movie1.setType("Bluray"); - movie1.setRentalPrice(2.0); - - Movie movie2 = new Movie(); - movie2.setTitle("Captain America"); - movie2.setType("Bluray"); - movie2.setRentalPrice(2.0); - - List movies = new ArrayList(); - movies.add(movie1); - movies.add(movie2); - - return movies; - - } - -} diff --git a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieDAOJDBCImpl.java b/spring-annotations/src/main/java/com/training/venkat/spring1/MovieDAOJDBCImpl.java deleted file mode 100644 index 4351d67..0000000 --- a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieDAOJDBCImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.venkat.spring1; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository("jdbc") -public class MovieDAOJDBCImpl implements MovieDAO { - - public List getMovies() { - - Movie movie1 = new Movie(); - - movie1.setTitle("Lego From JDBC"); - movie1.setType("Bluray"); - movie1.setRentalPrice(2.0); - - Movie movie2 = new Movie(); - movie2.setTitle("Captain America from JDBC"); - movie2.setType("Bluray"); - movie2.setRentalPrice(2.0); - - List movies = new ArrayList(); - movies.add(movie1); - movies.add(movie2); - - return movies; - } - -} diff --git a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieService.java b/spring-annotations/src/main/java/com/training/venkat/spring1/MovieService.java deleted file mode 100644 index 2f47818..0000000 --- a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.venkat.spring1; - -import java.util.List; - -public interface MovieService { - - List getBluerayMovies(); - -} diff --git a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieServiceImpl.java b/spring-annotations/src/main/java/com/training/venkat/spring1/MovieServiceImpl.java deleted file mode 100644 index 2343da5..0000000 --- a/spring-annotations/src/main/java/com/training/venkat/spring1/MovieServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.venkat.spring1; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -@Service -public class MovieServiceImpl implements MovieService { - - @Autowired - @Qualifier("jdbc") - private MovieDAO dao; - - public List getBluerayMovies() { - - List allMovies = dao.getMovies(); - - List bluerayMovies = new ArrayList(); - - for(Movie movie : allMovies) - { - if(movie.getType().equalsIgnoreCase("BLURAY")) - { - bluerayMovies.add(movie); - } - } - - return bluerayMovies; - } -} diff --git a/spring-annotations/src/main/resources/spring-config.xml b/spring-annotations/src/main/resources/spring-config.xml deleted file mode 100644 index 5256175..0000000 --- a/spring-annotations/src/main/resources/spring-config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/spring-annotations/src/test/java/com/training/venkat/spring1/MovieServiceImplTest2.java b/spring-annotations/src/test/java/com/training/venkat/spring1/MovieServiceImplTest2.java deleted file mode 100644 index 1a72d96..0000000 --- a/spring-annotations/src/test/java/com/training/venkat/spring1/MovieServiceImplTest2.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.venkat.spring1; - -import java.util.List; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class MovieServiceImplTest2 { - - public static void main(String[] args) { - - ApplicationContext context = new ClassPathXmlApplicationContext( - "spring-config.xml"); - - MovieService service = context.getBean(MovieService.class); - - List movies = service.getBluerayMovies(); - for (Movie movie : movies) { - System.out.println("Title = " + movie.getTitle()); - } - - } - -} diff --git a/spring1/.classpath b/spring1/.classpath deleted file mode 100644 index 1344384..0000000 --- a/spring1/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/spring1/.project b/spring1/.project deleted file mode 100644 index d9c636c..0000000 --- a/spring1/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - spring1 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/spring1/.settings/org.eclipse.core.resources.prefs b/spring1/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index f1ca26d..0000000 --- a/spring1/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Tue Mar 06 20:11:45 EST 2012 -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/spring1/.settings/org.eclipse.jdt.core.prefs b/spring1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 9922ef1..0000000 --- a/spring1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Tue Mar 06 20:14:40 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/spring1/.settings/org.eclipse.m2e.core.prefs b/spring1/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 28d725e..0000000 --- a/spring1/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Tue Mar 06 20:11:44 EST 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/spring1/.springBeans b/spring1/.springBeans deleted file mode 100644 index f46b8c8..0000000 --- a/spring1/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/spring1/pom.xml b/spring1/pom.xml deleted file mode 100644 index 9e27849..0000000 --- a/spring1/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - 4.0.0 - - com.training - spring1 - 1.0 - jar - - spring1 - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.10 - test - - - org.springframework - spring-context - 3.0.7.RELEASE - - - mysql - mysql-connector-java - 5.1.18 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - - diff --git a/spring1/src/main/java/com/training/java/spring/DummplyInstrument.java b/spring1/src/main/java/com/training/java/spring/DummplyInstrument.java deleted file mode 100644 index 3dfe609..0000000 --- a/spring1/src/main/java/com/training/java/spring/DummplyInstrument.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.spring; - -public class DummplyInstrument implements Instrument { - - @Override - public void play() { - System.out.println("Mine is dummy"); - } - -} diff --git a/spring1/src/main/java/com/training/java/spring/Instrument.java b/spring1/src/main/java/com/training/java/spring/Instrument.java deleted file mode 100644 index 74ca278..0000000 --- a/spring1/src/main/java/com/training/java/spring/Instrument.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.java.spring; - -public interface Instrument { - - void play(); - -} diff --git a/spring1/src/main/java/com/training/java/spring/Instrumentalist.java b/spring1/src/main/java/com/training/java/spring/Instrumentalist.java deleted file mode 100644 index 4fb85f3..0000000 --- a/spring1/src/main/java/com/training/java/spring/Instrumentalist.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.spring; - -public class Instrumentalist { - - private Instrument instrument; - - public Instrumentalist(Instrument instrument) - { - this.instrument = instrument; - } - - public void playInstrument() - { - instrument.play(); - } - -} diff --git a/spring1/src/main/java/com/training/java/spring/Piano.java b/spring1/src/main/java/com/training/java/spring/Piano.java deleted file mode 100644 index 0a13e8a..0000000 --- a/spring1/src/main/java/com/training/java/spring/Piano.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.spring; - -public class Piano implements Instrument { - - @Override - public void play() - { - System.out.println("Playing piano"); - } -} diff --git a/spring1/src/main/java/com/training/java/spring/Saxaphone.java b/spring1/src/main/java/com/training/java/spring/Saxaphone.java deleted file mode 100644 index 5e0bb90..0000000 --- a/spring1/src/main/java/com/training/java/spring/Saxaphone.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.spring; - -public class Saxaphone implements Instrument { - - @Override - public void play() { - System.out.println("Playing Saxaphone"); - } - -} diff --git a/spring1/src/main/java/com/training/java/spring/two/DAOException.java b/spring1/src/main/java/com/training/java/spring/two/DAOException.java deleted file mode 100644 index 96cb642..0000000 --- a/spring1/src/main/java/com/training/java/spring/two/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.spring.two; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/spring1/src/main/java/com/training/java/spring/two/Student.java b/spring1/src/main/java/com/training/java/spring/two/Student.java deleted file mode 100644 index 1a9ab49..0000000 --- a/spring1/src/main/java/com/training/java/spring/two/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.spring.two; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/spring1/src/main/java/com/training/java/spring/two/StudentDAO.java b/spring1/src/main/java/com/training/java/spring/two/StudentDAO.java deleted file mode 100644 index 7a58c1c..0000000 --- a/spring1/src/main/java/com/training/java/spring/two/StudentDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.java.spring.two; - -import java.util.List; - -interface StudentDAO { - - List getStudents(); -} diff --git a/spring1/src/main/java/com/training/java/spring/two/StudentDAOJDBCImpl.java b/spring1/src/main/java/com/training/java/spring/two/StudentDAOJDBCImpl.java deleted file mode 100644 index e8a13e4..0000000 --- a/spring1/src/main/java/com/training/java/spring/two/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.training.java.spring.two; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/spring1/src/main/java/com/training/java/spring/two/StudentService.java b/spring1/src/main/java/com/training/java/spring/two/StudentService.java deleted file mode 100644 index 67753a0..0000000 --- a/spring1/src/main/java/com/training/java/spring/two/StudentService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.spring.two; - -import java.util.List; - -public interface StudentService { - - List getStudents(); - -} diff --git a/spring1/src/main/java/com/training/java/spring/two/StudentServiceImpl.java b/spring1/src/main/java/com/training/java/spring/two/StudentServiceImpl.java deleted file mode 100644 index e9c4afc..0000000 --- a/spring1/src/main/java/com/training/java/spring/two/StudentServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.java.spring.two; - -import java.util.ArrayList; -import java.util.List; - -public class StudentServiceImpl implements StudentService { - private StudentDAO dao; - - public StudentServiceImpl(StudentDAO dao) { - this.dao = dao; - } - - @Override - public List getStudents() { - List allStudents = dao.getStudents(); - - List troyStudents = new ArrayList(); - - for(Student aStudent : allStudents) - { - if(aStudent.getCity() != null && aStudent.getCity().equalsIgnoreCase("TROY")) - { - troyStudents.add(aStudent); - } - } - - return troyStudents; - } -} diff --git a/spring1/src/main/resources/spring-config.xml b/spring1/src/main/resources/spring-config.xml deleted file mode 100644 index 694da87..0000000 --- a/spring1/src/main/resources/spring-config.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring1/src/test/java/com/training/java/spring/InstrumentalistTest.java b/spring1/src/test/java/com/training/java/spring/InstrumentalistTest.java deleted file mode 100644 index 118b6cb..0000000 --- a/spring1/src/test/java/com/training/java/spring/InstrumentalistTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.spring; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class InstrumentalistTest { - - @Test - public void testPlayInstrument() throws Exception { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - Instrumentalist instrumentalist = (Instrumentalist) context.getBean("jiten"); - - instrumentalist.playInstrument(); - } - -} diff --git a/spring1/src/test/java/com/training/java/spring/two/StudentServiceImplTest.java b/spring1/src/test/java/com/training/java/spring/two/StudentServiceImplTest.java deleted file mode 100644 index 7459c1e..0000000 --- a/spring1/src/test/java/com/training/java/spring/two/StudentServiceImplTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.spring.two; - -import java.util.List; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class StudentServiceImplTest { - - @Test - public void testGetStudents() throws Exception { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - StudentService service = context.getBean(StudentService.class); - List students = service.getStudents(); - - for(Student aStudent : students) - { - System.out.println("City = " + aStudent.getCity()); - } - } - - -} diff --git a/spring1_feb2015/.classpath b/spring1_feb2015/.classpath deleted file mode 100644 index 949eb4c..0000000 --- a/spring1_feb2015/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring1_feb2015/.project b/spring1_feb2015/.project deleted file mode 100644 index b686355..0000000 --- a/spring1_feb2015/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - spring1_feb2015 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/spring1_feb2015/.settings/org.eclipse.core.resources.prefs b/spring1_feb2015/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a..0000000 --- a/spring1_feb2015/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/spring1_feb2015/.settings/org.eclipse.jdt.core.prefs b/spring1_feb2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index bbcbc93..0000000 --- a/spring1_feb2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/spring1_feb2015/.settings/org.eclipse.m2e.core.prefs b/spring1_feb2015/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/spring1_feb2015/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/spring1_feb2015/.springBeans b/spring1_feb2015/.springBeans deleted file mode 100644 index 8cfc0fc..0000000 --- a/spring1_feb2015/.springBeans +++ /dev/null @@ -1,16 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - - - diff --git a/spring1_feb2015/pom.xml b/spring1_feb2015/pom.xml deleted file mode 100644 index 05c23f6..0000000 --- a/spring1_feb2015/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - 4.0.0 - - com.training - spring1_feb2015 - 1.0 - jar - - spring - http://maven.apache.org - - - UTF-8 - - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - - spring1_feb2015 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.7 - 1.7 - - - - - - diff --git a/spring1_feb2015/src/main/java/com/training/spring/Bus.java b/spring1_feb2015/src/main/java/com/training/spring/Bus.java deleted file mode 100644 index e3b58b5..0000000 --- a/spring1_feb2015/src/main/java/com/training/spring/Bus.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Bus implements Vehicle { - - @Override - public void start() { - System.out.println("Starting Bus"); - } - - @Override - public void stop() { - System.out.println("Stopping Bus"); - } - - @Override - public void drive() { - System.out.println("Driving Bus"); - } - -} diff --git a/spring1_feb2015/src/main/java/com/training/spring/Car.java b/spring1_feb2015/src/main/java/com/training/spring/Car.java deleted file mode 100644 index 39c0bfe..0000000 --- a/spring1_feb2015/src/main/java/com/training/spring/Car.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.spring; - -import org.springframework.stereotype.Component; - -@Component("uma") -public class Car implements Vehicle { - - @Override - public void start() { - System.out.println("Starting Car"); - } - - @Override - public void stop() { - System.out.println("Stopping Car"); - } - - @Override - public void drive() { - System.out.println("Driving Car"); - } - -} diff --git a/spring1_feb2015/src/main/java/com/training/spring/Traveller.java b/spring1_feb2015/src/main/java/com/training/spring/Traveller.java deleted file mode 100644 index 497cb5c..0000000 --- a/spring1_feb2015/src/main/java/com/training/spring/Traveller.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.spring; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -public class Traveller { - - @Autowired - @Qualifier("uma") - private Vehicle vehicle; - - public void travel() { - vehicle.start(); - vehicle.drive(); - vehicle.stop(); - } -} diff --git a/spring1_feb2015/src/main/java/com/training/spring/Traveller2.java b/spring1_feb2015/src/main/java/com/training/spring/Traveller2.java deleted file mode 100644 index e489bb8..0000000 --- a/spring1_feb2015/src/main/java/com/training/spring/Traveller2.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.spring; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -public class Traveller2 { - - @Autowired - @Qualifier("bus") - private Vehicle vehicle; - - private String name; - - public void travel() { - name = "Anteneh"; - - System.out.println(name + " is travelling"); - vehicle.start(); - vehicle.drive(); - vehicle.stop(); - } - - public String getName() { - return name; - } -} diff --git a/spring1_feb2015/src/main/java/com/training/spring/Truck.java b/spring1_feb2015/src/main/java/com/training/spring/Truck.java deleted file mode 100644 index b45ade3..0000000 --- a/spring1_feb2015/src/main/java/com/training/spring/Truck.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Truck implements Vehicle { - - @Override - public void start() { - System.out.println("Starting Truck"); - } - - @Override - public void stop() { - System.out.println("Stopping Truck"); - } - - @Override - public void drive() { - System.out.println("Driving Truck"); - } - -} diff --git a/spring1_feb2015/src/main/java/com/training/spring/Vehicle.java b/spring1_feb2015/src/main/java/com/training/spring/Vehicle.java deleted file mode 100644 index 980ef35..0000000 --- a/spring1_feb2015/src/main/java/com/training/spring/Vehicle.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.training.spring; - -public interface Vehicle { - - void start(); - - void stop(); - - void drive(); - -} diff --git a/spring1_feb2015/src/main/resources/spring-config.xml b/spring1_feb2015/src/main/resources/spring-config.xml deleted file mode 100644 index 59a99da..0000000 --- a/spring1_feb2015/src/main/resources/spring-config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/spring1_feb2015/src/test/java/com/training/spring/TravellerDemo.java b/spring1_feb2015/src/test/java/com/training/spring/TravellerDemo.java deleted file mode 100644 index 3d89936..0000000 --- a/spring1_feb2015/src/test/java/com/training/spring/TravellerDemo.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.spring; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class TravellerDemo { - - public static void main(String[] args) { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - Traveller shovan = context.getBean(Traveller.class); - shovan.travel(); - } - -} diff --git a/spring1_feb2015/src/test/java/com/training/spring/TravellerDemo2.java b/spring1_feb2015/src/test/java/com/training/spring/TravellerDemo2.java deleted file mode 100644 index 35dd2b0..0000000 --- a/spring1_feb2015/src/test/java/com/training/spring/TravellerDemo2.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.spring; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class TravellerDemo2 { - - public static void main(String[] args) { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - //Traveller traveller = context.getBean(Traveller.class); - - //traveller.travel(); - - Traveller2 t2 = (Traveller2) context.getBean("traveller2"); - t2.travel(); - } - -} diff --git a/spring2/.classpath b/spring2/.classpath deleted file mode 100644 index 1344384..0000000 --- a/spring2/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/spring2/.project b/spring2/.project deleted file mode 100644 index 8c2e880..0000000 --- a/spring2/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - spring2 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/spring2/.settings/org.eclipse.core.resources.prefs b/spring2/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index a129b01..0000000 --- a/spring2/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 11 08:15:07 EDT 2012 -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/spring2/.settings/org.eclipse.jdt.core.prefs b/spring2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index e041d98..0000000 --- a/spring2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Sun Mar 11 08:15:32 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/spring2/.settings/org.eclipse.m2e.core.prefs b/spring2/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 85d0d97..0000000 --- a/spring2/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 11 08:15:07 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/spring2/.springBeans b/spring2/.springBeans deleted file mode 100644 index f46b8c8..0000000 --- a/spring2/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/spring2/pom.xml b/spring2/pom.xml deleted file mode 100644 index 8100f48..0000000 --- a/spring2/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - 4.0.0 - - com.training - spring2 - 1.0 - jar - - spring1 - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.10 - test - - - org.springframework - spring-context - 3.0.7.RELEASE - - - mysql - mysql-connector-java - 5.1.18 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - - diff --git a/spring2/readme.txt b/spring2/readme.txt deleted file mode 100644 index 9be7fdf..0000000 --- a/spring2/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Setter injection \ No newline at end of file diff --git a/spring2/src/main/java/com/training/java/spring/DummplyInstrument.java b/spring2/src/main/java/com/training/java/spring/DummplyInstrument.java deleted file mode 100644 index 3dfe609..0000000 --- a/spring2/src/main/java/com/training/java/spring/DummplyInstrument.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.spring; - -public class DummplyInstrument implements Instrument { - - @Override - public void play() { - System.out.println("Mine is dummy"); - } - -} diff --git a/spring2/src/main/java/com/training/java/spring/Instrument.java b/spring2/src/main/java/com/training/java/spring/Instrument.java deleted file mode 100644 index 74ca278..0000000 --- a/spring2/src/main/java/com/training/java/spring/Instrument.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.java.spring; - -public interface Instrument { - - void play(); - -} diff --git a/spring2/src/main/java/com/training/java/spring/Instrumentalist.java b/spring2/src/main/java/com/training/java/spring/Instrumentalist.java deleted file mode 100644 index df6eb30..0000000 --- a/spring2/src/main/java/com/training/java/spring/Instrumentalist.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.spring; - -public class Instrumentalist { - - private Instrument instrument; - - public void playInstrument() { - instrument.play(); - } - - public Instrument getInstrument() { - return instrument; - } - - public void setInstrument(Instrument instrument) { - this.instrument = instrument; - } -} diff --git a/spring2/src/main/java/com/training/java/spring/Piano.java b/spring2/src/main/java/com/training/java/spring/Piano.java deleted file mode 100644 index 0a13e8a..0000000 --- a/spring2/src/main/java/com/training/java/spring/Piano.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.spring; - -public class Piano implements Instrument { - - @Override - public void play() - { - System.out.println("Playing piano"); - } -} diff --git a/spring2/src/main/java/com/training/java/spring/Saxaphone.java b/spring2/src/main/java/com/training/java/spring/Saxaphone.java deleted file mode 100644 index 5e0bb90..0000000 --- a/spring2/src/main/java/com/training/java/spring/Saxaphone.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.spring; - -public class Saxaphone implements Instrument { - - @Override - public void play() { - System.out.println("Playing Saxaphone"); - } - -} diff --git a/spring2/src/main/resources/spring-config.xml b/spring2/src/main/resources/spring-config.xml deleted file mode 100644 index 1d2099e..0000000 --- a/spring2/src/main/resources/spring-config.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/spring2/src/test/java/com/training/java/spring/InstrumentalistTest.java b/spring2/src/test/java/com/training/java/spring/InstrumentalistTest.java deleted file mode 100644 index 118b6cb..0000000 --- a/spring2/src/test/java/com/training/java/spring/InstrumentalistTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.spring; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class InstrumentalistTest { - - @Test - public void testPlayInstrument() throws Exception { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - Instrumentalist instrumentalist = (Instrumentalist) context.getBean("jiten"); - - instrumentalist.playInstrument(); - } - -} diff --git a/spring2_feb2015/.classpath b/spring2_feb2015/.classpath deleted file mode 100644 index 949eb4c..0000000 --- a/spring2_feb2015/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring2_feb2015/.project b/spring2_feb2015/.project deleted file mode 100644 index b686355..0000000 --- a/spring2_feb2015/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - spring1_feb2015 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/spring2_feb2015/.settings/org.eclipse.core.resources.prefs b/spring2_feb2015/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a..0000000 --- a/spring2_feb2015/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/spring2_feb2015/.settings/org.eclipse.jdt.core.prefs b/spring2_feb2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index bbcbc93..0000000 --- a/spring2_feb2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/spring2_feb2015/.settings/org.eclipse.m2e.core.prefs b/spring2_feb2015/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/spring2_feb2015/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/spring2_feb2015/.springBeans b/spring2_feb2015/.springBeans deleted file mode 100644 index 8cfc0fc..0000000 --- a/spring2_feb2015/.springBeans +++ /dev/null @@ -1,16 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - - - diff --git a/spring2_feb2015/pom.xml b/spring2_feb2015/pom.xml deleted file mode 100644 index 05c23f6..0000000 --- a/spring2_feb2015/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - 4.0.0 - - com.training - spring1_feb2015 - 1.0 - jar - - spring - http://maven.apache.org - - - UTF-8 - - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - - spring1_feb2015 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.7 - 1.7 - - - - - - diff --git a/spring2_feb2015/src/main/java/com/training/spring/Bus.java b/spring2_feb2015/src/main/java/com/training/spring/Bus.java deleted file mode 100644 index e3b58b5..0000000 --- a/spring2_feb2015/src/main/java/com/training/spring/Bus.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Bus implements Vehicle { - - @Override - public void start() { - System.out.println("Starting Bus"); - } - - @Override - public void stop() { - System.out.println("Stopping Bus"); - } - - @Override - public void drive() { - System.out.println("Driving Bus"); - } - -} diff --git a/spring2_feb2015/src/main/java/com/training/spring/Car.java b/spring2_feb2015/src/main/java/com/training/spring/Car.java deleted file mode 100644 index 00f0ce9..0000000 --- a/spring2_feb2015/src/main/java/com/training/spring/Car.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Car implements Vehicle { - - @Override - public void start() { - System.out.println("Starting Car"); - } - - @Override - public void stop() { - System.out.println("Stopping Car"); - } - - @Override - public void drive() { - System.out.println("Driving Car"); - } - -} diff --git a/spring2_feb2015/src/main/java/com/training/spring/Traveller.java b/spring2_feb2015/src/main/java/com/training/spring/Traveller.java deleted file mode 100644 index 13c315e..0000000 --- a/spring2_feb2015/src/main/java/com/training/spring/Traveller.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.spring; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -public class Traveller { - - @Autowired - @Qualifier("car") - private Vehicle vehicle; - - public void travel() { - vehicle.start(); - vehicle.drive(); - vehicle.stop(); - } -} diff --git a/spring2_feb2015/src/main/java/com/training/spring/Traveller2.java b/spring2_feb2015/src/main/java/com/training/spring/Traveller2.java deleted file mode 100644 index 6d5d7ab..0000000 --- a/spring2_feb2015/src/main/java/com/training/spring/Traveller2.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Traveller2 { - - private Vehicle vehicle; - private String name; - - public void travel() { - System.out.println(name + " is travelling"); - vehicle.start(); - vehicle.drive(); - vehicle.stop(); - } - - public void setVehicle(Vehicle vehicle) { - this.vehicle = vehicle; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/spring2_feb2015/src/main/java/com/training/spring/Truck.java b/spring2_feb2015/src/main/java/com/training/spring/Truck.java deleted file mode 100644 index b45ade3..0000000 --- a/spring2_feb2015/src/main/java/com/training/spring/Truck.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Truck implements Vehicle { - - @Override - public void start() { - System.out.println("Starting Truck"); - } - - @Override - public void stop() { - System.out.println("Stopping Truck"); - } - - @Override - public void drive() { - System.out.println("Driving Truck"); - } - -} diff --git a/spring2_feb2015/src/main/java/com/training/spring/Vehicle.java b/spring2_feb2015/src/main/java/com/training/spring/Vehicle.java deleted file mode 100644 index 980ef35..0000000 --- a/spring2_feb2015/src/main/java/com/training/spring/Vehicle.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.training.spring; - -public interface Vehicle { - - void start(); - - void stop(); - - void drive(); - -} diff --git a/spring2_feb2015/src/main/resources/spring-config.xml b/spring2_feb2015/src/main/resources/spring-config.xml deleted file mode 100644 index dbfb6fa..0000000 --- a/spring2_feb2015/src/main/resources/spring-config.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/spring2_feb2015/src/test/java/com/training/spring/TravellerDemo.java b/spring2_feb2015/src/test/java/com/training/spring/TravellerDemo.java deleted file mode 100644 index 25cf0a5..0000000 --- a/spring2_feb2015/src/test/java/com/training/spring/TravellerDemo.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.spring; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class TravellerDemo { - - public static void main(String[] args) { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - - Traveller t2 = context.getBean(Traveller.class); - t2.travel(); - } - -} diff --git a/spring3/.classpath b/spring3/.classpath deleted file mode 100644 index 1344384..0000000 --- a/spring3/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/spring3/.project b/spring3/.project deleted file mode 100644 index 777f0c9..0000000 --- a/spring3/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - spring3 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/spring3/.settings/org.eclipse.core.resources.prefs b/spring3/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 338b4d2..0000000 --- a/spring3/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 11 09:26:15 EDT 2012 -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/spring3/.settings/org.eclipse.jdt.core.prefs b/spring3/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 05826e0..0000000 --- a/spring3/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Sun Mar 11 09:27:18 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/spring3/.settings/org.eclipse.m2e.core.prefs b/spring3/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index b14242d..0000000 --- a/spring3/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 11 09:26:15 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/spring3/.springBeans b/spring3/.springBeans deleted file mode 100644 index f46b8c8..0000000 --- a/spring3/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/spring3/pom.xml b/spring3/pom.xml deleted file mode 100644 index d0ef5fc..0000000 --- a/spring3/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - 4.0.0 - - com.training - spring3 - 1.0 - jar - - spring1 - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.10 - test - - - org.springframework - spring-context - 3.0.7.RELEASE - - - mysql - mysql-connector-java - 5.1.18 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - - diff --git a/spring3/readme.txt b/spring3/readme.txt deleted file mode 100644 index 3567dd5..0000000 --- a/spring3/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Spring annotations \ No newline at end of file diff --git a/spring3/src/main/java/com/training/java/spring/DummplyInstrument.java b/spring3/src/main/java/com/training/java/spring/DummplyInstrument.java deleted file mode 100644 index 3dfe609..0000000 --- a/spring3/src/main/java/com/training/java/spring/DummplyInstrument.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.spring; - -public class DummplyInstrument implements Instrument { - - @Override - public void play() { - System.out.println("Mine is dummy"); - } - -} diff --git a/spring3/src/main/java/com/training/java/spring/Instrument.java b/spring3/src/main/java/com/training/java/spring/Instrument.java deleted file mode 100644 index 74ca278..0000000 --- a/spring3/src/main/java/com/training/java/spring/Instrument.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.java.spring; - -public interface Instrument { - - void play(); - -} diff --git a/spring3/src/main/java/com/training/java/spring/Instrumentalist.java b/spring3/src/main/java/com/training/java/spring/Instrumentalist.java deleted file mode 100644 index d1875ab..0000000 --- a/spring3/src/main/java/com/training/java/spring/Instrumentalist.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.spring; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -public class Instrumentalist { - - @Autowired - @Qualifier("piano") - private Instrument instrument; - - public void playInstrument() { - instrument.play(); - } -} diff --git a/spring3/src/main/java/com/training/java/spring/Piano.java b/spring3/src/main/java/com/training/java/spring/Piano.java deleted file mode 100644 index f6abe1f..0000000 --- a/spring3/src/main/java/com/training/java/spring/Piano.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Piano implements Instrument { - - @Override - public void play() - { - System.out.println("Playing piano"); - } -} diff --git a/spring3/src/main/java/com/training/java/spring/Saxaphone.java b/spring3/src/main/java/com/training/java/spring/Saxaphone.java deleted file mode 100644 index 7469aae..0000000 --- a/spring3/src/main/java/com/training/java/spring/Saxaphone.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Saxaphone implements Instrument { - - @Override - public void play() { - System.out.println("Playing Saxaphone"); - } - -} diff --git a/spring3/src/main/java/com/training/java/spring/two/DAOException.java b/spring3/src/main/java/com/training/java/spring/two/DAOException.java deleted file mode 100644 index 96cb642..0000000 --- a/spring3/src/main/java/com/training/java/spring/two/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.spring.two; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/spring3/src/main/java/com/training/java/spring/two/Student.java b/spring3/src/main/java/com/training/java/spring/two/Student.java deleted file mode 100644 index 1a9ab49..0000000 --- a/spring3/src/main/java/com/training/java/spring/two/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.spring.two; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/spring3/src/main/java/com/training/java/spring/two/StudentDAO.java b/spring3/src/main/java/com/training/java/spring/two/StudentDAO.java deleted file mode 100644 index 7a58c1c..0000000 --- a/spring3/src/main/java/com/training/java/spring/two/StudentDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.java.spring.two; - -import java.util.List; - -interface StudentDAO { - - List getStudents(); -} diff --git a/spring3/src/main/java/com/training/java/spring/two/StudentDAOJDBCImpl.java b/spring3/src/main/java/com/training/java/spring/two/StudentDAOJDBCImpl.java deleted file mode 100644 index e8a13e4..0000000 --- a/spring3/src/main/java/com/training/java/spring/two/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.training.java.spring.two; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/spring3/src/main/java/com/training/java/spring/two/StudentService.java b/spring3/src/main/java/com/training/java/spring/two/StudentService.java deleted file mode 100644 index 67753a0..0000000 --- a/spring3/src/main/java/com/training/java/spring/two/StudentService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.spring.two; - -import java.util.List; - -public interface StudentService { - - List getStudents(); - -} diff --git a/spring3/src/main/java/com/training/java/spring/two/StudentServiceImpl.java b/spring3/src/main/java/com/training/java/spring/two/StudentServiceImpl.java deleted file mode 100644 index 5819824..0000000 --- a/spring3/src/main/java/com/training/java/spring/two/StudentServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.java.spring.two; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class StudentServiceImpl implements StudentService { - - @Autowired - private StudentDAO dao; - - @Override - public List getStudents() { - List allStudents = dao.getStudents(); - - List troyStudents = new ArrayList(); - - for(Student aStudent : allStudents) - { - if(aStudent.getCity() != null && aStudent.getCity().equalsIgnoreCase("TROY")) - { - troyStudents.add(aStudent); - } - } - - return troyStudents; - } -} diff --git a/spring3/src/main/resources/spring-config.xml b/spring3/src/main/resources/spring-config.xml deleted file mode 100644 index 3b5ae63..0000000 --- a/spring3/src/main/resources/spring-config.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - diff --git a/spring3/src/test/java/com/training/java/spring/InstrumentalistTest.java b/spring3/src/test/java/com/training/java/spring/InstrumentalistTest.java deleted file mode 100644 index 212834f..0000000 --- a/spring3/src/test/java/com/training/java/spring/InstrumentalistTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.java.spring; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class InstrumentalistTest { - - @Test - public void testPlayInstrument() throws Exception { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - Instrumentalist instrumentalist = context.getBean(Instrumentalist.class); - - instrumentalist.playInstrument(); - } - -} diff --git a/spring3/src/test/java/com/training/java/spring/two/StudentServiceImplTest.java b/spring3/src/test/java/com/training/java/spring/two/StudentServiceImplTest.java deleted file mode 100644 index 7459c1e..0000000 --- a/spring3/src/test/java/com/training/java/spring/two/StudentServiceImplTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.spring.two; - -import java.util.List; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class StudentServiceImplTest { - - @Test - public void testGetStudents() throws Exception { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - StudentService service = context.getBean(StudentService.class); - List students = service.getStudents(); - - for(Student aStudent : students) - { - System.out.println("City = " + aStudent.getCity()); - } - } - - -} diff --git a/springaop/.classpath b/springaop/.classpath deleted file mode 100644 index 1344384..0000000 --- a/springaop/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/springaop/.project b/springaop/.project deleted file mode 100644 index 1192bc0..0000000 --- a/springaop/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - springaop - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/springaop/.settings/org.eclipse.core.resources.prefs b/springaop/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index aace8ce..0000000 --- a/springaop/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 11 11:29:47 EDT 2012 -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/springaop/.settings/org.eclipse.jdt.core.prefs b/springaop/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 92fb804..0000000 --- a/springaop/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Sun Mar 11 11:31:32 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/springaop/.settings/org.eclipse.m2e.core.prefs b/springaop/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 1ca3c94..0000000 --- a/springaop/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 11 11:29:47 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/springaop/.springBeans b/springaop/.springBeans deleted file mode 100644 index f46b8c8..0000000 --- a/springaop/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/springaop/pom.xml b/springaop/pom.xml deleted file mode 100644 index a505263..0000000 --- a/springaop/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - 4.0.0 - - com.training - springaop - 1.0 - jar - - spring1 - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.10 - test - - - org.springframework - spring-context - 3.0.7.RELEASE - - - mysql - mysql-connector-java - 5.1.18 - - - org.aspectj - aspectjrt - 1.6.8 - - - org.aspectj - aspectjweaver - 1.6.8 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - - diff --git a/springaop/src/main/java/com/training/java/spring/aspects/LoggingAspect.java b/springaop/src/main/java/com/training/java/spring/aspects/LoggingAspect.java deleted file mode 100644 index 9096303..0000000 --- a/springaop/src/main/java/com/training/java/spring/aspects/LoggingAspect.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.training.java.spring.aspects; - -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.springframework.stereotype.Component; - -@Component -@Aspect -public class LoggingAspect { - - @Pointcut("execution(* com.training.java.spring.two.*.*(..))") - public void loggingPointcut() { - - } - - @Around("loggingPointcut()") - public Object logAround(ProceedingJoinPoint joinPoint) - { - System.out.println("Before method.." - + joinPoint.getSignature().getName() + " in " - + joinPoint.getTarget().getClass().getSimpleName()); - - Object returnValue = null; - - try { - returnValue = joinPoint.proceed(); - } catch (Throwable e) { - System.out.println("I GOT ERROR!"); - } - - System.out.println("After method.." - + joinPoint.getSignature().getName() + " in " - + joinPoint.getTarget().getClass().getSimpleName()); - - return returnValue; - } - - /*@Before("loggingPointcut()") - public void logBefore(JoinPoint joinPoint) { - System.out.println("Before method.." - + joinPoint.getSignature().getName() + " in " - + joinPoint.getTarget().getClass().getSimpleName()); - } - - @After("loggingPointcut()") - public void logAfter(JoinPoint joinPoint) - { - System.out.println("After method.." - + joinPoint.getSignature().getName() + " in " - + joinPoint.getTarget().getClass().getSimpleName()); - }*/ - -} diff --git a/springaop/src/main/java/com/training/java/spring/two/DAOException.java b/springaop/src/main/java/com/training/java/spring/two/DAOException.java deleted file mode 100644 index 96cb642..0000000 --- a/springaop/src/main/java/com/training/java/spring/two/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.spring.two; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/springaop/src/main/java/com/training/java/spring/two/Student.java b/springaop/src/main/java/com/training/java/spring/two/Student.java deleted file mode 100644 index 1a9ab49..0000000 --- a/springaop/src/main/java/com/training/java/spring/two/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.spring.two; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/springaop/src/main/java/com/training/java/spring/two/StudentDAO.java b/springaop/src/main/java/com/training/java/spring/two/StudentDAO.java deleted file mode 100644 index 7a58c1c..0000000 --- a/springaop/src/main/java/com/training/java/spring/two/StudentDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.java.spring.two; - -import java.util.List; - -interface StudentDAO { - - List getStudents(); -} diff --git a/springaop/src/main/java/com/training/java/spring/two/StudentDAOJDBCImpl.java b/springaop/src/main/java/com/training/java/spring/two/StudentDAOJDBCImpl.java deleted file mode 100644 index e8a13e4..0000000 --- a/springaop/src/main/java/com/training/java/spring/two/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.training.java.spring.two; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/springaop/src/main/java/com/training/java/spring/two/StudentService.java b/springaop/src/main/java/com/training/java/spring/two/StudentService.java deleted file mode 100644 index 67753a0..0000000 --- a/springaop/src/main/java/com/training/java/spring/two/StudentService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.spring.two; - -import java.util.List; - -public interface StudentService { - - List getStudents(); - -} diff --git a/springaop/src/main/java/com/training/java/spring/two/StudentServiceImpl.java b/springaop/src/main/java/com/training/java/spring/two/StudentServiceImpl.java deleted file mode 100644 index 5819824..0000000 --- a/springaop/src/main/java/com/training/java/spring/two/StudentServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.java.spring.two; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class StudentServiceImpl implements StudentService { - - @Autowired - private StudentDAO dao; - - @Override - public List getStudents() { - List allStudents = dao.getStudents(); - - List troyStudents = new ArrayList(); - - for(Student aStudent : allStudents) - { - if(aStudent.getCity() != null && aStudent.getCity().equalsIgnoreCase("TROY")) - { - troyStudents.add(aStudent); - } - } - - return troyStudents; - } -} diff --git a/springaop/src/main/resources/spring-config.xml b/springaop/src/main/resources/spring-config.xml deleted file mode 100644 index e570efc..0000000 --- a/springaop/src/main/resources/spring-config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/springaop/src/test/java/com/training/java/spring/two/StudentServiceImplTest.java b/springaop/src/test/java/com/training/java/spring/two/StudentServiceImplTest.java deleted file mode 100644 index 7459c1e..0000000 --- a/springaop/src/test/java/com/training/java/spring/two/StudentServiceImplTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.spring.two; - -import java.util.List; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class StudentServiceImplTest { - - @Test - public void testGetStudents() throws Exception { - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - StudentService service = context.getBean(StudentService.class); - List students = service.getStudents(); - - for(Student aStudent : students) - { - System.out.println("City = " + aStudent.getCity()); - } - } - - -} diff --git a/springdayone/.classpath b/springdayone/.classpath deleted file mode 100644 index 1344384..0000000 --- a/springdayone/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/springdayone/.project b/springdayone/.project deleted file mode 100644 index f9575f8..0000000 --- a/springdayone/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - springdayone - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/springdayone/.settings/org.eclipse.core.resources.prefs b/springdayone/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 6aa3d62..0000000 --- a/springdayone/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Tue Apr 17 19:32:22 EDT 2012 -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/springdayone/.settings/org.eclipse.jdt.core.prefs b/springdayone/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2865846..0000000 --- a/springdayone/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Tue Apr 17 19:34:38 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/springdayone/.settings/org.eclipse.m2e.core.prefs b/springdayone/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 726f2fb..0000000 --- a/springdayone/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Tue Apr 17 19:32:21 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/springdayone/.springBeans b/springdayone/.springBeans deleted file mode 100644 index f46b8c8..0000000 --- a/springdayone/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/springdayone/pom.xml b/springdayone/pom.xml deleted file mode 100644 index 23f8f54..0000000 --- a/springdayone/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - 4.0.0 - - com.training - springdayone - 1.0 - jar - - springdayone - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.10 - test - - - org.springframework - spring-context - 3.0.7.RELEASE - - - mysql - mysql-connector-java - 5.1.18 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/springdayone/src/main/java/com/training/spring/two/Car.java b/springdayone/src/main/java/com/training/spring/two/Car.java deleted file mode 100644 index c798d56..0000000 --- a/springdayone/src/main/java/com/training/spring/two/Car.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.spring.two; - -public class Car -{ - private int id; - private String type; - private String make; - private String model; - private int year; - private double price; - - public Car(int id, String type, String make, String model, int year, - double price) - { - this(type, make, model, year, price); - this.id = id; - } - - public Car(String type, String make, String model, int year, double price) - { - this.type = type; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - } - - public int getId() - { - return id; - } - - public String getMake() - { - return make; - } - - public String getModel() - { - return model; - } - - public int getYear() - { - return year; - } - - public double getPrice() - { - return price; - } - - public String getType() - { - return type; - } -} diff --git a/springdayone/src/main/java/com/training/spring/two/CarDAO.java b/springdayone/src/main/java/com/training/spring/two/CarDAO.java deleted file mode 100644 index fc48eaf..0000000 --- a/springdayone/src/main/java/com/training/spring/two/CarDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.spring.two; - -import java.util.List; - - -interface CarDAO { - void createCar(Car car); - List getAllCars(); - Car getCarById(int id); - void update(Car car); - void delete(int id); -} diff --git a/springdayone/src/main/java/com/training/spring/two/CarDAODummyImpl.java b/springdayone/src/main/java/com/training/spring/two/CarDAODummyImpl.java deleted file mode 100644 index 1e16e4c..0000000 --- a/springdayone/src/main/java/com/training/spring/two/CarDAODummyImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.training.spring.two; - -import java.util.ArrayList; -import java.util.List; - -public class CarDAODummyImpl implements CarDAO -{ - - @Override - public void createCar(Car car) - { - // TODO Auto-generated method stub - - } - - @Override - public List getAllCars() - { - List cars = new ArrayList(); - - Car car1 = new Car("Sedan", "Ford", "Tarus", 2012, 12000.00); - Car car2 = new Car("Sedan", "Toyota", "Corolla", 2011, 13000.00); - - cars.add(car1); - cars.add(car2); - - return cars; - } - - @Override - public Car getCarById(int id) - { - // TODO Auto-generated method stub - return null; - } - - @Override - public void update(Car car) - { - // TODO Auto-generated method stub - - } - - @Override - public void delete(int id) - { - // TODO Auto-generated method stub - - } - -} diff --git a/springdayone/src/main/java/com/training/spring/two/CarDAOJDBCImpl.java b/springdayone/src/main/java/com/training/spring/two/CarDAOJDBCImpl.java deleted file mode 100644 index 25256a3..0000000 --- a/springdayone/src/main/java/com/training/spring/two/CarDAOJDBCImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.training.spring.two; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class CarDAOJDBCImpl implements CarDAO -{ - - CarDAOJDBCImpl() - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) - { - throw new DAOException(e); - } - } - - @Override - public List getAllCars() - { - - List cars = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try - { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from car"); - - while (rs.next()) - { - int id = rs.getInt("id"); - - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - Car car = new Car(id, type, make, model, year, price); - cars.add(car); - } - return cars; - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(rs, stmt, con); - } - } - - @Override - public void createCar(Car car) - { - - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("insert into car(type, make, model, year, price) values(?,?,?,?,?)"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - @Override - public Car getCarById(int id) - { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Car car = null; - try - { - con = getConnection(); - stmt = con.prepareStatement("select * from car where id = ?"); - stmt.setInt(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) - { - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - car = new Car(id, type, make, model, year, price); - } - return car; - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - private Connection getConnection() throws SQLException - { - return DriverManager.getConnection("jdbc:mysql://localhost/training", - "root", "password"); - - } - - private void closeResources(ResultSet rs, Statement stmt, Connection con) - { - if (rs != null) - { - try - { - rs.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (stmt != null) - { - try - { - stmt.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (con != null) - { - try - { - con.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - - } - - @Override - public void update(Car car) - { - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("update car set type = ?, make = ?, model= ?, year = ?, price = ? where id = ?"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - stmt.setInt(6, car.getId()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - } - - @Override - public void delete(int id) - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con.prepareStatement("delete from car where id = ?"); - stmt.setInt(1, id); - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } -} diff --git a/springdayone/src/main/java/com/training/spring/two/CarService.java b/springdayone/src/main/java/com/training/spring/two/CarService.java deleted file mode 100644 index f204c33..0000000 --- a/springdayone/src/main/java/com/training/spring/two/CarService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.spring.two; - -import java.util.List; - -public interface CarService -{ - void create(Car car); - List getAllCars(); -} diff --git a/springdayone/src/main/java/com/training/spring/two/CarServiceImpl.java b/springdayone/src/main/java/com/training/spring/two/CarServiceImpl.java deleted file mode 100644 index 4bf5527..0000000 --- a/springdayone/src/main/java/com/training/spring/two/CarServiceImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.training.spring.two; - -import java.util.ArrayList; -import java.util.List; - -public class CarServiceImpl implements CarService -{ - private CarDAO dao; - - public CarServiceImpl(CarDAO dao) - { - this.dao = dao; - } - - @Override - public void create(Car car) - { - dao.createCar(car); - } - - @Override - public List getAllCars() - { - List allCars = dao.getAllCars(); - - List fordCars = new ArrayList(); - - for (Car aCar : allCars) - { - if (aCar.getMake() != null - && aCar.getMake().equalsIgnoreCase("FORD")) - { - fordCars.add(aCar); - } - } - - return fordCars; - } -} diff --git a/springdayone/src/main/java/com/training/spring/two/DAOException.java b/springdayone/src/main/java/com/training/spring/two/DAOException.java deleted file mode 100644 index d901200..0000000 --- a/springdayone/src/main/java/com/training/spring/two/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.spring.two; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(Throwable ex) { - super(ex); - } -} diff --git a/springdayone/src/main/java/com/training/springdayone/Car.java b/springdayone/src/main/java/com/training/springdayone/Car.java deleted file mode 100644 index ea2cc3c..0000000 --- a/springdayone/src/main/java/com/training/springdayone/Car.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.springdayone; - -public class Car implements Vehicle -{ - @Override - public void start() - { - System.out.println("Car is starting"); - } - - @Override - public void drive() - { - System.out.println("Car is driving"); - } - - @Override - public void stop() - { - System.out.println("Car is stopping"); - } -} diff --git a/springdayone/src/main/java/com/training/springdayone/MockVehicle.java b/springdayone/src/main/java/com/training/springdayone/MockVehicle.java deleted file mode 100644 index 8c48f4a..0000000 --- a/springdayone/src/main/java/com/training/springdayone/MockVehicle.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.springdayone; - -public class MockVehicle implements Vehicle -{ - @Override - public void start() - { - System.out.println("Dummy start"); - } - - @Override - public void drive() - { - System.out.println("Dummy drive"); - } - - @Override - public void stop() - { - System.out.println("Dummy stop"); - } -} diff --git a/springdayone/src/main/java/com/training/springdayone/Traveller.java b/springdayone/src/main/java/com/training/springdayone/Traveller.java deleted file mode 100644 index e4d98f0..0000000 --- a/springdayone/src/main/java/com/training/springdayone/Traveller.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.springdayone; - -public class Traveller -{ - private Vehicle vehicle; - - public Traveller(Vehicle vehicle) - { - this.vehicle = vehicle; - } - - public void travel() - { - vehicle.start(); - vehicle.drive(); - vehicle.stop(); - } - -} diff --git a/springdayone/src/main/java/com/training/springdayone/Truck.java b/springdayone/src/main/java/com/training/springdayone/Truck.java deleted file mode 100644 index 2ff0f89..0000000 --- a/springdayone/src/main/java/com/training/springdayone/Truck.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.springdayone; - -public class Truck implements Vehicle -{ - - @Override - public void start() - { - System.out.println("Truck is starting"); - } - - @Override - public void drive() - { - System.out.println("Truck is driving"); - } - - @Override - public void stop() - { - System.out.println("Truck is stopping"); - } -} diff --git a/springdayone/src/main/java/com/training/springdayone/Vehicle.java b/springdayone/src/main/java/com/training/springdayone/Vehicle.java deleted file mode 100644 index d584fae..0000000 --- a/springdayone/src/main/java/com/training/springdayone/Vehicle.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.springdayone; - -public interface Vehicle -{ - void start(); - void drive(); - void stop(); -} diff --git a/springdayone/src/main/resources/spring-config.xml b/springdayone/src/main/resources/spring-config.xml deleted file mode 100644 index 5ef9a54..0000000 --- a/springdayone/src/main/resources/spring-config.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/springdayone/src/test/java/com/training/spring/two/CarServiceImplTest.java b/springdayone/src/test/java/com/training/spring/two/CarServiceImplTest.java deleted file mode 100644 index 3fb2e7c..0000000 --- a/springdayone/src/test/java/com/training/spring/two/CarServiceImplTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.training.spring.two; - -import static junit.framework.Assert.assertEquals; - -import java.util.List; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class CarServiceImplTest -{ - @Test - public void testGetAllCars() throws Exception - { - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - CarService service = context.getBean(CarService.class); - - List cars = service.getAllCars(); - assertEquals(11, cars.size()); - - for(Car aCar : cars) - { - System.out.println("Make = " + aCar.getMake()); - System.out.println("Model = " + aCar.getModel()); - System.out.println("Price = " + aCar.getPrice()); - } - } -} diff --git a/springdayone/src/test/java/com/training/springdayone/TravellerTest.java b/springdayone/src/test/java/com/training/springdayone/TravellerTest.java deleted file mode 100644 index cfc9515..0000000 --- a/springdayone/src/test/java/com/training/springdayone/TravellerTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.training.springdayone; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class TravellerTest -{ - @Test - public void testTravel() throws Exception - { - //ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - //Traveller traveller = (Traveller) context.getBean("traveller"); - - Vehicle vehicle = new MockVehicle(); - Traveller traveller = new Traveller(vehicle); - traveller.travel(); - } -} diff --git a/springdaytwo/.classpath b/springdaytwo/.classpath deleted file mode 100644 index 1344384..0000000 --- a/springdaytwo/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/springdaytwo/.project b/springdaytwo/.project deleted file mode 100644 index b6b7450..0000000 --- a/springdaytwo/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - springdaytwo - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/springdaytwo/.settings/org.eclipse.core.resources.prefs b/springdaytwo/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 5008a22..0000000 --- a/springdaytwo/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Thu Apr 19 19:52:20 EDT 2012 -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/springdaytwo/.settings/org.eclipse.jdt.core.prefs b/springdaytwo/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index fdfefed..0000000 --- a/springdaytwo/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Thu Apr 19 19:52:56 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/springdaytwo/.settings/org.eclipse.m2e.core.prefs b/springdaytwo/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index e04b669..0000000 --- a/springdaytwo/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Thu Apr 19 19:52:20 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/springdaytwo/.springBeans b/springdaytwo/.springBeans deleted file mode 100644 index f46b8c8..0000000 --- a/springdaytwo/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/springdaytwo/pom.xml b/springdaytwo/pom.xml deleted file mode 100644 index 9696462..0000000 --- a/springdaytwo/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - 4.0.0 - - com.training - springdaytwo - 1.0 - jar - - springdaytwo - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.10 - test - - - org.springframework - spring-context - 3.0.7.RELEASE - - - mysql - mysql-connector-java - 5.1.18 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/springdaytwo/src/main/java/com/training/spring/two/Car.java b/springdaytwo/src/main/java/com/training/spring/two/Car.java deleted file mode 100644 index c798d56..0000000 --- a/springdaytwo/src/main/java/com/training/spring/two/Car.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.spring.two; - -public class Car -{ - private int id; - private String type; - private String make; - private String model; - private int year; - private double price; - - public Car(int id, String type, String make, String model, int year, - double price) - { - this(type, make, model, year, price); - this.id = id; - } - - public Car(String type, String make, String model, int year, double price) - { - this.type = type; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - } - - public int getId() - { - return id; - } - - public String getMake() - { - return make; - } - - public String getModel() - { - return model; - } - - public int getYear() - { - return year; - } - - public double getPrice() - { - return price; - } - - public String getType() - { - return type; - } -} diff --git a/springdaytwo/src/main/java/com/training/spring/two/CarDAO.java b/springdaytwo/src/main/java/com/training/spring/two/CarDAO.java deleted file mode 100644 index fc48eaf..0000000 --- a/springdaytwo/src/main/java/com/training/spring/two/CarDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.spring.two; - -import java.util.List; - - -interface CarDAO { - void createCar(Car car); - List getAllCars(); - Car getCarById(int id); - void update(Car car); - void delete(int id); -} diff --git a/springdaytwo/src/main/java/com/training/spring/two/CarDAODummyImpl.java b/springdaytwo/src/main/java/com/training/spring/two/CarDAODummyImpl.java deleted file mode 100644 index 36ef051..0000000 --- a/springdaytwo/src/main/java/com/training/spring/two/CarDAODummyImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.spring.two; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository("dummy") -public class CarDAODummyImpl implements CarDAO -{ - - @Override - public void createCar(Car car) - { - // TODO Auto-generated method stub - - } - - @Override - public List getAllCars() - { - List cars = new ArrayList(); - - Car car1 = new Car("Sedan", "Ford", "Tarus", 2012, 12000.00); - Car car2 = new Car("Sedan", "Toyota", "Corolla", 2011, 13000.00); - - cars.add(car1); - cars.add(car2); - - return cars; - } - - @Override - public Car getCarById(int id) - { - // TODO Auto-generated method stub - return null; - } - - @Override - public void update(Car car) - { - // TODO Auto-generated method stub - - } - - @Override - public void delete(int id) - { - // TODO Auto-generated method stub - - } - -} diff --git a/springdaytwo/src/main/java/com/training/spring/two/CarDAOJDBCImpl.java b/springdaytwo/src/main/java/com/training/spring/two/CarDAOJDBCImpl.java deleted file mode 100644 index f4b51a3..0000000 --- a/springdaytwo/src/main/java/com/training/spring/two/CarDAOJDBCImpl.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.training.spring.two; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository("jdbc") -class CarDAOJDBCImpl implements CarDAO -{ - CarDAOJDBCImpl() - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) - { - throw new DAOException(e); - } - } - - @Override - public List getAllCars() - { - - List cars = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try - { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from car"); - - while (rs.next()) - { - int id = rs.getInt("id"); - - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - Car car = new Car(id, type, make, model, year, price); - cars.add(car); - } - return cars; - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(rs, stmt, con); - } - } - - @Override - public void createCar(Car car) - { - - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("insert into car(type, make, model, year, price) values(?,?,?,?,?)"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - @Override - public Car getCarById(int id) - { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Car car = null; - try - { - con = getConnection(); - stmt = con.prepareStatement("select * from car where id = ?"); - stmt.setInt(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) - { - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - car = new Car(id, type, make, model, year, price); - } - return car; - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - private Connection getConnection() throws SQLException - { - return DriverManager.getConnection("jdbc:mysql://localhost/training", - "root", "password"); - - } - - private void closeResources(ResultSet rs, Statement stmt, Connection con) - { - if (rs != null) - { - try - { - rs.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (stmt != null) - { - try - { - stmt.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (con != null) - { - try - { - con.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - - } - - @Override - public void update(Car car) - { - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("update car set type = ?, make = ?, model= ?, year = ?, price = ? where id = ?"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - stmt.setInt(6, car.getId()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - } - - @Override - public void delete(int id) - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con.prepareStatement("delete from car where id = ?"); - stmt.setInt(1, id); - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } -} diff --git a/springdaytwo/src/main/java/com/training/spring/two/CarService.java b/springdaytwo/src/main/java/com/training/spring/two/CarService.java deleted file mode 100644 index f204c33..0000000 --- a/springdaytwo/src/main/java/com/training/spring/two/CarService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.spring.two; - -import java.util.List; - -public interface CarService -{ - void create(Car car); - List getAllCars(); -} diff --git a/springdaytwo/src/main/java/com/training/spring/two/CarServiceImpl.java b/springdaytwo/src/main/java/com/training/spring/two/CarServiceImpl.java deleted file mode 100644 index 8600f94..0000000 --- a/springdaytwo/src/main/java/com/training/spring/two/CarServiceImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.training.spring.two; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -@Service -public class CarServiceImpl implements CarService -{ - private CarDAO dao; - - @Autowired - public CarServiceImpl(@Qualifier("jdbc") CarDAO dao) - { - this.dao = dao; - } - - @Override - public void create(Car car) - { - dao.createCar(car); - } - - @Override - public List getAllCars() - { - List allCars = dao.getAllCars(); - - List fordCars = new ArrayList(); - - for (Car aCar : allCars) - { - if (aCar.getMake() != null - && aCar.getMake().equalsIgnoreCase("FORD")) - { - fordCars.add(aCar); - } - } - - return fordCars; - } -} diff --git a/springdaytwo/src/main/java/com/training/spring/two/DAOException.java b/springdaytwo/src/main/java/com/training/spring/two/DAOException.java deleted file mode 100644 index d901200..0000000 --- a/springdaytwo/src/main/java/com/training/spring/two/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.spring.two; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(Throwable ex) { - super(ex); - } -} diff --git a/springdaytwo/src/main/resources/spring-config.xml b/springdaytwo/src/main/resources/spring-config.xml deleted file mode 100644 index f232480..0000000 --- a/springdaytwo/src/main/resources/spring-config.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/springdaytwo/src/test/java/com/training/spring/two/CarServiceImplTest.java b/springdaytwo/src/test/java/com/training/spring/two/CarServiceImplTest.java deleted file mode 100644 index ac8e1ea..0000000 --- a/springdaytwo/src/test/java/com/training/spring/two/CarServiceImplTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.spring.two; - -import java.util.List; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class CarServiceImplTest -{ - @Test - public void testGetAllCars() throws Exception - { - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - CarService service = context.getBean(CarService.class); - - List cars = service.getAllCars(); - - for(Car aCar : cars) - { - System.out.println("Make = " + aCar.getMake()); - System.out.println("Model = " + aCar.getModel()); - System.out.println("Price = " + aCar.getPrice()); - } - } -} diff --git a/springjpa1/.classpath b/springjpa1/.classpath deleted file mode 100644 index 13cc653..0000000 --- a/springjpa1/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/springjpa1/.project b/springjpa1/.project deleted file mode 100644 index db34bda..0000000 --- a/springjpa1/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - springjpa1 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/springjpa1/.settings/org.eclipse.core.resources.prefs b/springjpa1/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a..0000000 --- a/springjpa1/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/springjpa1/.settings/org.eclipse.jdt.core.prefs b/springjpa1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8626026..0000000 --- a/springjpa1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/springjpa1/.settings/org.eclipse.m2e.core.prefs b/springjpa1/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/springjpa1/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/springjpa1/.springBeans b/springjpa1/.springBeans deleted file mode 100644 index 2fc88ee..0000000 --- a/springjpa1/.springBeans +++ /dev/null @@ -1,13 +0,0 @@ - - - 1 - - - - - - - - - - diff --git a/springjpa1/pom.xml b/springjpa1/pom.xml deleted file mode 100644 index dbc6888..0000000 --- a/springjpa1/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - 4.0.0 - - com.training - springjpa1 - 1.0 - jar - - springjpa1 - http://maven.apache.org - - - - - - junit - junit - 4.10 - test - - - - org.springframework - spring-orm - 3.1.2.RELEASE - - - - org.springframework - spring-test - 3.1.2.RELEASE - - - - org.hibernate - hibernate-core - 4.1.0.Final - - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - 1.0.1.Final - - - - org.hibernate - hibernate-entitymanager - 4.1.0.Final - - - - com.oracle - ojdbc6 - 11.2.0 - - - - commons-dbcp - commons-dbcp - 1.4 - - - - - - diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/Book.java b/springjpa1/src/main/java/com/training/jpa2/domain/Book.java deleted file mode 100644 index 05adbd6..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/Book.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.training.jpa2.domain; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; - -@Entity -@Access(AccessType.FIELD) -@SequenceGenerator(name = "generator_book_id_seq", sequenceName = "book_id_seq", allocationSize = 1) -public class Book implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator_book_id_seq") - @Column(name = "book_id") - private int id; - private String title; - private String author; - private String isbn; - - @Column(name = "number_of_pages") - private int pages; - - @Column(name = "pub_date") - private Date publisherDate; - - @ManyToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY) - @JoinColumn(name = "publisher_id", referencedColumnName = "id") - private Publisher publisher; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - - public void setPublisherDate(Date publisherDate) { - this.publisherDate = publisherDate; - } - - public Publisher getPublisher() { - return publisher; - } - - public void setPublisher(Publisher publisher) { - this.publisher = publisher; - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - - sb.append("Title = " + this.title + "\n"); - sb.append("Author = " + this.author + "\n"); - sb.append("Pages = " + this.pages + "\n"); - sb.append("Pub. Date = " + this.publisherDate + "\n"); - - return sb.toString(); - } -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/BookDAO.java b/springjpa1/src/main/java/com/training/jpa2/domain/BookDAO.java deleted file mode 100644 index b9fd0e9..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/BookDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.jpa2.domain; - -public interface BookDAO { - - void create(Book book); - Book findByPrimaryKey(int id); - void update(Book book); - void delete(int id); - -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/BookDAOJPAImpl.java b/springjpa1/src/main/java/com/training/jpa2/domain/BookDAOJPAImpl.java deleted file mode 100644 index e3979ec..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/BookDAOJPAImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.jpa2.domain; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; - -import org.springframework.stereotype.Repository; - -@Repository -public class BookDAOJPAImpl implements BookDAO { - - @PersistenceContext - private EntityManager em; - - public void create(Book book) { - em.persist(book); - } - - public Book findByPrimaryKey(int id) { - return em.find(Book.class, id); - } - - public void update(Book book) { - em.merge(book); - } - - public void delete(int id) { - Book book = em.find(Book.class, id); - em.remove(book); - } -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/BookService.java b/springjpa1/src/main/java/com/training/jpa2/domain/BookService.java deleted file mode 100644 index 0a81b45..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/BookService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.jpa2.domain; - -public interface BookService { - - Book findByPrimaryKey(int id); - -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/BookServiceImpl.java b/springjpa1/src/main/java/com/training/jpa2/domain/BookServiceImpl.java deleted file mode 100644 index 673354e..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/BookServiceImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.jpa2.domain; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class BookServiceImpl implements BookService { - - @Autowired - private BookDAO dao; - - @Transactional - public Book findByPrimaryKey(int id) { - return dao.findByPrimaryKey(id); - } - -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/Publisher.java b/springjpa1/src/main/java/com/training/jpa2/domain/Publisher.java deleted file mode 100644 index 1bd664b..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/Publisher.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.jpa2.domain; - -import java.util.Collection; - -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.SequenceGenerator; - -@Entity -@Access(AccessType.FIELD) -@SequenceGenerator(name = "generator_publisher_id_seq", sequenceName = "publisher_id_seq", allocationSize = 1) -public class Publisher { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator_publisher_id_seq") - private int id; - private String name; - private String address; - private String city; - - @Column(name = "zip_code") - private String zipCode; - - // When FetchType is EAGER, observe that it retrieves the Book details also - // along with the Publisher. - // When FetchType is LAZY (default for Collection types), observe that Book - // details will not be fetched along with the Publisher. When you try to - // first access the books (through getBooks()), then it makes a fresh - // database call and retrieves and the Books. If EntityManager is closed by - // then, it will throw LazyInitializationException. - @OneToMany(mappedBy = "publisher", targetEntity = Book.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY) - private Collection books; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - public Collection getBooks() { - return books; - } - - public void setBooks(Collection books) { - this.books = books; - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(); - - sb.append("Name = " + this.name + "\n"); - sb.append("Address = " + this.address + "\n"); - sb.append("City = " + this.city + "\n"); - sb.append("ZipCode = " + this.zipCode + "\n"); - - return sb.toString(); - } -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/PublisherDAO.java b/springjpa1/src/main/java/com/training/jpa2/domain/PublisherDAO.java deleted file mode 100644 index 38d855d..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/PublisherDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.jpa2.domain; - -public interface PublisherDAO { - - void create(Publisher publisher); - Publisher findByName(String name); - -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/PublisherDAOJPAImpl.java b/springjpa1/src/main/java/com/training/jpa2/domain/PublisherDAOJPAImpl.java deleted file mode 100644 index 34f91c8..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/PublisherDAOJPAImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.jpa2.domain; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; - -import org.springframework.stereotype.Repository; - -@Repository -public class PublisherDAOJPAImpl implements PublisherDAO { - - @PersistenceContext(unitName="bookStore") - private EntityManager em; - - public void create(Publisher publisher) { - em.persist(publisher); - } - - public Publisher findByName(String name) { - - Query query = em.createQuery("select pub from Publisher pub where pub.name = ?"); - query.setParameter(1, name); - - return (Publisher) query.getSingleResult(); - } - -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/PublisherService.java b/springjpa1/src/main/java/com/training/jpa2/domain/PublisherService.java deleted file mode 100644 index 697ce7a..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/PublisherService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.jpa2.domain; - -public interface PublisherService { - - void create(Publisher publisher); - -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/PublisherServiceImpl.java b/springjpa1/src/main/java/com/training/jpa2/domain/PublisherServiceImpl.java deleted file mode 100644 index cfd7e00..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/PublisherServiceImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.training.jpa2.domain; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class PublisherServiceImpl implements PublisherService { - - @Autowired - private PublisherDAO dao; - - @Transactional - public void create(Publisher publisher) { - dao.create(publisher); - } - -} diff --git a/springjpa1/src/main/java/com/training/jpa2/domain/package-info.java b/springjpa1/src/main/java/com/training/jpa2/domain/package-info.java deleted file mode 100644 index c385699..0000000 --- a/springjpa1/src/main/java/com/training/jpa2/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Venkata - * - */ -package com.training.jpa2.domain; \ No newline at end of file diff --git a/springjpa1/src/main/resources/META-INF/persistence.xml b/springjpa1/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index fff9c97..0000000 --- a/springjpa1/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - org.hibernate.ejb.HibernatePersistence - - - - - - - - - - - - - \ No newline at end of file diff --git a/springjpa1/src/main/resources/spring-config.xml b/springjpa1/src/main/resources/spring-config.xml deleted file mode 100644 index 4f58f8b..0000000 --- a/springjpa1/src/main/resources/spring-config.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/springjpa1/src/test/java/com/training/jpa2/domain/BookDAOJPAImplTest.java b/springjpa1/src/test/java/com/training/jpa2/domain/BookDAOJPAImplTest.java deleted file mode 100644 index f5cc7bf..0000000 --- a/springjpa1/src/test/java/com/training/jpa2/domain/BookDAOJPAImplTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.training.jpa2.domain; - -import java.util.Date; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations="classpath:spring-config.xml") -public class BookDAOJPAImplTest { - - @Autowired - private BookDAO dao; - - @Ignore - public void testCreate() throws Exception { - - Book book = new Book(); - book.setAuthor("Cathy Sierra"); - book.setTitle("Head First Java"); - book.setIsbn("987654"); - book.setPages(321); - book.setPublisherDate(new Date()); - - // If Cascade persist or Cascade ALL if ON, if this publisher doesn't - // exist, it will create a new publisher first and then inserts its key in book table - Publisher publisher = new Publisher(); - - publisher.setName("Orielly"); - publisher.setAddress("1234 Main St"); - publisher.setCity("Troy"); - publisher.setZipCode("48084"); - - book.setPublisher(publisher); - - dao.create(book); - } - - @Test - public void testFindByPrimaryKey() throws Exception { - - Book book = dao.findByPrimaryKey(11); - - System.out.println("book = " + book); - System.out.println("Publisher = " + book.getPublisher()); - } - - @Ignore - public void testUpdate() throws Exception { - - Book book = dao.findByPrimaryKey(7); - - book.setAuthor("Cathy Sierra & Bert Bates"); - - dao.update(book); - } - - @Ignore - public void testDelete() throws Exception { - dao.delete(4); - } - -} diff --git a/springjpa1/src/test/java/com/training/jpa2/domain/BookServiceImplTest.java b/springjpa1/src/test/java/com/training/jpa2/domain/BookServiceImplTest.java deleted file mode 100644 index 50bc2bb..0000000 --- a/springjpa1/src/test/java/com/training/jpa2/domain/BookServiceImplTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.jpa2.domain; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = "classpath:spring-config.xml") -public class BookServiceImplTest { - - @Autowired - private BookService service; - - @Test - public void testFindByPrimaryKey() throws Exception { - Book book = service.findByPrimaryKey(11); - - System.out.println("Title = " + book.getTitle()); - System.out.println("ISBN = " + book.getIsbn()); - - // You will get LazyInitializationException because the EntityManager is - // already closed as the transaction got committed. - System.out.println("Pub name = " + book.getPublisher().getName()); - } - -} diff --git a/springjpa1/src/test/java/com/training/jpa2/domain/PublisherDAOJPAImplTest.java b/springjpa1/src/test/java/com/training/jpa2/domain/PublisherDAOJPAImplTest.java deleted file mode 100644 index 43c0235..0000000 --- a/springjpa1/src/test/java/com/training/jpa2/domain/PublisherDAOJPAImplTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.training.jpa2.domain; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations="classpath:spring-config.xml") -public class PublisherDAOJPAImplTest { - - @Autowired - private PublisherDAO dao; - - @Test - public void testFindByName() { - Publisher publisher = dao.findByName("Orielly"); - - System.out.println("Publisher = " + publisher); - System.out.println("Books = " + publisher.getBooks()); - } - - @Ignore - public void testCreate() { - - Publisher publisher = new Publisher(); - - publisher.setName("Apple Press"); - publisher.setAddress("One Infinite Loop"); - publisher.setCity("Cupertino"); - publisher.setZipCode("12345"); - - dao.create(publisher); - } - -} diff --git a/springjpa1/src/test/java/com/training/jpa2/domain/PublisherServiceImplTest.java b/springjpa1/src/test/java/com/training/jpa2/domain/PublisherServiceImplTest.java deleted file mode 100644 index e99c078..0000000 --- a/springjpa1/src/test/java/com/training/jpa2/domain/PublisherServiceImplTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.training.jpa2.domain; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations="classpath:spring-config.xml") -public class PublisherServiceImplTest { - - @Autowired - private PublisherService service; - - @Test - public void testCreate() { - Publisher publisher = new Publisher(); - - publisher.setName("Oracle Press"); - publisher.setAddress("2 Oracle drive"); - publisher.setCity("MountainView"); - publisher.setZipCode("98765"); - - service.create(publisher); - } - -} diff --git a/springmvc/.classpath b/springmvc/.classpath deleted file mode 100644 index 23a27a7..0000000 --- a/springmvc/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/springmvc/.project b/springmvc/.project deleted file mode 100644 index f46d7a6..0000000 --- a/springmvc/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - springmvc - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/springmvc/.settings/.jsdtscope b/springmvc/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/springmvc/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/springmvc/.settings/org.eclipse.jdt.core.prefs b/springmvc/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/springmvc/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/springmvc/.settings/org.eclipse.wst.common.component b/springmvc/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 1f3c88c..0000000 --- a/springmvc/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/springmvc/.settings/org.eclipse.wst.common.project.facet.core.xml b/springmvc/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 113dbf9..0000000 --- a/springmvc/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/springmvc/.settings/org.eclipse.wst.jsdt.ui.superType.container b/springmvc/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/springmvc/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/springmvc/.settings/org.eclipse.wst.jsdt.ui.superType.name b/springmvc/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/springmvc/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/springmvc/.springBeans b/springmvc/.springBeans deleted file mode 100644 index 47f2ce7..0000000 --- a/springmvc/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - WebContent/WEB-INF/springmvc-servlet.xml - - - - diff --git a/springmvc/WebContent/META-INF/MANIFEST.MF b/springmvc/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/springmvc/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/springmvc/WebContent/WEB-INF/lib/aopalliance-1.0.jar b/springmvc/WebContent/WEB-INF/lib/aopalliance-1.0.jar deleted file mode 100644 index 578b1a0..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/aopalliance-1.0.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/commons-dbcp2-2.0.jar b/springmvc/WebContent/WEB-INF/lib/commons-dbcp2-2.0.jar deleted file mode 100644 index 5ce4662..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/commons-dbcp2-2.0.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar b/springmvc/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar deleted file mode 100644 index ab51254..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/commons-pool2-2.2.jar b/springmvc/WebContent/WEB-INF/lib/commons-pool2-2.2.jar deleted file mode 100644 index 6a3eb38..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/commons-pool2-2.2.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar b/springmvc/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar deleted file mode 100644 index 9d5fe16..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/junit-4.11.jar b/springmvc/WebContent/WEB-INF/lib/junit-4.11.jar deleted file mode 100644 index aaf7444..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/junit-4.11.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/ojdbc6.jar b/springmvc/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/servlet-api-2.5.jar b/springmvc/WebContent/WEB-INF/lib/servlet-api-2.5.jar deleted file mode 100644 index fb52493..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/servlet-api-2.5.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar b/springmvc/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar deleted file mode 100644 index 941485e..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar b/springmvc/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar deleted file mode 100644 index cfa5696..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar b/springmvc/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar deleted file mode 100644 index 9936474..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar b/springmvc/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar deleted file mode 100644 index fa08986..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar b/springmvc/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar deleted file mode 100644 index b8f346e..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/spring-jdbc-3.2.8.RELEASE.jar b/springmvc/WebContent/WEB-INF/lib/spring-jdbc-3.2.8.RELEASE.jar deleted file mode 100644 index a8224e3..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/spring-jdbc-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/spring-tx-3.2.8.RELEASE.jar b/springmvc/WebContent/WEB-INF/lib/spring-tx-3.2.8.RELEASE.jar deleted file mode 100644 index 13d7f4f..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/spring-tx-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar b/springmvc/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar deleted file mode 100644 index 87cf842..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/lib/spring-webmvc-3.2.8.RELEASE.jar b/springmvc/WebContent/WEB-INF/lib/spring-webmvc-3.2.8.RELEASE.jar deleted file mode 100644 index bd1bcf1..0000000 Binary files a/springmvc/WebContent/WEB-INF/lib/spring-webmvc-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvc/WebContent/WEB-INF/springmvc-servlet.xml b/springmvc/WebContent/WEB-INF/springmvc-servlet.xml deleted file mode 100644 index b67e556..0000000 --- a/springmvc/WebContent/WEB-INF/springmvc-servlet.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/springmvc/WebContent/WEB-INF/views/CustomersList.jsp b/springmvc/WebContent/WEB-INF/views/CustomersList.jsp deleted file mode 100644 index 6f4dbdf..0000000 --- a/springmvc/WebContent/WEB-INF/views/CustomersList.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@page import="com.training.java.springmvc.Customer"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - - <% - - List customers = (List) request.getAttribute("customers"); - System.out.println("Number of customers = " + customers.size()); - - %> - - - - - \ No newline at end of file diff --git a/springmvc/WebContent/WEB-INF/views/HelloWorld.jsp b/springmvc/WebContent/WEB-INF/views/HelloWorld.jsp deleted file mode 100644 index 0650d61..0000000 --- a/springmvc/WebContent/WEB-INF/views/HelloWorld.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

        Welcome to Spring MVC!!

        - - - \ No newline at end of file diff --git a/springmvc/WebContent/WEB-INF/web.xml b/springmvc/WebContent/WEB-INF/web.xml deleted file mode 100644 index 3bdf409..0000000 --- a/springmvc/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - springmvc - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - springmvc - org.springframework.web.servlet.DispatcherServlet - - - - springmvc - / - - - \ No newline at end of file diff --git a/springmvc/src/com/training/java/springmvc/Customer.java b/springmvc/src/com/training/java/springmvc/Customer.java deleted file mode 100644 index 4c663fc..0000000 --- a/springmvc/src/com/training/java/springmvc/Customer.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java.springmvc; - -public class Customer { - - private long customerId; - private String firstName; - private String lastName; - private String address; - private String city; - private String state; - private String zipCode; - private String userName; - private String password; - - public Customer() - { - - } - public Customer(long customerId,String firstName,String lastName) - { - this.customerId=customerId; - this.firstName=firstName; - this.lastName=lastName; - } - - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - public String getAddress() { - return address; - } - public void setAddress(String address) { - this.address = address; - } - public String getCity() { - return city; - } - public void setCity(String city) { - this.city = city; - } - public String getState() { - return state; - } - public void setState(String state) { - this.state = state; - } - public String getZipCode() { - return zipCode; - } - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - public long getCustomerId() { - return customerId; - } - public String getFirstName() { - return firstName; - } - public String getLastName() { - return lastName; - } - - - } diff --git a/springmvc/src/com/training/java/springmvc/CustomerController.java b/springmvc/src/com/training/java/springmvc/CustomerController.java deleted file mode 100644 index 39e920e..0000000 --- a/springmvc/src/com/training/java/springmvc/CustomerController.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.training.java.springmvc; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -@Controller -public class CustomerController { - - @Autowired - private CustomerService service; - - @RequestMapping("/customers") - public ModelAndView getAllCustomers() - { - ModelAndView modelAndView = new ModelAndView(); - try { - List customers = service.getAllCustomers(); - - modelAndView.addObject("customers", customers); - modelAndView.setViewName("CustomersList"); - - } catch (ServiceException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - return modelAndView; - } - - -} diff --git a/springmvc/src/com/training/java/springmvc/CustomerDAO.java b/springmvc/src/com/training/java/springmvc/CustomerDAO.java deleted file mode 100644 index ecec6df..0000000 --- a/springmvc/src/com/training/java/springmvc/CustomerDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.springmvc; - -import java.util.List; - -public interface CustomerDAO { - - List getAllCustomers() throws DAOException; - void addCustomer(Customer customer)throws DAOException; - void updateCustomer(Customer customer) throws DAOException; - void deleteCustomer(String customerId) throws DAOException; - Customer findCustomerByCustomerId(String customerId)throws DAOException; - Customer findCustomerByUsername(String username)throws DAOException; - Customer findByUsernameAndPassword(String username, String password)throws DAOException; - -} - - diff --git a/springmvc/src/com/training/java/springmvc/CustomerDaoJdbcImpl.java b/springmvc/src/com/training/java/springmvc/CustomerDaoJdbcImpl.java deleted file mode 100644 index cefd66d..0000000 --- a/springmvc/src/com/training/java/springmvc/CustomerDaoJdbcImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.training.java.springmvc; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.stereotype.Repository; - -@Repository -public class CustomerDaoJdbcImpl implements CustomerDAO { - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getAllCustomers() throws DAOException { - return jdbcTemplate.query("select * from customers", - new CustomerRowMapper()); - } - - @Override - public void addCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("insert into customers values(customer_seq.NEXTVAL,?,?,?,?,?,?,?,?)", - customer.getFirstName(), customer.getLastName(), - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword()); - } - - @Override - public void updateCustomer(Customer customer) throws DAOException { - - jdbcTemplate - .update("update customers set address=?,city=?, state=?,zipcode=?,username=?,password=? where customer_id = ?", - customer.getAddress(), customer.getCity(), - customer.getState(), customer.getZipCode(), - customer.getUserName(), customer.getPassword(), - customer.getCustomerId()); - } - - @Override - public void deleteCustomer(String customerId) throws DAOException { - jdbcTemplate.update("delete from customers where customer_id=?", - customerId); - } - - @Override - public Customer findCustomerByCustomerId(String customerId) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where customer_id = ?", - new CustomerRowMapper(), customerId); - } - - @Override - public Customer findCustomerByUsername(String username) throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ?", - new CustomerRowMapper(), username); - } - - @Override - public Customer findByUsernameAndPassword(String username, String password) - throws DAOException { - return jdbcTemplate.queryForObject( - "Select * from customers where username = ? and password=?", - new CustomerRowMapper(), username, password); - } - - private static final class CustomerRowMapper implements RowMapper { - @Override - public Customer mapRow(ResultSet resultSet, int rowNum) - throws SQLException { - - long customerId = resultSet.getLong("customer_id"); - String username = resultSet.getString("username"); - String password = resultSet.getString("password"); - String firstname = resultSet.getString("first_name"); - String lastname = resultSet.getString("last_name"); - String address = resultSet.getString("address"); - String city = resultSet.getString("city"); - String state = resultSet.getString("state"); - String zipcode = resultSet.getString("zipcode"); - - Customer customer = new Customer(customerId, firstname, lastname); - customer.setAddress(address); - customer.setCity(city); - customer.setState(state); - customer.setZipCode(zipcode); - customer.setUserName(username); - customer.setPassword(password); - - return customer; - } - - } -} diff --git a/springmvc/src/com/training/java/springmvc/CustomerService.java b/springmvc/src/com/training/java/springmvc/CustomerService.java deleted file mode 100644 index d990a60..0000000 --- a/springmvc/src/com/training/java/springmvc/CustomerService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.springmvc; - -import java.util.List; - -public interface CustomerService { - - void addCustomer(Customer customer) throws ServiceException; - List getAllCustomers() throws ServiceException; - -} diff --git a/springmvc/src/com/training/java/springmvc/CustomerServiceImpl.java b/springmvc/src/com/training/java/springmvc/CustomerServiceImpl.java deleted file mode 100644 index bae0d49..0000000 --- a/springmvc/src/com/training/java/springmvc/CustomerServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.java.springmvc; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -@Service -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO dao; - - @Override - public void addCustomer(Customer customer) throws ServiceException { - try { - dao.addCustomer(customer); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public List getAllCustomers() throws ServiceException { - try { - return dao.getAllCustomers(); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - -} diff --git a/springmvc/src/com/training/java/springmvc/DAOException.java b/springmvc/src/com/training/java/springmvc/DAOException.java deleted file mode 100644 index 84559c9..0000000 --- a/springmvc/src/com/training/java/springmvc/DAOException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.springmvc; - -import java.sql.SQLException; - -public class DAOException extends Exception { - - public DAOException(Exception ex, String errorMessage) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage, Exception ex) { - super(errorMessage, ex); - } - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(SQLException ex) { - super(ex); - } - -} diff --git a/springmvc/src/com/training/java/springmvc/HelloController.java b/springmvc/src/com/training/java/springmvc/HelloController.java deleted file mode 100644 index 7bfe619..0000000 --- a/springmvc/src/com/training/java/springmvc/HelloController.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.springmvc; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class HelloController { - - @RequestMapping("/hello") - public String sayHello() - { - System.out.println("HelloController has been called"); - return "HelloWorld"; - } - -} diff --git a/springmvc/src/com/training/java/springmvc/ServiceException.java b/springmvc/src/com/training/java/springmvc/ServiceException.java deleted file mode 100644 index 9dd867e..0000000 --- a/springmvc/src/com/training/java/springmvc/ServiceException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.java.springmvc; - -public class ServiceException extends Exception { - - public ServiceException(Exception ex) { - super(ex); - } - -} diff --git a/springmvc1/.classpath b/springmvc1/.classpath deleted file mode 100644 index eb4fa20..0000000 --- a/springmvc1/.classpath +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/springmvc1/.project b/springmvc1/.project deleted file mode 100644 index 70e8e93..0000000 --- a/springmvc1/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - springmvc1 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/springmvc1/.settings/.jsdtscope b/springmvc1/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/springmvc1/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/springmvc1/.settings/org.eclipse.jdt.core.prefs b/springmvc1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c034688..0000000 --- a/springmvc1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Wed Apr 25 19:47:32 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/springmvc1/.settings/org.eclipse.m2e.core.prefs b/springmvc1/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 7f5a599..0000000 --- a/springmvc1/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Wed Apr 25 19:46:34 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/springmvc1/.settings/org.eclipse.wst.common.component b/springmvc1/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 59ece30..0000000 --- a/springmvc1/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/springmvc1/.settings/org.eclipse.wst.common.project.facet.core.xml b/springmvc1/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 73d04c9..0000000 --- a/springmvc1/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/springmvc1/.settings/org.eclipse.wst.jsdt.ui.superType.container b/springmvc1/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/springmvc1/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/springmvc1/.settings/org.eclipse.wst.jsdt.ui.superType.name b/springmvc1/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/springmvc1/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/springmvc1/.springBeans b/springmvc1/.springBeans deleted file mode 100644 index 6a76872..0000000 --- a/springmvc1/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/webapp/WEB-INF/springmvc1-servlet.xml - - - - diff --git a/springmvc1/pom.xml b/springmvc1/pom.xml deleted file mode 100644 index 5fb325a..0000000 --- a/springmvc1/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - 4.0.0 - com.training - springmvc1 - war - 1.0 - springmvc1 Maven Webapp - http://maven.apache.org - - - - junit - junit - 4.10 - test - - - javax.servlet - servlet-api - 2.5 - provided - - - mysql - mysql-connector-java - 5.1.18 - - - org.springframework - spring-web - 3.0.7.RELEASE - - - org.springframework - spring-webmvc - 3.0.7.RELEASE - - - - springmvc1 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/springmvc1/src/main/java/com/training/springmvc/web/HelloWorldController.java b/springmvc1/src/main/java/com/training/springmvc/web/HelloWorldController.java deleted file mode 100644 index dbf888d..0000000 --- a/springmvc1/src/main/java/com/training/springmvc/web/HelloWorldController.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.springmvc.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class HelloWorldController -{ - @RequestMapping({"/hello", "/hi"}) - public String sayHello() - { - //TODO should call service class here - return "HelloWorld"; - } - -} diff --git a/springmvc1/src/main/webapp/WEB-INF/springmvc1-servlet.xml b/springmvc1/src/main/webapp/WEB-INF/springmvc1-servlet.xml deleted file mode 100644 index d76156b..0000000 --- a/springmvc1/src/main/webapp/WEB-INF/springmvc1-servlet.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/springmvc1/src/main/webapp/WEB-INF/views/HelloWorld.jsp b/springmvc1/src/main/webapp/WEB-INF/views/HelloWorld.jsp deleted file mode 100644 index b32c161..0000000 --- a/springmvc1/src/main/webapp/WEB-INF/views/HelloWorld.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

        Hello, world!!

        - - \ No newline at end of file diff --git a/springmvc1/src/main/webapp/WEB-INF/web.xml b/springmvc1/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 2643336..0000000 --- a/springmvc1/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - struts2 - - - springmvc1 - org.springframework.web.servlet.DispatcherServlet - - - - springmvc1 - / - - - - diff --git a/springmvc1/src/main/webapp/index.jsp b/springmvc1/src/main/webapp/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/springmvc1/src/main/webapp/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ - - -

        Hello World!

        - - diff --git a/springmvc1_feb2015/.classpath b/springmvc1_feb2015/.classpath deleted file mode 100644 index b80b726..0000000 --- a/springmvc1_feb2015/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/springmvc1_feb2015/.project b/springmvc1_feb2015/.project deleted file mode 100644 index d9fc67a..0000000 --- a/springmvc1_feb2015/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - springmvc1_feb2015 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/springmvc1_feb2015/.settings/.jsdtscope b/springmvc1_feb2015/.settings/.jsdtscope deleted file mode 100644 index 585c967..0000000 --- a/springmvc1_feb2015/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/springmvc1_feb2015/.settings/org.eclipse.jdt.core.prefs b/springmvc1_feb2015/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62a317c..0000000 --- a/springmvc1_feb2015/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/springmvc1_feb2015/.settings/org.eclipse.m2e.core.prefs b/springmvc1_feb2015/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/springmvc1_feb2015/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/springmvc1_feb2015/.settings/org.eclipse.wst.common.component b/springmvc1_feb2015/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 7395405..0000000 --- a/springmvc1_feb2015/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/springmvc1_feb2015/.settings/org.eclipse.wst.common.project.facet.core.xml b/springmvc1_feb2015/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index dac75cc..0000000 --- a/springmvc1_feb2015/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/springmvc1_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.container b/springmvc1_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/springmvc1_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/springmvc1_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.name b/springmvc1_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/springmvc1_feb2015/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/springmvc1_feb2015/.settings/org.eclipse.wst.validation.prefs b/springmvc1_feb2015/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 6f1cba6..0000000 --- a/springmvc1_feb2015/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/springmvc1_feb2015/.springBeans b/springmvc1_feb2015/.springBeans deleted file mode 100644 index dc4bbee..0000000 --- a/springmvc1_feb2015/.springBeans +++ /dev/null @@ -1,16 +0,0 @@ - - - 1 - - - - - - - src/main/webapp/WEB-INF/eshop-servlet.xml - - - - - - diff --git a/springmvc1_feb2015/pom.xml b/springmvc1_feb2015/pom.xml deleted file mode 100644 index 9209068..0000000 --- a/springmvc1_feb2015/pom.xml +++ /dev/null @@ -1,96 +0,0 @@ - - 4.0.0 - com.training - esho3 - war - 1.0 - eshop2 Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - javax.servlet.jsp - jsp-api - - - - - - com.oracle - ojdbc6 - 11.2.0.3 - - - - org.springframework - spring-context - 3.2.13.RELEASE - - - - org.springframework - spring-web - 3.2.13.RELEASE - - - - org.springframework - spring-webmvc - 3.2.13.RELEASE - - - - - - codelds - https://code.lds.org/nexus/content/groups/main-repo - - - - eshop3 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/springmvc1_feb2015/src/main/java/com/training/springmvc/Customer.java b/springmvc1_feb2015/src/main/java/com/training/springmvc/Customer.java deleted file mode 100644 index 101096c..0000000 --- a/springmvc1_feb2015/src/main/java/com/training/springmvc/Customer.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.training.springmvc; - -public class Customer { - - private String firstName; - private String lastName; - private String city; - private String state; - private String zipCode; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } -} diff --git a/springmvc1_feb2015/src/main/java/com/training/springmvc/CustomerController.java b/springmvc1_feb2015/src/main/java/com/training/springmvc/CustomerController.java deleted file mode 100644 index cb72143..0000000 --- a/springmvc1_feb2015/src/main/java/com/training/springmvc/CustomerController.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.training.springmvc; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -@Controller -public class CustomerController { - - @RequestMapping("/customer/add") - public ModelAndView signupForm() { - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("AddCustomer"); - modelAndView.addObject("customer", new Customer()); - - return modelAndView; - } - - @RequestMapping(value = "/customer/add", method = RequestMethod.POST) - public String saveCustomer(Customer customer) { - System.out.println("First name = " + customer.getFirstName()); - System.out.println("Last name = " + customer.getLastName()); - System.out.println("city = " + customer.getCity()); - System.out.println("state = " + customer.getState()); - System.out.println("zipCode = " + customer.getZipCode()); - - return "Success"; - } - -} diff --git a/springmvc1_feb2015/src/main/java/com/training/springmvc/HelloController.java b/springmvc1_feb2015/src/main/java/com/training/springmvc/HelloController.java deleted file mode 100644 index 4e8287b..0000000 --- a/springmvc1_feb2015/src/main/java/com/training/springmvc/HelloController.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.springmvc; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class HelloController { - - @RequestMapping(value = "/hello", method=RequestMethod.GET) - public String sayHello(@RequestParam("name") String name, @RequestParam("city") String city) { - System.out.println("city = " + city); - - System.out.println("Hey, I am in sayHello of HelloController"); - System.out.println("Calling service and get the data"); - - return "HelloWorld"; - } -} - diff --git a/springmvc1_feb2015/src/main/java/com/training/springmvc/LoginController.java b/springmvc1_feb2015/src/main/java/com/training/springmvc/LoginController.java deleted file mode 100644 index f8a39de..0000000 --- a/springmvc1_feb2015/src/main/java/com/training/springmvc/LoginController.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.training.springmvc; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class LoginController { - - @RequestMapping(value = "/login", method = RequestMethod.GET) - public String emptyForm() { - System.out.println("emptyForm called, so forwarding to Login page"); - return "Login"; - } - - @RequestMapping(value = "/login", method = RequestMethod.POST) - public String validate(@RequestParam String username, - @RequestParam String password) { - System.out.println("username = " + username); - System.out.println("password = " + password); - - return "Success"; - } - -} diff --git a/springmvc1_feb2015/src/main/webapp/WEB-INF/eshop-servlet.xml b/springmvc1_feb2015/src/main/webapp/WEB-INF/eshop-servlet.xml deleted file mode 100644 index fbd692f..0000000 --- a/springmvc1_feb2015/src/main/webapp/WEB-INF/eshop-servlet.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - diff --git a/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/AddCustomer.jsp b/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/AddCustomer.jsp deleted file mode 100644 index b8bb3af..0000000 --- a/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/AddCustomer.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%> - - - - - -Insert title here - - - - - First name :
        - Last name :
        - City :
        - State :
        - Zip :
        - - -
        - - - - \ No newline at end of file diff --git a/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/HelloWorld.jsp b/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/HelloWorld.jsp deleted file mode 100644 index 57a1bdc..0000000 --- a/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/HelloWorld.jsp +++ /dev/null @@ -1 +0,0 @@ -

        Hey, I am from Spring MVC - fancy web application framework :)

        \ No newline at end of file diff --git a/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/Login.jsp b/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/Login.jsp deleted file mode 100644 index 664143c..0000000 --- a/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/Login.jsp +++ /dev/null @@ -1,21 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

        Please enter your username and password

        -
        - - Username :
        - Password :
        - - -
        - - - \ No newline at end of file diff --git a/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/Success.jsp b/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/Success.jsp deleted file mode 100644 index ce4a363..0000000 --- a/springmvc1_feb2015/src/main/webapp/WEB-INF/jsp/Success.jsp +++ /dev/null @@ -1 +0,0 @@ -

        Your credentials are good

        \ No newline at end of file diff --git a/springmvc1_feb2015/src/main/webapp/WEB-INF/web.xml b/springmvc1_feb2015/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 864412a..0000000 --- a/springmvc1_feb2015/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - eshop - - - eshop - org.springframework.web.servlet.DispatcherServlet - - - - eshop - / - - - \ No newline at end of file diff --git a/springmvc2/.classpath b/springmvc2/.classpath deleted file mode 100644 index eb4fa20..0000000 --- a/springmvc2/.classpath +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/springmvc2/.project b/springmvc2/.project deleted file mode 100644 index 7877f31..0000000 --- a/springmvc2/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - springmvc2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/springmvc2/.settings/.jsdtscope b/springmvc2/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/springmvc2/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/springmvc2/.settings/org.eclipse.jdt.core.prefs b/springmvc2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 07054fd..0000000 --- a/springmvc2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Wed Apr 25 20:09:58 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/springmvc2/.settings/org.eclipse.m2e.core.prefs b/springmvc2/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index afe6e6b..0000000 --- a/springmvc2/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Wed Apr 25 20:09:11 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/springmvc2/.settings/org.eclipse.wst.common.component b/springmvc2/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 0d4230c..0000000 --- a/springmvc2/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/springmvc2/.settings/org.eclipse.wst.common.project.facet.core.xml b/springmvc2/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 73d04c9..0000000 --- a/springmvc2/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/springmvc2/.settings/org.eclipse.wst.jsdt.ui.superType.container b/springmvc2/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/springmvc2/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/springmvc2/.settings/org.eclipse.wst.jsdt.ui.superType.name b/springmvc2/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/springmvc2/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/springmvc2/pom.xml b/springmvc2/pom.xml deleted file mode 100644 index ec08d0e..0000000 --- a/springmvc2/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - 4.0.0 - com.training - springmvc2 - war - 1.0 - springmvc2 Maven Webapp - http://maven.apache.org - - - - junit - junit - 4.10 - test - - - javax.servlet - servlet-api - 2.5 - provided - - - mysql - mysql-connector-java - 5.1.18 - - - org.springframework - spring-web - 3.0.7.RELEASE - - - org.springframework - spring-webmvc - 3.0.7.RELEASE - - - javax.servlet - jstl - 1.2 - - - - springmvc2 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/springmvc2/src/main/java/com/training/springmvc/car/domain/Car.java b/springmvc2/src/main/java/com/training/springmvc/car/domain/Car.java deleted file mode 100644 index b959f52..0000000 --- a/springmvc2/src/main/java/com/training/springmvc/car/domain/Car.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.springmvc.car.domain; - -public class Car -{ - private int id; - private String type; - private String make; - private String model; - private int year; - private double price; - - public Car(int id, String type, String make, String model, int year, - double price) - { - this(type, make, model, year, price); - this.id = id; - } - - public Car(String type, String make, String model, int year, double price) - { - this.type = type; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - } - - public int getId() - { - return id; - } - - public String getMake() - { - return make; - } - - public String getModel() - { - return model; - } - - public int getYear() - { - return year; - } - - public double getPrice() - { - return price; - } - - public String getType() - { - return type; - } -} diff --git a/springmvc2/src/main/java/com/training/springmvc/car/domain/CarDAO.java b/springmvc2/src/main/java/com/training/springmvc/car/domain/CarDAO.java deleted file mode 100644 index e6378d7..0000000 --- a/springmvc2/src/main/java/com/training/springmvc/car/domain/CarDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.springmvc.car.domain; - -import java.util.List; - - -interface CarDAO { - void createCar(Car car); - List getAllCars(); - Car getCarById(int id); - void update(Car car); - void delete(int id); -} diff --git a/springmvc2/src/main/java/com/training/springmvc/car/domain/CarDAOJDBCImpl.java b/springmvc2/src/main/java/com/training/springmvc/car/domain/CarDAOJDBCImpl.java deleted file mode 100644 index 4ab86f8..0000000 --- a/springmvc2/src/main/java/com/training/springmvc/car/domain/CarDAOJDBCImpl.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.training.springmvc.car.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -class CarDAOJDBCImpl implements CarDAO -{ - CarDAOJDBCImpl() - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) - { - throw new DAOException(e); - } - } - - @Override - public List getAllCars() - { - - List cars = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try - { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from car"); - - while (rs.next()) - { - int id = rs.getInt("id"); - - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - Car car = new Car(id, type, make, model, year, price); - cars.add(car); - } - return cars; - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(rs, stmt, con); - } - } - - @Override - public void createCar(Car car) - { - - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("insert into car(type, make, model, year, price) values(?,?,?,?,?)"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - @Override - public Car getCarById(int id) - { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Car car = null; - try - { - con = getConnection(); - stmt = con.prepareStatement("select * from car where id = ?"); - stmt.setInt(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) - { - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - car = new Car(id, type, make, model, year, price); - } - return car; - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - private Connection getConnection() throws SQLException - { - return DriverManager.getConnection("jdbc:mysql://localhost/training", - "root", "password"); - - } - - private void closeResources(ResultSet rs, Statement stmt, Connection con) - { - if (rs != null) - { - try - { - rs.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (stmt != null) - { - try - { - stmt.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (con != null) - { - try - { - con.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - - } - - @Override - public void update(Car car) - { - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("update car set type = ?, make = ?, model= ?, year = ?, price = ? where id = ?"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - stmt.setInt(6, car.getId()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - } - - @Override - public void delete(int id) - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con.prepareStatement("delete from car where id = ?"); - stmt.setInt(1, id); - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } -} diff --git a/springmvc2/src/main/java/com/training/springmvc/car/domain/CarService.java b/springmvc2/src/main/java/com/training/springmvc/car/domain/CarService.java deleted file mode 100644 index da7e063..0000000 --- a/springmvc2/src/main/java/com/training/springmvc/car/domain/CarService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.springmvc.car.domain; - -import java.util.List; - -public interface CarService -{ - void create(Car car); - List getAllCars(); -} diff --git a/springmvc2/src/main/java/com/training/springmvc/car/domain/CarServiceImpl.java b/springmvc2/src/main/java/com/training/springmvc/car/domain/CarServiceImpl.java deleted file mode 100644 index 09e0a99..0000000 --- a/springmvc2/src/main/java/com/training/springmvc/car/domain/CarServiceImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.springmvc.car.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class CarServiceImpl implements CarService -{ - @Autowired - private CarDAO dao; - - @Override - public void create(Car car) - { - dao.createCar(car); - } - - @Override - public List getAllCars() - { - return dao.getAllCars(); - } -} diff --git a/springmvc2/src/main/java/com/training/springmvc/car/domain/DAOException.java b/springmvc2/src/main/java/com/training/springmvc/car/domain/DAOException.java deleted file mode 100644 index 5d92d66..0000000 --- a/springmvc2/src/main/java/com/training/springmvc/car/domain/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.springmvc.car.domain; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(Throwable ex) { - super(ex); - } -} diff --git a/springmvc2/src/main/java/com/training/springmvc/car/web/CarController.java b/springmvc2/src/main/java/com/training/springmvc/car/web/CarController.java deleted file mode 100644 index 1a959d8..0000000 --- a/springmvc2/src/main/java/com/training/springmvc/car/web/CarController.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.springmvc.car.web; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import com.training.springmvc.car.domain.Car; -import com.training.springmvc.car.domain.CarService; - -@Controller -public class CarController -{ - @Autowired - private CarService service; - - @RequestMapping("/cars") - public ModelAndView getCars() - { - List cars = service.getAllCars(); - - ModelAndView mvc = new ModelAndView(); - - mvc.addObject("cars", cars); - mvc.setViewName("ListCars"); - - return mvc; - } -} diff --git a/springmvc2/src/main/webapp/WEB-INF/springmvc2-servlet.xml b/springmvc2/src/main/webapp/WEB-INF/springmvc2-servlet.xml deleted file mode 100644 index d76156b..0000000 --- a/springmvc2/src/main/webapp/WEB-INF/springmvc2-servlet.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/springmvc2/src/main/webapp/WEB-INF/views/ListCars.jsp b/springmvc2/src/main/webapp/WEB-INF/views/ListCars.jsp deleted file mode 100644 index 2b90eae..0000000 --- a/springmvc2/src/main/webapp/WEB-INF/views/ListCars.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - -
        TypeMakeModelYearPrice
        ${eachCar.type}${eachCar.make}${eachCar.model}${eachCar.year}${eachCar.price}
        - - \ No newline at end of file diff --git a/springmvc2/src/main/webapp/WEB-INF/web.xml b/springmvc2/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 84d4e3d..0000000 --- a/springmvc2/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - struts2 - - - springmvc2 - org.springframework.web.servlet.DispatcherServlet - - - - springmvc2 - / - - - - diff --git a/springmvc2/src/main/webapp/index.jsp b/springmvc2/src/main/webapp/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/springmvc2/src/main/webapp/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ - - -

        Hello World!

        - - diff --git a/springmvc3/.classpath b/springmvc3/.classpath deleted file mode 100644 index 97401f0..0000000 --- a/springmvc3/.classpath +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/springmvc3/.project b/springmvc3/.project deleted file mode 100644 index 8c985aa..0000000 --- a/springmvc3/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - springmvc3 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/springmvc3/.settings/.jsdtscope b/springmvc3/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/springmvc3/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/springmvc3/.settings/org.eclipse.jdt.core.prefs b/springmvc3/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 71665ca..0000000 --- a/springmvc3/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Thu Mar 15 18:48:55 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/springmvc3/.settings/org.eclipse.m2e.core.prefs b/springmvc3/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 4b5f0a9..0000000 --- a/springmvc3/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Thu Mar 15 18:46:02 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/springmvc3/.settings/org.eclipse.wst.common.component b/springmvc3/.settings/org.eclipse.wst.common.component deleted file mode 100644 index c712fee..0000000 --- a/springmvc3/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/springmvc3/.settings/org.eclipse.wst.common.project.facet.core.xml b/springmvc3/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 73d04c9..0000000 --- a/springmvc3/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/springmvc3/.settings/org.eclipse.wst.jsdt.ui.superType.container b/springmvc3/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/springmvc3/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/springmvc3/.settings/org.eclipse.wst.jsdt.ui.superType.name b/springmvc3/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/springmvc3/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/springmvc3/.springBeans b/springmvc3/.springBeans deleted file mode 100644 index f46b8c8..0000000 --- a/springmvc3/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/springmvc3/pom.xml b/springmvc3/pom.xml deleted file mode 100644 index c4ad823..0000000 --- a/springmvc3/pom.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - 4.0.0 - com.training - springmvc3 - war - 1.0.0-SNAPSHOT - - 3.0.6.RELEASE - - - - - javax.servlet - jstl - 1.2 - - - org.springframework - spring-webmvc - 3.0.6.RELEASE - - - org.springframework - spring-jdbc - 3.0.6.RELEASE - - - mysql - mysql-connector-java - 5.1.17 - - - commons-dbcp - commons-dbcp - 1.4 - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.2.0.Final - - - - javax.servlet - servlet-api - 2.5 - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - - - junit - junit - 4.7 - test - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-dependency-plugin - - - install - install - - sources - - - - - - - \ No newline at end of file diff --git a/springmvc3/src/main/java/com/training/java/springmvc3/domain/DAOException.java b/springmvc3/src/main/java/com/training/java/springmvc3/domain/DAOException.java deleted file mode 100644 index a92d425..0000000 --- a/springmvc3/src/main/java/com/training/java/springmvc3/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.springmvc3.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/springmvc3/src/main/java/com/training/java/springmvc3/domain/Student.java b/springmvc3/src/main/java/com/training/java/springmvc3/domain/Student.java deleted file mode 100644 index 6786d33..0000000 --- a/springmvc3/src/main/java/com/training/java/springmvc3/domain/Student.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.training.java.springmvc3.domain; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -public class Student { - - - private int id; - - @NotNull - @Size(min=5, max=10, message="First name must be between 5 and 10 characters") - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentDAO.java b/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentDAO.java deleted file mode 100644 index 55688bf..0000000 --- a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.util.List; - -interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentDAOJDBCImpl.java b/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index 0cf51d7..0000000 --- a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -@Repository -class StudentDAOJDBCImpl implements StudentDAO { - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getAllStudents() { - return jdbcTemplate.query("select * from students", - new StudentRowMapper()); - } - - @Override - public void create(Student student) { - - jdbcTemplate.update("insert into students values(?, ?, ?, ?, ?, ?, ?)", - student.getFirstName(), student.getLastName(), - student.getPhoneNumber(), student.getEmail(), student.getAge(), - student.getCity(), student.getId()); - - } -} diff --git a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentRowMapper.java b/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentRowMapper.java deleted file mode 100644 index 9ff52ef..0000000 --- a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentRowMapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.springframework.jdbc.core.RowMapper; - -public class StudentRowMapper implements RowMapper { - - @Override - public Student mapRow(ResultSet resultSet, int rowNum) throws SQLException { - - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - return student; - } - -} diff --git a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentService.java b/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentService.java deleted file mode 100644 index 9936084..0000000 --- a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.util.List; - -public interface StudentService { - - List getAllStudents(); - void addStudent(Student student); - -} diff --git a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentServiceImpl.java b/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentServiceImpl.java deleted file mode 100644 index e9b7224..0000000 --- a/springmvc3/src/main/java/com/training/java/springmvc3/domain/StudentServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.training.java.springmvc3.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class StudentServiceImpl implements StudentService { - - @Autowired - StudentDAO dao; - - @Override - public void addStudent(Student student) { - dao.create(student); - } - - @Override - public List getAllStudents() { - return dao.getAllStudents(); - } -} diff --git a/springmvc3/src/main/java/com/training/java/springmvc3/web/StudentController.java b/springmvc3/src/main/java/com/training/java/springmvc3/web/StudentController.java deleted file mode 100644 index 5de61f6..0000000 --- a/springmvc3/src/main/java/com/training/java/springmvc3/web/StudentController.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.training.java.springmvc3.web; - -import java.util.List; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import com.training.java.springmvc3.domain.Student; -import com.training.java.springmvc3.domain.StudentService; - -@Controller -@RequestMapping("/students") -public class StudentController { - - @Autowired - StudentService service; - - @RequestMapping - public String getAllStudents(Model model) - { - List students = service.getAllStudents(); - model.addAttribute("students", students); - - return "/students/List"; - } - - @RequestMapping(value="/new", method=RequestMethod.GET) - public String createStudentForm(Model model) - { - model.addAttribute(new Student()); - - return "/students/Add"; - } - - @RequestMapping(value="/new", method=RequestMethod.POST) - public String addStudent(@Valid Student student, BindingResult bindingResult) - { - System.out.println("Errors = " + bindingResult.hasErrors()); - List errors = bindingResult.getFieldErrors(); - for(FieldError error : errors) - { - System.out.println("error = " + error.getDefaultMessage()); - } - - if(bindingResult.hasErrors()) - { - return "/students/Add"; - } - else - { - try { - service.addStudent(student); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return "/students/Acknowledgement"; - } - } - -} diff --git a/springmvc3/src/main/resources/spring-config.xml b/springmvc3/src/main/resources/spring-config.xml deleted file mode 100644 index 96e3e5f..0000000 --- a/springmvc3/src/main/resources/spring-config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/springmvc3/src/main/webapp/WEB-INF/springmvc3-servlet.xml b/springmvc3/src/main/webapp/WEB-INF/springmvc3-servlet.xml deleted file mode 100644 index 50e737c..0000000 --- a/springmvc3/src/main/webapp/WEB-INF/springmvc3-servlet.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - diff --git a/springmvc3/src/main/webapp/WEB-INF/views/students/Acknowledgement.jsp b/springmvc3/src/main/webapp/WEB-INF/views/students/Acknowledgement.jsp deleted file mode 100644 index 51e7b22..0000000 --- a/springmvc3/src/main/webapp/WEB-INF/views/students/Acknowledgement.jsp +++ /dev/null @@ -1 +0,0 @@ -

        Your details have been saved successfully in database.

        \ No newline at end of file diff --git a/springmvc3/src/main/webapp/WEB-INF/views/students/Add.jsp b/springmvc3/src/main/webapp/WEB-INF/views/students/Add.jsp deleted file mode 100644 index 14852ba..0000000 --- a/springmvc3/src/main/webapp/WEB-INF/views/students/Add.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@page import="org.springframework.validation.BindingResult"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf" %> - - - -Insert title here - - - -

        Please fill the details below and press Submit...

        - - Id :
        -
        - First name :
        - Last name :
        - Age :
        - Phone :
        - Email :
        - City :
        - -
        - - -
        - - \ No newline at end of file diff --git a/springmvc3/src/main/webapp/WEB-INF/views/students/List.jsp b/springmvc3/src/main/webapp/WEB-INF/views/students/List.jsp deleted file mode 100644 index aed4469..0000000 --- a/springmvc3/src/main/webapp/WEB-INF/views/students/List.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - - - - - - - - - - - -
        First NameLast NameCity
        ${current.firstName}${current.lastName}${current.city}
        diff --git a/springmvc3/src/main/webapp/WEB-INF/web.xml b/springmvc3/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index d4355e3..0000000 --- a/springmvc3/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - springmvc3 - org.springframework.web.servlet.DispatcherServlet - 1 - - - - springmvc3 - / - - - \ No newline at end of file diff --git a/springmvc3/src/main/webapp/index.jsp b/springmvc3/src/main/webapp/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/springmvc3/src/main/webapp/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ - - -

        Hello World!

        - - diff --git a/springmvc4/.classpath b/springmvc4/.classpath deleted file mode 100644 index 97401f0..0000000 --- a/springmvc4/.classpath +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/springmvc4/.project b/springmvc4/.project deleted file mode 100644 index e01524d..0000000 --- a/springmvc4/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - springmvc4 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/springmvc4/.settings/.jsdtscope b/springmvc4/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/springmvc4/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/springmvc4/.settings/org.eclipse.jdt.core.prefs b/springmvc4/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 07ada92..0000000 --- a/springmvc4/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sat Apr 28 09:19:30 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/springmvc4/.settings/org.eclipse.m2e.core.prefs b/springmvc4/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 9058305..0000000 --- a/springmvc4/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sat Apr 28 09:18:22 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/springmvc4/.settings/org.eclipse.wst.common.component b/springmvc4/.settings/org.eclipse.wst.common.component deleted file mode 100644 index e9c4054..0000000 --- a/springmvc4/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/springmvc4/.settings/org.eclipse.wst.common.project.facet.core.xml b/springmvc4/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 6b007af..0000000 --- a/springmvc4/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/springmvc4/.settings/org.eclipse.wst.jsdt.ui.superType.container b/springmvc4/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/springmvc4/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/springmvc4/.settings/org.eclipse.wst.jsdt.ui.superType.name b/springmvc4/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/springmvc4/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/springmvc4/.springBeans b/springmvc4/.springBeans deleted file mode 100644 index ea7563f..0000000 --- a/springmvc4/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/webapp/WEB-INF/springmvc3-servlet.xml - - - - diff --git a/springmvc4/pom.xml b/springmvc4/pom.xml deleted file mode 100644 index 43d40c0..0000000 --- a/springmvc4/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - com.training - springmvc4 - war - 1.0 - springmvc4 Maven Webapp - http://maven.apache.org - - - - junit - junit - 4.10 - test - - - javax.servlet - servlet-api - 2.5 - provided - - - mysql - mysql-connector-java - 5.1.18 - - - org.springframework - spring-web - 3.0.7.RELEASE - - - org.springframework - spring-webmvc - 3.0.7.RELEASE - - - javax.servlet - jstl - 1.2 - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.2.0.Final - - - - springmvc4 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/springmvc4/src/main/java/com/training/springmvc/car/domain/Car.java b/springmvc4/src/main/java/com/training/springmvc/car/domain/Car.java deleted file mode 100644 index 684cd80..0000000 --- a/springmvc4/src/main/java/com/training/springmvc/car/domain/Car.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.training.springmvc.car.domain; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -public class Car -{ - private int id; - - @NotNull(message="Type cannot be null!") - @Size(min=3, max=5, message="Type must be between 3 and 5 characters") - private String type; - - @NotNull(message="Make cannot be null!") - @Size(min=4, max=30, message="Make must be between 4 and 30 characters") - private String make; - private String model; - private int year; - private double price; - - public Car() - { - } - - public Car(int id, String type, String make, String model, int year, - double price) - { - this(type, make, model, year, price); - this.id = id; - } - - public Car(String type, String make, String model, int year, double price) - { - this.type = type; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - } - - public int getId() - { - return id; - } - - public String getMake() - { - return make; - } - - public String getModel() - { - return model; - } - - public int getYear() - { - return year; - } - - public double getPrice() - { - return price; - } - - public String getType() - { - return type; - } - - public void setId(int id) - { - this.id = id; - } - - public void setType(String type) - { - this.type = type; - } - - public void setMake(String make) - { - this.make = make; - } - - public void setModel(String model) - { - this.model = model; - } - - public void setYear(int year) - { - this.year = year; - } - - public void setPrice(double price) - { - this.price = price; - } - -} diff --git a/springmvc4/src/main/java/com/training/springmvc/car/domain/CarDAO.java b/springmvc4/src/main/java/com/training/springmvc/car/domain/CarDAO.java deleted file mode 100644 index e6378d7..0000000 --- a/springmvc4/src/main/java/com/training/springmvc/car/domain/CarDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.springmvc.car.domain; - -import java.util.List; - - -interface CarDAO { - void createCar(Car car); - List getAllCars(); - Car getCarById(int id); - void update(Car car); - void delete(int id); -} diff --git a/springmvc4/src/main/java/com/training/springmvc/car/domain/CarDAOJDBCImpl.java b/springmvc4/src/main/java/com/training/springmvc/car/domain/CarDAOJDBCImpl.java deleted file mode 100644 index 4ab86f8..0000000 --- a/springmvc4/src/main/java/com/training/springmvc/car/domain/CarDAOJDBCImpl.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.training.springmvc.car.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -@Repository -class CarDAOJDBCImpl implements CarDAO -{ - CarDAOJDBCImpl() - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) - { - throw new DAOException(e); - } - } - - @Override - public List getAllCars() - { - - List cars = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try - { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from car"); - - while (rs.next()) - { - int id = rs.getInt("id"); - - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - Car car = new Car(id, type, make, model, year, price); - cars.add(car); - } - return cars; - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(rs, stmt, con); - } - } - - @Override - public void createCar(Car car) - { - - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("insert into car(type, make, model, year, price) values(?,?,?,?,?)"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - @Override - public Car getCarById(int id) - { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Car car = null; - try - { - con = getConnection(); - stmt = con.prepareStatement("select * from car where id = ?"); - stmt.setInt(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) - { - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - car = new Car(id, type, make, model, year, price); - } - return car; - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - private Connection getConnection() throws SQLException - { - return DriverManager.getConnection("jdbc:mysql://localhost/training", - "root", "password"); - - } - - private void closeResources(ResultSet rs, Statement stmt, Connection con) - { - if (rs != null) - { - try - { - rs.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (stmt != null) - { - try - { - stmt.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (con != null) - { - try - { - con.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - - } - - @Override - public void update(Car car) - { - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("update car set type = ?, make = ?, model= ?, year = ?, price = ? where id = ?"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - stmt.setInt(6, car.getId()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - } - - @Override - public void delete(int id) - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con.prepareStatement("delete from car where id = ?"); - stmt.setInt(1, id); - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } -} diff --git a/springmvc4/src/main/java/com/training/springmvc/car/domain/CarService.java b/springmvc4/src/main/java/com/training/springmvc/car/domain/CarService.java deleted file mode 100644 index da7e063..0000000 --- a/springmvc4/src/main/java/com/training/springmvc/car/domain/CarService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.springmvc.car.domain; - -import java.util.List; - -public interface CarService -{ - void create(Car car); - List getAllCars(); -} diff --git a/springmvc4/src/main/java/com/training/springmvc/car/domain/CarServiceImpl.java b/springmvc4/src/main/java/com/training/springmvc/car/domain/CarServiceImpl.java deleted file mode 100644 index 09e0a99..0000000 --- a/springmvc4/src/main/java/com/training/springmvc/car/domain/CarServiceImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.springmvc.car.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class CarServiceImpl implements CarService -{ - @Autowired - private CarDAO dao; - - @Override - public void create(Car car) - { - dao.createCar(car); - } - - @Override - public List getAllCars() - { - return dao.getAllCars(); - } -} diff --git a/springmvc4/src/main/java/com/training/springmvc/car/domain/DAOException.java b/springmvc4/src/main/java/com/training/springmvc/car/domain/DAOException.java deleted file mode 100644 index 5d92d66..0000000 --- a/springmvc4/src/main/java/com/training/springmvc/car/domain/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.springmvc.car.domain; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(Throwable ex) { - super(ex); - } -} diff --git a/springmvc4/src/main/java/com/training/springmvc/car/web/CarController.java b/springmvc4/src/main/java/com/training/springmvc/car/web/CarController.java deleted file mode 100644 index f0daa60..0000000 --- a/springmvc4/src/main/java/com/training/springmvc/car/web/CarController.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.training.springmvc.car.web; - -import java.util.List; - -import javax.validation.Valid; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.training.springmvc.car.domain.Car; -import com.training.springmvc.car.domain.CarService; - -@Controller -public class CarController -{ - @Autowired - private CarService service; - - @RequestMapping("/cars") - public ModelAndView getCars() - { - List cars = service.getAllCars(); - - ModelAndView mvc = new ModelAndView(); - - mvc.addObject("cars", cars); - mvc.setViewName("ListCars"); - - return mvc; - } - - @RequestMapping(value="/cars/new", method=RequestMethod.GET) - public ModelAndView createCarForm(Model model) - { - return new ModelAndView("AddCar", "car", new Car()); - } - - @RequestMapping(value="/cars/new", method=RequestMethod.POST) - public String saveCar(@Valid Car car, BindingResult bindingResult) - { - if(bindingResult.hasErrors()) - { - return "AddCar"; - } - else - { - service.create(car); - return "Acknowledgement"; - } - } -} diff --git a/springmvc4/src/main/webapp/WEB-INF/springmvc3-servlet.xml b/springmvc4/src/main/webapp/WEB-INF/springmvc3-servlet.xml deleted file mode 100644 index 864d2a4..0000000 --- a/springmvc4/src/main/webapp/WEB-INF/springmvc3-servlet.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/springmvc4/src/main/webapp/WEB-INF/views/Acknowledgement.jsp b/springmvc4/src/main/webapp/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 3497979..0000000 --- a/springmvc4/src/main/webapp/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

        Your details have been saved successfully..

        - - \ No newline at end of file diff --git a/springmvc4/src/main/webapp/WEB-INF/views/AddCar.jsp b/springmvc4/src/main/webapp/WEB-INF/views/AddCar.jsp deleted file mode 100644 index 080b8b4..0000000 --- a/springmvc4/src/main/webapp/WEB-INF/views/AddCar.jsp +++ /dev/null @@ -1,32 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%> - - - -Insert title here - - - -

        Welcome

        - -

        Please enter your details here

        - - - -
        - Type :
        - -
        - Make :
        - Model :
        - Year :
        - Price :
        - - - -
        - - - - - \ No newline at end of file diff --git a/springmvc4/src/main/webapp/WEB-INF/views/ListCars.jsp b/springmvc4/src/main/webapp/WEB-INF/views/ListCars.jsp deleted file mode 100644 index 2b90eae..0000000 --- a/springmvc4/src/main/webapp/WEB-INF/views/ListCars.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - -
        TypeMakeModelYearPrice
        ${eachCar.type}${eachCar.make}${eachCar.model}${eachCar.year}${eachCar.price}
        - - \ No newline at end of file diff --git a/springmvc4/src/main/webapp/WEB-INF/web.xml b/springmvc4/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index d387ce4..0000000 --- a/springmvc4/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - struts2 - - - springmvc3 - org.springframework.web.servlet.DispatcherServlet - - - - springmvc3 - / - - - - diff --git a/springmvc4/src/main/webapp/index.jsp b/springmvc4/src/main/webapp/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/springmvc4/src/main/webapp/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ - - -

        Hello World!

        - - diff --git a/springmvcform/.classpath b/springmvcform/.classpath deleted file mode 100644 index 23a27a7..0000000 --- a/springmvcform/.classpath +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/springmvcform/.project b/springmvcform/.project deleted file mode 100644 index a498678..0000000 --- a/springmvcform/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - springmvcform - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/springmvcform/.settings/.jsdtscope b/springmvcform/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/springmvcform/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/springmvcform/.settings/org.eclipse.jdt.core.prefs b/springmvcform/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 11f6e46..0000000 --- a/springmvcform/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/springmvcform/.settings/org.eclipse.wst.common.component b/springmvcform/.settings/org.eclipse.wst.common.component deleted file mode 100644 index aff30c3..0000000 --- a/springmvcform/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/springmvcform/.settings/org.eclipse.wst.common.project.facet.core.xml b/springmvcform/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d4f6c99..0000000 --- a/springmvcform/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/springmvcform/.settings/org.eclipse.wst.jsdt.ui.superType.container b/springmvcform/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/springmvcform/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/springmvcform/.settings/org.eclipse.wst.jsdt.ui.superType.name b/springmvcform/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/springmvcform/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/springmvcform/.springBeans b/springmvcform/.springBeans deleted file mode 100644 index cb90fda..0000000 --- a/springmvcform/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - WebContent/WEB-INF/springmvcform-servlet.xml - - - - diff --git a/springmvcform/WebContent/META-INF/MANIFEST.MF b/springmvcform/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/springmvcform/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/springmvcform/WebContent/WEB-INF/lib/aopalliance-1.0.jar b/springmvcform/WebContent/WEB-INF/lib/aopalliance-1.0.jar deleted file mode 100644 index 578b1a0..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/aopalliance-1.0.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/commons-dbcp2-2.0.jar b/springmvcform/WebContent/WEB-INF/lib/commons-dbcp2-2.0.jar deleted file mode 100644 index 5ce4662..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/commons-dbcp2-2.0.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar b/springmvcform/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar deleted file mode 100644 index ab51254..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/commons-pool2-2.2.jar b/springmvcform/WebContent/WEB-INF/lib/commons-pool2-2.2.jar deleted file mode 100644 index 6a3eb38..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/commons-pool2-2.2.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar b/springmvcform/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar deleted file mode 100644 index 9d5fe16..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/hibernate-validator-4.3.1.Final.jar b/springmvcform/WebContent/WEB-INF/lib/hibernate-validator-4.3.1.Final.jar deleted file mode 100644 index 5656793..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/hibernate-validator-4.3.1.Final.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/hibernate-validator-annotation-processor-4.3.1.Final.jar b/springmvcform/WebContent/WEB-INF/lib/hibernate-validator-annotation-processor-4.3.1.Final.jar deleted file mode 100644 index 7f39345..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/hibernate-validator-annotation-processor-4.3.1.Final.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar b/springmvcform/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar deleted file mode 100644 index a86a365..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-1.2.1.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar b/springmvcform/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar deleted file mode 100644 index 4b3b433..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/javax.servlet.jsp.jstl-api-1.2.1.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/jboss-logging-3.1.0.CR2.jar b/springmvcform/WebContent/WEB-INF/lib/jboss-logging-3.1.0.CR2.jar deleted file mode 100644 index cd095e6..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/jboss-logging-3.1.0.CR2.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/junit-4.11.jar b/springmvcform/WebContent/WEB-INF/lib/junit-4.11.jar deleted file mode 100644 index aaf7444..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/junit-4.11.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/ojdbc6.jar b/springmvcform/WebContent/WEB-INF/lib/ojdbc6.jar deleted file mode 100644 index 01da074..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/ojdbc6.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/servlet-api-2.5.jar b/springmvcform/WebContent/WEB-INF/lib/servlet-api-2.5.jar deleted file mode 100644 index fb52493..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/servlet-api-2.5.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar b/springmvcform/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar deleted file mode 100644 index 941485e..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar b/springmvcform/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar deleted file mode 100644 index cfa5696..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar b/springmvcform/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar deleted file mode 100644 index 9936474..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/spring-context-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar b/springmvcform/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar deleted file mode 100644 index fa08986..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/spring-core-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar b/springmvcform/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar deleted file mode 100644 index b8f346e..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/spring-jdbc-3.2.8.RELEASE.jar b/springmvcform/WebContent/WEB-INF/lib/spring-jdbc-3.2.8.RELEASE.jar deleted file mode 100644 index a8224e3..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/spring-jdbc-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/spring-tx-3.2.8.RELEASE.jar b/springmvcform/WebContent/WEB-INF/lib/spring-tx-3.2.8.RELEASE.jar deleted file mode 100644 index 13d7f4f..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/spring-tx-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar b/springmvcform/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar deleted file mode 100644 index 87cf842..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/spring-web-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/spring-webmvc-3.2.8.RELEASE.jar b/springmvcform/WebContent/WEB-INF/lib/spring-webmvc-3.2.8.RELEASE.jar deleted file mode 100644 index bd1bcf1..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/spring-webmvc-3.2.8.RELEASE.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/lib/validation-api-1.0.0.GA.jar b/springmvcform/WebContent/WEB-INF/lib/validation-api-1.0.0.GA.jar deleted file mode 100644 index 1ff2dd7..0000000 Binary files a/springmvcform/WebContent/WEB-INF/lib/validation-api-1.0.0.GA.jar and /dev/null differ diff --git a/springmvcform/WebContent/WEB-INF/springmvcform-servlet.xml b/springmvcform/WebContent/WEB-INF/springmvcform-servlet.xml deleted file mode 100644 index b1d7c8a..0000000 --- a/springmvcform/WebContent/WEB-INF/springmvcform-servlet.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/springmvcform/WebContent/WEB-INF/views/Acknowledgement.jsp b/springmvcform/WebContent/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index e48c46f..0000000 --- a/springmvcform/WebContent/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

        Your details have been saved successfully!!

        - - - \ No newline at end of file diff --git a/springmvcform/WebContent/WEB-INF/views/SignupForm.jsp b/springmvcform/WebContent/WEB-INF/views/SignupForm.jsp deleted file mode 100644 index f3ba7e7..0000000 --- a/springmvcform/WebContent/WEB-INF/views/SignupForm.jsp +++ /dev/null @@ -1,40 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%> - - - - - -Insert title here - - - - - - - - - - -

        Please enter the customer details and press Submit

        - -First Name :

        -Last Name :

        -Age :

        - -

        - - - -
        - - - - \ No newline at end of file diff --git a/springmvcform/WebContent/WEB-INF/web.xml b/springmvcform/WebContent/WEB-INF/web.xml deleted file mode 100644 index d747d2e..0000000 --- a/springmvcform/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - springmvcform - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - springmvcform - org.springframework.web.servlet.DispatcherServlet - - - - springmvcform - *.do - - \ No newline at end of file diff --git a/springmvcform/src/com/training/java/spring/mvc/Customer.java b/springmvcform/src/com/training/java/spring/mvc/Customer.java deleted file mode 100644 index 010fd7c..0000000 --- a/springmvcform/src/com/training/java/spring/mvc/Customer.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.training.java.spring.mvc; - -import org.hibernate.validator.constraints.NotEmpty; -import org.hibernate.validator.constraints.Range; - -public class Customer { - - @NotEmpty - private String firstName; - - @NotEmpty - private String lastName; - - @Range(min = 20) - private int age; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("First name = " + getFirstName() + " , "); - str.append("Last name = " + getLastName() + " , "); - str.append("Age = " + getAge()); - - return str.toString(); - } -} diff --git a/springmvcform/src/com/training/java/spring/mvc/CustomerController.java b/springmvcform/src/com/training/java/spring/mvc/CustomerController.java deleted file mode 100644 index abc1956..0000000 --- a/springmvcform/src/com/training/java/spring/mvc/CustomerController.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.training.java.spring.mvc; - -import javax.validation.Valid; - -import org.springframework.stereotype.Controller; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -@Controller -public class CustomerController { - - @RequestMapping(value = "/customer/signup.do", method = RequestMethod.GET) - public ModelAndView getEmptyForm() { - ModelAndView modelAndView = new ModelAndView("SignupForm"); - - Customer customer = new Customer(); - - customer.setFirstName("Please enter first name here"); - customer.setLastName("Please enter last name here"); - - modelAndView.addObject("customer", customer); - - return modelAndView; - } - - @RequestMapping(value = "/customer/signup.do", method = RequestMethod.POST) - public String saveForm(@Valid Customer customer, BindingResult result) { - - if (result.hasErrors()) { - - System.out.println("has errors"); - - return "SignupForm"; - } else { - System.out.println(customer); - return "Acknowledgement"; - } - - } - -} diff --git a/springmvcform/src/redbox.properties b/springmvcform/src/redbox.properties deleted file mode 100644 index 94b6f77..0000000 --- a/springmvcform/src/redbox.properties +++ /dev/null @@ -1,3 +0,0 @@ -NotEmpty.customer.firstName = First name is mandatory -NotEmpty.customer.lastName = Last name is mandatory -Range.customer.age = Age must be greater than or equal to 20 diff --git a/struts1/.classpath b/struts1/.classpath deleted file mode 100644 index 9927372..0000000 --- a/struts1/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/struts1/.project b/struts1/.project deleted file mode 100644 index 7c3291d..0000000 --- a/struts1/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - struts1 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/struts1/.settings/.jsdtscope b/struts1/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/struts1/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/struts1/.settings/org.eclipse.jdt.core.prefs b/struts1/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 681a050..0000000 --- a/struts1/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Apr 05 19:32:31 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/struts1/.settings/org.eclipse.wst.common.component b/struts1/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 815ffb2..0000000 --- a/struts1/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/struts1/.settings/org.eclipse.wst.common.project.facet.core.xml b/struts1/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index baa1c17..0000000 --- a/struts1/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/struts1/.settings/org.eclipse.wst.jsdt.ui.superType.container b/struts1/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/struts1/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/struts1/.settings/org.eclipse.wst.jsdt.ui.superType.name b/struts1/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/struts1/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/struts1/WebContent/META-INF/MANIFEST.MF b/struts1/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/struts1/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/struts1/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/struts1/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/struts1/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/struts1/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/struts1/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/struts1/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/struts1/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/commons-io-1.1.jar b/struts1/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/struts1/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/struts1/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/struts1/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/oro-2.0.8.jar b/struts1/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/standard-1.0.6.jar b/struts1/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/struts1/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/struts1/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/struts1/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/struts1/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/struts1/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/struts1/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/struts1/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/struts1/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/struts1/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/struts1/WebContent/WEB-INF/struts-config.xml b/struts1/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index e5134e6..0000000 --- a/struts1/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/struts1/WebContent/WEB-INF/views/Ankita.jsp b/struts1/WebContent/WEB-INF/views/Ankita.jsp deleted file mode 100644 index c26583f..0000000 --- a/struts1/WebContent/WEB-INF/views/Ankita.jsp +++ /dev/null @@ -1 +0,0 @@ -

        Hi, I am Ankita, and welcome to my Struts Application!!

        \ No newline at end of file diff --git a/struts1/WebContent/WEB-INF/views/HelloWorld.jsp b/struts1/WebContent/WEB-INF/views/HelloWorld.jsp deleted file mode 100644 index f85827b..0000000 --- a/struts1/WebContent/WEB-INF/views/HelloWorld.jsp +++ /dev/null @@ -1 +0,0 @@ -

        Welcome to Struts world

        \ No newline at end of file diff --git a/struts1/WebContent/WEB-INF/web.xml b/struts1/WebContent/WEB-INF/web.xml deleted file mode 100644 index 38895b6..0000000 --- a/struts1/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - struts1 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/struts-config.xml - - - - - - ActionServlet - *.do - - - \ No newline at end of file diff --git a/struts1/WebContent/index.html b/struts1/WebContent/index.html deleted file mode 100644 index d3c043c..0000000 --- a/struts1/WebContent/index.html +++ /dev/null @@ -1 +0,0 @@ -

        Hello, welcome to my website

        \ No newline at end of file diff --git a/struts1/src/com/training/java/struts1/HelloWorldAction.java b/struts1/src/com/training/java/struts1/HelloWorldAction.java deleted file mode 100644 index 1d0e3c6..0000000 --- a/struts1/src/com/training/java/struts1/HelloWorldAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.struts1; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class HelloWorldAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - System.out.println("HelloWorldAction is called"); - - String name = request.getParameter("name"); - - if(name != null && name.equalsIgnoreCase("ankita")) - { - return mapping.findForward("ankita"); - } - else - { - return mapping.findForward("hello"); - } - } - -} diff --git a/struts2/.classpath b/struts2/.classpath deleted file mode 100644 index 5174128..0000000 --- a/struts2/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/struts2/.project b/struts2/.project deleted file mode 100644 index bcdf85c..0000000 --- a/struts2/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - struts2 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/struts2/.settings/.jsdtscope b/struts2/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/struts2/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/struts2/.settings/org.eclipse.jdt.core.prefs b/struts2/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index b4c73b5..0000000 --- a/struts2/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Mon Apr 09 22:08:08 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/struts2/.settings/org.eclipse.wst.common.component b/struts2/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 01c9ea4..0000000 --- a/struts2/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/struts2/.settings/org.eclipse.wst.common.project.facet.core.xml b/struts2/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index f2b0ce9..0000000 --- a/struts2/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/struts2/.settings/org.eclipse.wst.jsdt.ui.superType.container b/struts2/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/struts2/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/struts2/.settings/org.eclipse.wst.jsdt.ui.superType.name b/struts2/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/struts2/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/struts2/WebContent/META-INF/MANIFEST.MF b/struts2/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/struts2/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/struts2/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/struts2/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/struts2/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/struts2/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/struts2/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/struts2/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/struts2/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/commons-io-1.1.jar b/struts2/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/struts2/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/struts2/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/struts2/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/struts2/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/oro-2.0.8.jar b/struts2/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/standard-1.0.6.jar b/struts2/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/struts2/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/struts2/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/struts2/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/struts2/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/struts2/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/struts2/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/struts2/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/struts2/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/struts2/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/struts2/WebContent/WEB-INF/struts-config.xml b/struts2/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index 0c2b6cd..0000000 --- a/struts2/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/struts2/WebContent/WEB-INF/views/Acknowledgement.jsp b/struts2/WebContent/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 3497979..0000000 --- a/struts2/WebContent/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

        Your details have been saved successfully..

        - - \ No newline at end of file diff --git a/struts2/WebContent/WEB-INF/views/AddCar.jsp b/struts2/WebContent/WEB-INF/views/AddCar.jsp deleted file mode 100644 index b836ee1..0000000 --- a/struts2/WebContent/WEB-INF/views/AddCar.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - -Insert title here - - - -

        - -

        Please enter your details here

        - - - - -Type : - Sedan - Coupe - Van
        -Make :
        -Model :
        -Year :
        -Price :
        - - -
        - - - \ No newline at end of file diff --git a/struts2/WebContent/WEB-INF/views/ListCars.jsp b/struts2/WebContent/WEB-INF/views/ListCars.jsp deleted file mode 100644 index 4078568..0000000 --- a/struts2/WebContent/WEB-INF/views/ListCars.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - -
        TypeMakeModelYearPrice
        ${eachCar.type}${eachCar.make}${eachCar.model}${eachCar.year}${eachCar.price}
        - - \ No newline at end of file diff --git a/struts2/WebContent/WEB-INF/web.xml b/struts2/WebContent/WEB-INF/web.xml deleted file mode 100644 index d430482..0000000 --- a/struts2/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - struts2 - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/struts-config.xml - - - - - - ActionServlet - / - - - \ No newline at end of file diff --git a/struts2/readme.txt b/struts2/readme.txt deleted file mode 100644 index d303bc5..0000000 --- a/struts2/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -Goals : - ---> Struts basics revisited ---> Understanding of ActionForm ---> Struts tag libraries ---> Internationalization ---> Validation - - diff --git a/struts2/src/CarDealership.properties b/struts2/src/CarDealership.properties deleted file mode 100644 index 2c2efe4..0000000 --- a/struts2/src/CarDealership.properties +++ /dev/null @@ -1,12 +0,0 @@ -display.welcome=Welcome to UncleBob's DEALERSHIP!! - -type.required=Car type is required to enter -make.required=Make is required to enter -model.required=Model is required to enter - -errors.header=

        Validation Errors

          -errors.prefix=
        • -errors.suffix= -errors.footer=
        - - diff --git a/struts2/src/CarDealership_de.properties b/struts2/src/CarDealership_de.properties deleted file mode 100644 index e4084e5..0000000 --- a/struts2/src/CarDealership_de.properties +++ /dev/null @@ -1 +0,0 @@ -display.welcome=Welcome in German \ No newline at end of file diff --git a/struts2/src/com/training/struts/car/domain/Car.java b/struts2/src/com/training/struts/car/domain/Car.java deleted file mode 100644 index 9186eda..0000000 --- a/struts2/src/com/training/struts/car/domain/Car.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.struts.car.domain; - -public class Car -{ - private int id; - private String type; - private String make; - private String model; - private int year; - private double price; - - public Car(int id, String type, String make, String model, int year, - double price) - { - this(type, make, model, year, price); - this.id = id; - } - - public Car(String type, String make, String model, int year, double price) - { - this.type = type; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - } - - public int getId() - { - return id; - } - - public String getMake() - { - return make; - } - - public String getModel() - { - return model; - } - - public int getYear() - { - return year; - } - - public double getPrice() - { - return price; - } - - public String getType() - { - return type; - } -} diff --git a/struts2/src/com/training/struts/car/domain/CarDAO.java b/struts2/src/com/training/struts/car/domain/CarDAO.java deleted file mode 100644 index b793bc6..0000000 --- a/struts2/src/com/training/struts/car/domain/CarDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.struts.car.domain; - -import java.util.List; - - -interface CarDAO { - void createCar(Car car); - List getAllCars(); - Car getCarById(int id); - void update(Car car); - void delete(int id); -} diff --git a/struts2/src/com/training/struts/car/domain/CarDAOJDBCImpl.java b/struts2/src/com/training/struts/car/domain/CarDAOJDBCImpl.java deleted file mode 100644 index f61573d..0000000 --- a/struts2/src/com/training/struts/car/domain/CarDAOJDBCImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.training.struts.car.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class CarDAOJDBCImpl implements CarDAO -{ - - CarDAOJDBCImpl() - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) - { - throw new DAOException(e); - } - } - - @Override - public List getAllCars() - { - - List cars = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try - { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from car"); - - while (rs.next()) - { - int id = rs.getInt("id"); - - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - Car car = new Car(id, type, make, model, year, price); - cars.add(car); - } - return cars; - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(rs, stmt, con); - } - } - - @Override - public void createCar(Car car) - { - - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("insert into car(type, make, model, year, price) values(?,?,?,?,?)"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - @Override - public Car getCarById(int id) - { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Car car = null; - try - { - con = getConnection(); - stmt = con.prepareStatement("select * from car where id = ?"); - stmt.setInt(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) - { - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - car = new Car(id, type, make, model, year, price); - } - return car; - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - private Connection getConnection() throws SQLException - { - return DriverManager.getConnection("jdbc:mysql://localhost/training", - "root", "password"); - - } - - private void closeResources(ResultSet rs, Statement stmt, Connection con) - { - if (rs != null) - { - try - { - rs.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (stmt != null) - { - try - { - stmt.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (con != null) - { - try - { - con.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - - } - - @Override - public void update(Car car) - { - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("update car set type = ?, make = ?, model= ?, year = ?, price = ? where id = ?"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - stmt.setInt(6, car.getId()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - } - - @Override - public void delete(int id) - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con.prepareStatement("delete from car where id = ?"); - stmt.setInt(1, id); - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } -} diff --git a/struts2/src/com/training/struts/car/domain/CarService.java b/struts2/src/com/training/struts/car/domain/CarService.java deleted file mode 100644 index c2a84b2..0000000 --- a/struts2/src/com/training/struts/car/domain/CarService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.struts.car.domain; - -import java.util.List; - -public interface CarService -{ - void create(Car car); - List getAllCars(); -} diff --git a/struts2/src/com/training/struts/car/domain/CarServiceImpl.java b/struts2/src/com/training/struts/car/domain/CarServiceImpl.java deleted file mode 100644 index 95c5fa4..0000000 --- a/struts2/src/com/training/struts/car/domain/CarServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.struts.car.domain; - -import java.util.List; - -public class CarServiceImpl implements CarService -{ - @Override - public void create(Car car) - { - CarDAO dao = new CarDAOJDBCImpl(); - dao.createCar(car); - } - - @Override - public List getAllCars() - { - CarDAO dao = new CarDAOJDBCImpl(); - return dao.getAllCars(); - } -} diff --git a/struts2/src/com/training/struts/car/domain/DAOException.java b/struts2/src/com/training/struts/car/domain/DAOException.java deleted file mode 100644 index baeb33b..0000000 --- a/struts2/src/com/training/struts/car/domain/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.struts.car.domain; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(Throwable ex) { - super(ex); - } -} diff --git a/struts2/src/com/training/struts/car/web/AddCarAction.java b/struts2/src/com/training/struts/car/web/AddCarAction.java deleted file mode 100644 index e076a0f..0000000 --- a/struts2/src/com/training/struts/car/web/AddCarAction.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.struts.car.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddCarAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - return mapping.findForward("add"); - } -} diff --git a/struts2/src/com/training/struts/car/web/CarForm.java b/struts2/src/com/training/struts/car/web/CarForm.java deleted file mode 100644 index 67cd17e..0000000 --- a/struts2/src/com/training/struts/car/web/CarForm.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.training.struts.car.web; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class CarForm extends ActionForm -{ - private String type; - private String make; - private String model; - private int year; - private double price; - - public String getType() - { - return type; - } - - public void setType(String type) - { - this.type = type; - } - - public String getMake() - { - return make; - } - - public void setMake(String make) - { - this.make = make; - } - - public String getModel() - { - return model; - } - - public void setModel(String model) - { - this.model = model; - } - - public int getYear() - { - return year; - } - - public void setYear(int year) - { - this.year = year; - } - - public double getPrice() - { - return price; - } - - public void setPrice(double price) - { - this.price = price; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) - { - ActionErrors errors = new ActionErrors(); - - if(type == null || type.length() == 0) - { - errors.add("type", new ActionMessage("type.required")); - } - if(make == null || make.length() == 0) - { - errors.add("make", new ActionMessage("make.required")); - } - if(model == null || model.length() == 0) - { - errors.add("model", new ActionMessage("model.required")); - } - - return errors; - } - -} diff --git a/struts2/src/com/training/struts/car/web/ListCarAction.java b/struts2/src/com/training/struts/car/web/ListCarAction.java deleted file mode 100644 index fca06ce..0000000 --- a/struts2/src/com/training/struts/car/web/ListCarAction.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.training.struts.car.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.struts.car.domain.Car; -import com.training.struts.car.domain.CarService; -import com.training.struts.car.domain.CarServiceImpl; - -public class ListCarAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - CarService service = new CarServiceImpl(); - List cars = service.getAllCars(); - - request.setAttribute("cars", cars); - - return mapping.findForward("list"); - } -} diff --git a/struts2/src/com/training/struts/car/web/SaveCarAction.java b/struts2/src/com/training/struts/car/web/SaveCarAction.java deleted file mode 100644 index 8f3f77f..0000000 --- a/struts2/src/com/training/struts/car/web/SaveCarAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.struts.car.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.struts.car.domain.Car; -import com.training.struts.car.domain.CarService; -import com.training.struts.car.domain.CarServiceImpl; - -public class SaveCarAction extends Action -{ - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - CarForm carForm = (CarForm) form; - - CarService service = new CarServiceImpl(); - Car car = new Car(carForm.getType(), carForm.getMake(), carForm.getModel(), carForm.getYear(), carForm.getPrice()); - - service.create(car); - - return mapping.findForward("acknowledgement"); - - } -} diff --git a/struts3/.classpath b/struts3/.classpath deleted file mode 100644 index 5174128..0000000 --- a/struts3/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/struts3/.project b/struts3/.project deleted file mode 100644 index adb4fed..0000000 --- a/struts3/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - struts3 - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/struts3/.settings/.jsdtscope b/struts3/.settings/.jsdtscope deleted file mode 100644 index 887f573..0000000 --- a/struts3/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/struts3/.settings/org.eclipse.jdt.core.prefs b/struts3/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2971595..0000000 --- a/struts3/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Tue Apr 10 06:28:30 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/struts3/.settings/org.eclipse.wst.common.component b/struts3/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 7487ff0..0000000 --- a/struts3/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/struts3/.settings/org.eclipse.wst.common.project.facet.core.xml b/struts3/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 456aae9..0000000 --- a/struts3/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/struts3/.settings/org.eclipse.wst.jsdt.ui.superType.container b/struts3/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/struts3/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/struts3/.settings/org.eclipse.wst.jsdt.ui.superType.name b/struts3/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/struts3/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/struts3/WebContent/META-INF/MANIFEST.MF b/struts3/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/struts3/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/struts3/WebContent/WEB-INF/lib/antlr-2.7.2.jar b/struts3/WebContent/WEB-INF/lib/antlr-2.7.2.jar deleted file mode 100644 index 8850fc6..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/antlr-2.7.2.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/bsf-2.3.0.jar b/struts3/WebContent/WEB-INF/lib/bsf-2.3.0.jar deleted file mode 100644 index caa4dea..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/bsf-2.3.0.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar b/struts3/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar deleted file mode 100644 index caf7ae3..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/commons-chain-1.2.jar b/struts3/WebContent/WEB-INF/lib/commons-chain-1.2.jar deleted file mode 100644 index 20fa4c5..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/commons-chain-1.2.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/commons-digester-1.8.jar b/struts3/WebContent/WEB-INF/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar b/struts3/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/commons-io-1.1.jar b/struts3/WebContent/WEB-INF/lib/commons-io-1.1.jar deleted file mode 100644 index 624fc1a..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/commons-io-1.1.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar b/struts3/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar b/struts3/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar deleted file mode 100644 index 55b12b1..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/jstl-1.0.2.jar b/struts3/WebContent/WEB-INF/lib/jstl-1.0.2.jar deleted file mode 100644 index f832589..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/jstl-1.0.2.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar b/struts3/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar deleted file mode 100644 index af5847e..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/mysql-connector-java-5.1.12-bin.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/oro-2.0.8.jar b/struts3/WebContent/WEB-INF/lib/oro-2.0.8.jar deleted file mode 100644 index 23488d2..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/oro-2.0.8.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/standard-1.0.6.jar b/struts3/WebContent/WEB-INF/lib/standard-1.0.6.jar deleted file mode 100644 index c74dbad..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/standard-1.0.6.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/struts-core-1.3.10.jar b/struts3/WebContent/WEB-INF/lib/struts-core-1.3.10.jar deleted file mode 100644 index 81ef9b3..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/struts-core-1.3.10.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/struts-el-1.3.10.jar b/struts3/WebContent/WEB-INF/lib/struts-el-1.3.10.jar deleted file mode 100644 index f2cc95a..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/struts-el-1.3.10.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar b/struts3/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar deleted file mode 100644 index e86653f..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/struts-extras-1.3.10.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar b/struts3/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar deleted file mode 100644 index 821fb56..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/struts-faces-1.3.10.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar b/struts3/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar deleted file mode 100644 index 8fe547d..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.10.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar b/struts3/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar deleted file mode 100644 index 3c9b770..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/struts-scripting-1.3.10.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar b/struts3/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar deleted file mode 100644 index 1ec7a5b..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/struts-taglib-1.3.10.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar b/struts3/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar deleted file mode 100644 index e05cc95..0000000 Binary files a/struts3/WebContent/WEB-INF/lib/struts-tiles-1.3.10.jar and /dev/null differ diff --git a/struts3/WebContent/WEB-INF/struts-config.xml b/struts3/WebContent/WEB-INF/struts-config.xml deleted file mode 100644 index 1634b8f..0000000 --- a/struts3/WebContent/WEB-INF/struts-config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/struts3/WebContent/WEB-INF/views/Acknowledgement.jsp b/struts3/WebContent/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 3497979..0000000 --- a/struts3/WebContent/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

        Your details have been saved successfully..

        - - \ No newline at end of file diff --git a/struts3/WebContent/WEB-INF/views/AddCar.jsp b/struts3/WebContent/WEB-INF/views/AddCar.jsp deleted file mode 100644 index b67e413..0000000 --- a/struts3/WebContent/WEB-INF/views/AddCar.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - -Insert title here - - - -

        - -

        Please enter your details here

        - - - - -Type : - Sedan - Coupe - Van
        -Make :
        -Model :
        -Year :
        -Price :
        - - -
        - - - \ No newline at end of file diff --git a/struts3/WebContent/WEB-INF/views/ListCars.jsp b/struts3/WebContent/WEB-INF/views/ListCars.jsp deleted file mode 100644 index 4078568..0000000 --- a/struts3/WebContent/WEB-INF/views/ListCars.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - -
        TypeMakeModelYearPrice
        ${eachCar.type}${eachCar.make}${eachCar.model}${eachCar.year}${eachCar.price}
        - - \ No newline at end of file diff --git a/struts3/WebContent/WEB-INF/web.xml b/struts3/WebContent/WEB-INF/web.xml deleted file mode 100644 index d430482..0000000 --- a/struts3/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - struts2 - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/struts-config.xml - - - - - - ActionServlet - / - - - \ No newline at end of file diff --git a/struts3/readme.txt b/struts3/readme.txt deleted file mode 100644 index 93119bc..0000000 --- a/struts3/readme.txt +++ /dev/null @@ -1 +0,0 @@ ---> Dispatch action example \ No newline at end of file diff --git a/struts3/src/CarDealership.properties b/struts3/src/CarDealership.properties deleted file mode 100644 index 2c2efe4..0000000 --- a/struts3/src/CarDealership.properties +++ /dev/null @@ -1,12 +0,0 @@ -display.welcome=Welcome to UncleBob's DEALERSHIP!! - -type.required=Car type is required to enter -make.required=Make is required to enter -model.required=Model is required to enter - -errors.header=

        Validation Errors

          -errors.prefix=
        • -errors.suffix= -errors.footer=
        - - diff --git a/struts3/src/com/training/struts/car/domain/Car.java b/struts3/src/com/training/struts/car/domain/Car.java deleted file mode 100644 index 9186eda..0000000 --- a/struts3/src/com/training/struts/car/domain/Car.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.training.struts.car.domain; - -public class Car -{ - private int id; - private String type; - private String make; - private String model; - private int year; - private double price; - - public Car(int id, String type, String make, String model, int year, - double price) - { - this(type, make, model, year, price); - this.id = id; - } - - public Car(String type, String make, String model, int year, double price) - { - this.type = type; - this.make = make; - this.model = model; - this.year = year; - this.price = price; - } - - public int getId() - { - return id; - } - - public String getMake() - { - return make; - } - - public String getModel() - { - return model; - } - - public int getYear() - { - return year; - } - - public double getPrice() - { - return price; - } - - public String getType() - { - return type; - } -} diff --git a/struts3/src/com/training/struts/car/domain/CarDAO.java b/struts3/src/com/training/struts/car/domain/CarDAO.java deleted file mode 100644 index b793bc6..0000000 --- a/struts3/src/com/training/struts/car/domain/CarDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.struts.car.domain; - -import java.util.List; - - -interface CarDAO { - void createCar(Car car); - List getAllCars(); - Car getCarById(int id); - void update(Car car); - void delete(int id); -} diff --git a/struts3/src/com/training/struts/car/domain/CarDAOJDBCImpl.java b/struts3/src/com/training/struts/car/domain/CarDAOJDBCImpl.java deleted file mode 100644 index f61573d..0000000 --- a/struts3/src/com/training/struts/car/domain/CarDAOJDBCImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.training.struts.car.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class CarDAOJDBCImpl implements CarDAO -{ - - CarDAOJDBCImpl() - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) - { - throw new DAOException(e); - } - } - - @Override - public List getAllCars() - { - - List cars = new ArrayList(); - - Connection con = null; - Statement stmt = null; - ResultSet rs = null; - - try - { - con = getConnection(); - stmt = con.createStatement(); - rs = stmt.executeQuery("select * from car"); - - while (rs.next()) - { - int id = rs.getInt("id"); - - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - Car car = new Car(id, type, make, model, year, price); - cars.add(car); - } - return cars; - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(rs, stmt, con); - } - } - - @Override - public void createCar(Car car) - { - - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("insert into car(type, make, model, year, price) values(?,?,?,?,?)"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - @Override - public Car getCarById(int id) - { - Connection con = null; - PreparedStatement stmt = null; - ResultSet rs = null; - - Car car = null; - try - { - con = getConnection(); - stmt = con.prepareStatement("select * from car where id = ?"); - stmt.setInt(1, id); - rs = stmt.executeQuery(); - - if (rs.next()) - { - String type = rs.getString("type"); - String make = rs.getString("make"); - String model = rs.getString("model"); - int year = rs.getInt("year"); - double price = rs.getDouble("price"); - - car = new Car(id, type, make, model, year, price); - } - return car; - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - - private Connection getConnection() throws SQLException - { - return DriverManager.getConnection("jdbc:mysql://localhost/training", - "root", "password"); - - } - - private void closeResources(ResultSet rs, Statement stmt, Connection con) - { - if (rs != null) - { - try - { - rs.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (stmt != null) - { - try - { - stmt.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - if (con != null) - { - try - { - con.close(); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - - } - - @Override - public void update(Car car) - { - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con - .prepareStatement("update car set type = ?, make = ?, model= ?, year = ?, price = ? where id = ?"); - - stmt.setString(1, car.getType()); - stmt.setString(2, car.getMake()); - stmt.setString(3, car.getModel()); - stmt.setInt(4, car.getYear()); - stmt.setDouble(5, car.getPrice()); - stmt.setInt(6, car.getId()); - - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } - } - - @Override - public void delete(int id) - { - Connection con = null; - PreparedStatement stmt = null; - - try - { - con = getConnection(); - stmt = con.prepareStatement("delete from car where id = ?"); - stmt.setInt(1, id); - stmt.execute(); - - } catch (SQLException e) - { - throw new DAOException(e); - } finally - { - closeResources(null, stmt, con); - } - } -} diff --git a/struts3/src/com/training/struts/car/domain/CarService.java b/struts3/src/com/training/struts/car/domain/CarService.java deleted file mode 100644 index c2a84b2..0000000 --- a/struts3/src/com/training/struts/car/domain/CarService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.training.struts.car.domain; - -import java.util.List; - -public interface CarService -{ - void create(Car car); - List getAllCars(); -} diff --git a/struts3/src/com/training/struts/car/domain/CarServiceImpl.java b/struts3/src/com/training/struts/car/domain/CarServiceImpl.java deleted file mode 100644 index 95c5fa4..0000000 --- a/struts3/src/com/training/struts/car/domain/CarServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.struts.car.domain; - -import java.util.List; - -public class CarServiceImpl implements CarService -{ - @Override - public void create(Car car) - { - CarDAO dao = new CarDAOJDBCImpl(); - dao.createCar(car); - } - - @Override - public List getAllCars() - { - CarDAO dao = new CarDAOJDBCImpl(); - return dao.getAllCars(); - } -} diff --git a/struts3/src/com/training/struts/car/domain/DAOException.java b/struts3/src/com/training/struts/car/domain/DAOException.java deleted file mode 100644 index baeb33b..0000000 --- a/struts3/src/com/training/struts/car/domain/DAOException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.struts.car.domain; - -public class DAOException extends RuntimeException { - - public DAOException(String errorMessage) { - super(errorMessage); - } - - public DAOException(Throwable ex) { - super(ex); - } -} diff --git a/struts3/src/com/training/struts/car/web/CarAction.java b/struts3/src/com/training/struts/car/web/CarAction.java deleted file mode 100644 index 5081454..0000000 --- a/struts3/src/com/training/struts/car/web/CarAction.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.training.struts.car.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.actions.DispatchAction; - -import com.training.struts.car.domain.Car; -import com.training.struts.car.domain.CarService; -import com.training.struts.car.domain.CarServiceImpl; - -public class CarAction extends DispatchAction -{ - public ActionForward list(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - CarService service = new CarServiceImpl(); - List cars = service.getAllCars(); - - request.setAttribute("cars", cars); - - return mapping.findForward("list"); - } - - public ActionForward add(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - return mapping.findForward("add"); - } - - public ActionForward save(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception - { - CarForm carForm = (CarForm) form; - - CarService service = new CarServiceImpl(); - Car car = new Car(carForm.getType(), carForm.getMake(), carForm.getModel(), carForm.getYear(), carForm.getPrice()); - - service.create(car); - - return mapping.findForward("acknowledgement"); - - } -} diff --git a/struts3/src/com/training/struts/car/web/CarForm.java b/struts3/src/com/training/struts/car/web/CarForm.java deleted file mode 100644 index 8753c9a..0000000 --- a/struts3/src/com/training/struts/car/web/CarForm.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.training.struts.car.web; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class CarForm extends ActionForm -{ - private String type; - private String make; - private String model; - private int year; - private double price; - - public String getType() - { - return type; - } - - public void setType(String type) - { - this.type = type; - } - - public String getMake() - { - return make; - } - - public void setMake(String make) - { - this.make = make; - } - - public String getModel() - { - return model; - } - - public void setModel(String model) - { - this.model = model; - } - - public int getYear() - { - return year; - } - - public void setYear(int year) - { - this.year = year; - } - - public double getPrice() - { - return price; - } - - public void setPrice(double price) - { - this.price = price; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) - { - ActionErrors errors = new ActionErrors(); - - String action = request.getParameter("action"); - - if(action != null && action.equals("save")) - { - if(type == null || type.length() == 0) - { - errors.add("type", new ActionMessage("type.required")); - } - if(make == null || make.length() == 0) - { - errors.add("make", new ActionMessage("make.required")); - } - if(model == null || model.length() == 0) - { - errors.add("model", new ActionMessage("model.required")); - } - } - - return errors; - } - -} diff --git a/strutsmaven/.classpath b/strutsmaven/.classpath deleted file mode 100644 index 8cf008d..0000000 --- a/strutsmaven/.classpath +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/strutsmaven/.project b/strutsmaven/.project deleted file mode 100644 index fa8c69a..0000000 --- a/strutsmaven/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - strutsmaven - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/strutsmaven/.settings/.jsdtscope b/strutsmaven/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/strutsmaven/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/strutsmaven/.settings/org.eclipse.jdt.core.prefs b/strutsmaven/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index e22a743..0000000 --- a/strutsmaven/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sun Mar 04 10:22:57 EST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/strutsmaven/.settings/org.eclipse.m2e.core.prefs b/strutsmaven/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index ae3553d..0000000 --- a/strutsmaven/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sun Mar 04 10:09:44 EST 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/strutsmaven/.settings/org.eclipse.wst.common.component b/strutsmaven/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 8818b61..0000000 --- a/strutsmaven/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/strutsmaven/.settings/org.eclipse.wst.common.project.facet.core.xml b/strutsmaven/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 6b007af..0000000 --- a/strutsmaven/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/strutsmaven/.settings/org.eclipse.wst.jsdt.ui.superType.container b/strutsmaven/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/strutsmaven/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/strutsmaven/.settings/org.eclipse.wst.jsdt.ui.superType.name b/strutsmaven/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/strutsmaven/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/strutsmaven/pom.xml b/strutsmaven/pom.xml deleted file mode 100644 index bda2d6e..0000000 --- a/strutsmaven/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - 4.0.0 - - com.training - strutsmaven - war - 1.0 - - strutsmaven Maven Webapp - http://maven.apache.org - - - junit - junit - 4.10 - test - - - javax.servlet - servlet-api - 2.5 - provided - - - org.apache.struts - struts-taglib - 1.3.10 - - - mysql - mysql-connector-java - 5.1.18 - - - - strutsmaven - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/domain/DAOException.java b/strutsmaven/src/main/java/com/training/java/struts/students/domain/DAOException.java deleted file mode 100644 index ad3c3f7..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/domain/DAOException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.java.struts.students.domain; - -public class DAOException extends RuntimeException { - - public DAOException(Throwable ex) - { - super(ex); - } - - public DAOException(String errorMessage, Throwable ex) - { - super(errorMessage, ex); - } -} diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/domain/Student.java b/strutsmaven/src/main/java/com/training/java/struts/students/domain/Student.java deleted file mode 100644 index ca60747..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/domain/Student.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.training.java.struts.students.domain; - -public class Student { - - private int id; - private String firstName; - private String lastName; - private String phoneNumber; - private String email; - private int age; - private String city; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public String toString() { - - StringBuilder str = new StringBuilder(); - str.append("id = " + id); - str.append(" city = " + city); - str.append(" age = " + age); - str.append(" email = " + email); - str.append(" firstName = " + firstName); - str.append(" lastName = " + lastName); - - return str.toString(); - } - -} diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentDAO.java b/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentDAO.java deleted file mode 100644 index 98ac085..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.util.List; - -interface StudentDAO { - - List getAllStudents(); - void create(Student student); - -} diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentDAOJDBCImpl.java b/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentDAOJDBCImpl.java deleted file mode 100644 index 7ae6107..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentDAOJDBCImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -class StudentDAOJDBCImpl implements StudentDAO { - - private String driverClassName; - private String jdbcURL; - private String username; - private String password; - - public StudentDAOJDBCImpl(String driverClassName, String jdbcURL, - String username, String password) { - this.driverClassName = driverClassName; - this.jdbcURL = jdbcURL; - this.username = username; - this.password = password; - } - - @Override - public List getAllStudents() { - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try { - connection = getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from students"); - - List students = new ArrayList(); - - while (resultSet.next()) { - String firstName = resultSet.getString("first_name"); - String lastName = resultSet.getString("last_name"); - String city = resultSet.getString("city"); - int id = resultSet.getInt("id"); - int age = resultSet.getInt("age"); - String phoneNumber = resultSet.getString("phone_number"); - String email = resultSet.getString("email"); - - Student student = new Student(); - student.setAge(age); - student.setCity(city); - student.setEmail(email); - student.setFirstName(firstName); - student.setId(id); - student.setLastName(lastName); - student.setPhoneNumber(phoneNumber); - - students.add(student); - } - - return students; - } catch (SQLException e) { - e.printStackTrace(); - throw new DAOException(e); - } finally { - try { - if (resultSet != null) { - resultSet.close(); - } - closeResources(statement, connection); - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public void create(Student student) { - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = getConnection(); - - statement = connection - .prepareStatement("insert into students values(?, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, student.getFirstName()); - statement.setString(2, student.getLastName()); - statement.setString(3, student.getPhoneNumber()); - statement.setString(4, student.getEmail()); - statement.setInt(5, student.getAge()); - statement.setString(6, student.getCity()); - statement.setInt(7, student.getId()); - - statement.execute(); - } catch (SQLException ex) { - ex.printStackTrace(); - throw new DAOException(ex); - } finally { - closeResources(statement, connection); - } - } - - private void closeResources(Statement statement, Connection connection) { - try { - if (statement != null) { - statement.close(); - } - if (connection != null) { - connection.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - } - } - - private Connection getConnection() throws SQLException { - try { - Class.forName(driverClassName); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - return DriverManager.getConnection(jdbcURL, username, password); - } - -} diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentService.java b/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentService.java deleted file mode 100644 index 0d233ee..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.util.List; - -public interface StudentService { - - List getAllStudents(); - void addStudent(Student student); - -} diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentServiceImpl.java b/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentServiceImpl.java deleted file mode 100644 index 22c8017..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/domain/StudentServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.java.struts.students.domain; - -import java.util.List; - -public class StudentServiceImpl implements StudentService { - - @Override - public void addStudent(Student student) { - - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - dao.create(student); - - } - - @Override - public List getAllStudents() { - StudentDAO dao = new StudentDAOJDBCImpl("com.mysql.jdbc.Driver", - "jdbc:mysql://localhost/training", "root", "password"); - return dao.getAllStudents(); - } -} diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/web/AddStudentAction.java b/strutsmaven/src/main/java/com/training/java/struts/students/web/AddStudentAction.java deleted file mode 100644 index c061a6a..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/web/AddStudentAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.struts.students.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddStudentAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("add"); - } - -} diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/web/ListStudentAction.java b/strutsmaven/src/main/java/com/training/java/struts/students/web/ListStudentAction.java deleted file mode 100644 index fd30d3c..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/web/ListStudentAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.struts.students.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.students.domain.Student; -import com.training.java.struts.students.domain.StudentService; -import com.training.java.struts.students.domain.StudentServiceImpl; - -public class ListStudentAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - StudentService service = new StudentServiceImpl(); - List students = service.getAllStudents(); - - request.setAttribute("students", students); - - return mapping.findForward("list"); - } - -} diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/web/SaveStudentAction.java b/strutsmaven/src/main/java/com/training/java/struts/students/web/SaveStudentAction.java deleted file mode 100644 index b5ea949..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/web/SaveStudentAction.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.training.java.struts.students.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -import com.training.java.struts.students.domain.Student; -import com.training.java.struts.students.domain.StudentService; -import com.training.java.struts.students.domain.StudentServiceImpl; - -public class SaveStudentAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - StudentForm studentForm = (StudentForm) form; - - System.out.println("first name = " + studentForm.getFirstName()); - System.out.println("last name = " + studentForm.getLastName()); - System.out.println("Age = " + studentForm.getAge()); - - Student student = new Student(); - - student.setAge(studentForm.getAge()); - student.setFirstName(studentForm.getFirstName()); - student.setLastName(studentForm.getLastName()); - student.setId(studentForm.getId()); - student.setEmail(studentForm.getEmail()); - student.setCity(studentForm.getCity()); - student.setPhoneNumber(studentForm.getPhone()); - - StudentService service = new StudentServiceImpl(); - service.addStudent(student); - - return mapping.findForward("acknowledgement"); - } -} diff --git a/strutsmaven/src/main/java/com/training/java/struts/students/web/StudentForm.java b/strutsmaven/src/main/java/com/training/java/struts/students/web/StudentForm.java deleted file mode 100644 index c4af267..0000000 --- a/strutsmaven/src/main/java/com/training/java/struts/students/web/StudentForm.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.training.java.struts.students.web; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class StudentForm extends ActionForm { - - private String firstName; - private String lastName; - private int age; - private int id; - private String phone; - private String email; - private String city; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { - - ActionErrors errors = new ActionErrors(); - - if(firstName == null || firstName.trim().length() == 0) - { - errors.add("firstNameRequired", new ActionMessage("firstName.required")); - } - - if(lastName == null || lastName.trim().length() == 0) - { - errors.add("lastNameRequired", new ActionMessage("lastName.required")); - } - - if(id == 0) - { - errors.add("idRequired", new ActionMessage("id.required")); - } - - return errors; - } - -} diff --git a/strutsmaven/src/main/resources/Students.properties b/strutsmaven/src/main/resources/Students.properties deleted file mode 100644 index 99367c4..0000000 --- a/strutsmaven/src/main/resources/Students.properties +++ /dev/null @@ -1,16 +0,0 @@ -display.firstName=First Name -display.lastName=Last Name -display.city=City -display.age=Age -display.phoneNumber=Phone Number -display.email=Email - -errors.header=

        Validation Errors

          -errors.footer=
        -errors.prefix=
      • -errors.suffix=
      • - -id.required=ID is required to create a new student -firstName.required=First name is mandatory -lastName.required=Last name is mandatory - diff --git a/strutsmaven/src/main/resources/Students_de.properties b/strutsmaven/src/main/resources/Students_de.properties deleted file mode 100644 index dd630a4..0000000 --- a/strutsmaven/src/main/resources/Students_de.properties +++ /dev/null @@ -1,6 +0,0 @@ -display.firstName=DE First Name -display.lastName=DE Last Name -display.city=DE City -display.age=DE Age -display.phoneNumber=DE Phone Number -display.email=DE Email diff --git a/strutsmaven/src/main/resources/log4j.properties b/strutsmaven/src/main/resources/log4j.properties deleted file mode 100644 index fd9f7d4..0000000 --- a/strutsmaven/src/main/resources/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -log4j.rootLogger=ERROR, R -log4j.appender.R = org.apache.log4j.DailyRollingFileAppender -log4j.appender.R.File = /logs/StrutsAdvanced.log -log4j.appender.R.Append = true -log4j.appender.R.DatePattern = '.'yyy-MM-dd -log4j.appender.R.layout = org.apache.log4j.PatternLayout -log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n - -log4j.logger.com.training=DEBUG \ No newline at end of file diff --git a/strutsmaven/src/main/webapp/WEB-INF/struts-config.xml b/strutsmaven/src/main/webapp/WEB-INF/struts-config.xml deleted file mode 100644 index bb6ae15..0000000 --- a/strutsmaven/src/main/webapp/WEB-INF/struts-config.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/strutsmaven/src/main/webapp/WEB-INF/views/Acknowledgement.jsp b/strutsmaven/src/main/webapp/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 6c93bc0..0000000 --- a/strutsmaven/src/main/webapp/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -

        Your details have been saved..

        - - \ No newline at end of file diff --git a/strutsmaven/src/main/webapp/WEB-INF/views/AddStudent.jsp b/strutsmaven/src/main/webapp/WEB-INF/views/AddStudent.jsp deleted file mode 100644 index 64fd61c..0000000 --- a/strutsmaven/src/main/webapp/WEB-INF/views/AddStudent.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %> - - - -Insert title here - - - - - -

        Please fill the details below and press Submit...

        - - Id :
        - First name :
        - Last name :
        - Age :
        - Phone :
        - Email :
        - City :
        - - -
        - - \ No newline at end of file diff --git a/strutsmaven/src/main/webapp/WEB-INF/views/ListStudents.jsp b/strutsmaven/src/main/webapp/WEB-INF/views/ListStudents.jsp deleted file mode 100644 index 19b7b19..0000000 --- a/strutsmaven/src/main/webapp/WEB-INF/views/ListStudents.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - -<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> -<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> - - - - -Insert title here - - - - - - - - - - - - - - - - - - - - - - - -
        - - - - - - - - - - - -
        - - \ No newline at end of file diff --git a/strutsmaven/src/main/webapp/WEB-INF/web.xml b/strutsmaven/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 136e080..0000000 --- a/strutsmaven/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - StrutsHelloWorld - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - - ActionServlet - org.apache.struts.action.ActionServlet - - - config - /WEB-INF/struts-config.xml - - - - - - ActionServlet - *.do - - - \ No newline at end of file diff --git a/strutsmaven/src/main/webapp/index.jsp b/strutsmaven/src/main/webapp/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/strutsmaven/src/main/webapp/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ - - -

        Hello World!

        - - diff --git a/strutsspring/.classpath b/strutsspring/.classpath deleted file mode 100644 index 803d7e0..0000000 --- a/strutsspring/.classpath +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/strutsspring/.project b/strutsspring/.project deleted file mode 100644 index 9c06e60..0000000 --- a/strutsspring/.project +++ /dev/null @@ -1,48 +0,0 @@ - - - strutsspring - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/strutsspring/.settings/.jsdtscope b/strutsspring/.settings/.jsdtscope deleted file mode 100644 index beb42ee..0000000 --- a/strutsspring/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/strutsspring/.settings/org.eclipse.jdt.core.prefs b/strutsspring/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62a317c..0000000 --- a/strutsspring/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/strutsspring/.settings/org.eclipse.m2e.core.prefs b/strutsspring/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b..0000000 --- a/strutsspring/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/strutsspring/.settings/org.eclipse.wst.common.component b/strutsspring/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 06d09f8..0000000 --- a/strutsspring/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/strutsspring/.settings/org.eclipse.wst.common.project.facet.core.xml b/strutsspring/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 6b007af..0000000 --- a/strutsspring/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/strutsspring/.settings/org.eclipse.wst.jsdt.ui.superType.container b/strutsspring/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/strutsspring/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/strutsspring/.settings/org.eclipse.wst.jsdt.ui.superType.name b/strutsspring/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/strutsspring/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/strutsspring/.springBeans b/strutsspring/.springBeans deleted file mode 100644 index c2332e7..0000000 --- a/strutsspring/.springBeans +++ /dev/null @@ -1,14 +0,0 @@ - - - 1 - - - - - - - src/main/resources/spring-config.xml - - - - diff --git a/strutsspring/pom.xml b/strutsspring/pom.xml deleted file mode 100644 index c422b75..0000000 --- a/strutsspring/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - 4.0.0 - com.training - strutsspring - war - 1.0 - stutsspring Maven Webapp - http://maven.apache.org - - - junit - junit - 4.10 - test - - - javax.servlet - servlet-api - 2.5 - provided - - - org.apache.struts - struts-taglib - 1.3.10 - - - com.oracle - ojdbc6 - 11.2 - - - org.springframework - spring-core - 3.1.2.RELEASE - - - - org.springframework - spring-context - 3.1.2.RELEASE - - - - org.springframework - spring-jdbc - 3.1.2.RELEASE - - - - org.springframework - spring-web - 3.1.2.RELEASE - - - - org.apache.commons - commons-lang3 - 3.1 - - - - stutsspring - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - diff --git a/strutsspring/src/main/java/com/training/java/struts/domain/Book.java b/strutsspring/src/main/java/com/training/java/struts/domain/Book.java deleted file mode 100644 index b9fe0e3..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/domain/Book.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.training.java.struts.domain; - -import java.io.Serializable; -import java.util.Date; - -public class Book implements Serializable { - private int id; - private String title; - private String author; - private String isbn; - private int pages; - private Date publisherDate; - - public Book(int id, String title, String author, String isbn, int pages, - Date publisherDate) { - super(); - this.id = id; - this.title = title; - this.author = author; - this.isbn = isbn; - this.pages = pages; - this.publisherDate = publisherDate; - } - - public void init() - { - - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getAuthor() { - return author; - } - - public String getIsbn() { - return isbn; - } - - public int getPages() { - return pages; - } - - public Date getPublisherDate() { - return publisherDate; - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/domain/BookDAO.java b/strutsspring/src/main/java/com/training/java/struts/domain/BookDAO.java deleted file mode 100644 index 62031f4..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/domain/BookDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -public interface BookDAO { - - List getAllBooks() throws DAOException; - void addBook(Book book) throws DAOException; - void updateBook(Book book) throws DAOException; - void deleteBook(int bookId) throws DAOException; - Book findByPrimaryKey(int bookId) throws DAOException; - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/domain/BookDAOJDBCImpl.java b/strutsspring/src/main/java/com/training/java/struts/domain/BookDAOJDBCImpl.java deleted file mode 100644 index 915eda8..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/domain/BookDAOJDBCImpl.java +++ /dev/null @@ -1,263 +0,0 @@ -package com.training.java.struts.domain; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository -class BookDAOJDBCImpl implements BookDAO { - - @Autowired - private DataSource dataSource; - - @Override - public List getAllBooks() throws DAOException { - - List books = new ArrayList(); - - Connection connection = null; - Statement statement = null; - ResultSet resultSet = null; - - try - { - connection = dataSource.getConnection(); - statement = connection.createStatement(); - resultSet = statement.executeQuery("select * from book"); - - while(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - Book book = new Book(id, title, author, isbn, pages, publisherDate); - - books.add(book); - } - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - - return books; - } - - @Override - public void addBook(Book book) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = dataSource.getConnection(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("insert into book values(book_id_seq.nextval, ?, ?, ?, ?, ?, ?)"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - statement.setInt(6, 1); - - int numberOfRowsInserted = statement.executeUpdate(); - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void updateBook(Book book) throws DAOException { - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = dataSource.getConnection(); - int id = book.getId(); - String author = book.getAuthor(); - String isbn = book.getIsbn(); - String title = book.getTitle(); - int pages = book.getPages(); - java.sql.Date publisherDate = new java.sql.Date(book.getPublisherDate().getTime()); - - statement = connection.prepareStatement("update book set title = ?, author = ?, number_of_pages = ?, isbn = ?, pub_date = ? where book_id = ?"); - - statement.setString(1, title); - statement.setString(2, author); - statement.setInt(3, pages); - statement.setString(4, isbn); - statement.setDate(5, publisherDate); - - statement.setInt(6, id); - - int numberOfRowsUpdate = statement.executeUpdate(); - - if(numberOfRowsUpdate != 1) - { - throw new DAOException("Update book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public void deleteBook(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = dataSource.getConnection(); - - statement = connection.prepareStatement("delete book where book_id = ?"); - statement.setInt(1, bookId); - - int numberOfRowsDeleted = statement.executeUpdate(); - - if(numberOfRowsDeleted != 1) - { - throw new DAOException("Delete book failed!!"); - } - } - catch(SQLException ex) - { - ex.printStackTrace(); - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - - @Override - public Book findByPrimaryKey(int bookId) throws DAOException { - - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - - try - { - connection = dataSource.getConnection(); - statement = connection.prepareStatement("select * from book where book_id = ?"); - - statement.setInt(1, bookId); - - resultSet = statement.executeQuery(); - - if(resultSet.next()) - { - int id = resultSet.getInt("book_id"); - String title = resultSet.getString("title"); - String author = resultSet.getString("author"); - int pages = resultSet.getInt("number_of_pages"); - String isbn = resultSet.getString("isbn"); - Date publisherDate = resultSet.getDate("pub_date"); - - return new Book(id, title, author, isbn, pages, publisherDate); - } - - throw new DAOException("Invalid book id provided!!"); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - finally - { - closeResources(resultSet, statement, connection); - } - } - -/* private Connection getConnection() throws DAOException - { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new DAOException(ex); - } - catch(SQLException ex) - { - throw new DAOException(ex); - } - - } -*/ - private void closeResources(ResultSet resultSet, Statement statement, Connection connection) - { - if(resultSet != null) - { - try { - resultSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(statement != null) - { - try { - statement.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - if(connection != null) - { - try { - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/domain/BookService.java b/strutsspring/src/main/java/com/training/java/struts/domain/BookService.java deleted file mode 100644 index c1f928c..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/domain/BookService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -public interface BookService { - - List getAllBooks() throws ServiceException; - - void addBook(Book book) throws ServiceException; - - Book getById(int id) throws ServiceException; - - void update(Book book) throws ServiceException; - - void delete(int id) throws ServiceException; - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/domain/BookServiceImpl.java b/strutsspring/src/main/java/com/training/java/struts/domain/BookServiceImpl.java deleted file mode 100644 index c855622..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/domain/BookServiceImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.training.java.struts.domain; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class BookServiceImpl implements BookService { - - @Autowired - private BookDAO dao; - - @Override - public List getAllBooks() throws ServiceException { - - try { - return dao.getAllBooks(); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public void addBook(Book book) throws ServiceException { - try { - dao.addBook(book); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public Book getById(int id) throws ServiceException { - try { - return dao.findByPrimaryKey(id); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - - } - - @Override - public void update(Book book) throws ServiceException { - try { - dao.updateBook(book); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } - - @Override - public void delete(int id) throws ServiceException { - try { - dao.deleteBook(id); - } catch (DAOException ex) { - ex.printStackTrace(); - throw new ServiceException(ex); - } - } -} diff --git a/strutsspring/src/main/java/com/training/java/struts/domain/DAOException.java b/strutsspring/src/main/java/com/training/java/struts/domain/DAOException.java deleted file mode 100644 index acb3f75..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/domain/DAOException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.training.java.struts.domain; - - -public class DAOException extends Exception { - - public DAOException(String errorMessage) - { - super(errorMessage); - } - - public DAOException(Throwable cause) - { - super(cause); - } - - public DAOException(String errorMessage, Throwable cause) { - super(errorMessage, cause); - - } -} diff --git a/strutsspring/src/main/java/com/training/java/struts/domain/ServiceException.java b/strutsspring/src/main/java/com/training/java/struts/domain/ServiceException.java deleted file mode 100644 index b1b34e9..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/domain/ServiceException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.training.java.struts.domain; - -public class ServiceException extends Exception { - - public ServiceException(Throwable ex) - { - super(ex); - } - - public ServiceException(String errorMessage) - { - super(errorMessage); - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/domain/package-info.java b/strutsspring/src/main/java/com/training/java/struts/domain/package-info.java deleted file mode 100644 index 51a5e92..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/domain/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.struts.domain; \ No newline at end of file diff --git a/strutsspring/src/main/java/com/training/java/struts/util/Constants.java b/strutsspring/src/main/java/com/training/java/struts/util/Constants.java deleted file mode 100644 index 3574718..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/util/Constants.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.java.struts.util; - -public class Constants { - - public static final String SPRING_APP_CTX_NAME = "SPRING_APP_CTX"; - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/util/MyDataSource.java b/strutsspring/src/main/java/com/training/java/struts/util/MyDataSource.java deleted file mode 100644 index ebd28f0..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/util/MyDataSource.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.training.java.struts.util; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.logging.Logger; - -import javax.sql.DataSource; - -public class MyDataSource implements DataSource { - - private String jdbcURL; - private String username; - private String password; - - public String getJdbcURL() { - return jdbcURL; - } - - public void setJdbcURL(String jdbcURL) { - this.jdbcURL = jdbcURL; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public PrintWriter getLogWriter() throws SQLException { - return null; - } - - @Override - public void setLogWriter(PrintWriter out) throws SQLException { - } - - @Override - public void setLoginTimeout(int seconds) throws SQLException { - } - - @Override - public int getLoginTimeout() throws SQLException { - return 0; - } - - @Override - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - return null; - } - - @Override - public T unwrap(Class iface) throws SQLException { - return null; - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - return false; - } - - @Override - public Connection getConnection() throws SQLException { - try { - Class.forName("oracle.jdbc.driver.OracleDriver"); - return DriverManager.getConnection(jdbcURL, username, password); - } catch (ClassNotFoundException ex) { - throw new SQLException(ex); - } - } - - @Override - public Connection getConnection(String username, String password) - throws SQLException { - return getConnection(); - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/util/SpringContextListener.java b/strutsspring/src/main/java/com/training/java/struts/util/SpringContextListener.java deleted file mode 100644 index 8b32e4b..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/util/SpringContextListener.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.java.struts.util; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class SpringContextListener implements ServletContextListener { - - @Override - public void contextDestroyed(ServletContextEvent arg0) { - - } - - @Override - public void contextInitialized(ServletContextEvent servletContextEvent) { - - System.out.println("contextInitialized called"); - - ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); - servletContextEvent.getServletContext().setAttribute(Constants.SPRING_APP_CTX_NAME, context); - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/web/AddBooksAction.java b/strutsspring/src/main/java/com/training/java/struts/web/AddBooksAction.java deleted file mode 100644 index 472eb1c..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/web/AddBooksAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class AddBooksAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("AddBook"); - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/web/BookForm.java b/strutsspring/src/main/java/com/training/java/struts/web/BookForm.java deleted file mode 100644 index 79b915a..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/web/BookForm.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; - -public class BookForm extends ActionForm { - - private String title; - private String author; - private String isbn; - private int pages; - private int id; - private boolean updateFlag; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public int getPages() { - return pages; - } - - public void setPages(int pages) { - this.pages = pages; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public boolean isUpdateFlag() { - return updateFlag; - } - - public void setUpdateFlag(boolean updateFlag) { - this.updateFlag = updateFlag; - } - - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { - - ActionErrors errors = new ActionErrors(); - - if (StringUtils.isBlank(this.title)) { - errors.add("title.missing", new ActionMessage( - "error.title.required")); - } - if (StringUtils.isBlank(this.author)) { - errors.add("author.missing", new ActionMessage( - "error.author.required")); - } - if (StringUtils.isBlank(this.isbn)) { - errors.add("isbn.errors", new ActionMessage("error.isbn.required")); - } - - return errors; - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/web/DeleteBookAction.java b/strutsspring/src/main/java/com/training/java/struts/web/DeleteBookAction.java deleted file mode 100644 index 6bf71dc..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/web/DeleteBookAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.java.struts.domain.BookService; - -public class DeleteBookAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - String idStr = request.getParameter("id"); - int id = Integer.parseInt(idStr); - - ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServlet().getServletContext()); - BookService service = context.getBean(BookService.class); - - service.delete(id); - - return mapping.findForward("List"); - } -} diff --git a/strutsspring/src/main/java/com/training/java/struts/web/HomeAction.java b/strutsspring/src/main/java/com/training/java/struts/web/HomeAction.java deleted file mode 100644 index 2859bec..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/web/HomeAction.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -public class HomeAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - return mapping.findForward("Home"); - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/web/ListBooksAction.java b/strutsspring/src/main/java/com/training/java/struts/web/ListBooksAction.java deleted file mode 100644 index 1fe5210..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/web/ListBooksAction.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.training.java.struts.web; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookService; - -public class ListBooksAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServlet().getServletContext()); - BookService service = context.getBean(BookService.class); - - List books = service.getAllBooks(); - - request.setAttribute("venkat", books); - - return mapping.findForward("ListBooks"); - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/web/SaveBooksAction.java b/strutsspring/src/main/java/com/training/java/struts/web/SaveBooksAction.java deleted file mode 100644 index 753bae7..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/web/SaveBooksAction.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.training.java.struts.web; - -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookService; - -public class SaveBooksAction extends Action { - - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - BookForm bookForm = (BookForm) form; - - //Convert BookForm into Book object - Book book = new Book(bookForm.getId(), bookForm.getTitle(), bookForm.getAuthor(), bookForm.getIsbn(), bookForm.getPages(), new Date()); - - //Call BookService and save the details - ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServlet().getServletContext()); - BookService service = context.getBean(BookService.class); - - if(bookForm.isUpdateFlag()) - { - service.update(book); - } - else - { - service.addBook(book); - } - - //Send acknowledgement - return mapping.findForward("Acknowledgement"); - - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/web/UpdateBookAction.java b/strutsspring/src/main/java/com/training/java/struts/web/UpdateBookAction.java deleted file mode 100644 index 9af60e8..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/web/UpdateBookAction.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.training.java.struts.web; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import com.training.java.struts.domain.Book; -import com.training.java.struts.domain.BookService; - -public class UpdateBookAction extends Action { - - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { - - BookForm bookForm = (BookForm) form; - - ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServlet().getServletContext()); - BookService service = context.getBean(BookService.class); - - Book book = service.getById(bookForm.getId()); - - bookForm.setAuthor(book.getAuthor()); - bookForm.setIsbn(book.getIsbn()); - bookForm.setPages(book.getPages()); - bookForm.setTitle(book.getTitle()); - bookForm.setUpdateFlag(true); - - return mapping.findForward("UpdateBook"); - - } - -} diff --git a/strutsspring/src/main/java/com/training/java/struts/web/package-info.java b/strutsspring/src/main/java/com/training/java/struts/web/package-info.java deleted file mode 100644 index 341c1c2..0000000 --- a/strutsspring/src/main/java/com/training/java/struts/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author Hari - * - */ -package com.training.java.struts.web; \ No newline at end of file diff --git a/strutsspring/src/main/resources/BookStore.properties b/strutsspring/src/main/resources/BookStore.properties deleted file mode 100644 index dd33f5f..0000000 --- a/strutsspring/src/main/resources/BookStore.properties +++ /dev/null @@ -1,20 +0,0 @@ -display.title=Title -display.author=Author -display.pubDate=Pub. Date -display.isbn=ISBN -display.pages=No of Pages - -error.title.required=Title is mandatory -error.isbn.required=ISBN is mandatory -error.author.required=Author is mandatory - -errors.header=

        Validation Errors

          -errors.prefix=
        1. -errors.suffix=
        2. -errors.footer=
        - - - - - - diff --git a/strutsspring/src/main/resources/BookStore_de.properties b/strutsspring/src/main/resources/BookStore_de.properties deleted file mode 100644 index 091ad60..0000000 --- a/strutsspring/src/main/resources/BookStore_de.properties +++ /dev/null @@ -1,5 +0,0 @@ -display.title=Titel -display.author=Autor -display.pubDate=Publisher Datum -display.isbn=ISBN -display.pages=No of Pages diff --git a/strutsspring/src/main/resources/spring-config.xml b/strutsspring/src/main/resources/spring-config.xml deleted file mode 100644 index 156ad87..0000000 --- a/strutsspring/src/main/resources/spring-config.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - diff --git a/strutsspring/src/main/webapp/WEB-INF/spring-config.xml b/strutsspring/src/main/webapp/WEB-INF/spring-config.xml deleted file mode 100644 index 156ad87..0000000 --- a/strutsspring/src/main/webapp/WEB-INF/spring-config.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - diff --git a/strutsspring/src/main/webapp/WEB-INF/struts-config.xml b/strutsspring/src/main/webapp/WEB-INF/struts-config.xml deleted file mode 100644 index 6501f8f..0000000 --- a/strutsspring/src/main/webapp/WEB-INF/struts-config.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/strutsspring/src/main/webapp/WEB-INF/views/Acknowledgement.jsp b/strutsspring/src/main/webapp/WEB-INF/views/Acknowledgement.jsp deleted file mode 100644 index 94a47c4..0000000 --- a/strutsspring/src/main/webapp/WEB-INF/views/Acknowledgement.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

        Your details have been saved.

        - - - - \ No newline at end of file diff --git a/strutsspring/src/main/webapp/WEB-INF/views/AddBook.jsp b/strutsspring/src/main/webapp/WEB-INF/views/AddBook.jsp deleted file mode 100644 index 036a09b..0000000 --- a/strutsspring/src/main/webapp/WEB-INF/views/AddBook.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - -<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> -<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> - - - - -Insert title here - - - - - - - - - - - : - - - - - -
        - : - - - - -
        - :
        - :
        - - - -
        - - - - - - - \ No newline at end of file diff --git a/strutsspring/src/main/webapp/WEB-INF/views/Index.jsp b/strutsspring/src/main/webapp/WEB-INF/views/Index.jsp deleted file mode 100644 index e2101f9..0000000 --- a/strutsspring/src/main/webapp/WEB-INF/views/Index.jsp +++ /dev/null @@ -1,18 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - - -

        Welcome to our Bookstore application!!

        - - If you want to add a book, please click here
        - For list of existing books, please click here
        - - - - \ No newline at end of file diff --git a/strutsspring/src/main/webapp/WEB-INF/views/ListBooks.jsp b/strutsspring/src/main/webapp/WEB-INF/views/ListBooks.jsp deleted file mode 100644 index 420e1cd..0000000 --- a/strutsspring/src/main/webapp/WEB-INF/views/ListBooks.jsp +++ /dev/null @@ -1,38 +0,0 @@ -<%@page import="java.lang.reflect.Method"%> -<%@page import="com.training.java.struts.domain.Book"%> -<%@page import="java.util.List"%> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> - - - - - - -Insert title here - - - - - - - - - - - - - - - - - - -
        TitleAuthorISBNUpdate/Delete Link
        ${aBook.title}${aBook.author}${aBook.isbn} - Update - Delete -
        - - - \ No newline at end of file diff --git a/strutsspring/src/main/webapp/WEB-INF/web.xml b/strutsspring/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index a64f01e..0000000 --- a/strutsspring/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - struts1 - - index.html - index.htm - index.jsp - default.html - default.htm - default.jsp - - - org.springframework.web.context.ContextLoaderListener - - - ActionServlet - org.apache.struts.action.ActionServlet - - config - /WEB-INF/struts-config.xml - - - - ActionServlet - / - - - contextConfigLocation - /WEB-INF/spring-config.xml - - \ No newline at end of file diff --git a/wsconsumer/.classpath b/wsconsumer/.classpath deleted file mode 100644 index 7eca680..0000000 --- a/wsconsumer/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/wsconsumer/.project b/wsconsumer/.project deleted file mode 100644 index a0bbcb2..0000000 --- a/wsconsumer/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - wsconsumer - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/wsconsumer/.settings/org.eclipse.core.resources.prefs b/wsconsumer/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 84e913e..0000000 --- a/wsconsumer/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sat Mar 17 22:20:34 EDT 2012 -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/wsconsumer/.settings/org.eclipse.jdt.core.prefs b/wsconsumer/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 6e9ff56..0000000 --- a/wsconsumer/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Sat Mar 17 22:21:45 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/wsconsumer/.settings/org.eclipse.m2e.core.prefs b/wsconsumer/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 826e985..0000000 --- a/wsconsumer/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sat Mar 17 22:20:34 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/wsconsumer/pom.xml b/wsconsumer/pom.xml deleted file mode 100644 index b12e05f..0000000 --- a/wsconsumer/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - 4.0.0 - - com.training - wsconsumer - 1.0 - jar - - wsconsumer - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.10 - test - - - com.sun.xml.ws - jaxws-rt - 2.2.6 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - org.codehaus.mojo - jaxws-maven-plugin - - - - wsimport - - - - http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL - - com.training.java.webservice.soap.client - - - - - - - diff --git a/wsconsumer/src/main/java/com/training/java/webservice/soap/client/weather/WeatherServiceClient.java b/wsconsumer/src/main/java/com/training/java/webservice/soap/client/weather/WeatherServiceClient.java deleted file mode 100644 index 98d9f5e..0000000 --- a/wsconsumer/src/main/java/com/training/java/webservice/soap/client/weather/WeatherServiceClient.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.training.java.webservice.soap.client.weather; - -import com.training.java.webservice.soap.client.Weather; -import com.training.java.webservice.soap.client.WeatherReturn; -import com.training.java.webservice.soap.client.WeatherSoap; - -public class WeatherServiceClient -{ - - /** - * @param args - */ - public static void main(String[] args) - { - Weather service = new Weather(); - WeatherSoap port = service.getWeatherSoap(); - WeatherReturn weatherReturn = port.getCityWeatherByZIP("94035"); - String temperature = weatherReturn.getTemperature(); - - System.out.println("Temperature = " + temperature); - System.out.println("Description = " + weatherReturn.getDescription()); - System.out.println("Wind = " + weatherReturn.getWind()); - System.out.println("Pressure = " + weatherReturn.getPressure()); - System.out.println("Relative humidity = " + weatherReturn.getRelativeHumidity()); - } - -} diff --git a/wsproducer/.classpath b/wsproducer/.classpath deleted file mode 100644 index 97401f0..0000000 --- a/wsproducer/.classpath +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/wsproducer/.project b/wsproducer/.project deleted file mode 100644 index f1d9f9a..0000000 --- a/wsproducer/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - wsproducer - - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/wsproducer/.settings/.jsdtscope b/wsproducer/.settings/.jsdtscope deleted file mode 100644 index fac399c..0000000 --- a/wsproducer/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/wsproducer/.settings/org.eclipse.jdt.core.prefs b/wsproducer/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index a27c14f..0000000 --- a/wsproducer/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sat Mar 17 20:41:53 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/wsproducer/.settings/org.eclipse.m2e.core.prefs b/wsproducer/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 526eb31..0000000 --- a/wsproducer/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sat Mar 17 20:40:30 EDT 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/wsproducer/.settings/org.eclipse.wst.common.component b/wsproducer/.settings/org.eclipse.wst.common.component deleted file mode 100644 index cad5fe0..0000000 --- a/wsproducer/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/wsproducer/.settings/org.eclipse.wst.common.project.facet.core.xml b/wsproducer/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 6b007af..0000000 --- a/wsproducer/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/wsproducer/.settings/org.eclipse.wst.jsdt.ui.superType.container b/wsproducer/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/wsproducer/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/wsproducer/.settings/org.eclipse.wst.jsdt.ui.superType.name b/wsproducer/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/wsproducer/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/wsproducer/pom.xml b/wsproducer/pom.xml deleted file mode 100644 index eca3eaf..0000000 --- a/wsproducer/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - 4.0.0 - com.training - wsproducer - war - 1.0 - wsproducer Maven Webapp - http://maven.apache.org - - - junit - junit - 4.10 - test - - - com.sun.xml.ws - jaxws-rt - 2.2.6 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - wsproducer - - diff --git a/wsproducer/src/main/java/com/training/java/webservice/soap/one/WeatherService.java b/wsproducer/src/main/java/com/training/java/webservice/soap/one/WeatherService.java deleted file mode 100644 index 3522e3d..0000000 --- a/wsproducer/src/main/java/com/training/java/webservice/soap/one/WeatherService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.training.java.webservice.soap.one; - -import javax.jws.WebMethod; -import javax.jws.WebService; - -@WebService -public interface WeatherService -{ - @WebMethod - String getWeather(String troy); -} diff --git a/wsproducer/src/main/java/com/training/java/webservice/soap/one/WeatherServiceImpl.java b/wsproducer/src/main/java/com/training/java/webservice/soap/one/WeatherServiceImpl.java deleted file mode 100644 index 780f172..0000000 --- a/wsproducer/src/main/java/com/training/java/webservice/soap/one/WeatherServiceImpl.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.training.java.webservice.soap.one; - -import javax.jws.WebMethod; -import javax.jws.WebService; - -@WebService(endpointInterface="com.training.java.webservice.soap.one.WeatherService") -public class WeatherServiceImpl implements WeatherService -{ - @Override - @WebMethod - public String getWeather(String troy) - { - return "rainy"; - } - -} diff --git a/wsproducer/src/main/webapp/WEB-INF/sun-jaxws.xml b/wsproducer/src/main/webapp/WEB-INF/sun-jaxws.xml deleted file mode 100644 index c2214ee..0000000 --- a/wsproducer/src/main/webapp/WEB-INF/sun-jaxws.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - diff --git a/wsproducer/src/main/webapp/WEB-INF/web.xml b/wsproducer/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index c7ff147..0000000 --- a/wsproducer/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - com.sun.xml.ws.transport.http.servlet.WSServletContextListener - - - - JAX-WS endpoint - The JAX-WS servlet - jaxws - com.sun.xml.ws.transport.http.servlet.WSServlet - - - jaxws - /weather - - \ No newline at end of file diff --git a/wsproducer/src/main/webapp/index.jsp b/wsproducer/src/main/webapp/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/wsproducer/src/main/webapp/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ - - -

        Hello World!

        - -