Class GRNRegistry

java.lang.Object
org.graylog.grn.GRNRegistry

@Singleton public class GRNRegistry extends Object
The global GRN registry.
  • Field Details

    • GLOBAL_USER_GRN

      public static final GRN GLOBAL_USER_GRN
  • Method Details

    • createEmpty

      public static GRNRegistry createEmpty()
      Returns an empty registry.
      Returns:
      the registry
    • createWithBuiltinTypes

      public static GRNRegistry createWithBuiltinTypes()
      Returns a registry that has been initialized with the builtin Graylog GRN types.
      Returns:
      the registry
    • createWithTypes

      public static GRNRegistry createWithTypes(Collection<GRNType> types)
      Returns a registry that has been initialized with the given GRN types.
      Parameters:
      types - the GRN types to initialize the registry with
      Returns:
      the registry
    • parse

      public GRN parse(String grnString)
      Parses the given GRN string and returns a GRN.
      Parameters:
      grnString - the GRN string to parse
      Returns:
      the GRN
      Throws:
      IllegalArgumentException - when given GRN string is invalid
    • newGRN

      public GRN newGRN(String type, String entity)
      Returns the GRN for the given type and entity.
      Parameters:
      type - the GRN type string
      entity - the entity string
      Returns:
      the GRN
      Throws:
      IllegalArgumentException - when given type doesn't exist or any arguments are null or empty
    • newGRN

      public GRN newGRN(GRNType type, String entity)
      Returns the GRN for the given type and entity.
      Parameters:
      type - the GRN type string
      entity - the entity string
      Returns:
      the GRN
      Throws:
      IllegalArgumentException - when given type doesn't exist or any arguments are null or empty
    • ofEventDefinition

      public GRN ofEventDefinition(EventDefinition eventDefinition)
    • ofUser

      public GRN ofUser(User user)
    • isUser

      public boolean isUser(GRN grn)
    • newGRNBuilder

      public GRN.Builder newGRNBuilder(String type)
      Returns a new GRN.Builder for the given type string.
      Parameters:
      type - the GRN type string
      Returns:
      the GRN builder
      Throws:
      IllegalArgumentException - when given type doesn't exist
    • newGRNBuilder

      public GRN.Builder newGRNBuilder(GRNType type)
      Returns a new GRN.Builder for the given type string.
      Parameters:
      type - the GRN type string
      Returns:
      the GRN builder
      Throws:
      IllegalArgumentException - when given type doesn't exist
    • registerType

      public void registerType(GRNType type)
      Registers the given GRN type.
      Parameters:
      type - the typt to register
      Throws:
      IllegalStateException - when given type is already registered