01 /*
02 * Copyright 2008-2014 the original author or authors.
03 *
04 * Licensed under the Apache License, Version 2.0 (the "License");
05 * you may not use this file except in compliance with the License.
06 * You may obtain a copy of the License at
07 *
08 * http://www.apache.org/licenses/LICENSE-2.0
09 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package griffon.core.artifact;
17
18 import griffon.core.mvc.MVCGroup;
19
20 import javax.annotation.Nonnull;
21 import java.util.Map;
22
23 /**
24 * Identifies an artifact that belongs to an MVC group.<p>
25 * The main difference between {@code buildMVCGroup} and {@code createMVCGroup} methods is that
26 * the formers will return a Map of instances where there could be more than strict MVC members
27 * (like actions or charts), the latters will always return the canonical MVC members of a group
28 * and nothing more.
29 *
30 * @author Andres Almiray
31 * @since 2.0.0
32 */
33 public interface GriffonMvcArtifact extends GriffonArtifact {
34 /**
35 * Post initialization callback.<p>
36 * This callback is called for all artifacts that belong to the
37 * same MVC group right after each instance has been created.
38 * Each entry on the <tt>args</tt> Map points either to an MVC
39 * member or a variable that was defined using any of the {@code buildMVCGroup}
40 * and/or {@code createMVCGroup} methods that can take a Map as parameter.
41 *
42 * @param args a Map of MVC instances or variables keyed by type.
43 */
44 void mvcGroupInit(@Nonnull Map<String, Object> args);
45
46 /**
47 * Callback for when the group is destroyed and disposed from the application.<p>
48 * Once an artifact has been "destroyed" it should not be used anymore. The application
49 * will remove any references to the group on its cache.
50 */
51 void mvcGroupDestroy();
52
53 @Nonnull
54 MVCGroup getMvcGroup();
55 }
|