2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.policy.controlloop.eventmanager;
23 import java.io.Serializable;
24 import java.util.concurrent.CompletableFuture;
25 import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
28 * Context used by steps to perform their work.
30 public interface StepContext {
33 * Determines if the context contains a property.
35 * @param name name of the property of interest
36 * @return {@code true} if the context contains the property, {@code false} otherwise
38 public boolean contains(String name);
41 * Gets a property, casting it to the desired type.
43 * @param <T> desired type
44 * @param name name of the property whose value is to be retrieved
45 * @return the property's value, or {@code null} if it does not yet have a value
47 public <T> T getProperty(String name);
50 * Sets a property's value.
52 * @param name property name
53 * @param value new property value
55 public void setProperty(String name, Serializable value);
60 * @param name property name
62 public void removeProperty(String name);
65 * Requests a lock. This requests the lock for the time that remains before the
66 * timeout expires. This avoids having to extend the lock.
68 * @param targetEntity entity to be locked
69 * @return a future that can be used to await the lock
71 public CompletableFuture<OperationOutcome> requestLock(String targetEntity);