f709a4345f059ff35542cac9defafe547b97ca46
[aaf/authz.git] / misc / env / src / main / java / org / onap / aaf / misc / env / Env.java
1 /**\r
2  * ============LICENSE_START====================================================\r
3  * org.onap.aaf\r
4  * ===========================================================================\r
5  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.\r
6  * ===========================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END====================================================\r
19  *\r
20  */\r
21 \r
22 package org.onap.aaf.misc.env;\r
23 \r
24 \r
25 /**\r
26  * <H1>Env</H1>\r
27  * <i>Env</i> is the basic representation of what can be obtained from the\r
28  * Environment.  Environments also need the ability to Log and Track Time, so\r
29  * to keep the interfaces clean, Env Interface inherits from Trans.  This does NOT\r
30  * mean that all Environments are Transactions... It only means Environments need \r
31  * to Log and Track Times. \r
32  * .<p>\r
33  * \r
34  * Using this abstraction, Components can be built on a modular basis,\r
35  * and still have the essentials of functioning within the service mechanism.<p>\r
36  * \r
37  * Thus, for instance, an Module could be made to work in two separate\r
38  * service types, with substantial differences in choices of logging, or auditing,\r
39  * and still have reasonably deep insight, such as the exact time a\r
40  * remote service was invoked.<p>\r
41  * \r
42  * There is a bit of an assumption corresponding to the reality of the 2000s that\r
43  * XML plays a part in most service work.\r
44  *  \r
45  * @author Jonathan\r
46  *\r
47  */\r
48 public interface Env {\r
49     /**\r
50      * Very Severe Error may cause program to abort\r
51      */\r
52     public LogTarget fatal();\r
53     \r
54     /**\r
55      * Severe Error, but program might continue running\r
56      */\r
57     public LogTarget error();\r
58 \r
59     /**\r
60      * Required Audit statements\r
61      * @return\r
62      */\r
63     public LogTarget audit();\r
64 \r
65     /**\r
66      * Initialization steps... Allows a Logger to separate startup info\r
67      * @return\r
68      */\r
69     public LogTarget init();\r
70 \r
71     /**\r
72      * Potentially harmful situations\r
73      * @return\r
74      */\r
75     public LogTarget warn();\r
76     \r
77     /**\r
78      * Course Grained highlights of program progress\r
79      * @return\r
80      */\r
81     public LogTarget info();\r
82     \r
83     /**\r
84      * Fine-grained informational events useful for debugging\r
85      * @return\r
86      */\r
87     public LogTarget debug();\r
88     \r
89     /**\r
90      * Finest grained Informational events... more detailed than Debug\r
91      * @return\r
92      */\r
93     public LogTarget trace();\r
94 \r
95 \r
96     /**\r
97      * Basic and Common Audit info... \r
98      *  \r
99      * Note Apps can define, but should use Integers after 0x1F.  They can combine with "&"\r
100      */\r
101     public static final int REMOTE = 0x01;\r
102     public static final int XML = 0x02;\r
103     public static final int JSON = 0x04;\r
104     public static final int SUB = 0x08;\r
105     public static final int CHECKPOINT = 0x10;\r
106     public static final int ALWAYS = 0x20; // Mark as a line to print, even in WARN+ mode\r
107 \r
108 \r
109     \r
110     /**\r
111      * Start a Time Trail with differentiation by flag.  This can be Defined By above flags or combined with\r
112      * app flag definitions\r
113      * \r
114      * @param string\r
115      * @param flag\r
116      * @return\r
117      */\r
118     public TimeTaken start(String name, int flag);\r
119     \r
120     public String setProperty(String tag, String value);\r
121     public String getProperty(String tag);\r
122     public String getProperty(String tag, String deflt);\r
123     \r
124     /**\r
125      * Passwords should be encrypted on the disk.  Use this method to apply decryption before\r
126      * using.  The Implementation should give ways to decrypt\r
127      * \r
128      * @param tag\r
129      * @return\r
130      */\r
131     public Decryptor decryptor();\r
132     \r
133     public Encryptor encryptor();\r
134 \r
135 }\r
136 \r