LDAPFilterMatcher() { parser = new FilterParserImpl(); }
public void addNamingListener( Name name, String filterStr, SearchControls searchControls, NamingListener namingListener ) throws NamingException { ExprNode filter; try { filter = filterParser.parse( filterStr ); } catch ( Exception e ) { NamingException e2 = new NamingException( "could not parse filter: " + filterStr ); e2.setRootCause( e ); throw e2; } ( ( PartitionNexusProxy ) getNexusProxy() ).addNamingListener( this, buildTarget( name ), filter, searchControls, namingListener ); getListeners().add( namingListener ); }
/** * @see javax.naming.directory.DirContext#search(javax.naming.Name, * java.lang.String, javax.naming.directory.SearchControls) */ public NamingEnumeration search( Name name, String filter, SearchControls cons ) throws NamingException { ExprNode filterNode; LdapDN target = buildTarget( name ); try { filterNode = filterParser.parse( filter ); } catch ( ParseException pe ) { InvalidSearchFilterException isfe = new InvalidSearchFilterException( "Encountered parse exception while parsing the filter: '" + filter + "'" ); isfe.setRootCause( pe ); throw isfe; } catch ( IOException ioe ) { NamingException ne = new NamingException( "Parser failed with IO exception on filter: '" + filter + "'" ); ne.setRootCause( ioe ); throw ne; } return getNexusProxy().search( target, getEnvironment(), filterNode, cons ); }
FilterParser parser = new FilterParserImpl(); ExprNode root = null;
public boolean doAnnotate( String filter ) throws Exception { FilterParser parser = new FilterParserImpl(); ExprNode root = null; try { root = parser.parse( filter ); } catch ( Exception e ) { JTextArea text = new JTextArea(); String msg = e.getMessage(); if ( msg.length() > 1024 ) { msg = msg.substring( 0, 1024 ) + "\n. . . truncated . . ."; } text.setText( msg ); text.setEnabled( false ); JOptionPane.showMessageDialog( null, text, "Syntax Error", JOptionPane.ERROR_MESSAGE ); return false; } AnnotatedFilterTreeDialog treeDialog = new AnnotatedFilterTreeDialog( PartitionFrame.this, false ); treeDialog.setFilter( filter ); eng.getOptimizer().annotate( root ); TreeNode astRoot = new ASTNode( null, root ); TreeModel model = new DefaultTreeModel( astRoot, true ); treeDialog.setModel( model ); treeDialog.setVisible( true ); return true; }