`MVCGroupManager.java`
`001 /* 002 * Copyright 2010-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package griffon.core; 017 018 import groovy.util.FactoryBuilderSupport; 019 020 import java.util.Map; 021 022 /** 023 * Manages the configuration and instantiation of MVC groups. 024 * 025 * @author Andres Almiray 026 * @since 0.9.4 027 */ 028 public interface MVCGroupManager extends MVCHandler, ApplicationHandler { 029 /** 030 * Creates an MVCConfiguration instance with the given arguments. 031 * 032 * @param mvcType the name of the MVC group 033 * @param members members of the group 034 * @param config additional configuration required by the group 035 * @return a ready-to-use MVCGroupConfiguration instance 036 */ 037 MVCGroupConfiguration newMVCGroupConfiguration(String mvcType, Map<String, String> members, Map<String, Object> config); 038 039 /** 040 * Clones an existing MVCGroupConfiguration, optionally overriding additional config values. 041 * 042 * @param mvcType the name of the configuration to clone 043 * @param config additional config parameters to be set on the configuration 044 * @return a ready-to-use MVCGroupConfiguration instance 045 * @since 0.9.5 046 */ 047 MVCGroupConfiguration cloneMVCGroupConfiguration(String mvcType, Map<String, Object> config); 048 049 /** 050 * Creates a new MVCGroup instance. 051 * 052 * @param configuration the configuration of the group 053 * @param mvcId the id to use for the group 054 * @param members the instance members of the group 055 * @return a ready-to-use MVCGroup instance 056 */ 057 MVCGroup newMVCGroup(MVCGroupConfiguration configuration, String mvcId, Map<String, Object> members); 058 059 /** 060 * Initializes this manager with the group configurations provided by the application and addons. 061 * 062 * @param configurations available group configurations 063 */ 064 void initialize(Map<String, MVCGroupConfiguration> configurations); 065 066 void addConfiguration(MVCGroupConfiguration configuration); 067 068 Map<String, MVCGroupConfiguration> getConfigurations(); 069 070 Map<String, MVCGroup> getGroups(); 071 072 MVCGroupConfiguration findConfiguration(String mvcType); 073 074 MVCGroup findGroup(String mvcId); 075 076 MVCGroup getAt(String mvcId); 077 078 /** 079 * Returns all currently available model instances, keyed by group name.<p> 080 * 081 * @return a Map of all currently instantiated models. 082 */ 083 Map<String, ? extends GriffonModel> getModels(); 084 085 /** 086 * Returns all currently available view instances, keyed by group name.<p> 087 * 088 * @return a Map of all currently instantiated views. 089 */ 090 Map<String, ? extends GriffonView> getViews(); 091 092 /** 093 * Returns all currently available controller instances, keyed by group name.<p> 094 * 095 * @return a Map of all currently instantiated controllers. 096 */ 097 Map<String, ? extends GriffonController> getControllers(); 098 099 /** 100 * Returns all currently available builder instances, keyed by group name.<p> 101 * 102 * @return a Map of all currently instantiated builders. 103 */ 104 Map<String, ? extends FactoryBuilderSupport> getBuilders(); 105 }`