OIM 11.1.1.5 Develop Connectors using ICF and SPI APIS: Part1:: Implement the configuration class for the Flat File Connector by extending the org.identityconnectors.framework.spi.AbstractConfiguration base class.
package org.identityconnectors.flatfile; import java.io.File; import org.identityconnectors.flatfile.io.FlatFileIOFactory; import org.identityconnectors.framework.common.exceptions.ConfigurationException; import org.identityconnectors.framework.spi.AbstractConfiguration; import org.identityconnectors.framework.spi.ConfigurationProperty; /** * Class for storing the flat file configuration */ public class FlatFileConfiguration extends AbstractConfiguration { /* * Storage file name */ private File storeFile; /* * Delimeter used */ private String textFieldDelimeter; /* * Unique attribute field name */ private String uniqueAttributeName = ""; /* * Change attribute field name. Should be numeric */ private String changeLogAttributeName = ""; public File getStoreFile() { return storeFile; } public String getTextFieldDelimeter() { return textFieldDelimeter; } public String getUniqueAttributeName() { return uniqueAttributeName; } public String getChangeLogAttributeName() { return changeLogAttributeName; } /** * Set the store file * @param storeFile */ @ConfigurationProperty(order = 1, helpMessageKey = "USER_ACCOUNT_STORE_HELP", displayMessageKey = "USER_ACCOUNT_STORE_DISPLAY") public void setStoreFile(File storeFile) { this.storeFile = storeFile; } /** * Set the text field delimeter * @param textFieldDelimeter */ @ConfigurationProperty(order = 2, helpMessageKey = "USER_STORE_TEXT_DELIM_HELP", displayMessageKey = "USER_STORE_TEXT_DELIM_DISPLAY") public void setTextFieldDelimeter(String textFieldDelimeter) { this.textFieldDelimeter = textFieldDelimeter; } /** * Set the field whose values will be considered as unique attributes * @param uniqueAttributeName */ @ConfigurationProperty(order = 3, helpMessageKey = "UNIQUE_ATTR_HELP", displayMessageKey = "UNIQUE_ATTR_DISPLAY") public void setUniqueAttributeName(String uniqueAttributeName) { this.uniqueAttributeName = uniqueAttributeName; } /** * Set the field name where change number should be stored * @param changeLogAttributeName */ @ConfigurationProperty(order = 3, helpMessageKey = "CHANGELOG_ATTR_HELP", displayMessageKey = "CHANGELOG_ATTR_DISPLAY") public void setChangeLogAttributeName(String changeLogAttributeName) { this.changeLogAttributeName = changeLogAttributeName; } @Override public void validate() { // Validate if file exists and is usable boolean validFile = (this.storeFile.exists() && this.storeFile.canRead() && this.storeFile.canWrite() && this.storeFile.isFile()); if (!validFile) throw new ConfigurationException("User store file not valid"); // Validate if there is a field on name of unique attribute field name // Validate if there is a field on name of change attribute field name FlatFileIOFactory.getInstance(this); // Initialization does the validation } } |
Saturday, June 23, 2012
OIM 11.1.1.5 Develop Connectors using ICF and SPI APIS.. Part 1
########
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment