001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019 020package org.apache.isis.core.commons.components; 021 022import java.util.List; 023 024/** 025 * A factory for a {@link Component}, defining that component's 026 * {@link #getType() type} and its {@link #getName() name}. 027 * 028 * <p> 029 * The ({@link #getType() type}, {@link #getName() name}) is expected to be a 030 * unique identifier of a component. 031 * 032 * <p> 033 * The <i>default runtime</i> (<tt>org.apache.isis.runtimes.dflt</tt> module), 034 * which adopts a service locator design, uses the 035 * <tt>installer-registry.properties</tt> resource as a registry of all 036 * available installers. The installers are loaded and indexed by their name and 037 * type. Other runtime implementations may use different approaches. 038 */ 039public interface Installer extends ApplicationScopedComponent { 040 041 /** 042 * The type of the installer, meaning the component type, and consistent 043 * with the long option of the command line flag where applicable. 044 * 045 * <p> 046 * Examples are <tt>authentication</tt> or <tt>persistor</tt>. 047 * 048 * <p> 049 * Because all implementations of a given subinterface of {@link Installer} 050 * should return the same value for this method, by convention these 051 * subinterfaces define a constant which the implementation can just return. 052 * 053 * <p> 054 * Used, with {@link #getName()}, to determine the config files and config 055 * keys for this installer. 056 * 057 * @see #getConfigurationResources() 058 */ 059 String getType(); 060 061 /** 062 * The name (qualified by type). 063 * 064 * <p> 065 * Used, with {@link #getType()}, to determine the config files and config 066 * keys for this installer. 067 * 068 * @see #getConfigurationResources() 069 */ 070 String getName(); 071 072 /** 073 * The configuration resources (files) to merge in configuration properties. 074 * 075 * <p> 076 * For example, would return list of [<tt>persistor.properties</tt>, and 077 * <tt>persistor_in-memory.properties</tt>] for the in-memory object store. 078 * 079 * <p> 080 * The implementation should look under keys prefixed either 081 * <tt>isis.persistor</tt> or <tt>isis.persistor.in-memory</tt>. 082 * 083 * <p> 084 * Note that we use an '_' underscore to join the {@link #getType() type} 085 * and {@link #getName() name} in the filenames, but a '.' (period) for the 086 * keys. 087 */ 088 List<String> getConfigurationResources(); 089 090 /** 091 * The (classes of) the types that this installer makes available in the 092 * {@link #getModule() module}. 093 */ 094 List<Class<?>> getTypes(); 095}