Package ora4mas.nopl
Class GroupBoard
java.lang.Object
cartago.Artifact
ora4mas.nopl.OrgArt
ora4mas.nopl.GroupBoard
- All Implemented Interfaces:
ToXML,npl.DynamicFactsProvider
- Direct Known Subclasses:
SimpleGroupBoard
public class GroupBoard extends OrgArt
Artifact to manage a group instance.
Operations (see details in method list below):
Operations (see details in method list below):
- adoptRole
- leaveRole
- addScheme
- removeScheme
- setParentGroup
- destroy
- play(ag,role,group): agent ag is playing the role in the group.
- schemes: a list of schemes identification the group is responsible for.
- specification: the specification of the group in the OS (a prolog like representation)
- subgroups: a list of subgroups ids
- parent group: the id of the parent group (used in subgroups)
- formationStatus: whether the group is well-formed (values are ok and nok)
- oblCreated(o): the obligation o is created
- oblFulfilled(o): the obligation o is fulfilled
- oblUnfulfilled(o): the obligation o is unfulfilled (e.g. by timeout)
- oblInactive(o): the obligation o is inactive (e.g. its maintenance condition does not hold anymore)
- normFailure(f): the failure f has happened (e.g. due some regimentation)
- Author:
- Jomi
- See Also:
Group
-
Nested Class Summary
Nested classes/interfaces inherited from class ora4mas.nopl.OrgArt
OrgArt.Ora4masWSPRuleEngine, OrgArt.UpdateGuiThreadNested classes/interfaces inherited from class cartago.Artifact
cartago.Artifact.AbstractAsyncProcess -
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.String>futureSchemesSchemes to be responsible for when well formed.protected static java.util.Collection<GroupBoard>grBoardsprotected java.util.Set<cartago.ArtifactId>listenersprotected java.util.logging.Loggerloggerstatic java.lang.StringobsPropParentGroupstatic java.lang.StringobsPropPlaystatic java.lang.StringobsPropSchemesstatic java.lang.StringobsPropSpecstatic java.lang.StringobsPropSubgroupsstatic java.lang.StringobsWellFormedprotected cartago.ArtifactIdparentGroupprotected java.util.Set<cartago.ArtifactId>schemesprotected GroupspecFields inherited from class ora4mas.nopl.OrgArt
dfpListeners, gui, myNPLListener, nengine, normativeEvtListeners, oeId, orgBoardName, orgState, ownerAgent, running, runningDestroy, sglDestroyed, sglNormFailure, sglOblCreated, sglOblFulfilled, sglOblInactive, sglOblUnfulfilled, sglSanction, updateGUIThreadFields inherited from class cartago.Artifact
observabilityRadius, position, thisOpId -
Constructor Summary
Constructors Constructor Description GroupBoard() -
Method Summary
Modifier and Type Method Description voidaddListener(java.lang.String artId)voidaddRole(java.lang.String roleId)voidaddScheme(java.lang.String schId)The agent executing this operation tries to add a scheme under the responsibility of a groupvoidaddSchemeWhenFormationOk(java.lang.String schId)The group will be responsible for the scheme when its formation is Ok(package private) voidaddSubgroup(java.lang.String grId, java.lang.String grType, java.lang.String parentGr)voidadmCommand(java.lang.String cmd)Commands that the owner of the group can perform.voidadoptRole(java.lang.String role)The agent executing this operation tries to adopt a role in the groupprotected voidadoptRole(java.lang.String ag, java.lang.String role)voidagKilled(java.lang.String agName)voiddebug(java.lang.String kind)voiddestroy()The agent executing this operation tries to destroy the instance of the grouporg.w3c.dom.ElementgetAsDOM(org.w3c.dom.Document document)java.lang.StringgetAsDot()static org.w3c.dom.ElementgetGrAsDOM(Group gr, java.lang.String spec, boolean isWellFormed, java.lang.String owner, Group root, org.w3c.dom.Document document)static java.util.Collection<GroupBoard>getGroupBoards()GroupgetGrpState()protected java.util.logging.LoggergetLogger()java.lang.StringgetNPLSrc()GroupgetSpec()protected java.lang.StringgetStyleSheetName()voidinit(java.lang.String osFile, java.lang.String grType)Initialises the group boardbooleanisWellFormed()voidleaveRole(java.lang.String role)The agent executing this operation tries to give up a role in the groupprotected booleanleaveRoleWithoutVerify(java.lang.String ag, java.lang.String role, boolean oldStatus)protected voidnotifyObservers()voidremoveScheme(java.lang.String schId)The agent executing this operation tries to remove a scheme that is under the responsibility of a group(package private) voidremoveSubgroup(java.lang.String grId)voidsetCardinality(java.lang.String element, java.lang.String id, int min, int max)voidsetParentGroup(java.lang.String parentGroupId)The agent executing this operation tries to connect the group to a parentGroup(package private) voidupdateSubgroupFormationStatus(java.lang.String grId, boolean isWellFormed)(package private) voidupdateSubgroupPlayers(java.lang.String grId, java.util.Collection<Player> rp)protected voidupdateWellFormed(boolean status)Methods inherited from class ora4mas.nopl.OrgArt
consult, debug, fixAgName, fixOSFile, getArtId, getDebugText, getNormativeEngine, getNormIdTerm, getNSTransformer, getOEId, getOpUserName, getParser, getStyleSheet, getTermsAsProlog, getTermsAsProlog, initNormativeEngine, initWspRuleEngine, installNormativeSignaler, isRelevant, isUserAllowed, notifyDFPListeners, notifyNormativeEventListeners, ora4masOperationTemplate, postReorgUpdates, setOrgBoardName, setOwner, specToStr, subscribeDFP, subscribeNormativeEvents, updateGuiOEMethods inherited from class cartago.Artifact
await, await, await_time, beginExtSession, commit, defineNewOp, defineObsProperty, defineOp, delay, dispose, dispose, endExtSession, endExtSessionWithFailure, execInternalOp, execLinkedOp, execLinkedOp, failed, failed, getCreatorId, getCurrentOpAgentBody, getCurrentOpAgentId, getId, getLinkedArtifacts, getManualSrcFile, getObservabilityRadius, getObsProperty, getObsPropertyByTemplate, getOpKey, getPosition, hasObsProperty, hasObsPropertyByTemplate, isLinked, log, lookupArtifact, makeArtifact, removeObsProperty, removeObsPropertyByTemplate, removeOp, setupOperations, setupPosition, signal, signal, updateObservabilityRadius, updateObsProperty, updatePositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface npl.DynamicFactsProvider
consultFromCollection, consultFromProviders
-
Field Details
-
spec
-
schemes
protected java.util.Set<cartago.ArtifactId> schemes -
listeners
protected java.util.Set<cartago.ArtifactId> listeners -
parentGroup
protected cartago.ArtifactId parentGroup -
futureSchemes
protected java.util.List<java.lang.String> futureSchemesSchemes to be responsible for when well formed. -
obsPropSpec
public static final java.lang.String obsPropSpec- See Also:
- Constant Field Values
-
obsPropPlay
public static final java.lang.String obsPropPlay -
obsPropSchemes
public static final java.lang.String obsPropSchemes- See Also:
- Constant Field Values
-
obsPropSubgroups
public static final java.lang.String obsPropSubgroups- See Also:
- Constant Field Values
-
obsPropParentGroup
public static final java.lang.String obsPropParentGroup- See Also:
- Constant Field Values
-
obsWellFormed
public static final java.lang.String obsWellFormed- See Also:
- Constant Field Values
-
grBoards
-
logger
protected java.util.logging.Logger logger
-
-
Constructor Details
-
GroupBoard
public GroupBoard()
-
-
Method Details
-
getGroupBoards
-
getLogger
protected java.util.logging.Logger getLogger() -
getGrpState
-
getSpec
-
init
public void init(java.lang.String osFile, java.lang.String grType) throws npl.parser.ParseException, MoiseException, cartago.OperationExceptionInitialises the group board- Parameters:
osFile- the organisation specification file (path and file name)grType- the type of the group (as defined in the OS)- Throws:
npl.parser.ParseException- if the OS file is not correctMoiseException- if grType was not specifiedcartago.OperationException- if parentGroupId doesn't exit
-
debug
public void debug(java.lang.String kind) throws java.lang.Exception- Throws:
java.lang.Exception
-
destroy
public void destroy()The agent executing this operation tries to destroy the instance of the group -
agKilled
public void agKilled(java.lang.String agName) throws java.lang.Exception -
setParentGroup
public void setParentGroup(java.lang.String parentGroupId) throws cartago.OperationExceptionThe agent executing this operation tries to connect the group to a parentGroup- Parameters:
parentGroupId- the group Id to connect to- Throws:
cartago.OperationException
-
adoptRole
public void adoptRole(java.lang.String role)The agent executing this operation tries to adopt a role in the group- Parameters:
role- the role being adopted
-
adoptRole
protected void adoptRole(java.lang.String ag, java.lang.String role) -
updateWellFormed
protected void updateWellFormed(boolean status) -
leaveRole
public void leaveRole(java.lang.String role)The agent executing this operation tries to give up a role in the group- Parameters:
role- the role being removed/leaved
-
leaveRoleWithoutVerify
protected boolean leaveRoleWithoutVerify(java.lang.String ag, java.lang.String role, boolean oldStatus) throws cartago.CartagoException, cartago.OperationException- Throws:
cartago.CartagoExceptioncartago.OperationException
-
addScheme
public void addScheme(java.lang.String schId)The agent executing this operation tries to add a scheme under the responsibility of a group- Parameters:
schId- the scheme Id being added
-
addSchemeWhenFormationOk
public void addSchemeWhenFormationOk(java.lang.String schId)The group will be responsible for the scheme when its formation is Ok- Parameters:
schId- the scheme Id being added
-
removeScheme
public void removeScheme(java.lang.String schId)The agent executing this operation tries to remove a scheme that is under the responsibility of a group- Parameters:
schId- the scheme Id being removed
-
addListener
public void addListener(java.lang.String artId) -
notifyObservers
protected void notifyObservers() throws cartago.CartagoException- Throws:
cartago.CartagoException
-
updateSubgroupPlayers
-
updateSubgroupFormationStatus
void updateSubgroupFormationStatus(java.lang.String grId, boolean isWellFormed) -
addSubgroup
void addSubgroup(java.lang.String grId, java.lang.String grType, java.lang.String parentGr) -
removeSubgroup
void removeSubgroup(java.lang.String grId) -
admCommand
public void admCommand(java.lang.String cmd) throws cartago.CartagoException, jason.asSyntax.parser.ParseException, jason.NoValueException, MoiseException, npl.parser.ParseExceptionCommands that the owner of the group can perform.- Parameters:
cmd- , possible values (as strings): adoptRole(, ) setCardinality( , , , ) [element type= role/subgroup] - Throws:
cartago.CartagoExceptionjason.asSyntax.parser.ParseExceptionjason.NoValueExceptionMoiseExceptionnpl.parser.ParseException
-
addRole
- Throws:
MoiseExceptionnpl.parser.ParseException
-
setCardinality
public void setCardinality(java.lang.String element, java.lang.String id, int min, int max) throws MoiseException, npl.parser.ParseException- Throws:
MoiseExceptionnpl.parser.ParseException
-
getNPLSrc
public java.lang.String getNPLSrc() -
getStyleSheetName
protected java.lang.String getStyleSheetName()- Specified by:
getStyleSheetNamein classOrgArt
-
isWellFormed
public boolean isWellFormed() -
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document) -
getGrAsDOM
-
getAsDot
public java.lang.String getAsDot()
-