当前位置: 首页>>代码示例>>Java>>正文


Java Policy.getId方法代码示例

本文整理汇总了Java中org.apache.neethi.Policy.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Policy.getId方法的具体用法?Java Policy.getId怎么用?Java Policy.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.neethi.Policy的用法示例。


在下文中一共展示了Policy.getId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyPolicyToBindings

import org.apache.neethi.Policy; //导入方法依赖的package包/类
private Policy applyPolicyToBindings(AxisService axisService) throws ServerException {
    Parameter parameter = axisService.getParameter(APPLY_POLICY_TO_BINDINGS);
    if (parameter != null && "true".equalsIgnoreCase(parameter.getValue().toString()) &&
            axisService.getPolicySubject() != null && axisService.getPolicySubject().getAttachedPolicyComponents()
            != null) {
        Iterator iterator = axisService.getPolicySubject().
                getAttachedPolicyComponents().iterator();
        while (iterator.hasNext()) {
            PolicyComponent currentPolicyComponent = (PolicyComponent) iterator.next();
            if (currentPolicyComponent instanceof Policy) {
                Policy policy = ((Policy) currentPolicyComponent);
                String policyId = policy.getId();
                axisService.getPolicySubject().detachPolicyComponent(policyId);
                addPolicyToAllBindings(axisService, policy);
                return policy;
            }
        }
    }
    return null;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:SecurityDeploymentInterceptor.java

示例2: setPolicy

import org.apache.neethi.Policy; //导入方法依赖的package包/类
/**
* @param policy
* @see org.apache.axis2.description.PolicySubject#attachPolicy(Policy)
* @see org.apache.axis2.description.PolicySubject#clear()
* @deprecated As of 1.4 release, replaced by
*             {@link PolicySubject #attachPolicy(Policy)} Use
*             {@link PolicySubject #clear()} beforehand effective policy of
*             {@link AxisDescription} has to be set as the argument.
* 
*/
  public void setPolicy(Policy policy) {
      wrapperElements.clear();

      if (policy.getName() == null && policy.getId() == null) {
          policy.setId(UIDGenerator.generateUID());
      }

      Wrapper wrapper = new Wrapper(PolicyInclude.ANON_POLICY, policy);
      if (policy.getName() != null) {
          wrapperElements.put(policy.getName(), wrapper);
      } else {
          wrapperElements.put(policy.getId(), wrapper);
      }
      
      if (description != null) {
	description.getPolicySubject().clear();
	description.getPolicySubject().attachPolicy(policy);
}
  }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:30,代码来源:PolicyInclude.java

示例3: updatePolicy

import org.apache.neethi.Policy; //导入方法依赖的package包/类
/**
* @deprecated As of 1.4 release, replaced by
*             {@link PolicySubject #updatePolicy(Policy)}.
*/
  public void updatePolicy(Policy policy) {
      String key;

      if ((key = policy.getName()) == null && (key = policy.getId()) == null) {
          // TODO throw more meaningful exception ..
          throw new RuntimeException("policy doesn't have a name or an id ");
      }

      Wrapper wrapper = (Wrapper) wrapperElements.get(key);
      wrapper.value = policy;
      
      if (description != null) {
	description.getPolicySubject().updatePolicy(policy);
}
  }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:PolicyInclude.java

示例4: addPolicyElement

import org.apache.neethi.Policy; //导入方法依赖的package包/类
/**
* @deprecated As of 1.4 release, replaced by
*             {@link PolicySubject #attachPolicy(Policy)}
*/
  public void addPolicyElement(int type, Policy policy) {

      String key;

      if ((key = policy.getName()) == null && (key = policy.getId()) == null) {
          policy.setId(UIDGenerator.generateUID());
      }

      key = (policy.getName() != null) ? policy.getName() : policy.getId();

      Wrapper wrapper = new Wrapper(type, policy);
      wrapperElements.put(key, wrapper);
      reg.register(key, policy);
      
      if (description != null) {
	description.getPolicySubject().attachPolicy(policy);
}
  }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:PolicyInclude.java

示例5: addPolicyToAllBindings

import org.apache.neethi.Policy; //导入方法依赖的package包/类
public void addPolicyToAllBindings(AxisService axisService, Policy policy)
        throws ServerException {
    try {
        if (policy.getId() == null) {
            // Generate an ID
            policy.setId(UUIDGenerator.getUUID());
        }
        Map endPointMap = axisService.getEndpoints();
        for (Object o : endPointMap.entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            AxisEndpoint point = (AxisEndpoint) entry.getValue();
            AxisBinding binding = point.getBinding();
            String bindingName = binding.getName().getLocalPart();

            //only UTOverTransport is allowed for HTTP
            if (bindingName.endsWith("HttpBinding") &&
                    (!policy.getAttributes().containsValue("UTOverTransport"))) {
                continue;
            }
            binding.getPolicySubject().attachPolicy(policy);
            // Add the new policy to the registry
        }
    } catch (Exception e) {
        log.error("Error in adding security policy to all bindings", e);
        throw new ServerException("addPoliciesToService", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:28,代码来源:SecurityDeploymentInterceptor.java

示例6: addSecurityPolicyToAllBindings

import org.apache.neethi.Policy; //导入方法依赖的package包/类
/**
 * This method add Policy to service at the Registry. Does not add the
 * policy to Axis2. To all Bindings available
 *
 * @param axisService Service
 * @param policy      Policy
 * @throws org.wso2.carbon.utils.ServerException se
 */
public void addSecurityPolicyToAllBindings(AxisService axisService, Policy policy)
        throws ServerException {
    try {
        if (policy.getId() == null) {
            policy.setId(UUIDGenerator.getUUID());
        }

        Map endPointMap = axisService.getEndpoints();
        for (Object o : endPointMap.entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            AxisEndpoint point = (AxisEndpoint) entry.getValue();
            AxisBinding binding = point.getBinding();
            String bindingName = binding.getName().getLocalPart();

            //only UTOverTransport is allowed for HTTP
            if (bindingName.endsWith("HttpBinding") &&
                    (!policy.getAttributes().containsValue("UTOverTransport"))) {
                continue;
            }
            binding.getPolicySubject().attachPolicy(policy);

        }
    } catch (Exception e) {
        log.error("Error in adding security policy to all bindings", e);
        throw new ServerException("addPoliciesToService", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:36,代码来源:SecurityServiceAdmin.java

示例7: addSecurityPolicyToAllBindings

import org.apache.neethi.Policy; //导入方法依赖的package包/类
/**
 * This method add Policy to service at the Registry. Does not add the
 * policy to Axis2. To all Bindings available
 *
 * @param axisService Service
 * @param policy      Policy
 * @throws org.wso2.carbon.utils.ServerException se
 */
public void addSecurityPolicyToAllBindings(AxisService axisService, Policy policy)
        throws ServerException {
    String serviceGroupId = axisService.getAxisServiceGroup().getServiceGroupName();
    try {
        if (policy.getId() == null) {
            policy.setId(UUIDGenerator.getUUID());
        }

        Map endPointMap = axisService.getEndpoints();
        for (Object o : endPointMap.entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            AxisEndpoint point = (AxisEndpoint) entry.getValue();
            AxisBinding binding = point.getBinding();
            String bindingName = binding.getName().getLocalPart();

            //only UTOverTransport is allowed for HTTP
            if (bindingName.endsWith("HttpBinding") &&
                    (!policy.getAttributes().containsValue("UTOverTransport"))) {
                continue;
            }
            binding.getPolicySubject().attachPolicy(policy);

        }
    } catch (Exception e) {
        log.error("Error in adding security policy to all bindings", e);
        throw new ServerException("addPoliciesToService", e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:37,代码来源:SecurityServiceAdmin.java

示例8: attachPolicy

import org.apache.neethi.Policy; //导入方法依赖的package包/类
public void attachPolicy(Policy policy) {
	String key = policy.getName();
	if (key == null) {
		key = policy.getId();
		if (key == null) {
			key = UIDGenerator.generateUID();
			policy.setId(key);
		}
	}
	attachPolicyComponent(key, policy);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:12,代码来源:PolicySubject.java

示例9: updatePolicy

import org.apache.neethi.Policy; //导入方法依赖的package包/类
public void updatePolicy(Policy policy) {
	String key = (policy.getName() != null) ? policy.getName() : policy
			.getId();
	if (key == null) {
		throw new IllegalArgumentException(
				"policy doesn't have a name or an id ");
	}
	attachedPolicyComponents.put(key, policy);
	setLastUpdatedTime(new Date());
	
	if (!isUpdated()) {
		setUpdated(true);
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:PolicySubject.java

示例10: createPolicyReference

import org.apache.neethi.Policy; //导入方法依赖的package包/类
public static PolicyReference createPolicyReference(Policy policy) {
	PolicyReference policyReference = new PolicyReference();
	String key = policy.getName();
	if (key == null) {
		key = policy.getId();
		if (key == null) {
			key = UIDGenerator.generateUID();
			policy.setId(key);
		}
		policyReference.setURI("#" + key);
	} else {
		policyReference.setURI(key);
	}
	return policyReference;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:PolicyUtil.java

示例11: init

import org.apache.neethi.Policy; //导入方法依赖的package包/类
/**
 * initialize the module
 */
public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault {
    this.configctx = configContext;
    initDefaultPolicy();
    initDefaultThrottle();
    Throttle throttle;

    ThrottleObserver observer = new ThrottleObserver(configctx, defaultThrottle);
    AxisConfiguration axisConfiguration = configctx.getAxisConfiguration();
    axisConfiguration.addObservers(observer);

    /**
     * Global policy can be configured through the axis2.xml as well. If it is configured, we
     * give priority to that policy over the one coming from the module.xml.
     * This is done to allow user to modify the global policy without editing the module.xml
     * of the throttle module.
     */
    PolicySubject policySubject =
            ThrottleEnguageUtils.readExternalGlobalPolicy(axisConfiguration);
    if (policySubject == null) {
        policySubject = module.getPolicySubject();
    }
    if (policySubject != null) {
        List list = new ArrayList(policySubject.getAttachedPolicyComponents());
        Policy policy = PolicyUtil.getMergedPolicy(list, null);
        if (policy != null) {
            try {
                throttle = ThrottleFactory.createModuleThrottle(policy);
            }
            catch (ThrottleException e) {

                log.error("Error was occurred when initiating throttle" +
                        " module " + e.getMessage());
                log.info("Throttling will occur using default module policy");

                String id = policy.getId();
                policySubject.detachPolicyComponent(id);
                defaultPolicy.setId(id);
                policySubject.attachPolicy(defaultPolicy);
                throttle = defaultThrottle;
            }
            if (throttle != null) {
                Map throttles =
                        (Map) configctx.getPropertyNonReplicable(
                                ThrottleConstants.THROTTLES_MAP);
                if (throttles == null) {
                    throttles = new HashMap();
                    configctx.setNonReplicableProperty(ThrottleConstants.THROTTLES_MAP,
                            throttles);
                }
                throttle.setId(ThrottleConstants.GLOBAL_THROTTLE_ID);
                throttles.put(ThrottleConstants.GLOBAL_THROTTLE_KEY, throttle);
                ConcurrentAccessController cac = throttle.getConcurrentAccessController();
                if (cac != null) {
                    String cacKey = ThrottleConstants.THROTTLE_PROPERTY_PREFIX
                            + ThrottleConstants.GLOBAL_THROTTLE_ID +
                            ThrottleConstants.CAC_SUFFIX;
                    configctx.setProperty(cacKey, cac);
                }
            }
        }
    }

}
 
开发者ID:wso2-attic,项目名称:carbon-qos,代码行数:67,代码来源:ThrottleModule.java


注:本文中的org.apache.neethi.Policy.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。