View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.core.provisioning.api;
20  
21  import java.util.Collection;
22  import java.util.Optional;
23  import org.apache.syncope.common.lib.to.ConnInstanceTO;
24  import org.apache.syncope.common.lib.types.ConnConfProperty;
25  import org.apache.syncope.common.lib.types.ConnectorCapability;
26  import org.apache.syncope.core.persistence.api.entity.ConnInstance;
27  import org.apache.syncope.core.persistence.api.entity.ExternalResource;
28  
29  /**
30   * Entry point for creating and destroying connectors for external resources.
31   *
32   * @see Connector
33   */
34  public interface ConnectorManager {
35  
36      /**
37       * Builds connector instance override over base connector instance, configuration and capabilities.
38       *
39       * @param connInstance base connector instance
40       * @param confOverride configuration override
41       * @param capabilitiesOverride capabilities override
42       * @return connector instance override over base connector instance, configuration and capabilities
43       */
44      ConnInstance buildConnInstanceOverride(
45              ConnInstanceTO connInstance,
46              Collection<ConnConfProperty> confOverride,
47              Optional<Collection<ConnectorCapability>> capabilitiesOverride);
48  
49      /**
50       * Create connector from given connector instance.
51       *
52       * @param connInstance connector instance
53       * @return connector
54       */
55      Connector createConnector(ConnInstance connInstance);
56  
57      /**
58       * Get existing connector bean for the given resource or create if not found.
59       *
60       * @param resource the resource
61       * @return live connector bean for given resource
62       */
63      Connector getConnector(ExternalResource resource);
64  
65      /*
66       * Get existing connector bean for the given resource if found.
67       *
68       * @param resource the resource.
69       * @return live connector bean for given resource
70       */
71      Optional<Connector> readConnector(ExternalResource resource);
72  
73      /**
74       * Load connectors for all existing resources.
75       *
76       * @see ExternalResource
77       */
78      void load();
79  
80      /**
81       * Unload connectors for all existing resources.
82       *
83       * @see ExternalResource
84       */
85      void unload();
86  
87      /**
88       * Create and register into Spring context a bean for the given resource.
89       *
90       * @param resource external resource
91       */
92      void registerConnector(ExternalResource resource);
93  
94      /**
95       * Removes the Spring bean for the given resource from the context.
96       *
97       * @param resource external resource
98       */
99      void unregisterConnector(ExternalResource resource);
100 }