Skip to content

Commit

Permalink
Rename start/stop to init/destroy and rename former init/destroy to o…
Browse files Browse the repository at this point in the history
…nInit/onDestroy
  • Loading branch information
gitblit committed Mar 5, 2015
1 parent cab8700 commit e18ce51
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 32 deletions.
12 changes: 6 additions & 6 deletions pippo-core/src/main/java/ro/pippo/core/Application.java
Expand Up @@ -93,7 +93,7 @@ public Application(PippoSettings settings) {
registerContentTypeEngine(JaxbEngine.class); registerContentTypeEngine(JaxbEngine.class);
} }


public final void start() { public final void init() {
initializers.addAll(getInitializers()); initializers.addAll(getInitializers());
for (Initializer initializer : initializers) { for (Initializer initializer : initializers) {
log.debug("Initializing '{}'", initializer.getClass().getName()); log.debug("Initializing '{}'", initializer.getClass().getName());
Expand All @@ -104,11 +104,11 @@ public final void start() {
} }
} }


init(); onInit();
} }


public final void stop() { public final void destroy() {
destroy(); onDestroy();
for (Initializer initializer : initializers) { for (Initializer initializer : initializers) {
log.debug("Destroying '{}'", initializer.getClass().getName()); log.debug("Destroying '{}'", initializer.getClass().getName());
try { try {
Expand All @@ -119,10 +119,10 @@ public final void stop() {
} }
} }


public void init() { protected void onInit() {
} }


public void destroy() { protected void onDestroy() {
} }


/** /**
Expand Down
4 changes: 2 additions & 2 deletions pippo-core/src/main/java/ro/pippo/core/PippoFilter.java
Expand Up @@ -103,7 +103,7 @@ public void init(FilterConfig filterConfig) throws ServletException {
log.debug("Serving application on context path '{}'", contextPath); log.debug("Serving application on context path '{}'", contextPath);


log.debug("Initializing application '{}'", application); log.debug("Initializing application '{}'", application);
application.start(); application.init();


routeContextFactory = getRouteContextFactory(); routeContextFactory = getRouteContextFactory();
routeContextFactory.init(application); routeContextFactory.init(application);
Expand Down Expand Up @@ -206,7 +206,7 @@ public void setFilterPath(String filterPath) {
public void destroy() { public void destroy() {
if (application != null) { if (application != null) {
try { try {
application.stop(); application.destroy();


log.info("Pippo destroyed"); log.info("Pippo destroyed");
} finally { } finally {
Expand Down
Expand Up @@ -35,8 +35,7 @@ public class BasicApplication extends Application {
private final static Logger log = LoggerFactory.getLogger(BasicApplication.class); private final static Logger log = LoggerFactory.getLogger(BasicApplication.class);


@Override @Override
public void init() { protected void onInit() {
super.init();


getRouter().ignorePaths("/favicon.ico"); getRouter().ignorePaths("/favicon.ico");


Expand Down
Expand Up @@ -25,8 +25,7 @@
public class ControllerApplication extends Application { public class ControllerApplication extends Application {


@Override @Override
public void init() { protected void onInit() {
super.init();


GET(new WebjarsResourceHandler()); GET(new WebjarsResourceHandler());
GET(new PublicResourceHandler()); GET(new PublicResourceHandler());
Expand Down
Expand Up @@ -37,8 +37,7 @@ public class CrudApplication extends Application {
private ContactService contactService; private ContactService contactService;


@Override @Override
public void init() { protected void onInit() {
super.init();


GET(new WebjarsResourceHandler()); GET(new WebjarsResourceHandler());
GET(new PublicResourceHandler()); GET(new PublicResourceHandler());
Expand Down
Expand Up @@ -41,8 +41,7 @@ public ContactService getContactService() {
} }


@Override @Override
public void init() { protected void onInit() {
super.init();


GET(new WebjarsResourceHandler()); GET(new WebjarsResourceHandler());
GET(new PublicResourceHandler()); GET(new PublicResourceHandler());
Expand Down
Expand Up @@ -23,8 +23,7 @@
public class CustomApplication extends Application { public class CustomApplication extends Application {


@Override @Override
public void init() { protected void onInit() {
super.init();


// use a custom route context // use a custom route context
GET("/", new CustomContextHandler() { GET("/", new CustomContextHandler() {
Expand Down
Expand Up @@ -28,8 +28,7 @@
public class GuiceApplication extends Application { public class GuiceApplication extends Application {


@Override @Override
public void init() { protected void onInit() {
super.init();


GET(new WebjarsResourceHandler()); GET(new WebjarsResourceHandler());
GET(new PublicResourceHandler()); GET(new PublicResourceHandler());
Expand Down
Expand Up @@ -30,8 +30,7 @@ public class GuiceApplication2 extends Application {
private ContactService contactService; private ContactService contactService;


@Override @Override
public void init() { protected void onInit() {
super.init();


GET(new WebjarsResourceHandler()); GET(new WebjarsResourceHandler());
GET(new PublicResourceHandler()); GET(new PublicResourceHandler());
Expand Down
Expand Up @@ -28,8 +28,7 @@
public class SpringApplication extends Application { public class SpringApplication extends Application {


@Override @Override
public void init() { protected void onInit() {
super.init();


GET(new WebjarsResourceHandler()); GET(new WebjarsResourceHandler());
GET(new PublicResourceHandler()); GET(new PublicResourceHandler());
Expand Down
Expand Up @@ -31,8 +31,7 @@ public class SpringApplication2 extends Application {
private ContactService contactService; private ContactService contactService;


@Override @Override
public void init() { protected void onInit() {
super.init();


GET(new WebjarsResourceHandler()); GET(new WebjarsResourceHandler());
GET(new PublicResourceHandler()); GET(new PublicResourceHandler());
Expand Down
Expand Up @@ -43,8 +43,7 @@ public TemplateApplication(TemplateEngine engine, String template) {
} }


@Override @Override
public void init() { protected void onInit() {
super.init();


// add classpath resource handlers // add classpath resource handlers
GET(new WebjarsResourceHandler()); GET(new WebjarsResourceHandler());
Expand Down
Expand Up @@ -30,8 +30,7 @@
public class UploadApplication extends Application { public class UploadApplication extends Application {


@Override @Override
public void init() { protected void onInit() {
super.init();


// setMaximumUploadSize(100 * 1024); // 100k // setMaximumUploadSize(100 * 1024); // 100k


Expand Down
Expand Up @@ -34,8 +34,7 @@
public class ValidationApplication extends Application { public class ValidationApplication extends Application {


@Override @Override
public void init() { protected void onInit() {
super.init();


GET(new WebjarsResourceHandler()); GET(new WebjarsResourceHandler());
GET(new PublicResourceHandler()); GET(new PublicResourceHandler());
Expand Down

0 comments on commit e18ce51

Please sign in to comment.