001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020 021package org.apache.directory.api.ldap.model.ldif.anonymizer; 022 023 024import java.util.Map; 025import java.util.Set; 026 027import org.apache.directory.api.ldap.model.entry.Attribute; 028import org.apache.directory.api.ldap.model.entry.Value; 029import org.apache.directory.api.ldap.model.schema.SchemaManager; 030 031 032/** 033 * An interface for Anonymizers. 034 * 035 * @param <K> The type of object that will be anonymized 036 * 037 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 038 */ 039public interface Anonymizer<K> 040{ 041 /** 042 * Take an attribute and its value, anonymizing all of them. 043 * 044 * @param valueMap The existing map of value to the associated anonymized counterpart 045 * @param valueSet The existing set of anonymized counterpart 046 * @param attribute The attribute to anonymize 047 * @return The anonymized attribute 048 */ 049 Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute ); 050 051 052 /** 053 * Inject a SchemaManager instance in this Anonymizer 054 * 055 * @param schemaManager The SchemaManager instance 056 */ 057 void setSchemaManager( SchemaManager schemaManager ); 058 059 060 /** 061 * Set the list of existing anonymizers 062 * 063 * @param attributeAnonymizers The list of existing anonymizers 064 */ 065 void setAnonymizers( Map<String, Anonymizer<K>> attributeAnonymizers ); 066 067 068 /** 069 * @return The latest String anonymized value map 070 */ 071 Map<Integer, String> getLatestStringMap(); 072 073 074 /** 075 * @param latestStringMap The latest String anonymized value map 076 */ 077 void setLatestStringMap( Map<Integer, String> latestStringMap ); 078 079 080 /** 081 * @return The latest byte[] anonymized value map 082 */ 083 Map<Integer, byte[]> getLatestBytesMap(); 084 085 086 /** 087 * @param latestBytesMap The latest byte[] anonymized value map 088 */ 089 void setLatestBytesMap( Map<Integer, byte[]> latestBytesMap ); 090}