/** * Process the ByteCode attribute */ private Attribute getByteCode( LoadableSchemaObject description, String objectType ) { String byteCodeString = description.getBytecode(); if ( byteCodeString == null ) { String msg = I18n.err( I18n.ERR_10028, objectType, MetaSchemaConstants.M_BYTECODE_AT ); LOG.warn( msg ); throw new IllegalArgumentException( msg ); } byte[] bytecode = Base64.decode( byteCodeString.toCharArray() ); Attribute attr = new DefaultAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode ); return attr; }
/** * Return the extensions formated as Ldif lines * * @param id The attributeId : can be m-objectClassExtension or * m-attributeTypeExtension * @return The extensions formated as ldif lines * @throws org.apache.directory.shared.ldap.model.exception.LdapException If the conversion goes wrong */ protected String extensionsToLdif( String id ) throws LdapException { StringBuilder sb = new StringBuilder(); Entry entry = new DefaultEntry(); Attribute attribute = new DefaultAttribute( id ); for ( String extension : extensions.keySet() ) { attribute.add( extension ); } sb.append( LdifUtils.convertAttributesToLdif( entry ) ); return sb.toString(); }
/** * @return the Names as Ldif lines * @throws org.apache.directory.shared.ldap.model.exception.LdapException If the conversion goes wrong */ private String nameToLdif() throws LdapException { if ( names.size() == 0 ) { return ""; } else { Entry entry = new DefaultEntry(); Attribute attribute = new DefaultAttribute( "m-name" ); for ( String name : names ) { attribute.add( name ); } entry.put( attribute ); return LdifUtils.convertAttributesToLdif( entry ); } }
/** * @return The description as a ldif line * @throws org.apache.directory.shared.ldap.model.exception.LdapException If the conversion goes wrong */ private String descToLdif() throws LdapException { if ( Strings.isEmpty( description ) ) { return ""; } else { Entry entry = new DefaultEntry(); Attribute attribute = new DefaultAttribute( "m-description", description ); entry.put( attribute ); return LdifUtils.convertAttributesToLdif( entry ); } }
attributeValue = DnUtils.getRdnValue( attributeTypeAndValue ); attributeSet.add( new DefaultAttribute( attributeType, attributeValue ) ); log.debug( "An attributeTypeAndValue from the set: " + attributeType + "=" + attributeValue);