001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2015 ForgeRock AS.
015 */
016package org.forgerock.openig.heap;
017
018import org.forgerock.http.Handler;
019import org.forgerock.http.filter.TransactionIdOutboundFilter;
020import org.forgerock.http.session.SessionManager;
021import org.forgerock.openig.config.Environment;
022import org.forgerock.openig.decoration.baseuri.BaseUriDecorator;
023import org.forgerock.openig.decoration.capture.CaptureDecorator;
024import org.forgerock.openig.decoration.timer.TimerDecorator;
025import org.forgerock.openig.handler.ClientHandler;
026import org.forgerock.openig.http.EndpointRegistry;
027import org.forgerock.openig.io.TemporaryStorage;
028import org.forgerock.openig.log.LogSink;
029import org.forgerock.util.time.TimeService;
030
031/**
032 * Define here the constants that can be used as Heap's keys.
033 */
034public final class Keys {
035
036    /**
037     * Key to retrieve a {@link org.forgerock.http.Filter} instance from the {@link org.forgerock.openig.heap.Heap} of
038     * {@literal config.json}.
039     */
040    public static final String API_PROTECTION_FILTER_HEAP_KEY = "ApiProtectionFilter";
041
042    /**
043     * Key to retrieve a {@link AuditDecorator} instance
044     * from the {@link org.forgerock.openig.heap.Heap}.
045     */
046    @Deprecated
047    public static final String AUDIT_HEAP_KEY = "audit";
048
049    /**
050     * Key to retrieve a default {@link AuditSystem} instance
051     * from the {@link org.forgerock.openig.heap.Heap}.
052     */
053    @Deprecated
054    public static final String AUDIT_SYSTEM_HEAP_KEY = "AuditSystem";
055
056    /**
057     * Key to retrieve a {@link BaseUriDecorator} instance from the {@link org.forgerock.openig.heap.Heap}.
058     */
059    public static final String BASEURI_HEAP_KEY = "baseURI";
060
061    /**
062     * Key to retrieve a {@link CaptureDecorator} instance from the {@link org.forgerock.openig.heap.Heap}.
063     */
064    public static final String CAPTURE_HEAP_KEY = "capture";
065
066    /**
067     * Key to retrieve a default {@link ClientHandler} instance from the
068     * {@link org.forgerock.openig.heap.Heap}.
069     */
070    public static final String CLIENT_HANDLER_HEAP_KEY = "ClientHandler";
071
072    /**
073     * Key to retrieve the {@link EndpointRegistry} instance dedicated for the current Route's objects
074     * from the {@link org.forgerock.openig.heap.Heap}.
075     *
076     * <p>Objects declared in {@literal config.json} will have a registry pointing to {@literal /openig/system/objects}.
077     * <p>Objects declared into routes will have another registry that is dedicated to the host route: {@literal
078     * /openig/system/objects/.../[route-name]/objects}.
079     *
080     * <p>Note that generic heaplets may use their private registry (using their own namespace based on their name)
081     * through {@linkplain GenericHeaplet#endpointRegistry() endpointRegistry()}.
082     * @see GenericHeaplet#endpointRegistry()
083     */
084    public static final String ENDPOINT_REGISTRY_HEAP_KEY = "EndpointRegistry";
085
086    /**
087     * Key to retrieve an {@link Environment} instance from the {@link org.forgerock.openig.heap.Heap}.
088     */
089    public static final String ENVIRONMENT_HEAP_KEY = "Environment";
090
091    /**
092     * Key to retrieve ForgeRock {@link ClientHandler} instance from the
093     * {@link org.forgerock.openig.heap.Heap}, which chains a
094     * {@link TransactionIdOutboundFilter} to a {@link ClientHandler}. This
095     * {@link Handler} is used by audit to forward custom audit header.
096     */
097    public static final String FORGEROCK_CLIENT_HANDLER_HEAP_KEY = "ForgeRockClientHandler";
098
099    /**
100     * Key to retrieve a {@link LogSink} instance from the {@link org.forgerock.openig.heap.Heap}.
101     */
102    public static final String LOGSINK_HEAP_KEY = "LogSink";
103
104    /**
105     * Key to retrieve the default {@link SessionManager} instance from the
106     * {@link org.forgerock.openig.heap.Heap}.
107     */
108    public static final String SESSION_FACTORY_HEAP_KEY = "Session";
109
110    /**
111     * Key to retrieve a {@link TemporaryStorage} instance from the
112     * {@link org.forgerock.openig.heap.Heap}.
113     */
114    public static final String TEMPORARY_STORAGE_HEAP_KEY = "TemporaryStorage";
115
116    /**
117     * Key to retrieve a {@link TimerDecorator} instance from the {@link org.forgerock.openig.heap.Heap}.
118     */
119    public static final String TIMER_HEAP_KEY = "timer";
120
121    /**
122     * Key to retrieve a {@link TimeService} instance from the {@link org.forgerock.openig.heap.Heap}.
123     */
124    public static final String TIME_SERVICE_HEAP_KEY = "TimeService";
125
126    /**
127     * Key to retrieve a {@link TransactionIdOutboundFilter} instance from the {@link org.forgerock.openig.heap.Heap}.
128     */
129    public static final String TRANSACTION_ID_OUTBOUND_FILTER_HEAP_KEY = "TransactionIdOutboundFilter";
130
131    private Keys() {
132        // Prevents from instantiating.
133    }
134}