Este contenido no está disponible en el idioma seleccionado.
Chapter 4. Mapping Manager
The Mapping Manager is an interface that obtains preconfigured MappingContexts for particular Mapping Class types, such as the java.security.acl.Group used in role mapping. Implementations of the Service Provider Interface (SPI) can define their own Mapping Class types.
The MappingManager interface is found in the following package:
package org.jboss.security.mapping;
/**
* Manager used to map various types
*/
public interface MappingManager
{
MappingContext getMappingContext(Class mappingType);
}
package org.jboss.security.mapping;
/**
* Manager used to map various types
*/
public interface MappingManager
{
MappingContext getMappingContext(Class mappingType);
}
Copy to ClipboardCopied!Toggle word wrapToggle overflow
The MappingContext is a set of preconfigured MappingProvider instances for a particular class type and security domain. The MappingContext interface looks like this:
package org.jboss.security.mapping;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Generic Context used by the Mapping Framework
*/
public class MappingContext
{
private List modules = new ArrayList();
public MappingContext(List mod)
{
this.modules = mod;
}
/**
* Get the set of mapping modules
* @return
*/
public List getModules()
{
return this.modules;
}
/**
* Apply mapping semantics on the passed object
* @param obj Read-only Contextual Map
* @param mappedObject an object on which mapping will be applied
*/
public <T> void performMapping(Map obj, T mappedObject)
{
int len = modules.size();
for(int i = 0 ; i < len; i++)
{
MappingProvider<T> mp = (MappingProvider<T>)modules.get(i);
mp.performMapping(obj, mappedObject);
}
}
}
package org.jboss.security.mapping;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Generic Context used by the Mapping Framework
*/
public class MappingContext
{
private List modules = new ArrayList();
public MappingContext(List mod)
{
this.modules = mod;
}
/**
* Get the set of mapping modules
* @return
*/
public List getModules()
{
return this.modules;
}
/**
* Apply mapping semantics on the passed object
* @param obj Read-only Contextual Map
* @param mappedObject an object on which mapping will be applied
*/
public <T> void performMapping(Map obj, T mappedObject)
{
int len = modules.size();
for(int i = 0 ; i < len; i++)
{
MappingProvider<T> mp = (MappingProvider<T>)modules.get(i);
mp.performMapping(obj, mappedObject);
}
}
}
Copy to ClipboardCopied!Toggle word wrapToggle overflow
The MappingProvider interface looks like the following:
package org.jboss.security.mapping;
import java.util.Map;
/**
* A provider with mapping functionality
*/
public interface MappingProvider<T>
{
/**
* Initializes the provider with the configured module options
* @param options
*/
void init(Map options);
/**
* Maps the passed object
* @param map A read-only contextual map that can provide information to the provider
* @param mappedObject an Object on which the mapping will be applied
* @throws IllegalArgumentException if the mappedObject is not understood by the
* provider.
*/
void performMapping(Map map, T mappedObject);
}
package org.jboss.security.mapping;
import java.util.Map;
/**
* A provider with mapping functionality
*/
public interface MappingProvider<T>
{
/**
* Initializes the provider with the configured module options
* @param options
*/
void init(Map options);
/**
* Maps the passed object
* @param map A read-only contextual map that can provide information to the provider
* @param mappedObject an Object on which the mapping will be applied
* @throws IllegalArgumentException if the mappedObject is not understood by the
* provider.
*/
void performMapping(Map map, T mappedObject);
}
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.
Hacer que el código abierto sea más inclusivo
Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.
Acerca de Red Hat
Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.