Examples of Policy


Examples of org.apache.hadoop.hbase.chaos.policies.Policy

    util.initializeCluster(clusterSize);
  }

  @Override
  public void setUpMonkey() throws Exception {
    Policy p = new PeriodicRandomActionPolicy(sleepTime,
      new RestartRsHoldingTableAction(sleepTime, tableName.getNameAsString()),
      new MoveRandomRegionOfTableAction(tableName));
    this.monkey = new PolicyBasedChaosMonkey(util, p);
    // don't start monkey right away
  }
View Full Code Here

Examples of org.apache.lenya.ac.Policy

            String ancestorUrl = "";
            int lastSlashIndex = url.lastIndexOf("/");
            if (lastSlashIndex != -1) {
                ancestorUrl = url.substring(0, lastSlashIndex);
            }
            Policy policy =
                policyManager.getPolicy(accessController.getAccreditableManager(), ancestorUrl);
            ssl = policy.isSSLProtected();
        } catch (AccessControlException e) {
            throw new ProcessingException("Resolving policy failed: ", e);
        }
        return ssl;
    }
View Full Code Here

Examples of org.apache.lenya.cms.ac.Policy

        } catch (Exception e) {
            getLogger().error(".authorize(): No policy could be retrieved (" + e + "). Access denied (return false).");
            return false;
        }

        Policy policy = new Policy(policyDoc, getLogger());

        // Read action (read, write, publish, etc.)
        String action = XPathAPI.selectSingleNode(policyDoc, "/ac/request/action/@name").getNodeValue(); //"read";

        if (getLogger().isDebugEnabled()) {
            getLogger().debug(".authorize(): action: " + action);
        }

        // Check permissions
        if (policy.authorizeWorld(action)) {
            return true;
        }

        if (policy.authorizeMachine(action, remoteAddress)) {
            return true;
        }

        Session session = request.getSession(true);

        if (session == null) {
            getLogger().error(".authorize(): No session object");

            return false;
        }


        // Needs to be here after authorizeMachine() check, else every component (XPSAssembler) must be wrapped by a proxy!
        String authenticator_type = (String) session.getAttribute("org.apache.lenya.cms.cocoon.acting.Authenticator.id");
        if (!this.authenticator_type.equals(authenticator_type)) {
            if (authenticator_type == null) {
                getLogger().warn(".authorize(): No authenticator yet");
            } else {
                getLogger().warn(".authorize(): Authenticators do not match: " + authenticator_type + " (Authorizer's authenticator: " + this.authenticator_type + ")");
            }
            getLogger().warn(".authorize(): Permission denied");
            return false;
        }


        Identity identity = (Identity) session.getAttribute("org.apache.lenya.cms.ac.Identity");

        if (identity != null) {
            if (policy.authorizeUser(action, identity.getUsername())) {
                return true;
            }

            String[] groupname = identity.getGroupnames();

            for (int i = 0; i < groupname.length; i++) {
                if (policy.authorizeGroup(action, groupname[i])) {
                    return true;
                }
            }
        }
View Full Code Here

