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