001/** 002 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 003 * This file is part of the LDP4j Project: 004 * http://www.ldp4j.org/ 005 * 006 * Center for Open Middleware 007 * http://www.centeropenmiddleware.com/ 008 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 009 * Copyright (C) 2014 Center for Open Middleware. 010 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 011 * Licensed under the Apache License, Version 2.0 (the "License"); 012 * you may not use this file except in compliance with the License. 013 * You may obtain a copy of the License at 014 * 015 * http://www.apache.org/licenses/LICENSE-2.0 016 * 017 * Unless required by applicable law or agreed to in writing, software 018 * distributed under the License is distributed on an "AS IS" BASIS, 019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 020 * See the License for the specific language governing permissions and 021 * limitations under the License. 022 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 023 * Artifact : org.ldp4j.framework:ldp4j-application-api:0.2.0 024 * Bundle : ldp4j-application-api-0.2.0.jar 025 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 026 */ 027package org.ldp4j.application.setup; 028 029import org.ldp4j.application.ext.Configuration; 030import org.ldp4j.application.ext.ResourceHandler; 031 032/** 033 * Utility interface for bootstrapping an LDP4j Application. Using this class 034 * the application will be able to register the {@code ResourceHandler} 035 * instances and classes that make up the application. <br/> <br/> 036 * 037 * Upon registration, the <b>LDP4j Application Engine</b> will analyze the 038 * templates defined by the resource handlers, discovering any additional 039 * resource handler not explicitly registered. 040 * 041 * @param <T> 042 * The configuration class required by the application that is to be 043 * bootstrapped. 044 */ 045public interface Bootstrap<T extends Configuration> { 046 047 /** 048 * Retrieve the configuration of the application. The returned value will 049 * never be null. 050 * 051 * @return an instance of the configuration. 052 */ 053 T configuration(); 054 055 /** 056 * Register an initialized {@code ResourceHandler} instance of the 057 * application. <br/> 058 * <br/> 059 * 060 * This method is to be used if and only if the resource handler requires a 061 * to be initialized in a controller manner. Otherwise, the resource handler 062 * class can be registered using the {@link #addHandlerClass(Class)} method. 063 * 064 * @param handler 065 * the handler instance. 066 * @throws NullPointerException 067 * if the handler instance is {@code null}. 068 */ 069 void addHandler(ResourceHandler handler); 070 071 /** 072 * Register a {@code ResourceHandler} class that is used by the application. <br/> 073 * <br/> 074 * 075 * This method is to be used if and only if resource handler instances do 076 * not require any special initialization. Otherwise, the an initialized 077 * resource handler instance can be registered using the 078 * {@link #addHandler(ResourceHandler)} method. 079 * 080 * @param handlerClass 081 * the handler class. 082 * @throws NullPointerException 083 * if the handler class is {@code null}. 084 */ 085 void addHandlerClass(Class<? extends ResourceHandler> handlerClass); 086 087}