From cd413ad5f62ab9ca7174bb926b5915f439784b93 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 6 Aug 2015 11:48:34 +0200 Subject: [PATCH] =?utf8?q?Renamed=20service=20stuff=20to=20application,=20?= =?utf8?q?as=20it=20is=20really=20an=20application=20Signed-off-by:Roland?= =?utf8?q?=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../PizzaApplication.java} | 6 +-- .../PizzaServiceApplication.java} | 37 +++++++++++++------ web/WEB-INF/glassfish-web.xml | 1 + web/bye.jsp | 6 +-- web/errorHandler.jsp | 10 ++--- web/finished.jsp | 10 ++--- web/index.jsp | 10 ++--- web/order.jsp | 10 ++--- 8 files changed, 53 insertions(+), 37 deletions(-) rename src/java/org/mxchange/pizzaservice/{service/Service.java => application/PizzaApplication.java} (97%) rename src/java/org/mxchange/pizzaservice/{service/PizzaService.java => application/PizzaServiceApplication.java} (95%) diff --git a/src/java/org/mxchange/pizzaservice/service/Service.java b/src/java/org/mxchange/pizzaservice/application/PizzaApplication.java similarity index 97% rename from src/java/org/mxchange/pizzaservice/service/Service.java rename to src/java/org/mxchange/pizzaservice/application/PizzaApplication.java index 383e21d1..d3867988 100644 --- a/src/java/org/mxchange/pizzaservice/service/Service.java +++ b/src/java/org/mxchange/pizzaservice/application/PizzaApplication.java @@ -14,20 +14,20 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaservice.service; +package org.mxchange.pizzaservice.application; import java.util.Iterator; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.mxchange.jcore.FrameworkInterface; +import org.mxchange.jcore.application.Application; import org.mxchange.pizzaservice.product.Product; /** * * @author Roland Haeder */ -public interface Service extends FrameworkInterface { +public interface PizzaApplication extends Application { /** * HTTP parameter "amount" */ diff --git a/src/java/org/mxchange/pizzaservice/service/PizzaService.java b/src/java/org/mxchange/pizzaservice/application/PizzaServiceApplication.java similarity index 95% rename from src/java/org/mxchange/pizzaservice/service/PizzaService.java rename to src/java/org/mxchange/pizzaservice/application/PizzaServiceApplication.java index e51da41d..31ce7240 100644 --- a/src/java/org/mxchange/pizzaservice/service/PizzaService.java +++ b/src/java/org/mxchange/pizzaservice/application/PizzaServiceApplication.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaservice.service; +package org.mxchange.pizzaservice.application; import java.text.MessageFormat; import java.util.Iterator; @@ -33,7 +33,7 @@ import org.mxchange.pizzaservice.product.Product; * * @author Roland Haeder */ -public class PizzaService extends BaseFrameworkSystem implements Service { +public class PizzaServiceApplication extends BaseFrameworkSystem implements PizzaApplication { /** * Main title */ @@ -52,9 +52,9 @@ public class PizzaService extends BaseFrameworkSystem implements Service { * @return This instance * @throws javax.servlet.ServletException If object is not set correctly */ - public static final Service getInstance (final ServletContext application) throws ServletException { + public static final PizzaApplication getInstance (final ServletContext application) throws ServletException { // Trace message - new PizzaService().getLogger().trace(MessageFormat.format("application={0} - CALLED!", application)); //NOI18N + new PizzaServiceApplication().getLogger().trace(MessageFormat.format("application={0} - CALLED!", application)); //NOI18N if (application == null) { // Not set @@ -62,21 +62,21 @@ public class PizzaService extends BaseFrameworkSystem implements Service { } // Init instance - PizzaService instance = null; + PizzaServiceApplication instance = null; // Get instance from servlet Object object = application.getAttribute("service"); //NOI18N // Is it set? - if (object instanceof PizzaService) { + if (object instanceof PizzaServiceApplication) { // Instance is set, so casting should work - instance = (PizzaService) object; + instance = (PizzaServiceApplication) object; } else if (object instanceof Object) { // Not correct instance throw new ServletException("service is not set correctly"); //NOI18N } else { // "service" is null, so initialize it - instance = new PizzaService(); + instance = new PizzaServiceApplication(); // And set it here application.setAttribute("service", instance); //NOI18N @@ -92,7 +92,7 @@ public class PizzaService extends BaseFrameworkSystem implements Service { /** * Private constructor */ - private PizzaService () { + private PizzaServiceApplication () { // Init products instance this.products = new TreeMap<>(); @@ -100,6 +100,21 @@ public class PizzaService extends BaseFrameworkSystem implements Service { this.fillProductsList(); } + @Override + public void doBootstrap () { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public void doMainLoop () { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public void doShutdown () { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + /** * Getter for product (list) iterator * @@ -150,7 +165,7 @@ public class PizzaService extends BaseFrameworkSystem implements Service { */ private void clearSessionAttribute (final Product product, final HttpSession session, final String parameter) { // Trace message - this.getLogger().trace(MessageFormat.format("produce={0},parameter={1},session={2}", product, parameter, session)); //NOI18N + this.getLogger().trace(MessageFormat.format("produce={0},parameter={1},session={2} - CALLED!", product, parameter, session)); //NOI18N // Clear in session this.getLogger().debug(MessageFormat.format("Clearing product={0},parameter={1} ...", product.getName(), parameter)); //NOI18N @@ -227,7 +242,7 @@ public class PizzaService extends BaseFrameworkSystem implements Service { */ public static void main (String[] args) { // Get instance and start it - new PizzaService().start(); + new PizzaServiceApplication().start(); } /** diff --git a/web/WEB-INF/glassfish-web.xml b/web/WEB-INF/glassfish-web.xml index 13e0059f..0c186a9a 100644 --- a/web/WEB-INF/glassfish-web.xml +++ b/web/WEB-INF/glassfish-web.xml @@ -7,4 +7,5 @@ Keep a copy of the generated servlet class' java code. + diff --git a/web/bye.jsp b/web/bye.jsp index b14fc10d..6e1b0701 100644 --- a/web/bye.jsp +++ b/web/bye.jsp @@ -5,18 +5,18 @@ --%> <%@page errorPage="errorHandler.jsp" %> -<%@page import="org.mxchange.pizzaservice.service.PizzaService"%> +<%@page import="org.mxchange.pizzaservice.application.PizzaServiceApplication"%> - <%=PizzaService.MAIN_TITLE%> - Sitzung beenden + <%=PizzaServiceApplication.MAIN_TITLE%> - Sitzung beenden
-

<%=PizzaService.MAIN_TITLE%> - Sitzung beenden

+

<%=PizzaServiceApplication.MAIN_TITLE%> - Sitzung beenden