Examples of org.apache.maven.archiva.policies.Policy

        {
            // Validate / Fix policy settings arriving from browser.
            for ( Map.Entry<String, Policy> entry : getPolicyMap().entrySet() )
            {
                String policyId = entry.getKey();
                Policy policy = entry.getValue();
                List<String> options = policy.getOptions();

                if ( !connector.getPolicies().containsKey( policyId ) )
                {
                    addActionError( "Policy [" + policyId + "] must be set (missing id)." );
                    continue;
View Full Code Here

Examples of org.apache.neethi.Policy

  }

  public static Policy getMergedPolicy(List policies,
      AxisDescription description) {

    Policy policy = null;

    for (Iterator iterator = policies.iterator(); iterator.hasNext();) {
      Object policyElement = iterator.next();
      if (policyElement instanceof Policy) {
        policy = (policy == null) ? (Policy) policyElement
            : (Policy) policy.merge((Policy) policyElement);

      } else {
        PolicyReference policyReference = (PolicyReference) policyElement;
        Policy policy2 = (Policy) policyReference.normalize(
            new AxisPolicyLocator(description), false);
        policy = (policy == null) ? policy2 : (Policy) policy
            .merge(policy2);
      }
    }
View Full Code Here

Examples of org.apache.stratos.adc.mgt.dto.Policy

    log.info("Subscribing tenant [" + tenantId + "] with username [" + username + "] Cartridge Alias " + alias
        + ", Cartridge Type: " + cartridgeType + ", Repo URL: " + repoURL + ", Policy: " + policy);
   
    // Assign auto scaling only when necessary.
    // Muti-tenant cartridge may not need a policy.
    Policy autoScalingPolicy = null;
   
    CartridgeInfo cartridgeInfo;
    try {
      cartridgeInfo = getServiceClient().getCartridgeInfo(cartridgeType);
    } catch (UnregisteredCartridgeException e) {
View Full Code Here

Examples of org.apache.stratos.manager.dto.Policy

  private void readPolicy(OMElement policyElement) {
    // retrieve attributes
    String name = policyElement.getAttributeValue(new QName(NAME_ATTR));
    boolean isDefault = Boolean.valueOf(policyElement.getAttributeValue(new QName(IS_DEFAULT_ATTR)));

    Policy policy = new Policy();
    policy.setName(name);
    policy.setDefaultPolicy(isDefault);

    // read description
    Iterator<?> it = policyElement.getChildrenWithName(new QName(DESCRIPTION_ELEMENT));

    if (it.hasNext()) {
      OMElement element = (OMElement) it.next();
      policy.setDescription(element.getText());
    }

    // read min_app_instances
    it = policyElement.getChildrenWithName(new QName(MIN_APP_INSTANCES_ELEMENT));

    if (it.hasNext()) {
      OMElement element = (OMElement) it.next();
      policy.setMinAppInstances(Integer.parseInt(element.getText()));
    }

    // read max_app_instances
    it = policyElement.getChildrenWithName(new QName(MAX_APP_INSTANCES_ELEMENT));

    if (it.hasNext()) {
      OMElement element = (OMElement) it.next();
      policy.setMaxAppInstances(Integer.parseInt(element.getText()));
    }

    // read max_requests_per_second
    it = policyElement.getChildrenWithName(new QName(MAX_REQUESTS_PER_SECOND_ELEMENT));

    if (it.hasNext()) {
      OMElement element = (OMElement) it.next();
      policy.setMaxRequestsPerSecond(Integer.parseInt(element.getText()));
    }

    // read rounds_to_average
    it = policyElement.getChildrenWithName(new QName(ROUNDS_TO_AVERAGE_ELEMENT));

    if (it.hasNext()) {
      OMElement element = (OMElement) it.next();
      policy.setRoundsToAverage(Integer.parseInt(element.getText()));
    }

    // read alarming_upper_rate
    it = policyElement.getChildrenWithName(new QName(ALARMING_UPPER_RATE_ELEMENT));

    if (it.hasNext()) {
      OMElement element = (OMElement) it.next();
      policy.setAlarmingUpperRate(new BigDecimal(element.getText()));
    }

    // read alarming_lower_rate
    it = policyElement.getChildrenWithName(new QName(ALARMING_LOWER_RATE_ELEMENT));

    if (it.hasNext()) {
      OMElement element = (OMElement) it.next();
      policy.setAlarmingLowerRate(new BigDecimal(element.getText()));
    }

    // read scale_down_factor
    it = policyElement.getChildrenWithName(new QName(SCALE_DOWN_FACTOR_ELEMENT));

    if (it.hasNext()) {
      OMElement element = (OMElement) it.next();
      policy.setScaleDownFactor(new BigDecimal(element.getText()));
    }
    if (log.isDebugEnabled()) {
      log.debug("Policy: " + new Gson().toJson(policy));
    }

    policyMap.put(policy.getName(), policy);
    PolicyDefinition policyDefinition = new PolicyDefinition();
    policyDefinition.setName(policy.getName());
    policyDefinition.setDescription(policy.getDescription());
    policyDefinition.setDefaultPolicy(policy.isDefaultPolicy());
    policyDefinitions.add(policyDefinition);
   
    // Set first default policy
    if (defaultPolicy == null && policy.isDefaultPolicy()) {
      defaultPolicy = policy;
    }
  }
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.Policy

    @PreAuthorize("hasRole('POLICY_CREATE')")
    public <T extends PolicyTO> T createInternal(final T policyTO) {
        LOG.debug("Creating policy " + policyTO);

        final Policy policy = binder.getPolicy(null, policyTO);

        auditManager.audit(Category.policy, PolicySubCategory.create, Result.success,
                "Successfully created " + policy.getType().toString() + " policy: " + policy.getId());

        return binder.getPolicyTO(policyDAO.save(policy));
    }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.Policy

            int event = reader.getEventType();
            if (event == XMLStreamConstants.START_ELEMENT) {
                if ("policySet".equals(reader.getName().getLocalPart())) {
                    reader.nextTag();
                    StAXArtifactProcessor processor = processors.get(reader.getName());
                    Policy policy = (Policy)processor.read(reader);

                    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                    XMLStreamWriter writer = outputFactory.createXMLStreamWriter(outputStream);
                    processor.write(policy, writer);
                    writer.flush();
View Full Code Here

Examples of org.apache.wookie.connector.framework.Policy

   
    List<Policy> policies = service.getPolicies(adminUsername, adminPassword, null);
    int policyListSize = policies.size();
    assertTrue ( "Unable to get policies", (policyListSize > 0) );
    String scope = "http://test.scope/8475374";
    Policy policy = new Policy ( scope, "http://nowhere.com", "ALLOW" );
    service.createPolicy(policy, adminUsername, adminPassword);
    assertTrue ( "New policy not created", service.getPolicies(adminUsername, adminPassword, scope).size() > 0);
    service.deletePolicy(policy, adminUsername, adminPassword);
    assertEquals ( service.getPolicies(adminUsername, adminPassword, null).size(), policyListSize);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.