GriffonArtifact.java
01 /*
02  * Copyright 2008-2015 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.GriffonApplication;
19 import griffon.core.mvc.MVCHandler;
20 import griffon.core.resources.ResourceHandler;
21 import griffon.core.threading.ThreadingHandler;
22 import org.slf4j.Logger;
23 
24 import javax.annotation.Nonnull;
25 
26 /**
27  * Identifies an object as a Griffon artifact.<p>
28  * Griffon artifacts are usually placed under the special "griffon-app" directory
29  * that every application has. They are also grouped together in in a subdirectory that
30  * clearly identifies their nature. For example "griffon-app/controllers" contains all
31  * Controller artifacts.<p>
32  * Implementing this interface for a custom artifact definition is highly recommended
33  * but not enforced.
34  *
35  @author Andres Almiray
36  @since 2.0.0
37  */
38 public interface GriffonArtifact extends ThreadingHandler, MVCHandler, ResourceHandler {
39     /**
40      * Reference to the current {@code GriffonApplication}
41      *
42      @return the currently running application
43      */
44     GriffonApplication getApplication();
45 
46     /**
47      * Returns the <tt>GriffonClass</tt> associated with this artifact.
48      *
49      @return the <tt>GriffonClass</tt> associated with this artifact
50      */
51     @Nonnull
52     GriffonClass getGriffonClass();
53 
54     /**
55      * Returns a Logger instance suitable for this Artifact.<p>
56      * The Logger is configured with the following prefix 'griffon.app.&lt;type&gt;'
57      * where &lt;type&gt; stands for the artifact's type.<p>
58      * Example: the Logger for class com.acme.SampleController will be configured for
59      * 'griffon.app.controller.com.acme.SampleController'.
60      *
61      @return a Logger instance associated with this artifact.
62      */
63     @Nonnull
64     Logger getLog();
65 }