aboutsummaryrefslogtreecommitdiffstats
path: root/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java
blob: b641f24a45fc587fd9d2a93e2fdf6eb74e328341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
/*
 * ============LICENSE_START=======================================================
 * policy-management
 * ================================================================================
 * Copyright (C) 2017-2019 AT&T Intellectual Property. 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.policy.drools.controller;

import java.util.List;
import java.util.Properties;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration;

/**
 * Drools Controller Factory to manage controller creation, destruction, and retrieval for
 * management interfaces.
 */
public interface DroolsControllerFactory {

    /**
     * Constructs a Drools Controller based on properties.
     *
     * @param properties properties containing initialization parameters
     * @param eventSources list of event sources
     * @param eventSinks list of event sinks
     *
     * @return the instantiated Drools Controller
     * @throws IllegalArgumentException with invalid parameters
     * @throws LinkageError Failure to link rules and models in Drools Libraries
     */
    public DroolsController build(Properties properties, List<? extends TopicSource> eventSources,
            List<? extends TopicSink> eventSinks) throws LinkageError;

    /**
     * Explicit construction of a Drools Controller.
     *
     * @param groupId maven group id of drools artifact
     * @param artifactId maven artifact id of drools artifact
     * @param version maven version id of drools artifact
     * @param decoderConfigurations list of decoder configurations
     * @param encoderConfigurations list of encoder configurations
     *
     * @return the instantiated Drools Controller
     * @throws IllegalArgumentException with invalid parameters
     * @throws LinkageError Failure to link rules and models in Drools Libraries
     */
    public DroolsController build(String groupId, String artifactId, String version,
            List<TopicCoderFilterConfiguration> decoderConfigurations,
            List<TopicCoderFilterConfiguration> encoderConfigurations) throws LinkageError;

    /**
     * Releases the Drools Controller from operation.
     *
     * @param controller the Drools Controller to shut down
     */
    public void shutdown(DroolsController controller);

    /**
     * Disables all Drools Controllers from operation.
     */
    public void shutdown();

    /**
     * Destroys and releases resources for a Drools Controller.
     *
     * @param controller the Drools Controller to destroy
     */
    public void destroy(DroolsController controller);

    /**
     * Destroys all Drools Controllers.
     */
    public void destroy();

    /**
     * Gets the Drools Controller associated with the maven group and artifact id.
     *
     * @param groupId maven group id of drools artifact
     * @param artifactId maven artifact id of drools artifact
     * @param version maven version id of drools artifact
     *
     * @return the Drools Controller
     * @throws IllegalArgumentException with invalid parameters
     */
    public DroolsController get(String groupId, String artifactId, String version);

    /**
     * returns the current inventory of Drools Controllers.
     *
     * @return a list of Drools Controllers
     */
    public List<DroolsController> inventory();
}