Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[higgins-dev] IdAS: The contract CP's must follow for incoming objects

We have a number of IdAS methods that take as input some interface or another.  For example, IContext.addSubject takes a set of IAttribute instances, IContext.getSubjects takes an IFilter instance.
 
So, how does an IdAS consumer get an object to pass to one of these methods?  To date, we've said that they have to get them from the context provider -- this is why we have IContext.build* methods (IContext.buildAttribute for example will build an IAttribute instance which could then be passed to IContext.addSubject.  On thee other hand, there are Basic implementations (like BasicAttribute) that are easy to instantiate without the help of a context instance.
 
We need to decide whether the IdAS consumer must call the build* methods to get interface instances to be used as arguments to subsequent method calls, or whether the contract is simply the interface -- in other words, the CPs must allow any object to be passed as long as the object implements the prescribed interface.
 
Arguments for making the IdAS consumer to always call build methods to create interface instances:
- CP controls all instances.  This allows the CP to always deal with its own well-known concrete classes.  It may be able to do things that increase performance and scalability.  It also allows the CP to cause a failure earlier when the consumer is requesting something that doesn't fit the context's model (schema).
 
Arguments for making the CP allow any instance of an interface to be passed:
- Consumers can new an org.eclipse.higgins.idas.impl.Basic* class without having an IContext instance and later use it (and re-use it).
- Seems like a more natural programming model.
- Solves a chicken and egg problem which is this:
 
Some org.eclipse.higgins.idas.impl.AuthN* classes work by populating themselves with properties (like name and password).  Today, these are simply instantiating BasicProperty objects which hold BasicValueString data.  This is wrong according to the existing model.  To keep with the existing model, I must change these such that the constructors require an IContext instance so I can call IContext.build* to create these properties. 
 
That change means two things to the consumer: 1) The consumer must already have an IContext instance.  2) The consumer cannot re-use an AuthN*Materials across contexts.  It means something worse to the CP.  Some CP's will require that open is called prior to allowing build* methods to be called.  If we need to get an AuthNNamePasswordMaterials to open the context, but we can't until the context is open, then we're stuck.
 
So, do people think a CP should allow any instance of a prescribed interface to be passed as an argument, or do we want to maintain that only instances produced by that CP's build methods may be passed?
 
Jim

Back to the top