|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gcube.vremanagement.resourcebroker.impl.services.GHNReservationHandler
public final class GHNReservationHandler
All the reservations of the GHNs to use during a decision making workflow are proxed by this component.
Makes use of persistent singleton resource
(SingletonResourceStorage
) and stores internally
to it a global list of GHNDescriptor
grouped
by scope (GCUBEScope
) and for each PlanBuilderWorkflow
the list of GHNDescriptor
entries owned by it (these lists
are so referred as private since the GHNs registered there
cannot be used by other workflow sessions).
The concurrent access to such shared resources are intermediated by this component that is the only responsible to handle GHN profiles, to retrieve them from the IS service and to properly update and manage them.
In the actual implementation the access to the GHNReservationHandler
is in a singleton pattern. This implies that the access to this class
follows the following schema:
GHNReservationHandler
handler = GHNReservationHandler.getInstance();
handler.getNextGHN(...);
Method Summary | |
---|---|
void |
addGHNDescriptor(GHNDescriptor ghn)
Stores inside the list of global GHNs the one passed in input. |
boolean |
containsReservationFor(PlanBuilderIdentifier wfID)
States if there is a reservation associated to a workflow identifier. |
GHNDescriptor |
getGHNByID(PlanBuilderIdentifier wfID,
GCUBEScope scope,
java.lang.String ghnID)
Given a GHN ID returns the corresponding descriptor stored in the local cache. |
java.util.List<GHNDescriptor> |
getGlobalGHNsForScope(GCUBEScope scope,
boolean applySorting)
Deprecated. do not use this explicitly it is used only internally. |
static GHNReservationHandler |
getInstance()
|
GHNDescriptor |
getNextGHN(GCUBEScope scope,
PlanBuilderIdentifier wfID,
boolean reserve)
Returns a new GHNDescriptor for a given GCUBEScope
that can be assigned to a workflow uniquely identified by its
PlanBuilderIdentifier . |
GHNDescriptor |
getNextMatchingGHN(GCUBEScope scope,
PlanBuilderIdentifier wfID,
Requirement[] requirements,
boolean reserve)
Used to retrieve the list of GHNs matching the input requirements. |
GHNReservation |
getReservationFor(PlanBuilderIdentifier wfID)
Deprecated. for internal use only |
java.util.List<GHNDescriptor> |
getReservedGHNs(GCUBEScope scope,
PlanBuilderIdentifier wfID)
Access the permanent resource to retrieve the list of GHNDescriptor that
have been reserved for a well defined PlanBuilderIdentifier . |
boolean |
isResourceLoaded()
|
void |
reserveGHN(PlanBuilderIdentifier wfID,
GHNDescriptor ghn)
Makes a new reservation for a GHN registered into a scope. |
void |
revokeExpiredReservations()
Deprecated. for internal use only. |
void |
revokeFailedReservation(PlanBuilderIdentifier wfID)
Revokes all the reservations assigned to a plan identified by its PlanBuilderIdentifier . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static GHNReservationHandler getInstance()
public GHNDescriptor getGHNByID(PlanBuilderIdentifier wfID, GCUBEScope scope, java.lang.String ghnID) throws GCUBEFault
Given a GHN ID returns the corresponding descriptor stored in the local cache. If no element matches then null is returned.
The search is applied to both global and private GHNs that are reserved
for the PlanBuilderIdentifier
workflow session.
Note: If no PlanBuilderIdentifier
is given (null)
the GHN profile is search only inside the global list of GHNDescriptor
for that scope.
wfID
- the requesting workflow. If null the GHN descriptor
will be searched only in the globally defined list of GHNs for
that scope by ignoring the reserved ones.scope
- the scope the GHN is registered in.ghnID
- the ID of ghn to search.
GCUBEFault
public GHNDescriptor getNextMatchingGHN(GCUBEScope scope, PlanBuilderIdentifier wfID, Requirement[] requirements, boolean reserve) throws GCUBEFault
scope
- wfID
-
GCUBEFault
public void addGHNDescriptor(GHNDescriptor ghn) throws GCUBEFault
ghn
- the GHNDescriptor
to store.
GCUBEFault
public java.util.List<GHNDescriptor> getGlobalGHNsForScope(GCUBEScope scope, boolean applySorting) throws GCUBEFault
TUpdateGHNProfiles
timed thread.
The retrieved elements are implicitely stored inside
the persistent state.
Note:
This method is called only once per scope since it overwrites
the GHNProfiles with the new ones.
At initialization phase
ServiceInitializer
calls it for pre-fetching the GHNs for default scopes.
GCUBEFault
public GHNDescriptor getNextGHN(GCUBEScope scope, PlanBuilderIdentifier wfID, boolean reserve) throws GCUBEFault
GHNDescriptor
for a given GCUBEScope
that can be assigned to a workflow uniquely identified by its
PlanBuilderIdentifier
.
scope
- the gCube scope in which the GHN must be retrieved.wfID
- the unique identifier of requesting PlanBuilderWorkflow
.reserve
- if the returned GHNDescriptor
should be reserved for
the workflow.
GCUBEFault
- if something goes wrong.public java.util.List<GHNDescriptor> getReservedGHNs(GCUBEScope scope, PlanBuilderIdentifier wfID) throws GCUBEFault
GHNDescriptor
that
have been reserved for a well defined PlanBuilderIdentifier
.
Here the wfID parameter in mandatory.
scope
- the scope in which the GHNDescriptor
is published.wfID
- the plan identifier for which looking up the reserved GHNs.
GHNDescriptor
reserved in the plan identified by wfID.
GCUBEFault
- in case of failure.public void reserveGHN(PlanBuilderIdentifier wfID, GHNDescriptor ghn) throws GCUBEFault
wfID
- the PlanBuilderWorkflow
owning the reservation.ghn
- the GHNDescriptor
to reserve.
GCUBEFault
public void revokeExpiredReservations() throws GCUBEFault
TRevokeReservations
.
GCUBEFault
public void revokeFailedReservation(PlanBuilderIdentifier wfID) throws GCUBEFault
PlanBuilderIdentifier
.
This functionality is used when the TTL for the reservation expires
or when the decision making workflow internally fails.
wfID
- the plan identifier.
GCUBEFault
- if something goes wrong.public boolean containsReservationFor(PlanBuilderIdentifier wfID)
public GHNReservation getReservationFor(PlanBuilderIdentifier wfID) throws GCUBEFault
GHNDescriptor
for
each PlanBuilderWorkflow
instance.
Note: If no reservation is associated a new one will be created and internally stored.
wfID
- the PlanBuilderWorkflow
identifier.
GCUBEFault
- if resource is not availablepublic boolean isResourceLoaded()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |