Ch11 Policies

1/20/2022 ServiceService Computing

# Ch11 Policies

  • Policy:requestor说我有什么条件,service说我需要什么条件才能提供服务,再由中间机构选择https://blog.csdn.net/yuwenruli/article/details/6675444

    img

    • img
  • 重要!policy what the quality of the service(QOS) ensuredimg

  • img

  • 例子:img

  • Policy是一些Policy alternative,它可以包含0个或多个policy assertion,用户可以选择一个policy alternative,但是必须满足里面的所有条件才能享受服务

    • vocabulary of policy是policy中所有的assertion types

    • vocabulary of policy alternative是policy alternative中所有的assertion types

    • 不能直接在policy中写assertion,只能写在其中的policy alternative中

  • Policy assertion是一个单一的要求

  • Policy assertion type是 policy assertion的一个抽象,一类policy

    • Policy assertion type只能识别Qname,就是namespace:name,所以以下两个是相同的img

    • 只有在assertion里面的policy expression才会被识别,所以以下灰色的不会被识别,fl:PaymentMethod是一个assertionimg

  • Policy vocabulary是在一个policy中Policy assertion type的集合img

  • normal form的policy格式:第一个元素必须是ExactlyOne,不能引用别的

    img

    • 例子:img
  • 可以在一个policy中include其他的policy;

    • policy可以用name来标识他的uriimg

    • 用reference URI来引用img

    • 引入后,会变成wsp:All,其中的child和引入的一样,不能自己引用自己

    • 例子:在同一个xml文档中用id表示并引用policy:img

    • 一个assertion中,只有直系child的第一个policy才生效img

  • Compact form的policy格式:wsp:policy==wsp:All

    • assertion默认是都要实现的,但是也可以用Optional属性表示某一个assertion可以是可选的,可实现也可以不实现img

    • 一样的意思,compact form和normal form的实现区别:img

    • 第一个表示所有都行,第二个表示所有都不行img

    • 交换律:assertion没有顺序,可以随便交换

    • 结合律:img

    • All中如果是空的,那么这行等于没写img

    • 一样的嵌套也可以化简:img

    • 分配律:

      imgimgimg

      • 3表示不能访问,no interaction
    • compact form转换为normal form例子:

      • compact form:img

      • normal form:imgimgimgimgimg

  • Intersecting Policies:

    • 两个assertions是compatible的条件:img

    • 两个policy alternative是compatible的条件:img

    • 两个policy是compatible的条件:img

    • WS-policy只关心Qname来判断是否是compatible的,而domain-specific compatibility processing关心Qname和attribute

    • Intersection类似assertion的交集,例子:只有compatible才能intersectionimg

    • 最后的结果就叫Effective policy,他会被放在soap消息的头部,而且需要DSPimg

    • 但是需要sementic post processing,否则如下图,单位不能又是美元又是欧元img

    • 例子:没有可以结合的就是incompatibleimg

    • 例子:不用post processing,因为是不同的assertionimg

  • Policy attachment:把policy和subject绑定起来的方法:

      1. 在subject的定义中加上
      1. policy在外部定义,并external binding到subject上img
    • 可以这样绑定,例子:imgimg

    • merge:把多个policy合成一个,相当于笛卡尔积,规则如下:

      img

      • 例子:P1和P2 mergeimgimgimgimgimg
    • port type的policy只可以是与binding无关的,因为port type是binding的接口

    • message的policy也只可以是与binding无关的,因为message可能被多个port type引用

    • input, output, fault也是

    • policy可以attach到wsdl文件中的port type, binding, port中

    • 在一个特定port的operation是两个policy的merge(port type:operation和binding:operation)

  • 在一个已经部署好的资源上添加policy:用external attachments,不用改变他的definition,即开闭原则:以下文件就表示把一个policy attach到一个资源上,而不用改变原有代码

    img

    • 例子:所有在这个uri下的文件都attach上这个policyimg
Last Updated: 11/19/2024, 1:54:38 PM