01 /*
02 * SPDX-License-Identifier: Apache-2.0
03 *
04 * Copyright 2008-2017 the original author or authors.
05 *
06 * Licensed under the Apache License, Version 2.0 (the "License");
07 * you may not use this file except in compliance with the License.
08 * You may obtain a copy of the License at
09 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package griffon.core.artifact;
19
20 import griffon.core.GriffonApplication;
21 import griffon.core.mvc.MVCHandler;
22 import griffon.core.resources.ResourceHandler;
23 import griffon.core.threading.ThreadingHandler;
24 import org.slf4j.Logger;
25
26 import javax.annotation.Nonnull;
27
28 /**
29 * Identifies an object as a Griffon artifact.<p>
30 * Griffon artifacts are usually placed under the special "griffon-app" directory
31 * that every application has. They are also grouped together in in a subdirectory that
32 * clearly identifies their nature. For example "griffon-app/controllers" contains all
33 * Controller artifacts.<p>
34 * Implementing this interface for a custom artifact definition is highly recommended
35 * but not enforced.
36 *
37 * @author Andres Almiray
38 * @since 2.0.0
39 */
40 public interface GriffonArtifact extends ThreadingHandler, MVCHandler, ResourceHandler {
41 /**
42 * Reference to the current {@code GriffonApplication}
43 *
44 * @return the currently running application
45 */
46 GriffonApplication getApplication();
47
48 /**
49 * Returns the <tt>GriffonClass</tt> associated with this artifact.
50 *
51 * @return the <tt>GriffonClass</tt> associated with this artifact
52 */
53 @Nonnull
54 GriffonClass getGriffonClass();
55
56 /**
57 * Returns the {@code Class} of this artifact.
58 *
59 * @return the {@code Class} of this artifact.
60 * @since 2.10.0
61 */
62 @Nonnull
63 Class<? extends GriffonArtifact> getTypeClass();
64
65 /**
66 * Returns a Logger instance suitable for this Artifact.<p>
67 * The Logger is configured with the following prefix 'griffon.app.<type>'
68 * where <type> stands for the artifact's type.<p>
69 * Example: the Logger for class com.acme.SampleController will be configured for
70 * 'griffon.app.controller.com.acme.SampleController'.
71 *
72 * @return a Logger instance associated with this artifact.
73 */
74 @Nonnull
75 Logger getLog();
76 }
|