AT&T 2.0.19 Code drop, stage 1
[aaf/authz.git] / misc / env / src / main / java / org / onap / aaf / misc / env / Trans.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
27 /**
28  * A Trans is like an Env, however, it's purpose it to track the Transient 
29  * Data associated with Transactions, or other short term elements.
30  * 
31  * Any Object implementing Trans should expect to go in an out of scope quickly
32  * 
33  * Implementations should also overload the concepts of "Start", etc and build up
34  * and Audit Log, so it can implement "metric" below
35  * 
36  * All Transactions (i.e. a call to a service) will need these items.
37  * 
38  * @author Jonathan
39  *
40  */
41 public interface Trans extends Env {
42         /**
43          * Add a completed entry in the Audit Trail for tracking purposes.
44          * 
45          * @param text
46          */
47         public void checkpoint(String text);
48
49         /**
50          * Add a completed entry in the Audit Trail for tracking purposes, and combine flag with "CHECKPOINT" 
51          * 
52          * @param text
53          */
54         public void checkpoint(String text, int additionalFlag);
55
56         /**
57          * Output an Audit Trail onto the StringBuilder
58          *
59          * Load metrics into an array of floats from passed in Flags
60          * 
61          * @param flag
62          * @param sb
63          * @return       
64          */
65         public Metric auditTrail(LogTarget lt, int indent, StringBuilder sb, int ... flag);
66
67         public Metric auditTrail(int indent, StringBuilder sb, int ... flag);
68
69         public class Metric {
70                 public float[] buckets;
71                 public float   total;
72                 public int     entries;
73         }
74 }