Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
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);
}
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);
}
}
}
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);
}