|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.provision.ThreadContext
A base class that provides context for one or more ProvisioningThread threads used to perform parallel resource operations. There are two subclasses, FetchContext used to fetch accounts, and ProvisionContext used to modify accounts.
Field Summary | |
static java.lang.String |
code_id
|
protected static Trace |
trace
|
Constructor Summary | |
ThreadContext(Provisioner p,
ProvisioningOptions options)
|
Method Summary | |
static WSUser |
buildResourceUser(WSUser master,
ResourceInfo info,
java.util.Map changes)
Build a filtered WSUser object for this resource op. |
static boolean |
buildResourceUser(WSUser master,
ResourceOp op,
ProvisioningOptions options)
Build a filtered WSUser object for this resource op. |
void |
checkAdapters()
Walk over the ops list resolving references to ResourceAdapters that handle the requests. |
void |
generateIdentities(java.util.List ops,
boolean tolerateFailure)
Go through the ResourceOps looking for accounts that do not yet have identities and try to create them. |
java.lang.String |
getAdministratorName()
|
abstract int |
getDesiredThreads()
Get what this context believes to be the ideal number of threads necessary to process the request. |
java.lang.String |
getExplicitIdentity(ResourceInfo info)
Given a ResourceInfo that either does not have an accountId check to see if the identity was passed down in the attributes map. |
abstract ResourceOp |
getNextOp()
Return the next operation that a thread can perform. |
ResourceOp |
getOp(ResourceInfo info)
Get the op that matches the specified ResourceInfo. |
abstract java.util.List |
getOps()
Return the list of ResourceOps. |
ProvisioningOptions |
getOptions()
|
Provisioner |
getProvisioner()
|
WSUser |
getUser()
|
java.lang.String |
getUserName()
|
abstract boolean |
isFinished(int thread)
Returns true once all operations have been performed. |
void |
launchThreads()
Launch threads to handle the operations in the context. |
void |
normalizeResourceInfos()
Normalize the ResourceInfo list to ensure that there is one for every assigned resource. |
void |
overrideResourceAttributes()
Walk over the ops list looking for Resources that need to have overridden resource attributes. |
abstract void |
prepare()
Do any last minute preparations before launching threads. |
static void |
println(java.lang.String msg)
|
abstract void |
processOp(ResourceOp op,
int thread)
Called by each thread after it has obtained an operation to perform. |
void |
setTrace(boolean t)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
protected static final Trace trace
Constructor Detail |
public ThreadContext(Provisioner p, ProvisioningOptions options)
Method Detail |
public void setTrace(boolean t)
public static void println(java.lang.String msg)
public abstract java.util.List getOps()
public abstract void prepare() throws WavesetException
WavesetException
public abstract int getDesiredThreads()
public abstract boolean isFinished(int thread)
The thread number is passed here so we can selectively decide to let threads expire even though we're not really done with processing. This might happen if we launched 10 threads to do a bunch of random things in parallel, but we're now down to 2 that have to iterate through 2 ordered lists. Since the other threads have nothing to do, we can let them die.
public abstract ResourceOp getNextOp()
Note that the implementation of this method must be synchronized.
public abstract void processOp(ResourceOp op, int thread) throws WavesetException
WavesetException
public ProvisioningOptions getOptions()
public WSUser getUser()
public java.lang.String getAdministratorName()
public java.lang.String getUserName()
public Provisioner getProvisioner()
public void launchThreads() throws WavesetException
WavesetException
public void normalizeResourceInfos() throws WavesetException
WavesetException
public java.lang.String getExplicitIdentity(ResourceInfo info)
public void generateIdentities(java.util.List ops, boolean tolerateFailure) throws WavesetException
WavesetException
public void overrideResourceAttributes() throws WavesetException
WavesetException
public void checkAdapters() throws WavesetException
WavesetException
public static boolean buildResourceUser(WSUser master, ResourceOp op, ProvisioningOptions options) throws WavesetException
We expect the ResourceInfo to have a non-null map of modified attributes, put there by the user view handler.
We also detect changes to resource attribute overrides stored in the ResourceInfo. When this happens, a custom Resource object will have been created and stored in the op. Differences are indicated by a special resource attribute. NOTE WELL: accountId sucks We have grown with a number of assumptions about the attribute accountId that makes supporting multiple accounts on a resource difficult. accountId often appears in the identity template, and less often in the schema map. When it is in the id template but not the map, we need to be able to pass an accountId down that is not necessarily the same as the Lighthouse accountId. This is ok except that there is code that assumes they are the same: auditing, self-edit detection, possibly recon. Further, once an account has been created, change detection won't send down a change for accountId since it is rarely changed. But code expects there to be a non-null accountId in the WSUser so we have to set it to the Lighthouse accountId. Then the problem is that since accountId appears in the WSUser, it may be treated as a change by the resources if it is in the schema map. This effectively wipes out the accountId on the next edit. We've decided it is reasonable to keep accountId out of the schema map and not treat it as an editable attribute, but that has other consequences that must be carefully considered. Until then, we require that the original accountId attribute be sent down in the ResourceInfo object. I decided to keep it out of the change map to avoid it showing up as a diff in the account tables. Made static for IDMX
WavesetException
public static WSUser buildResourceUser(WSUser master, ResourceInfo info, java.util.Map changes) throws WavesetException
We expect the ResourceInfo to have a non-null map of modified attributes, put there by the user view handler.
We also detect changes to resource attribute overrides stored in the ResourceInfo. When this happens, a custom Resource object will have been created and stored in the op. Differences are indicated by a special resource attribute. NOTE WELL: accountId sucks We have grown with a number of assumptions about the attribute accountId that makes supporting multiple accounts on a resource difficult. accountId often appears in the identity template, and less often in the schema map. When it is in the id template but not the map, we need to be able to pass an accountId down that is not necessarily the same as the Lighthouse accountId. This is ok except that there is code that assumes they are the same: auditing, self-edit detection, possibly recon. Further, once an account has been created, change detection won't send down a change for accountId since it is rarely changed. But code expects there to be a non-null accountId in the WSUser so we have to set it to the Lighthouse accountId. Then the problem is that since accountId appears in the WSUser, it may be treated as a change by the resources if it is in the schema map. This effectively wipes out the accountId on the next edit. We've decided it is reasonable to keep accountId out of the schema map and not treat it as an editable attribute, but that has other consequences that must be carefully considered. Until then, we require that the original accountId attribute be sent down in the ResourceInfo object. I decided to keep it out of the change map to avoid it showing up as a diff in the account tables.
WavesetException
public ResourceOp getOp(ResourceInfo info)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |