Class DefaultLdapCodecService
- java.lang.Object
-
- org.apache.directory.api.ldap.codec.osgi.DefaultLdapCodecService
-
- All Implemented Interfaces:
LdapApiService
- Direct Known Subclasses:
StandaloneLdapApiService
public class DefaultLdapCodecService extends Object implements LdapApiService
The defaultLdapApiServiceimplementation.- Version:
- $Rev$, $Date$
- Author:
- Apache Directory Project
-
-
Field Summary
-
Fields inherited from interface org.apache.directory.api.ldap.codec.api.LdapApiService
DEFAULT_PROTOCOL_CODEC_FACTORY
-
-
Constructor Summary
Constructors Constructor Description DefaultLdapCodecService()Creates a new instance of DefaultLdapCodecService.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExtendedRequestfromJndi(ExtendedRequest jndiRequest)Creates a model ExtendedResponse from the JNDI ExtendedRequest.ExtendedResponsefromJndi(ExtendedResponse jndiResponse)Creates a model ExtendedResponse from the JNDI ExtendedResponse.ControlfromJndiRequestControl(Control control)Creates a model request control from the JNDI request control.ControlfromJndiResponseControl(Control control)Creates a model response control from the JNDI response control.Map<String,ExtendedOperationFactory>getExtendedRequestFactories()Map<String,ExtendedOperationFactory>getExtendedResponseFactories()Map<String,IntermediateOperationFactory>getIntermediateResponseFactories()ProtocolCodecFactorygetProtocolCodecFactory()Creates a new LDAPProtocolCodecFactory.Map<String,ControlFactory<? extends Control>>getRequestControlFactories()Map<String,ControlFactory<? extends Control>>getResponseControlFactories()booleanisControlRegistered(String oid)Checks if a control has been registered.booleanisExtendedRequestRegistered(String oid)Checks to see if an extended request operation is registered.booleanisExtendedResponseRegistered(String oid)Checks to see if an extended response operation is registered.booleanisIntermediateResponseRegistered(String oid)Checks to see if an intermediate response is registered.Iterator<String>registeredExtendedRequests()Returns an Iterator over the OID Strings of registered extended requests.Iterator<String>registeredExtendedResponses()Returns an Iterator over the OID Strings of registered extended responses.Iterator<String>registeredIntermediateResponses()Returns an Iterator over the OID Strings of registered intermediate responses.Iterator<String>registeredRequestControls()Returns an Iterator over the OID Strings of registered request controls.Iterator<String>registeredResponseControls()Returns an Iterator over the OID Strings of registered response controls.ExtendedOperationFactoryregisterExtendedRequest(ExtendedOperationFactory factory)Registers anExtendedOperationFactoryfor generating extended request response pairs.ExtendedOperationFactoryregisterExtendedResponse(ExtendedOperationFactory factory)Registers anExtendedOperationFactoryfor generating extended response response pairs.IntermediateOperationFactoryregisterIntermediateResponse(IntermediateOperationFactory factory)Registers anIntermediateOperationFactoryfor generating intermediate responseProtocolCodecFactoryregisterProtocolCodecFactory(ProtocolCodecFactory protocolCodecFactory)Registers a ProtocolCodecFactory with this LdapCodecService.ControlFactory<?>registerRequestControl(ControlFactory<?> factory)Registers an requestControlFactorywith this service.ControlFactory<?>registerResponseControl(ControlFactory<?> factory)Registers an responseControlFactorywith this service.voidsetExtendedRequestFactories(Map<String,ExtendedOperationFactory> extendedOperationFactories)voidsetExtendedResponseFactories(Map<String,ExtendedOperationFactory> extendedOperationFactories)voidsetIntermediateResponseFactories(Map<String,IntermediateOperationFactory> intermediateResponseFactories)voidsetProtocolCodecFactory(ProtocolCodecFactory protocolCodecFactory)voidsetRequestControlFactories(Map<String,ControlFactory<? extends Control>> requestControlFactories)voidsetResponseControlFactories(Map<String,ControlFactory<? extends Control>> responseControlFactories)ExtendedRequesttoJndi(ExtendedRequest modelRequest)Creates a JNDIExtendedRequestfrom the modelExtendedRequest.ExtendedResponsetoJndi(ExtendedResponse modelResponse)Creates a JNDIExtendedResponsefrom the modelExtendedResponse.ControltoJndiControl(Control control)Creates a JNDI control from the ldap model's control.StringtoString()ExtendedOperationFactoryunregisterExtendedRequest(String oid)Unregisters anExtendedOperationFactoryfor generating extended request response pairs.ExtendedOperationFactoryunregisterExtendedResponse(String oid)Unregisters anExtendedOperationFactoryfor generating extended responses.IntermediateOperationFactoryunregisterIntermediateResponse(String oid)Unregisters anIntermediateOperationFactoryfor generating intermediate responseControlFactory<?>unregisterRequestControl(String oid)Unregisters a requestControlFactorywith this service.ControlFactory<?>unregisterResponseControl(String oid)Unregisters a responseControlFactorywith this service.
-
-
-
Method Detail
-
registerRequestControl
public ControlFactory<?> registerRequestControl(ControlFactory<?> factory)
Registers an requestControlFactorywith this service.- Specified by:
registerRequestControlin interfaceLdapApiService- Parameters:
factory- The control factory- Returns:
- The registered control factory
-
registerResponseControl
public ControlFactory<?> registerResponseControl(ControlFactory<?> factory)
Registers an responseControlFactorywith this service.- Specified by:
registerResponseControlin interfaceLdapApiService- Parameters:
factory- The control factory- Returns:
- The registered control factory
-
unregisterRequestControl
public ControlFactory<?> unregisterRequestControl(String oid)
Unregisters a requestControlFactorywith this service.- Specified by:
unregisterRequestControlin interfaceLdapApiService- Parameters:
oid- The oid of the control the factory is associated with.- Returns:
- The unregistered control factory
-
unregisterResponseControl
public ControlFactory<?> unregisterResponseControl(String oid)
Unregisters a responseControlFactorywith this service.- Specified by:
unregisterResponseControlin interfaceLdapApiService- Parameters:
oid- The oid of the control the factory is associated with.- Returns:
- The unregistered control factory
-
registeredRequestControls
public Iterator<String> registeredRequestControls()
Returns an Iterator over the OID Strings of registered request controls.- Specified by:
registeredRequestControlsin interfaceLdapApiService- Returns:
- The registered control OID Strings
-
registeredResponseControls
public Iterator<String> registeredResponseControls()
Returns an Iterator over the OID Strings of registered response controls.- Specified by:
registeredResponseControlsin interfaceLdapApiService- Returns:
- The registered control OID Strings
-
isControlRegistered
public boolean isControlRegistered(String oid)
Checks if a control has been registered. It will check in both the request and response control maps.- Specified by:
isControlRegisteredin interfaceLdapApiService- Parameters:
oid- The Control OID we are looking for- Returns:
- The OID of the control to check for registration
-
registeredExtendedRequests
public Iterator<String> registeredExtendedRequests()
Returns an Iterator over the OID Strings of registered extended requests.- Specified by:
registeredExtendedRequestsin interfaceLdapApiService- Returns:
- The registered extended request OID Strings
-
registeredExtendedResponses
public Iterator<String> registeredExtendedResponses()
Returns an Iterator over the OID Strings of registered extended responses.- Specified by:
registeredExtendedResponsesin interfaceLdapApiService- Returns:
- The registered extended response OID Strings
-
registerExtendedRequest
public ExtendedOperationFactory registerExtendedRequest(ExtendedOperationFactory factory)
Registers anExtendedOperationFactoryfor generating extended request response pairs.- Specified by:
registerExtendedRequestin interfaceLdapApiService- Parameters:
factory- The extended request factory- Returns:
- The registered factory if one existed for the oid
-
registerExtendedResponse
public ExtendedOperationFactory registerExtendedResponse(ExtendedOperationFactory factory)
Registers anExtendedOperationFactoryfor generating extended response response pairs.- Specified by:
registerExtendedResponsein interfaceLdapApiService- Parameters:
factory- The extended response factory- Returns:
- The registered factory if one existed for the oid
-
registeredIntermediateResponses
public Iterator<String> registeredIntermediateResponses()
Returns an Iterator over the OID Strings of registered intermediate responses.- Specified by:
registeredIntermediateResponsesin interfaceLdapApiService- Returns:
- The registered Intermediate response OID Strings
-
registerIntermediateResponse
public IntermediateOperationFactory registerIntermediateResponse(IntermediateOperationFactory factory)
Registers anIntermediateOperationFactoryfor generating intermediate response- Specified by:
registerIntermediateResponsein interfaceLdapApiService- Parameters:
factory- The intermediate response factory- Returns:
- The displaced factory if one existed for the oid
-
getProtocolCodecFactory
public ProtocolCodecFactory getProtocolCodecFactory()
Creates a new LDAPProtocolCodecFactory.- Specified by:
getProtocolCodecFactoryin interfaceLdapApiService- Returns:
- the
ProtocolCodecFactory
-
registerProtocolCodecFactory
public ProtocolCodecFactory registerProtocolCodecFactory(ProtocolCodecFactory protocolCodecFactory)
Registers a ProtocolCodecFactory with this LdapCodecService.- Specified by:
registerProtocolCodecFactoryin interfaceLdapApiService- Parameters:
protocolCodecFactory- The factory being registered.- Returns:
- The previously set
ProtocolCodecFactory, or null if none had been set earlier.
-
toJndiControl
public Control toJndiControl(Control control) throws EncoderException
Creates a JNDI control from the ldap model's control.- Specified by:
toJndiControlin interfaceLdapApiService- Parameters:
control- The model's control.- Returns:
- The JNDI control.
- Throws:
EncoderException- if there are problems encoding the modelControl.
-
fromJndiRequestControl
public Control fromJndiRequestControl(Control control) throws DecoderException
Creates a model request control from the JNDI request control.- Specified by:
fromJndiRequestControlin interfaceLdapApiService- Parameters:
control- The JNDI control.- Returns:
- The model request control.
- Throws:
DecoderException- if there are problems decoding the value of the JNDI control.
-
fromJndiResponseControl
public Control fromJndiResponseControl(Control control) throws DecoderException
Creates a model response control from the JNDI response control.- Specified by:
fromJndiResponseControlin interfaceLdapApiService- Parameters:
control- The JNDI response control.- Returns:
- The model control.
- Throws:
DecoderException- if there are problems decoding the value of the JNDI control.
-
unregisterExtendedRequest
public ExtendedOperationFactory unregisterExtendedRequest(String oid)
Unregisters anExtendedOperationFactoryfor generating extended request response pairs.- Specified by:
unregisterExtendedRequestin interfaceLdapApiService- Parameters:
oid- The extended request oid- Returns:
- The registered factory if one existed for the oid
-
unregisterExtendedResponse
public ExtendedOperationFactory unregisterExtendedResponse(String oid)
Unregisters anExtendedOperationFactoryfor generating extended responses.- Specified by:
unregisterExtendedResponsein interfaceLdapApiService- Parameters:
oid- The extended response oid- Returns:
- The registered factory if one existed for the oid
-
unregisterIntermediateResponse
public IntermediateOperationFactory unregisterIntermediateResponse(String oid)
Unregisters anIntermediateOperationFactoryfor generating intermediate response- Specified by:
unregisterIntermediateResponsein interfaceLdapApiService- Parameters:
oid- The intermediate response oid- Returns:
- The displaced factory if one existed for the oid
-
toJndi
public ExtendedResponse toJndi(ExtendedResponse modelResponse) throws EncoderException
Creates a JNDIExtendedResponsefrom the modelExtendedResponse.- Specified by:
toJndiin interfaceLdapApiService- Parameters:
modelResponse- The extended response to convert- Returns:
- A JNDI extended response
- Throws:
EncoderException- If the conversion failed
-
fromJndi
public ExtendedResponse fromJndi(ExtendedResponse jndiResponse) throws DecoderException
Creates a model ExtendedResponse from the JNDI ExtendedResponse.- Specified by:
fromJndiin interfaceLdapApiService- Parameters:
jndiResponse- The JNDI ExtendedResponse- Returns:
- The model ExtendedResponse
- Throws:
DecoderException- if the response value cannot be decoded.
-
fromJndi
public ExtendedRequest fromJndi(ExtendedRequest jndiRequest) throws DecoderException
Creates a model ExtendedResponse from the JNDI ExtendedRequest.- Specified by:
fromJndiin interfaceLdapApiService- Parameters:
jndiRequest- The JNDI ExtendedRequest- Returns:
- The model ExtendedRequest
- Throws:
DecoderException- if the request value cannot be decoded.
-
toJndi
public ExtendedRequest toJndi(ExtendedRequest modelRequest) throws EncoderException
Creates a JNDIExtendedRequestfrom the modelExtendedRequest.- Specified by:
toJndiin interfaceLdapApiService- Parameters:
modelRequest- The extended request to convert- Returns:
- A JNDI extended request
- Throws:
EncoderException- If the conversion failed
-
isExtendedRequestRegistered
public boolean isExtendedRequestRegistered(String oid)
Checks to see if an extended request operation is registered.- Specified by:
isExtendedRequestRegisteredin interfaceLdapApiService- Parameters:
oid- The object identifier for the extended request operation- Returns:
- true if registered, false if not
-
isExtendedResponseRegistered
public boolean isExtendedResponseRegistered(String oid)
Checks to see if an extended response operation is registered.- Specified by:
isExtendedResponseRegisteredin interfaceLdapApiService- Parameters:
oid- The object identifier for the extended response operation- Returns:
- true if registered, false if not
-
isIntermediateResponseRegistered
public boolean isIntermediateResponseRegistered(String oid)
Checks to see if an intermediate response is registered.- Specified by:
isIntermediateResponseRegisteredin interfaceLdapApiService- Parameters:
oid- The object identifier for the intermediate response- Returns:
- true if registered, false if not
-
getRequestControlFactories
public Map<String,ControlFactory<? extends Control>> getRequestControlFactories()
- Specified by:
getRequestControlFactoriesin interfaceLdapApiService- Returns:
- the request controlFactories
-
getResponseControlFactories
public Map<String,ControlFactory<? extends Control>> getResponseControlFactories()
- Specified by:
getResponseControlFactoriesin interfaceLdapApiService- Returns:
- the response controlFactories
-
setRequestControlFactories
public void setRequestControlFactories(Map<String,ControlFactory<? extends Control>> requestControlFactories)
- Parameters:
requestControlFactories- the request controlFactories to set
-
setResponseControlFactories
public void setResponseControlFactories(Map<String,ControlFactory<? extends Control>> responseControlFactories)
- Parameters:
responseControlFactories- the response controlFactories to set
-
getExtendedRequestFactories
public Map<String,ExtendedOperationFactory> getExtendedRequestFactories()
- Specified by:
getExtendedRequestFactoriesin interfaceLdapApiService- Returns:
- the extendedRequestFactories
-
getExtendedResponseFactories
public Map<String,ExtendedOperationFactory> getExtendedResponseFactories()
- Specified by:
getExtendedResponseFactoriesin interfaceLdapApiService- Returns:
- the extendedResponseFactories
-
getIntermediateResponseFactories
public Map<String,IntermediateOperationFactory> getIntermediateResponseFactories()
- Specified by:
getIntermediateResponseFactoriesin interfaceLdapApiService- Returns:
- the intermediateResponseFactories
-
setExtendedRequestFactories
public void setExtendedRequestFactories(Map<String,ExtendedOperationFactory> extendedOperationFactories)
- Parameters:
extendedOperationFactories- the extendedOperationFactories to set
-
setExtendedResponseFactories
public void setExtendedResponseFactories(Map<String,ExtendedOperationFactory> extendedOperationFactories)
- Parameters:
extendedOperationFactories- the extendedOperationFactories to set
-
setIntermediateResponseFactories
public void setIntermediateResponseFactories(Map<String,IntermediateOperationFactory> intermediateResponseFactories)
- Parameters:
intermediateResponseFactories- the intermediateResponseFactories to set
-
setProtocolCodecFactory
public void setProtocolCodecFactory(ProtocolCodecFactory protocolCodecFactory)
- Parameters:
protocolCodecFactory- the protocolCodecFactory to set
-
-