View Javadoc

1   /*
2    * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package edu.internet2.middleware.shibboleth.common.config.attribute.resolver.dataConnector;
18  
19  import edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataConnector.BaseDataConnector;
20  import edu.internet2.middleware.shibboleth.common.config.attribute.resolver.AbstractResolutionPluginFactoryBean;
21  
22  /**
23   * Base class for data connector factories.
24   */
25  public abstract class BaseDataConnectorFactoryBean extends AbstractResolutionPluginFactoryBean {
26  
27      /** ID of failover data connectors for this plugin. */
28      private String failoverDataConnectorId;
29  
30      /**
31       * Gets the ID of failover data connectors for this plugin.
32       * 
33       * @return ID of failover data connectors for this plugin
34       */
35      public String getFailoverDataConnectorId() {
36          return failoverDataConnectorId;
37      }
38  
39      /**
40       * Sets the ID of failover data connectors for this plugin.
41       * 
42       * @param id ID of failover data connectors for this plugin
43       */
44      public void setFailoverDataConnectorIds(String id) {
45          failoverDataConnectorId = id;
46      }
47  
48      /**
49       * Populates data connector with information from this factory.
50       * 
51       * @param connector data connector with information from this factory
52       */
53      protected void populateDataConnector(BaseDataConnector connector) {
54          connector.setId(getPluginId());
55  
56          if (getDependencyIds() != null) {
57              connector.getDependencyIds().addAll(getDependencyIds());
58          }
59  
60          if (getFailoverDataConnectorId() != null) {
61              connector.setFailoverDependencyIds(getFailoverDataConnectorId());
62          }
63      }
64  }