View Javadoc
1   package edu.internet2.middleware.grouper.pspng;
2   
3   
4   /*******************************************************************************
5    * Copyright 2015 Internet2
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
10   * 
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   * 
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   ******************************************************************************/
19  
20  import org.slf4j.Logger;
21  import org.slf4j.LoggerFactory;
22  
23  import edu.internet2.middleware.grouper.app.loader.GrouperLoaderConfig;
24  
25  /**
26   * Collects all the various properties and makes them available to the provisioner.
27   *
28   * @author Bert Bee-Lindgren
29   */
30  public class LdapAttributeProvisionerConfiguration extends LdapProvisionerConfiguration {
31  
32      private static final Logger LOG = LoggerFactory.getLogger(LdapAttributeProvisionerConfiguration.class);
33      private static final String PARAMETER_NAMESPACE = "changeLog.consumer.";
34  
35      /** 
36       * What attribute of an account maintains values related to the
37       * grouper groups the account is a member of. 
38       */
39      private String provisionedAttributeName;
40      
41      /**
42       * What value is stored in a member's attribute?
43       *   
44       *   Here are the possible values:
45       *   TODO
46       */
47      private String provisionedAttributeValueFormat;
48      protected String provisionedAttributeValueFormat_defaultValue = "${group.name}";
49      
50      
51      private String allProvisionedValuesPrefix;
52      protected String allProvisionedValuesPrefix_defaultValue = null;
53      
54      /**
55       * Wildcard attribute value can identify all users that attribute values
56       * provisioned by this provisioner. This is used to find attribute values
57       * no longer justified by the configuration, either by a deleted group or
58       * by a previous configuration. 
59       *  
60       * This is only used if grouperIsAuthoritative=true.
61       */
62      private String wildcardValueForFindingAllProvisionedValues;
63      
64      public LdapAttributeProvisionerConfiguration(String provisionerName) {
65        super(provisionerName);
66        
67        needsTargetSystemGroups_defaultValue = false;
68        needsTargetSystemUsers_defaultValue = true;
69      }
70      
71      @Override
72      public void readConfiguration() {
73        super.readConfiguration();
74        final String qualifiedParameterNamespace = PARAMETER_NAMESPACE + provisionerName + ".";
75  
76        LOG.debug("Ldap Attribute Provisioner - Setting properties for {} consumer/provisioner.", provisionerName);
77  
78        provisionedAttributeName =
79                  GrouperLoaderConfig.retrieveConfig().propertyValueStringRequired(qualifiedParameterNamespace + "provisionedAttributeName");
80        LOG.debug("Ldap Attribute Provisioner {} - Setting provisionedAttributeName to {}", provisionerName, provisionedAttributeName);
81  
82        provisionedAttributeValueFormat =
83                GrouperLoaderConfig.retrieveConfig().propertyValueString(qualifiedParameterNamespace + "provisionedAttributeValueFormat" , provisionedAttributeValueFormat_defaultValue);
84        LOG.debug("Ldap Attribute Provisioner {} - Setting provisionedAttributeValueFormat to {}", provisionerName, provisionedAttributeValueFormat);
85  
86        allProvisionedValuesPrefix =
87            GrouperLoaderConfig.retrieveConfig().propertyValueString(qualifiedParameterNamespace + "allProvisionedValuesPrefix" , allProvisionedValuesPrefix_defaultValue);
88        LOG.debug("Ldap Attribute Provisioner {} - Setting allProvisionedValuesPrefix to {}", provisionerName, allProvisionedValuesPrefix);
89      }
90  
91      
92      public String getProvisionedAttributeName() {
93        return provisionedAttributeName;
94      }
95  
96      
97      public String getProvisionedAttributeValueFormat() {
98        return provisionedAttributeValueFormat;
99      }
100     
101     public String getAllProvisionedValuesPrefix() {
102       return allProvisionedValuesPrefix;
103     }
104 }