本文整理汇总了Java中org.apache.directory.api.ldap.model.exception.LdapException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java LdapException.getMessage方法的具体用法?Java LdapException.getMessage怎么用?Java LdapException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.api.ldap.model.exception.LdapException
的用法示例。
在下文中一共展示了LdapException.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unregister
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ObjectClass unregister( String numericOid ) throws LdapException
{
try
{
ObjectClass removed = super.unregister( numericOid );
// Deleting an ObjectClass which might be used as a superior means we have
// to recursively update the descendant map. We also have to remove
// the at.oid -> descendant relation
oidToDescendants.remove( numericOid );
// Now recurse if needed
unregisterDescendants( removed, removed.getSuperiors() );
return removed;
}
catch ( LdapException ne )
{
throw new LdapNoSuchAttributeException( ne.getMessage(), ne );
}
}
示例2: unregister
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AttributeType unregister( String numericOid ) throws LdapException
{
try
{
AttributeType removed = super.unregister( numericOid );
removeMappingFor( removed );
// Deleting an AT which might be used as a superior means we have
// to recursively update the descendant map. We also have to remove
// the at.oid -> descendant relation
oidToDescendantSet.remove( numericOid );
// Now recurse if needed
unregisterDescendants( removed, removed.getSuperior() );
return removed;
}
catch ( LdapException ne )
{
throw new LdapNoSuchAttributeException( ne.getMessage(), ne );
}
}
示例3: action
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
ModifyRequestDsml modifyRequest = ( ModifyRequestDsml )
container.getBatchRequest().getCurrentRequest();
XmlPullParser xpp = container.getParser();
try
{
// We have to catch the type Attribute Value before going to the next Text node
String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
// Getting the value
String nextText = xpp.nextText();
// We are testing if nextText equals "" since a modification can be "".
try
{
if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
{
modifyRequest.addAttributeValue( Base64.decode( nextText.trim().toCharArray() ) );
}
else
{
modifyRequest.addAttributeValue( nextText.trim() );
}
}
catch ( LdapException le )
{
throw new XmlPullParserException( le.getMessage(), xpp, le );
}
}
catch ( IOException ioe )
{
throw new XmlPullParserException( I18n.err( I18n.ERR_03008, ioe.getMessage() ), xpp, ioe );
}
}
示例4: action
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
SearchResponse searchResponse = ( SearchResponse )
container.getBatchResponse().getCurrentResponse().getDecorated();
SearchResultEntryDsml searchResultEntry = searchResponse.getCurrentSearchResultEntry();
XmlPullParser xpp = container.getParser();
try
{
// We have to catch the type Attribute Value before going to the next Text node
String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
// Getting the value
String nextText = xpp.nextText();
try
{
if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
{
searchResultEntry.addAttributeValue( Base64.decode( nextText.toCharArray() ) );
}
else
{
searchResultEntry.addAttributeValue( nextText );
}
}
catch ( LdapException le )
{
throw new XmlPullParserException( le.getMessage(), xpp, le );
}
}
catch ( IOException ioe )
{
throw new XmlPullParserException( I18n.err( I18n.ERR_03008, ioe.getMessage() ), xpp, ioe );
}
}
示例5: toEntry
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* Convert a BasicAttributes or a AttributesImpl to an Entry
*
* @param attributes the BasicAttributes or AttributesImpl instance to convert
* @param dn The Dn which is needed by the Entry
* @return An instance of a Entry object
*
* @throws LdapException If we get an invalid attribute
*/
public static Entry toEntry( Attributes attributes, Dn dn ) throws LdapException
{
if ( attributes instanceof BasicAttributes )
{
try
{
Entry entry = new DefaultEntry( dn );
for ( NamingEnumeration<? extends javax.naming.directory.Attribute> attrs = attributes.getAll(); attrs
.hasMoreElements(); )
{
javax.naming.directory.Attribute attr = attrs.nextElement();
Attribute entryAttribute = toApiAttribute( attr );
if ( entryAttribute != null )
{
entry.put( entryAttribute );
}
}
return entry;
}
catch ( LdapException ne )
{
throw new LdapInvalidAttributeTypeException( ne.getMessage(), ne );
}
}
else
{
return null;
}
}
示例6: parseLdifFile
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* Parse a ldif file, decoding it using the given charset encoding
*
* @param fileName The ldif file
* @param encoding The charset encoding to use
* @return A list of entries
* @throws LdapLdifException If the parsing fails
*/
public List<LdifEntry> parseLdifFile( String fileName, String encoding ) throws LdapLdifException
{
if ( Strings.isEmpty( fileName ) )
{
LOG.error( I18n.err( I18n.ERR_12064_EMPTY_FILE_NAME ) );
throw new LdapLdifException( I18n.err( I18n.ERR_12064_EMPTY_FILE_NAME ) );
}
File file = new File( fileName );
if ( !file.exists() )
{
LOG.error( I18n.err( I18n.ERR_12066, fileName ) );
throw new LdapLdifException( I18n.err( I18n.ERR_12067, fileName ) );
}
// Open the file and then get a channel from the stream
try ( InputStream is = Files.newInputStream( Paths.get( fileName ) );
BufferedReader bufferReader = new BufferedReader(
new InputStreamReader( is, Charset.forName( encoding ) ) ) )
{
return parseLdif( bufferReader );
}
catch ( FileNotFoundException fnfe )
{
LOG.error( I18n.err( I18n.ERR_12068, fileName ) );
throw new LdapLdifException( I18n.err( I18n.ERR_12067, fileName ), fnfe );
}
catch ( LdapException le )
{
throw new LdapLdifException( le.getMessage(), le );
}
catch ( IOException ioe )
{
throw new LdapLdifException( ioe.getMessage(), ioe );
}
}
示例7: parseLdif
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* A method which parses a ldif string and returns a list of entries.
*
* @param ldif The ldif string
* @return A list of entries, or an empty List
* @throws LdapLdifException If something went wrong
*/
public List<LdifEntry> parseLdif( String ldif ) throws LdapLdifException
{
LOG.debug( "Starts parsing ldif buffer" );
if ( Strings.isEmpty( ldif ) )
{
return new ArrayList<>();
}
try ( BufferedReader bufferReader = new BufferedReader( new StringReader( ldif ) ) )
{
List<LdifEntry> entries = parseLdif( bufferReader );
if ( LOG.isDebugEnabled() )
{
LOG.debug( "Parsed {} entries.", Integer.valueOf( entries.size() ) );
}
return entries;
}
catch ( LdapLdifException ne )
{
LOG.error( I18n.err( I18n.ERR_12069, ne.getLocalizedMessage() ) );
throw new LdapLdifException( I18n.err( I18n.ERR_12070 ), ne );
}
catch ( LdapException le )
{
throw new LdapLdifException( le.getMessage(), le );
}
catch ( IOException ioe )
{
throw new LdapLdifException( I18n.err( I18n.ERR_12024_CANNOT_CLOSE_FILE ), ioe );
}
}
示例8: hasDescendants
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean hasDescendants( String ancestorId ) throws LdapException
{
try
{
String oid = getOidByName( ancestorId );
Set<ObjectClass> descendants = oidToDescendants.get( oid );
return ( descendants != null ) && !descendants.isEmpty();
}
catch ( LdapException ne )
{
throw new LdapNoSuchAttributeException( ne.getMessage(), ne );
}
}
示例9: registerDescendants
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void registerDescendants( ObjectClass objectClass, List<ObjectClass> ancestors )
throws LdapException
{
// add this attribute to descendant list of other attributes in superior chain
if ( ( ancestors == null ) || ancestors.isEmpty() )
{
return;
}
for ( ObjectClass ancestor : ancestors )
{
// Get the ancestor's descendant, if any
Set<ObjectClass> descendants = oidToDescendants.get( ancestor.getOid() );
// Initialize the descendant Set to store the descendants for the attributeType
if ( descendants == null )
{
descendants = new HashSet<>( 1 );
oidToDescendants.put( ancestor.getOid(), descendants );
}
// Add the current ObjectClass as a descendant
descendants.add( objectClass );
try
{
// And recurse until we reach the top of the hierarchy
registerDescendants( objectClass, ancestor.getSuperiors() );
}
catch ( LdapException ne )
{
throw new LdapNoSuchAttributeException( ne.getMessage(), ne );
}
}
}
示例10: unregisterDescendants
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void unregisterDescendants( ObjectClass attributeType, List<ObjectClass> ancestors )
throws LdapException
{
// add this attribute to descendant list of other attributes in superior chain
if ( ( ancestors == null ) || ancestors.isEmpty() )
{
return;
}
for ( ObjectClass ancestor : ancestors )
{
// Get the ancestor's descendant, if any
Set<ObjectClass> descendants = oidToDescendants.get( ancestor.getOid() );
if ( descendants != null )
{
descendants.remove( attributeType );
if ( descendants.isEmpty() )
{
oidToDescendants.remove( ancestor.getOid() );
}
}
try
{
// And recurse until we reach the top of the hierarchy
unregisterDescendants( attributeType, ancestor.getSuperiors() );
}
catch ( LdapException ne )
{
throw new LdapNoSuchAttributeException( ne.getMessage(), ne );
}
}
}
示例11: getOidByName
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String getOidByName( String name ) throws LdapException
{
try
{
return immutableAttributeTypeRegistry.getOidByName( name );
}
catch ( LdapException le )
{
throw new LdapNoSuchAttributeException( le.getMessage(), le );
}
}
示例12: hasDescendants
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean hasDescendants( String ancestorId ) throws LdapException
{
try
{
String oid = getOidByName( ancestorId );
Set<AttributeType> descendants = oidToDescendantSet.get( oid );
return ( descendants != null ) && !descendants.isEmpty();
}
catch ( LdapException ne )
{
throw new LdapNoSuchAttributeException( ne.getMessage(), ne );
}
}
示例13: lookup
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AttributeType lookup( String oid ) throws LdapException
{
try
{
return super.lookup( oid );
}
catch ( LdapException ne )
{
throw new LdapNoSuchAttributeException( ne.getMessage(), ne );
}
}
示例14: parse
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* Parses a search filter from it's string representation to an expression node object,
* using the provided SchemaManager
*
* @param schemaManager The SchemaManager to use
* @param filter the search filter in it's string representation
* @param relaxed <code>true</code> to parse the filter in relaxed mode
* @return the expression node object
* @throws ParseException If the filter is invalid
*/
public static ExprNode parse( SchemaManager schemaManager, String filter, boolean relaxed ) throws ParseException
{
if ( Strings.isEmpty( filter ) )
{
throw new ParseException( I18n.err( I18n.ERR_04158 ), 0 );
}
/** Convert the filter to an array of bytes, as this is what we expect */
byte[] filterBytes = Strings.getBytesUtf8( filter );
Position pos = new Position();
pos.start = 0;
pos.end = 0;
pos.length = filterBytes.length;
try
{
ExprNode node = parseFilterInternal( schemaManager, filterBytes, pos, relaxed );
if ( node == UndefinedNode.UNDEFINED_NODE )
{
return null;
}
else
{
return node;
}
}
catch ( LdapException le )
{
throw new ParseException( le.getMessage(), pos.start );
}
}
示例15: DefaultSchemaManager
import org.apache.directory.api.ldap.model.exception.LdapException; //导入方法依赖的package包/类
/**
* Creates a new instance of DefaultSchemaManager with the default schema schemaLoader
*/
public DefaultSchemaManager()
{
// Default to the the root (one schemaManager for all the entries
namingContext = Dn.ROOT_DSE;
errors = new ArrayList<>();
registries = new Registries();
factory = new SchemaEntityFactory();
isRelaxed = STRICT;
try
{
SchemaLoader schemaLoader = new JarLdifSchemaLoader();
for ( Schema schema : schemaLoader.getAllSchemas() )
{
schemaMap.put( schema.getSchemaName(), schema );
}
loadAllEnabled();
}
catch ( LdapException le )
{
LOG.error( "SchemaManager can't be loaded : {}", le.getMessage() );
throw new RuntimeException( le.getMessage() );
}
catch ( IOException ioe )
{
LOG.error( "SchemaManager can't be loaded : {}", ioe.getMessage() );
throw new RuntimeException( ioe.getMessage() );
}
}