On Tue, Mar 30, 2010 at 2:03 AM, Matt Doran <[email protected]> wrote:
> Hammond, Steven wrote:
>
>> This is how I did it back in 1.5.3 (which I am still on until we get
>> budget to move to the present)
>>
>> A warning, at first I just had getAddress, but this caused a reverseDNS
>> lookup and noticeable slowness.
>>
>> In
>> core\src\main\java\org\apache\directory\server\core\jndi\ServerContext.java
>> I added client_host and client_port:
>>
>>
>> protected NamingEnumeration<ServerSearchResult> doSearchOperation(
>> LdapDN dn, AliasDerefMode aliasDerefMode,
>> ExprNode filter, SearchControls searchControls, InetSocketAddress
>> clientAddress,
>> DirContext dirCtx) throws NamingException
>> {
>> // setup the op context and populate with request controls
>> SearchOperationContext opCtx = new SearchOperationContext(
>> registries, dn, aliasDerefMode, filter,
>> searchControls );
>>
>> opCtx.put( "client_host",
>> clientAddress.getAddress().getHostAddress() );
>> opCtx.put( "client_port", String.valueOf( clientAddress.getPort() )
>> );
>> opCtx.put( "client_JNDI_CXN", dirCtx );
>> opCtx.addRequestControls( requestControls );
>>
>> // execute search operation
>> NamingEnumeration<ServerSearchResult> results = nexusProxy.search(
>> opCtx );
>>
>> // clear the request controls and set the response controls
>> requestControls = EMPTY_CONTROLS;
>> responseControls = opCtx.getResponseControls();
>>
>> return results;
>> }
>>
>>
>>
>> Then in the my partition inside public
>> NamingEnumeration<ServerSearchResult> search(SearchOperationContext arg0) I
>> have:
>>
>> ob = opContext.get("client_host");
>> if (ob != null)
>> {
>> String hostname = (String) ob;
>> ob = opContext.get("client_port");
>> String clientPort = (String) ob;
>>
>>
>>
>
> Thanks for letting me know your approach. It looks like thngs have
> changed a lot since then, the SearchOperationContext doesn't have a put
> method. It seems that with Apache DS a minor point release means a big
> internal code change. :)
>
>
Hey Matt, take a look at this policy we have about how we change things with
releases:
http://cwiki.apache.org/DIRxPMGT/version-numbering-scheme.html
Basically with 1.5.x which is considered a feature release branch we have
the luxury to introduce significant changes. Yeah I know that this is way
better than using the alternative which is 1.0.x. Also we should have done
a 2.0 a long time ago. Plus this scheme is a bit quirky and not so hmmm
intuitive. Hopefully we can have a better scheme some day and we do plan on
this once we get 2.0 out the door.
Regards,
Alex
--
Alex Karasulu
My Blog :: http://www.jroller.com/akarasulu/
Apache Directory Server :: http://directory.apache.org
Apache MINA :: http://mina.apache.org
To set up a meeting with me: http://tungle.me/AlexKarasulu