aboutsummaryrefslogtreecommitdiffstats
path: root/ecomp-sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse-strong.png
AgeCommit message (Expand)AuthorFilesLines
2017-02-14Initial OpenECOMP policy/engine commitPamela Dragosh1-0/+0
6'>26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
/**
 * ============LICENSE_START=======================================================
 * org.onap.logging
 * ================================================================================
 * Copyright © 2018 Amdocs
 * All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.onap.logging.ref.slf4j;

import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

/**
 * Constants for standard ONAP headers, MDCs, etc.
 *
 * <p>See <tt>package-info.java</tt>.</p>
 */
public final class ONAPLogConstants {

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // Constructors.
    //
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Hide and forbid construction.
     */
    private ONAPLogConstants() {
        throw new UnsupportedOperationException();
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // Inner classes.
    //
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Marker constants.
     */
    public static final class Markers {

        /** Marker reporting invocation. */
        public static final Marker INVOKE = MarkerFactory.getMarker("INVOKE");
        
        /** Marker reporting invocation return. */
        public static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE_RETURN");

        /** Marker reporting synchronous invocation. */
        public static final Marker INVOKE_SYNCHRONOUS = build("INVOKE", "SYNCHRONOUS");

        /** Marker reporting asynchronous invocation. */
        public static final Marker INVOKE_ASYNCHRONOUS = build("INVOKE", "ASYNCHRONOUS");

        /** Marker reporting entry into a component. */
        public static final Marker ENTRY = MarkerFactory.getMarker("ENTRY");

        /** Marker reporting exit from a component. */
        public static final Marker EXIT = MarkerFactory.getMarker("EXIT");

        /**
         * Build nested, detached marker.
         * @param m1 top token.
         * @param m2 sub-token.
         * @return detached Marker.
         */
        private static Marker build(final String m1, final String m2) {
            final Marker marker = MarkerFactory.getDetachedMarker(m1);
            marker.add(MarkerFactory.getDetachedMarker(m2));
            return marker;
        }

        /**
         * Hide and forbid construction.
         */
        private Markers() {
            throw new UnsupportedOperationException();
        }
    }

    /**
     * MDC name constants.
     */
    public static final class MDCs {

        // Tracing. ////////////////////////////////////////////////////////////

        /** MDC correlating messages for an invocation. */
        public static final String INVOCATION_ID = "InvocationID";

        /** MDC correlating messages for a logical transaction. */
        public static final String REQUEST_ID = "RequestID";

        /** MDC recording calling partner name. */
        public static final String PARTNER_NAME = "PartnerName";

        /** MDC recording current service. */
        public static final String SERVICE_NAME = "ServiceName";

        /** MDC recording target service. */
        public static final String TARGET_SERVICE_NAME = "TargetServiceName";
        
        /** MDC recording target entity. */
        public static final String TARGET_ENTITY = "TargetEntity";

        /** MDC recording target element. */
        public static final String TARGET_ELEMENT = "TargetElement";

        /** MDC recording current service instance id. */
        public static final String SERVICE_INSTANCE_ID = "ServiceInstanceID";

        /** MDC recording current  instance id. */
        public static final String INSTANCE_UUID = "InstanceID";

        // Network. ////////////////////////////////////////////////////////////

        /** MDC recording caller address. */
        public static final String CLIENT_IP_ADDRESS = "ClientIPAddress";

        /** MDC recording server IP address. */
        public static final String SERVER_IP_ADDRESS = "ServerIPAddress";

        /** MDC recording server FQDN. */
        public static final String SERVER_FQDN = "ServerFQDN";

        /** MDC recording virtual server name. */
        public static final String VIRTUAL_SERVER_NAME = "VirtualServerName";

        /** MDC recording context name. */
        public static final String CONTEXT_NAME = "ContextName";

        /**
         * MDC recording timestamp at the start of the current request,
         * with the same scope as {@link #REQUEST_ID}.
         *
         * <p>Open issues:
         * <ul>
         *     <ul>Easily confused with {@link #INVOKE_TIMESTAMP}.</ul>
         *     <ul>No mechanism for propagation between components, e.g. via HTTP headers.</ul>
         *     <ul>Whatever mechanism we define, it's going to be costly.</ul>
         * </ul>
         * </p>
         * */
        public static final String ENTRY_TIMESTAMP = "EntryTimestamp";

        /** MDC recording timestamp at the start of the current invocation. */
        public static final String INVOKE_TIMESTAMP = "InvokeTimestamp";

        /** MDC recording elapsed time. */
        public static final String ELAPSED_TIME = "ElapsedTime";

        /** MDC recording log timestamp. */	
        public static final String LOG_TIMESTAMP = "LogTimestamp";

        // Outcomes. ///////////////////////////////////////////////////////////

        /** MDC reporting outcome code. */
        public static final String RESPONSE_CODE = "ResponseCode";

        /** MDC reporting outcome description. */
        public static final String RESPONSE_DESCRIPTION = "ResponseDesc";

        /** MDC reporting severity */
        public static final String RESPONSE_SEVERITY = "Severity";

        /** MDC reporting response status code */
        public static final String RESPONSE_STATUS_CODE = "StatusCode";

        /** MDC recording error code. */
        public static final String ERROR_CODE = "ErrorCode";       
	
        /** MDC recording error description. */
        public static final String ERROR_DESC = "ErrorDesc";

        // Unsorted. ///////////////////////////////////////////////////////////

        /**
         * Hide and forbid construction.
         */
        private MDCs() {
            throw new UnsupportedOperationException();
        }
    }

    /**
     * Header name constants.
     */
    public static final class Headers {

        /** HTTP <tt>X-ONAP-RequestID</tt> header. */
        public static final String REQUEST_ID = "X-ONAP-RequestID";

        /** HTTP <tt>X-InvocationID</tt> header. */
        public static final String INVOCATION_ID = "X-InvocationID";

        /** HTTP <tt>X-ONAP-PartnerName</tt> header. */
        public static final String PARTNER_NAME = "X-ONAP-PartnerName";

        /**
         * Hide and forbid construction.
         */
        private Headers() {
            throw new UnsupportedOperationException();
        }
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // Enums.
    //
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Response success or not, for setting <tt>StatusCode</tt>.
     */
    public enum ResponseStatus {

        /** Success. */
        COMPLETE,

        /** Not. */
        ERROR,
        
        /** In Progress. */
        INPROGRESS
    }

    /**
     * Synchronous or asynchronous execution, for setting invocation marker.
     */
    public enum InvocationMode {

        /** Synchronous, blocking. */
        SYNCHRONOUS("SYNCHRONOUS", Markers.INVOKE_SYNCHRONOUS),

        /** Asynchronous, non-blocking. */
        ASYNCHRONOUS("ASYNCHRONOUS", Markers.INVOKE_ASYNCHRONOUS);

        /** Enum value. */
        private String mString;

        /** Corresponding marker. */
        private Marker mMarker;

        /**
         * Construct enum.
         *
         * @param s enum value.
         * @param m corresponding Marker.
         */
        InvocationMode(final String s, final Marker m) {
            this.mString = s;
            this.mMarker = m;
        }

        /**
         * Get Marker for enum.
         *
         * @return Marker.
         */
        public Marker getMarker() {
            return this.mMarker;
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public String toString() {
            return this.mString;
        }
    }

}