Package com.getperka.flatpack.policy.pst

Examples of com.getperka.flatpack.policy.pst.GroupDefinition


      return false;
    }

    @Override
    public boolean visit(GroupDefinition x) {
      GroupDefinition n = new GroupDefinition();
      n.setName(clone(x.getName()));
      n.setPaths(clone(x.getPaths()));
      stack.push(n);
      return false;
    }
View Full Code Here


     */
    Map<Ident<SecurityGroup>, GroupDefinition> uniqueNames = mapForIteration();
    for (GroupBlock group : policy.getGroups()) {
      // Make a copy of the GroupDefinition that prepends the property being inherited from
      for (GroupDefinition def : group.getDefinitions()) {
        GroupDefinition inherited = new GroupDefinition(def, inheritFrom);
        uniqueNames.put(inherited.getName(), inherited);

        GroupDefinition aliased = new GroupDefinition(def, inheritFrom);
        aliased.setName(aliased.getName().removeLeadingIdent());
        uniqueNames.put(aliased.getName(), aliased);
      }
    }

    // Allow local definitions to override the inherited ones
    for (GroupDefinition def : x.getDefinitions()) {
View Full Code Here

      return;
    }

    // Determine if a group is being declared
    TypePolicy typePolicy = currentLocation(TypePolicy.class);
    GroupDefinition groupDefinition = currentLocation(GroupDefinition.class);
    if (groupDefinition != null) {
      // Ensure that all the PropertyPaths are set up
      List<PropertyPath> paths = ensureReferent(groupDefinition.getPaths());
      Class<? extends HasUuid> type = ensureReferent(typePolicy);
      if (type == null) {
        unresolved.add(typePolicy.getName());
        return;
      }
      SecurityGroup group = paths.isEmpty() ?
          securityGroups.getGroupEmpty() :
          securityGroups.getGroup(type, groupDefinition.getName().toString(),
              groupDefinition.toSource(), paths);
      x.setReferent(group);
      return;
    }

    // Find an already-declared group
    GroupDefinition group = scope().get(GroupDefinition.class, x);
    if (group != null) {
      x.setReferent(ensureReferent(group));
      return;
    }

    // Otherwise, it's a global name
    x.setReferent(securityGroups.getGroupGlobal(x.getSimpleName()));

    GroupDefinition globalDef = new GroupDefinition();
    globalDef.setLineNumber(x.getLineNumber());
    globalDef.setName(x);
    rootScope.put(globalDef);
  }
View Full Code Here

   * groupName = some.property.path [ , another.path ]
   * groupName empty
   * </pre>
   */
  Rule GroupDefinition() {
    final Var<GroupDefinition> var = new Var<GroupDefinition>(new GroupDefinition());
    return Sequence(
        NodeName(SecurityGroup.class, var),
        FirstOf(
            Sequence(
                "empty",
                ACTION(push(new ArrayList<Object>()))
            ),
            Sequence(
                "=",
                OneOrListOf(CompoundIdent(PropertyPath.class, Property.class), Ident.class, ","))),
        new Action<Object>() {
          @Override
          public boolean run(Context<Object> ctx) {
            GroupDefinition x = var.get();
            x.setPaths(popIdentList(PropertyPath.class));
            push(x);
            return true;
          }
        });
  }
View Full Code Here

TOP

Related Classes of com.getperka.flatpack.policy.pst.GroupDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.