本文整理汇总了Java中org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException类的典型用法代码示例。如果您正苦于以下问题:Java LdapInvalidAttributeValueException类的具体用法?Java LdapInvalidAttributeValueException怎么用?Java LdapInvalidAttributeValueException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LdapInvalidAttributeValueException类属于org.apache.directory.api.ldap.model.exception包,在下文中一共展示了LdapInvalidAttributeValueException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: DefaultAttribute
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Create a new instance of a schema aware Attribute, without value.
*
* @param upId the ID for the added attributeType
* @param attributeType the added AttributeType
*/
public DefaultAttribute( String upId, AttributeType attributeType )
{
if ( attributeType == null )
{
String message = I18n.err( I18n.ERR_04460_ATTRIBUTE_TYPE_NULL_NOT_ALLOWED );
LOG.error( message );
throw new IllegalArgumentException( message );
}
try
{
apply( attributeType );
}
catch ( LdapInvalidAttributeValueException liave )
{
// Do nothing, it can't happen, there is no value
}
setUpId( upId, attributeType );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:DefaultAttribute.java
示例2: createStringValue
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
private Value createStringValue( AttributeType attributeType, String value )
{
Value newValue;
if ( attributeType != null )
{
try
{
newValue = new Value( attributeType, value );
}
catch ( LdapInvalidAttributeValueException iae )
{
return null;
}
}
else
{
newValue = new Value( value );
}
return newValue;
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:23,代码来源:DefaultAttribute.java
示例3: createBinaryValue
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
private Value createBinaryValue( AttributeType attributeType, byte[] value )
throws LdapInvalidAttributeValueException
{
Value binaryValue;
if ( attributeType != null )
{
binaryValue = new Value( attributeType, value );
}
else
{
binaryValue = new Value( value );
}
return binaryValue;
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:17,代码来源:DefaultAttribute.java
示例4: isValid
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Uses the syntaxChecker associated with the attributeType to check if the
* value is valid.
*
* @param syntaxChecker the SyntaxChecker to use to validate the value
* @return <code>true</code> if the value is valid
* @exception LdapInvalidAttributeValueException if the value cannot be validated
*/
public final boolean isValid( SyntaxChecker syntaxChecker ) throws LdapInvalidAttributeValueException
{
if ( syntaxChecker == null )
{
String message = I18n.err( I18n.ERR_04139_NULL_SYNTAX_CHECKER, toString() );
LOG.error( message );
throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, message );
}
// No attributeType, or it's in relaxed mode
if ( isHR )
{
// We need to prepare the String in this case
return syntaxChecker.isValidSyntax( getValue() );
}
else
{
return syntaxChecker.isValidSyntax( bytes );
}
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:29,代码来源:Value.java
示例5: anonymize
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Anonymize an attribute using pure random values (either chars of bytes, depending on the Attribute type)
*/
@Override
public Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute )
{
Attribute result = new DefaultAttribute( attribute.getAttributeType() );
for ( Value value : attribute )
{
byte[] bytesValue = value.getBytes();
byte[] newValue = computeNewValue( bytesValue );
try
{
result.add( newValue );
Value anonValue = new Value( attribute.getAttributeType(), newValue );
valueMap.put( ( Value ) value, anonValue );
valueSet.add( anonValue );
}
catch ( LdapInvalidAttributeValueException e )
{
throw new RuntimeException( "Error while anonymizing the value" + value );
}
}
return result;
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:29,代码来源:BinaryAnonymizer.java
示例6: testGetNormalizedValue
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Test the getNormValue method
*/
@Test
public void testGetNormalizedValue() throws LdapInvalidAttributeValueException
{
AttributeType attribute = EntryUtils.getIA5StringAttributeType();
Value sv = new Value( attribute, (String)null );
assertTrue( sv.isSchemaAware() );
assertNull( sv.getValue() );
assertTrue( sv.isSchemaAware() );
sv = new Value( attribute, "" );
assertTrue( sv.isSchemaAware() );
assertEquals( 0, sv.compareTo( " " ) );
assertTrue( sv.isSchemaAware() );
sv = new Value( attribute, "TEST" );
assertTrue( sv.isSchemaAware() );
assertEquals( 0, sv.compareTo( " test " ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:StringValueAttributeTypeTest.java
示例7: testIsValid
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Test the isValid method
*
* The SyntaxChecker does not accept values longer than 5 chars.
*/
@Test
public void testIsValid() throws LdapInvalidAttributeValueException
{
AttributeType attribute = EntryUtils.getIA5StringAttributeType();
new Value( attribute, (String)null );
new Value( attribute, "" );
new Value( attribute, "TEST" );
try
{
new Value( attribute, "testlong" );
fail();
}
catch ( LdapInvalidAttributeValueException liave )
{
assertTrue( true );
}
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:StringValueAttributeTypeTest.java
示例8: testHashCode
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Tests to make sure the hashCode method is working properly.
* @throws Exception on errors
*/
@Test
public void testHashCode() throws LdapInvalidAttributeValueException
{
AttributeType at1 = EntryUtils.getCaseIgnoringAttributeNoNumbersType();
Value v0 = new Value( at1, "Alex" );
Value v1 = new Value( at1, "ALEX" );
Value v2 = new Value( at1, "alex" );
assertEquals( v0.hashCode(), v1.hashCode() );
assertEquals( v0.hashCode(), v2.hashCode() );
assertEquals( v1.hashCode(), v2.hashCode() );
assertEquals( v0, v1 );
assertEquals( v0, v2 );
assertEquals( v1, v2 );
Value v3 = new Value( at1, "Timber" );
assertNotSame( v0.hashCode(), v3.hashCode() );
Value v4 = new Value( at, "Alex" );
assertNotSame( v0.hashCode(), v4.hashCode() );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:29,代码来源:StringValueAttributeTypeTest.java
示例9: testCompareTo
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Test the compareTo method
*/
@Test
public void testCompareTo() throws LdapInvalidAttributeValueException
{
AttributeType at1 = EntryUtils.getCaseIgnoringAttributeNoNumbersType();
Value v0 = new Value( at1, "Alex" );
Value v1 = new Value( at1, "ALEX" );
assertEquals( 0, v0.compareTo( v1 ) );
assertEquals( 0, v1.compareTo( v0 ) );
Value v2 = new Value( at1, (String)null );
assertEquals( 1, v0.compareTo( v2 ) );
assertEquals( -1, v2.compareTo( v0 ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:StringValueAttributeTypeTest.java
示例10: testIsValid
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Test the isValid method
*
* The SyntaxChecker does not accept values longer than 5 chars.
*/
@Test
public void testIsValid() throws LdapInvalidAttributeValueException
{
AttributeType attribute = EntryUtils.getBytesAttributeType();
new Value( attribute, ( byte[] ) null );
new Value( attribute, Strings.EMPTY_BYTES );
new Value( attribute, new byte[]
{ 0x01, 0x02 } );
try
{
new Value( attribute, new byte[]
{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 } );
fail();
}
catch ( LdapInvalidAttributeValueException liave )
{
assertTrue( true );
}
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:BinaryValueAttributeTypeTest.java
示例11: testHashCode
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Tests to make sure the hashCode method is working properly.
* @throws Exception on errors
*/
@Test
public void testHashCode() throws LdapInvalidAttributeValueException
{
AttributeType attribute = EntryUtils.getBytesAttributeType();
Value v0 = new Value( attribute, new byte[]
{ 0x01, 0x02 } );
Value v1 = new Value( attribute, new byte[]
{ ( byte ) 0x81, ( byte ) 0x82 } );
Value v2 = new Value( attribute, new byte[]
{ 0x01, 0x02 } );
assertNotSame( v0.hashCode(), v1.hashCode() );
assertNotSame( v1.hashCode(), v2.hashCode() );
assertEquals( v0.hashCode(), v2.hashCode() );
assertNotSame( v0, v1 );
assertEquals( v0, v2 );
assertNotSame( v1, v2 );
Value v3 = new Value( attribute, new byte[]
{ 0x01, 0x03 } );
assertFalse( v3.equals( v0 ) );
assertFalse( v3.equals( v1 ) );
assertFalse( v3.equals( v2 ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:BinaryValueAttributeTypeTest.java
示例12: testCompareTo
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Test the compareTo method
*/
@Test
public void testCompareTo() throws LdapInvalidAttributeValueException
{
AttributeType at1 = EntryUtils.getBytesAttributeType();
Value v0 = new Value( at1, BYTES1 );
Value v1 = new Value( at1, BYTES1 );
assertEquals( 0, v0.compareTo( v1 ) );
assertEquals( 0, v1.compareTo( v0 ) );
Value v2 = new Value( at1, ( byte[] ) null );
assertEquals( 1, v0.compareTo( v2 ) );
assertEquals( -1, v2.compareTo( v0 ) );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:BinaryValueAttributeTypeTest.java
示例13: assertAttributeNotContains
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
protected void assertAttributeNotContains(Entry entry, String attrName, String expectedValue, MatchingRule<String> matchingRule) throws LdapInvalidAttributeValueException, SchemaException {
String dn = entry.getDn().toString();
Attribute ldapAttribute = entry.get(attrName);
if (ldapAttribute == null) {
return;
} else {
Iterator<Value<?>> iterator = ldapAttribute.iterator();
while (iterator.hasNext()) {
Value<?> value = iterator.next();
if (matchingRule == null) {
if (expectedValue.equals(value.getString())) {
AssertJUnit.fail("Attribute "+attrName+" in "+dn+" contains value " + expectedValue + ", but it should not have it");
}
} else {
if (matchingRule.match(expectedValue, value.getString())) {
AssertJUnit.fail("Attribute "+attrName+" in "+dn+" contains value " + expectedValue + ", but it should not have it");
}
}
}
}
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:22,代码来源:AbstractLdapTest.java
示例14: getDn
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
@Override
public String getDn(Entry entry) {
// distinguishedName attribute provides better DN format (some kind of Microsoft-cannonical form).
// The usual entry DN will be formatted in the same way as it was in the request. Therefore if
// name hint is used with midPoint, the normal DN will be all lowercase. This may break some things,
// e.g. it may interfere with names in older shadows.
// So use distinguishedName attribute if available.
Attribute distinguishedNameAttr = entry.get(AdConstants.ATTRIBUTE_DISTINGUISHED_NAME_NAME);
if (distinguishedNameAttr != null) {
try {
return distinguishedNameAttr.getString();
} catch (LdapInvalidAttributeValueException e) {
LOG.warn("Error getting sting value from {0}, falling back to entry DN: {1}",
distinguishedNameAttr, e.getMessage(), e);
return super.getDn(entry);
}
}
return super.getDn(entry);
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:20,代码来源:AdSchemaTranslator.java
示例15: processEntryBeforeCreate
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
private void processEntryBeforeCreate(Entry entry) {
for(final org.apache.directory.api.ldap.model.entry.Attribute attribute: entry.getAttributes()) {
Value<?> val = attribute.get();
if (val instanceof GuardedStringValue) {
attribute.remove(val);
((GuardedStringValue)val).getGuardedStringValue().access(new GuardedString.Accessor() {
@Override
public void access(char[] clearChars) {
try {
attribute.add(new String(clearChars));
} catch (LdapInvalidAttributeValueException e) {
throw new InvalidAttributeValueException(e.getMessage(), e);
}
}
});
}
}
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:20,代码来源:AbstractLdapConnector.java
示例16: getAttribute
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Method wraps ldap client to return attribute value by name within a given entry and returns as a string.
*
* @param entry contains the target ldap entry.
* @param attributeName name of ldap attribute to retrieve.
* @return value contained in a string variable.
* @throws LdapInvalidAttributeValueException When we weren't able to get the attribute from the entry
*/
protected String getAttribute( Entry entry, String attributeName ) throws LdapInvalidAttributeValueException
{
if ( entry != null )
{
Attribute attr = entry.get( attributeName );
if ( attr != null )
{
return attr.getString();
}
else
{
return null;
}
}
else
{
return null;
}
}
开发者ID:apache,项目名称:directory-fortress-core,代码行数:29,代码来源:LdapDataProvider.java
示例17: loadUserRoles
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Given a collection of RBAC roles, {@link UserRole}, convert to raw data format and load into ldap modification
* set in preparation for ldap modify.
*
* @param list contains List of type {@link UserRole} targeted for updating into ldap.
* @param mods contains ldap modification set containing RBAC role assignments in raw ldap format to be updated.
* @throws LdapInvalidAttributeValueException
*/
private void loadUserRoles( List<UserRole> list, List<Modification> mods )
throws LdapInvalidAttributeValueException
{
Attribute userRoleData = new DefaultAttribute( GlobalIds.USER_ROLE_DATA );
Attribute userRoleAssign = new DefaultAttribute( GlobalIds.USER_ROLE_ASSIGN );
if ( list != null )
{
for ( UserRole userRole : list )
{
userRoleData.add( userRole.getRawData() );
userRoleAssign.add( userRole.getName() );
}
if ( userRoleData.size() != 0 )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, userRoleData ) );
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, userRoleAssign ) );
}
}
}
开发者ID:apache,项目名称:directory-fortress-core,代码行数:30,代码来源:UserDAO.java
示例18: unloadAddress
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
* Given an ldap entry containing organzationalPerson address information, convert to {@link Address}
*
* @param entry contains ldap entry to retrieve admin roles from.
* @return entity of type {@link Address}.
* @throws LdapInvalidAttributeValueException
* @throws org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException in the event of ldap
* client error.
*/
private Address unloadAddress( Entry entry ) throws LdapInvalidAttributeValueException
{
Address addr = new ObjectFactory().createAddress();
List<String> pAddrs = getAttributes( entry, SchemaConstants.POSTAL_ADDRESS_AT );
if ( pAddrs != null )
{
for ( String pAddr : pAddrs )
{
addr.setAddress( pAddr );
}
}
addr.setCity( getAttribute( entry, SchemaConstants.L_AT ) );
addr.setState( getAttribute( entry, SchemaConstants.ST_AT ) );
addr.setPostalCode( getAttribute( entry, SchemaConstants.POSTALCODE_AT ) );
addr.setPostOfficeBox( getAttribute( entry, SchemaConstants.POSTOFFICEBOX_AT ) );
addr.setBuilding( getAttribute( entry, SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT ) );
addr.setDepartmentNumber( getAttribute( entry, DEPARTMENT_NUMBER ) );
addr.setRoomNumber( getAttribute( entry, ROOM_NUMBER ) );
// todo: add support for country attribute
//addr.setCountry(getAttribute(le, GlobalIds.COUNTRY));
return addr;
}
开发者ID:apache,项目名称:directory-fortress-core,代码行数:35,代码来源:UserDAO.java
示例19: unloadLdapEntry
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
/**
*
* @param le
* @param sequence
* @param contextId
* @return
* @throws LdapInvalidAttributeValueException
* @throws LdapException
*/
private Role unloadLdapEntry( Entry le, long sequence, String contextId ) throws LdapInvalidAttributeValueException
{
Role entity = new ObjectFactory().createRole();
entity.setSequenceId( sequence );
entity.setId( getAttribute( le, GlobalIds.FT_IID ) );
entity.setName( getAttribute( le, ROLE_NM ) );
entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
entity.setOccupants( getAttributes( le, SchemaConstants.ROLE_OCCUPANT_AT ) );
//entity.setParents(RoleUtil.getParents(entity.getName().toUpperCase(), contextId));
entity.setChildren( RoleUtil.getInstance().getChildren( entity.getName().toUpperCase(), contextId ) );
entity.setParents( getAttributeSet( le, GlobalIds.PARENT_NODES ) );
unloadTemporal( le, entity );
entity.setDn( le.getDn().getName() );
entity.addProperties( PropUtil.getProperties( getAttributes( le, GlobalIds.PROPS ) ) );
return entity;
}
开发者ID:apache,项目名称:directory-fortress-core,代码行数:26,代码来源:RoleDAO.java
示例20: getModEntityFromLdapEntry
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException; //导入依赖的package包/类
private Mod getModEntityFromLdapEntry( Entry le, long sequence ) throws LdapInvalidAttributeValueException
{
Mod mod = new ObjectFactory().createMod();
mod.setSequenceId( sequence );
mod.setObjectClass( getAttribute( le, OBJECTCLASS ) );
mod.setReqAuthzID( getAttribute( le, REQUAUTHZID ) );
mod.setReqDN( getAttribute( le, REQDN ) );
mod.setReqEnd( getAttribute( le, REQEND ) );
mod.setReqResult( getAttribute( le, REQRESULT ) );
mod.setReqSession( getAttribute( le, REQSESSION ) );
mod.setReqStart( getAttribute( le, REQSTART ) );
mod.setReqType( getAttribute( le, REQTYPE ) );
mod.setReqMod( getAttributes( le, REQMOD ) );
return mod;
}
开发者ID:apache,项目名称:directory-fortress-core,代码行数:17,代码来源:AuditDAO.java
注:本文中的org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论