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:
LightGroupBoard
public class GroupBoard extends OrgArt
Artifact to manage a group instance.
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.UpdateGuiThread
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.String>
futureSchemes
Schemes to be responsible for when well formed.protected static java.util.Collection<GroupBoard>
grBoards
protected java.util.Set<cartago.ArtifactId>
listeners
protected java.util.logging.Logger
logger
static java.lang.String
obsPropParentGroup
static java.lang.String
obsPropPlay
static java.lang.String
obsPropSchemes
static java.lang.String
obsPropSpec
static java.lang.String
obsPropSubgroups
static java.lang.String
obsWellFormed
protected cartago.ArtifactId
parentGroup
protected java.util.Set<cartago.ArtifactId>
schemes
protected Group
spec
-
Fields inherited from class ora4mas.nopl.OrgArt
dfpListeners, gui, myNPLListener, nengine, oeId, orgBoardName, orgState, ownerAgent, running, runningDestroy, sglDestroyed, sglNormFailure, sglOblCreated, sglOblFulfilled, sglOblInactive, sglOblUnfulfilled, updateGUIThread
-
-
Constructor Summary
Constructors Constructor Description GroupBoard()
-
Method Summary
Modifier and Type Method Description void
addListener(java.lang.String artId)
void
addRole(java.lang.String roleId)
void
addScheme(java.lang.String schId)
The agent executing this operation tries to add a scheme under the responsibility of a groupvoid
addSchemeWhenFormationOk(java.lang.String schId)
The group will be responsible for the scheme when its formation is Ok(package private) void
addSubgroup(java.lang.String grId, java.lang.String grType, java.lang.String parentGr)
void
admCommand(java.lang.String cmd)
Commands that the owner of the group can perform.void
adoptRole(java.lang.String role)
The agent executing this operation tries to adopt a role in the groupprotected void
adoptRole(java.lang.String ag, java.lang.String role)
void
agKilled(java.lang.String agName)
void
debug(java.lang.String kind)
void
destroy()
The agent executing this operation tries to destroy the instance of the grouporg.w3c.dom.Element
getAsDOM(org.w3c.dom.Document document)
java.lang.String
getAsDot()
static org.w3c.dom.Element
getGrAsDOM(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()
Group
getGrpState()
protected java.util.logging.Logger
getLogger()
java.lang.String
getNPLSrc()
Group
getSpec()
protected java.lang.String
getStyleSheetName()
void
init(java.lang.String osFile, java.lang.String grType)
Initialises the group boardboolean
isWellFormed()
void
leaveRole(java.lang.String role)
The agent executing this operation tries to give up a role in the groupprotected boolean
leaveRoleWithoutVerify(java.lang.String ag, java.lang.String role, boolean oldStatus)
protected void
notifyObservers()
void
removeScheme(java.lang.String schId)
The agent executing this operation tries to remove a scheme that is under the responsibility of a group(package private) void
removeSubgroup(java.lang.String grId)
void
setCardinality(java.lang.String element, java.lang.String id, int min, int max)
void
setParentGroup(java.lang.String parentGroupId)
The agent executing this operation tries to connect the group to a parentGroup(package private) void
updateSubgroupFormationStatus(java.lang.String grId, boolean isWellFormed)
(package private) void
updateSubgroupPlayers(java.lang.String grId, java.util.Collection<Player> rp)
protected void
updateWellFormed(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, notifyListeners, ora4masOperationTemplate, postReorgUpdates, setOrgBoardName, setOwner, specToStr, subscribeDFP, updateGuiOE
-
Methods 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, updatePosition
-
-
-
-
Field Detail
-
spec
protected Group 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> futureSchemes
Schemes 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
protected static java.util.Collection<GroupBoard> grBoards
-
logger
protected java.util.logging.Logger logger
-
-
Method Detail
-
getGroupBoards
public static java.util.Collection<GroupBoard> getGroupBoards()
-
getGrpState
public Group getGrpState()
-
getSpec
public Group getSpec()
-
init
public void init(java.lang.String osFile, java.lang.String grType) throws npl.parser.ParseException, MoiseException, cartago.OperationException
Initialises 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.OperationException
The 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.CartagoException
cartago.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
void updateSubgroupPlayers(java.lang.String grId, java.util.Collection<Player> rp)
-
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.ParseException
Commands that the owner of the group can perform.- Parameters:
cmd
- , possible values (as strings): adoptRole(, ) setCardinality( , , , ) [element type= role/subgroup] - Throws:
cartago.CartagoException
jason.asSyntax.parser.ParseException
jason.NoValueException
MoiseException
npl.parser.ParseException
-
addRole
public void addRole(java.lang.String roleId) throws MoiseException, npl.parser.ParseException
- Throws:
MoiseException
npl.parser.ParseException
-
setCardinality
public void setCardinality(java.lang.String element, java.lang.String id, int min, int max) throws MoiseException, npl.parser.ParseException
- Throws:
MoiseException
npl.parser.ParseException
-
getStyleSheetName
protected java.lang.String getStyleSheetName()
- Specified by:
getStyleSheetName
in classOrgArt
-
isWellFormed
public boolean isWellFormed()
-
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
-
getGrAsDOM
public static org.w3c.dom.Element getGrAsDOM(Group gr, java.lang.String spec, boolean isWellFormed, java.lang.String owner, Group root, org.w3c.dom.Document document)
-
-