Wouldn't it be nice if there was word from RIM, following all these complaints and problems ...

... you know a word like 'sorry'.

Ok, first i agree with what you are saying (all), i'm just not happy about it. Here's an example.
I've got a class that provides an LDap DirContext, through a "get" type method. Sometimes I'd like this class to maintain a persistent connection to the ldap server (through this DirContext) other times I wan't the connection to be recreated each time. Either way, the user uses the same interface to get this objects so:
interface LDAPProvider
DirContext getDirectoryContext();
When it's in persistent mode, it just returns a member variable, when not it creates a new one.
Well, I certainly don't want the user calling close on this returned object, as it may be that i'm maintaining a persistent connection. I also do want them to call close in the case that it is not a persistent connection.
So, i do
interface MyLDAPProvider
DirContext getDirectoryContext();
void releaseDirectoryContext( DirContext ctx );
and hope the user calls my method and not close... Which is just plain ugly and dangerous.
Alternately i create a DirContext implementing object (luckily i can cause this is an interface, what to do if this is a class that's final) and use aggregation, and implement all the DirContext methods, yuck, just to get the one close behavior. Also oogley
I really just want to do, (get out the mallots)
ctx.extendInterface( new DirContext()
private MyLDAPProvider lp = getTheAboveProviderSomeHow();
public void close()
if (!lp.isPersistent())
super.close();
}

Similar Messages

Maybe you are looking for

  • Material is not activated error in MM

    Hi, We'vs installed SAP IDES in our Landscape recently. Whenever I tried to create a new material using MM01 transaction code, it creates. But then when I tried to view the same in MM03 or MM02 it throws an error of the following, The material XXXXX

  • How to Search word in PDF?

    Hi, I am developing windows application, which will accept PDF file path as input. Users are allowed to  search for the specific word in the PDF and replace with new word. I don't have any idea on this. So can any one help me to start with. how can i

  • Organizer issue with PSE10

    I have been using PSE 10 with no problems. Today I bought several new digital elements (different places) and the import fails on each one saying the file type is not supported or they are already in the catalog. These are new so they are not in the

  • GUI graphical objects properties

    I want to develop a GUI for an RF switching network where the user see a diagram of the actual network. I did something similar before but I was using a pdf of an autocad drawing of the network where I placed custom controls to represent the switches

  • Answer: XSQL-004: Could not acquire a database connection named: gov

    I think is this the CLASSPATH issue. Please take look if there is another XSQLConfig.xml in your classpath.