001package com.identityworksllc.iiq.common.connector; 002 003import sailpoint.connector.AbstractConnector; 004import sailpoint.connector.ConnectorException; 005import sailpoint.object.Application; 006import sailpoint.object.Filter; 007import sailpoint.object.ProvisioningPlan; 008import sailpoint.object.ProvisioningResult; 009import sailpoint.object.ResourceObject; 010import sailpoint.tools.CloseableIterator; 011import sailpoint.tools.GeneralException; 012 013import java.util.Map; 014 015/** 016 * A connector that swallows all operations quietly, used for demo and testing purposes 017 */ 018public class NullConnector extends AbstractConnector { 019 /** 020 * Constructs a new NullConnector of the given application type 021 * @param application The application 022 */ 023 public NullConnector(Application application) { 024 super(application); 025 } 026 027 /** 028 * Constructs a new NullConnector of the given application type and instance name 029 * @param application The application type 030 * @param instance The instance name (usually null) 031 */ 032 033 public NullConnector(Application application, String instance) { 034 super(application, instance); 035 } 036 037 /** 038 * Returns null, because there is no real data here 039 * 040 * @param nativeIdentity The native ID of the object to retrieve 041 * @param filter A filter to apply to the object query 042 * @param options Any retrieval options 043 * @return An alleged object, but actually always null 044 * @throws ConnectorException on failures (never, in this case) 045 */ 046 @Override 047 public ResourceObject getObject(String nativeIdentity, String filter, Map<String, Object> options) throws ConnectorException { 048 return null; 049 } 050 051 /** 052 * Returns an empty iterator where hasNext() will always return false 053 * 054 * @param s The object type to query 055 * @param filter The filter to iterate over 056 * @param map A map of options 057 * @return An empty iterator 058 * @throws ConnectorException never 059 */ 060 @Override 061 public CloseableIterator<ResourceObject> iterateObjects(String s, Filter filter, Map<String, Object> map) throws ConnectorException { 062 return new CloseableIterator<ResourceObject>() { 063 @Override 064 public boolean hasNext() { 065 return false; 066 } 067 068 @Override 069 public ResourceObject next() { 070 return null; 071 } 072 073 @Override 074 public void close() { 075 076 } 077 }; 078 } 079 080 /** 081 * Swallows the provisioning operation and returns a status of Committed 082 * @param plan The provisioning plan to provision (or ignore, in this case) 083 * @return The result of the provisioning operation, always committed 084 * @throws ConnectorException on failures to provision 085 * @throws GeneralException on failures to do IIQ stuff 086 */ 087 @Override 088 public ProvisioningResult provision(ProvisioningPlan plan) throws ConnectorException, GeneralException { 089 ProvisioningResult result = new ProvisioningResult(); 090 result.setStatus(ProvisioningResult.STATUS_COMMITTED); 091 return result; 092 } 093 094 /** 095 * Tests the connector by silently succeeding 096 * @throws ConnectorException never 097 */ 098 @Override 099 public void testConfiguration() throws ConnectorException { 100 101 } 102}