001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket; 018 019import java.util.ServiceLoader; 020 021import org.apache.wicket.request.resource.PackageResource; 022 023/** 024 * Initializes something when application loads. 025 * <p> 026 * Initializer can be used for clustering. Lets say you access a page that has a link to a resource on 027 * node A now the url for the resource gets forwarded to node B, but node B doesn't have the 028 * resource registered yet because maybe the page class hasn't been loaded and so its static block 029 * hasn't run yet. So the initializer is a place for you to register all those resources and do all 030 * the stuff you used to do in the static blocks. 031 * <p> 032 * You don't have to pre-register {@link PackageResource package resources}, as they can be 033 * initialized lazily. 034 * <p> 035 * Initializers can be configured via {@link ServiceLoader}, i.e. by having a file 036 * /META-INF/services/org.apache.wicket.IInitializer in the class path root, with each line containing the 037 * full class name of an {@link IInitializer}. 038 * </p> 039 * 040 * @author Jonathan Locke 041 */ 042public interface IInitializer 043{ 044 /** 045 * @param application 046 * The application loading the component 047 */ 048 void init(Application application); 049 050 051 /** 052 * @param application 053 * The application loading the component 054 */ 055 void destroy(Application application); 056 057}