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):
  • adoptRole
  • leaveRole
  • addScheme
  • removeScheme
  • setParentGroup
  • destroy
Observable properties:
  • 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)
Signals (obligations has the form: obligation(to whom, maintenance condition, what, deadline)):
  • 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
  • Field Details

    • 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
  • Constructor Details

    • GroupBoard

      public GroupBoard()
  • Method Details

    • getGroupBoards

      public static java.util.Collection<GroupBoard> getGroupBoards()
    • getLogger

      protected java.util.logging.Logger getLogger()
      Overrides:
      getLogger in class OrgArt
    • 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 correct
      MoiseException - if grType was not specified
      cartago.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
      Overrides:
      destroy in class OrgArt
    • agKilled

      public void agKilled​(java.lang.String agName) throws java.lang.Exception
      Overrides:
      agKilled in class OrgArt
      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
    • getNPLSrc

      public java.lang.String getNPLSrc()
      Overrides:
      getNPLSrc in class OrgArt
    • getStyleSheetName

      protected java.lang.String getStyleSheetName()
      Specified by:
      getStyleSheetName in class OrgArt
    • 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)
    • getAsDot

      public java.lang.String getAsDot()
      Overrides:
      getAsDot in class OrgArt