Refine search
@Override public boolean apply(@Nullable CubingJob cubeJob) { if (cubeJob == null) { return false; } if (Strings.isEmpty(jobName)) { return true; } if (nameExactMatch) { return cubeJob.getName().equalsIgnoreCase(jobName); } else { return cubeJob.getName().toLowerCase(Locale.ROOT) .contains(jobName.toLowerCase(Locale.ROOT)); } } })));
if ( ( schemaObject == null ) || Strings.isEmpty( schemaObject.trim() ) ) throw new ParseException( I18n.err( I18n.ERR_13716_NULL_OR_EMPTY_STRING_SCHEMA_OBJECT ), 0 ); throw new ParseException( e.getMessage(), 0 );
/** * Thread safe method parses an OpenLDAP schemaObject element/object. * * @param schemaObject the String image of a complete schema object * @return The list of parsed schema elements * @throws java.io.IOException If the schema file can't be processed * @throws java.text.ParseException If we weren't able to parse the schema */ public synchronized List<SchemaElement> parse( String schemaObject ) throws IOException, ParseException { if ( ( schemaObject == null ) || ( schemaObject.trim().equals( Strings.EMPTY_STRING ) ) ) { throw new ParseException( I18n.err( I18n.ERR_15002_EMPTY_OR_NULL_SCHEMA_OBJECT ), 0 ); } schemaIn = new ByteArrayInputStream( Strings.getBytesUtf8( schemaObject ) ); if ( producerThread == null ) { producerThread = new Thread( new DataProducer() ); } producerThread.start(); return invokeParser( schemaObject ); }
public Entry add( String upId, Value... values ) throws LdapException if ( Strings.isEmpty( upId ) ) String message = I18n.err( I18n.ERR_13204_NULL_ATTRIBUTE_ID ); LOG.error( message ); throw new IllegalArgumentException( message ); add( upId, schemaManager.lookupAttributeTypeRegistry( upId ), values ); attribute.add( values ); attribute.setUpId( upId );
sb.append( " Entry : '" ).append( name.toString() ).append( "'\n" ); sb.append( " Attribute description : '" ).append( attrId ).append( "'\n" ); sb.append( " Attribute value : '" ); if ( attrVal.isHumanReadable() ) sb.append( attrVal.getValue() ); byte[] binVal = attrVal.getBytes(); sb.append( Strings.utf8ToString( binVal ) ).append( '/' ).append( Strings.dumpBytes( binVal ) ) .append( "'\n" );
public void action( CertGenerationContainer container ) throws DecoderException { BerValue value = container.getCurrentTLV().getValue(); String issuerDN = Strings.utf8ToString( value.getData() ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_08207_ISSUER_DN, issuerDN ) ); } if ( ( issuerDN != null ) && ( issuerDN.trim().length() > 0 ) ) { if ( !Dn.isValid( issuerDN ) ) { String msg = I18n.err( I18n.ERR_08203_INVALID_ISSUER_DN, issuerDN ); LOG.error( msg ); throw new DecoderException( msg ); } container.getCertGenerationRequest().setIssuerDN( issuerDN ); } } } );
/** * @see Object#toString() */ public String toString() { return "CompareContext for Dn '" + getDn().getName() + "'" + ( ( oid != null ) ? ", oid : <" + oid + ">" : "" ) + ( ( value != null ) ? ", value :'" + ( ( value.isHumanReadable() ) ? value.getValue() : ( ( !value.isHumanReadable() ) ? Strings.dumpBytes( value.getBytes() ) : "unknown value type" ) ) + "'" : "" ); } }
/** * Sets the User Provided ID as a byte[] * * @param upId The User Provided ID * @param attributeType The asscoiated AttributeType */ public void setUpId( byte[] upId, AttributeType attributeType ) { byte[] trimmed = Strings.trim( upId ); if ( Strings.isEmpty( trimmed ) && ( attributeType == null ) ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_13235_NULL_ID_WITH_NULL_AT_NOT_ALLOWED ) ); } String newId = Strings.toLowerCase( trimmed ); setUpIdInternal( Strings.utf8ToString( upId ), newId, attributeType ); }
/** * Returns the attributeType from an Attribute ID. * * @param upId The ID we are looking for * @return The found attributeType * @throws LdapException If the lookup failed */ protected AttributeType getAttributeType( String upId ) throws LdapException { if ( Strings.isEmpty( Strings.trim( upId ) ) ) { String message = I18n.err( I18n.ERR_13204_NULL_ATTRIBUTE_ID ); LOG.error( message ); throw new IllegalArgumentException( message ); } return schemaManager.lookupAttributeTypeRegistry( upId ); }
/** * {@inheritDoc} */ @Override public BindFuture bindAsync( Dn name, String credentials ) throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04102_BIND_REQUEST, name ) ); } // The password must not be empty or null if ( Strings.isEmpty( credentials ) && ( !Dn.EMPTY_DN.equals( name ) ) ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } throw new LdapAuthenticationException( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } // Create the BindRequest BindRequest bindRequest = createBindRequest( name, Strings.getBytesUtf8( credentials ) ); return bindAsync( bindRequest ); }
/** * Compute the DelRequest length * <br> * DelRequest : * <pre> * 0x4A L1 entry * * L1 = Length(entry) * Length(DelRequest) = Length(0x4A) + Length(L1) + L1 * </pre> */ @Override public int computeLength() { dnBytes = Strings.getBytesUtf8( getName().getName() ); int dnLength = dnBytes.length; // The entry return 1 + TLV.getNbBytes( dnLength ) + dnLength; }
/** * {@inheritDoc} */ @Override public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException { if ( Strings.isEmpty( value ) ) { return value; } // if value is a numeric id then return it as is if ( checker.isValidSyntax( value ) ) { return value; } // if it is a name we need to do a lookup String oid = schemaManager.getRegistries().getOid( value ); if ( oid != null ) { return oid; } // if all else fails throw new LdapOtherException( I18n.err( I18n.ERR_13725_CANNOT_HANDLE_NAME_AND_OPTIONAL_UID_NORM, value ) ); }
/** * Try to authenticate the usr against the underlying LDAP server. */ private CoreSession authenticate( String user, String password ) throws InvalidNameException, Exception { BindOperationContext bindContext = new BindOperationContext( getLdapSession().getCoreSession() ); bindContext.setDn( new Dn( user ) ); bindContext.setCredentials( Strings.getBytesUtf8( password ) ); getAdminSession().getDirectoryService().getOperationManager().bind( bindContext ); return bindContext.getSession(); }
/** * @see Object#toString() */ public String toString() { return "BindContext for Dn '" + getDn().getName() + "', credentials <" + ( credentials != null ? Strings.dumpBytes( credentials ) : "" ) + ">" + ( saslMechanism != null ? ", saslMechanism : <" + saslMechanism + ">" : "" ) + ( saslAuthId != null ? ", saslAuthId <" + saslAuthId + ">" : "" ); }
/** * {@inheritDoc} */ @Override public boolean contains( String upId, byte[]... values ) { if ( Strings.isEmpty( upId ) ) { return false; } String id = getId( upId ); if ( schemaManager != null ) { try { return contains( schemaManager.lookupAttributeTypeRegistry( id ), values ); } catch ( LdapException le ) { return false; } } Attribute attribute = attributes.get( id ); if ( attribute == null ) { return false; } return attribute.contains( values ); }
public void action( AdDirSyncContainer container ) { BerValue value = container.getCurrentTLV().getValue(); byte[] cookie = value.getData(); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) ); } container.getAdDirSyncControl().setCookie( cookie ); container.setGrammarEndAllowed( true ); } } );
/** * {@inheritDoc} */ @Override public void dumpIndex( PartitionTxn partitionTxn, OutputStream stream, String name ) throws IOException { stream.write( Strings.getBytesUtf8( "Nothing to dump for index " + name ) ); }
/** * {@inheritDoc} */ @Override public String getProcedureSpecification() { return Strings.utf8ToString( procedure ); }
@Override public void action( SortRequestContainer container ) throws DecoderException { BerValue value = container.getCurrentTLV().getValue(); String matchingRuleOid = Strings.utf8ToString( value.getData() ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_05309_MATCHING_RULE_OID, matchingRuleOid ) ); } container.getCurrentKey().setMatchingRuleId( matchingRuleOid ); container.setGrammarEndAllowed( true ); }
/** * Creates a Value with an initial user provided String value. * * @param upValue the value to wrap. It can be null */ public Value( String upValue ) { this.upValue = upValue; // We can't normalize the value, we store it as is normValue = upValue; if ( upValue != null ) { bytes = Strings.getBytesUtf8( upValue ); } hashCode(); }