本文整理汇总了Java中org.apache.directory.api.ldap.model.exception.LdapInvalidDnException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java LdapInvalidDnException.getMessage方法的具体用法?Java LdapInvalidDnException.getMessage怎么用?Java LdapInvalidDnException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.api.ldap.model.exception.LdapInvalidDnException
的用法示例。
在下文中一共展示了LdapInvalidDnException.getMessage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDefaultDefinition
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
public static ServerDefinition createDefaultDefinition(AbstractLdapConfiguration configuration) {
ServerDefinition def = new ServerDefinition();
def.host = configuration.getHost();
def.port = configuration.getPort();
def.connectionSecurity = configuration.getConnectionSecurity();
def.sslProtocol = configuration.getSslProtocol();
def.enabledSecurityProtocols = configuration.getEnabledSecurityProtocols();
def.enabledCipherSuites = configuration.getEnabledCipherSuites();
def.authenticationType = configuration.getAuthenticationType();
def.bindDn = configuration.getBindDn();
def.bindPassword = configuration.getBindPassword();
def.connectTimeout = configuration.getConnectTimeout();
try {
def.baseContext = new Dn(configuration.getBaseContext());
} catch (LdapInvalidDnException e) {
throw new ConfigurationException("Wrong DN format in baseContext: "+e.getMessage(), e);
}
def.origin = Origin.CONFIGURATION;
return def;
}
示例2: action
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
AddResponseDsml addResponse = new AddResponseDsml(
container.getLdapCodecService(), new AddResponseImpl() );
container.getBatchResponse().addResponse( addResponse );
LdapResult ldapResult = addResponse.getLdapResult();
XmlPullParser xpp = container.getParser();
// Checking and adding the batchRequest's attributes
String attributeValue;
// requestID
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
addResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
// MatchedDN
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
if ( attributeValue != null )
{
try
{
ldapResult.setMatchedDn( new Dn( attributeValue ) );
}
catch ( LdapInvalidDnException lide )
{
throw new XmlPullParserException( lide.getMessage(), xpp, lide );
}
}
}
示例3: deleteTree
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
/**
* deletes the entry with the given Dn, and all its children
*
* @param dn the target entry's Dn as a String
* @throws LdapException If the Dn is not valid or if the deletion failed
*/
public void deleteTree( String dn ) throws LdapException
{
try
{
String treeDeleteOid = "1.2.840.113556.1.4.805";
Dn newDn = new Dn( dn );
if ( isControlSupported( treeDeleteOid ) )
{
DeleteRequest deleteRequest = new DeleteRequestImpl();
deleteRequest.setName( newDn );
deleteRequest.addControl( new OpaqueControl( treeDeleteOid ) );
DeleteResponse deleteResponse = delete( deleteRequest );
processResponse( deleteResponse );
}
else
{
String msg = "The subtreeDelete control (1.2.840.113556.1.4.805) is not supported by the server\n"
+ " The deletion has been aborted";
LOG.error( msg );
throw new LdapException( msg );
}
}
catch ( LdapInvalidDnException e )
{
LOG.error( e.getMessage(), e );
throw new LdapException( e.getMessage(), e );
}
}
示例4: toAccountRdn
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
@Override
protected Rdn toAccountRdn(String username, String fullName) {
try {
return new Rdn(new Ava("CN", fullName));
} catch (LdapInvalidDnException e) {
throw new IllegalStateException(e.getMessage(),e);
}
}
示例5: toAccountRdn
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
protected Rdn toAccountRdn(String username, String fullName) {
try {
return new Rdn(new Ava("uid", username));
} catch (LdapInvalidDnException e) {
throw new IllegalStateException(e.getMessage(),e);
}
}
示例6: asDn
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
private Dn asDn(String stringDn) {
try {
return new Dn(stringDn);
} catch (LdapInvalidDnException e) {
throw new ConnectorException("Cannot parse '"+stringDn+" as DN: "+e.getMessage(), e);
}
}
示例7: toDn
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
public Dn toDn(String stringDn) {
if (stringDn == null) {
return null;
}
try {
return new Dn(stringDn);
} catch (LdapInvalidDnException e) {
throw new InvalidAttributeValueException("Invalid DN '"+stringDn+"': "+e.getMessage(), e);
}
}
示例8: toSchemaAwareDn
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
public Dn toSchemaAwareDn(String stringDn) {
if (stringDn == null) {
return null;
}
try {
return new Dn(schemaManager, stringDn);
} catch (LdapInvalidDnException e) {
throw new InvalidAttributeValueException("Invalid DN '"+stringDn+"': "+e.getMessage(), e);
}
}
示例9: parse
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
public static ServerDefinition parse(AbstractLdapConfiguration configuration, String serverConfigLine, int lineNumber) {
String[] clauses = serverConfigLine.split(";");
Map<String,String> props = new HashMap<>();
for (String clause: clauses) {
clause = clause.trim();
int indexEq = clause.indexOf('=');
if (indexEq < 0) {
throw new ConfigurationException("Wrong format of server configuration line "+lineNumber+": missing equals sign");
}
String propName = clause.substring(0, indexEq);
String propValue = clause.substring(indexEq+1);
props.put(propName, propValue);
}
ServerDefinition def = new ServerDefinition();
def.host = getStringProp(props, "host", configuration.getHost());
Integer port = getIntProp(props, "port", configuration.getPort());
if (port == null) {
def.port = 389;
} else {
def.port = port;
}
def.connectionSecurity = getStringProp(props, "connectionSecurity", configuration.getConnectionSecurity());
def.sslProtocol = getStringProp(props, "sslProtocol", configuration.getSslProtocol());
def.enabledSecurityProtocols = getStringArrayProp(props, "enabledSecurityProtocols", configuration.getEnabledSecurityProtocols());
def.enabledCipherSuites = getStringArrayProp(props, "enabledCipherSuites", configuration.getEnabledCipherSuites());
def.authenticationType = getStringProp(props, "authenticationType", configuration.getAuthenticationType());
def.bindDn = getStringProp(props, "bindDn", configuration.getBindDn());
def.bindPassword = getGuardedStringProp(props, "bindPassword", configuration.getBindPassword());
def.connectTimeout = getLongProp(props, "connectTimeout", configuration.getConnectTimeout());
try {
def.baseContext = new Dn(getStringProp(props, "baseContext", configuration.getBaseContext()));
} catch (LdapInvalidDnException e) {
throw new ConfigurationException("Wrong DN format in baseContext in server definition (line "+lineNumber+"): "+e.getMessage(), e);
}
def.origin = Origin.CONFIGURATION;
return def;
}
示例10: getDn
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
/**
* Creates a new Dn for the given orgUnit
*
* @param orgUnit The orgUnit
* @return A Dn
* @throws LdapInvalidDnException If the DN is invalid
*/
private Dn getDn( OrgUnit orgUnit )
{
Dn dn = null;
try
{
switch ( orgUnit.type )
{
case USER:
dn = new Dn( SchemaConstants.OU_AT + "=" + orgUnit.getName(), getRootDn( orgUnit.getContextId(),
GlobalIds.OSU_ROOT ) );
break;
case PERM:
dn = new Dn( SchemaConstants.OU_AT + "=" + orgUnit.getName(), getRootDn( orgUnit.getContextId(),
GlobalIds.PSU_ROOT ) );
break;
default:
String warning = "getDn invalid type";
LOG.warn( warning );
break;
}
return dn;
}
catch ( LdapInvalidDnException lide )
{
LOG.error( lide.getMessage() );
throw new RuntimeException( lide.getMessage() );
}
}
示例11: action
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
AddRequestDsml addRequest = new AddRequestDsml( codec, new AddRequestImpl() );
container.getBatchRequest().addRequest( addRequest );
XmlPullParser xpp = container.getParser();
// Checking and adding the request's attributes
String attributeValue;
// requestID
attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
if ( attributeValue != null )
{
addRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
else
{
if ( ParserUtils.isRequestIdNeeded( container ) )
{
throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
}
}
// dn
attributeValue = xpp.getAttributeValue( "", "dn" );
if ( attributeValue != null )
{
try
{
addRequest.setEntryDn( new Dn( attributeValue ) );
}
catch ( LdapInvalidDnException lide )
{
throw new XmlPullParserException( lide.getMessage(), xpp, lide );
}
}
else
{
throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
}
}