Overview

Common API Parts

All common API Parts like used headers are defined in Common REST API Guide.

Resources

The PMP contains 3 different resources. PolicyId, Policy and Component.

PolicyId and Policies have methods to deploy, revoke, remove and list policies. The PolicyId resource is a projection on policy objects that extracts just the id to reduce the bandwith, as the xml content of a policy could be really huge. The structure of policyId and policy are defined in the relevant section below.

At the end of the chapter a comprehensive example for component registration is appended.

Policies

The Policy resources is used to deploy, remove and list policies

The API contains the following services:

Show Policy by id

A GET request that shows the content of the policy as an xml String for the a Policy with the given id.

Example request

$ curl 'http://localhost:8080/policy/urn:policy:2:3/export' -i -H 'Accept: application/json'

Example response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 10157

{
  "id": {
    "policyType": "ILP",
    "scope": "2",
    "identifier": "3"
  },
  "deployed": true,
  "metaData": {},
  "policy": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<policy xmlns=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/enforcementLanguage\" xmlns:tns=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/enforcementLanguage\" xmlns:param=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/param\"\n  xmlns:pip=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/pip\" xmlns:function=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/function\" xmlns:constant=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/constant\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" id=\"urn:policy:test:b\" description=\"Policy for Fleet PoC Use Case 1\">\n\n  <preventiveMechanism id=\"decideOnStorageOfPositionUpdates\">\n    <description>Decides whether to store a position update coming from a vehicle.</description>\n    <event action=\"urn:action:test:cr-writeData\" isTry=\"false\">\n      <!-- is the eventType no longer a parameter of writeData? -->\n      <param:boolean name=\"eventType\">\n        <function:exists>\n          <constant:string value=\"attribute/longitude\" />\n        </function:exists>\n      </param:boolean>\n      <param:boolean name=\"basdf\" value=\"true\"/>\n      <param:int name=\"b\" value=\"2\" />\n      <param:float name=\"d\" value=\"2\" />\n      <param:double name=\"e\" value=\"2\" />\n      <param:string name=\"g\" value=\"abc\" />\n      <param:boolean name=\"h\" />\n      <param:int name=\"i\" />\n      <param:float name=\"j\" />\n      <param:double name=\"k\" />\n      <param:string name=\"l\" />\n      <param:long name=\"m\" />\n      <param:long name=\"n\" value=\"2\"/>\n    </event>\n    <condition>\n      <and>\n        <not>\n          <function:equals>\n            <function:contains mode=\"NONE\">\n              <pip:list default=\"[1, 2]\" method=\"urn:method:test:bla\" />\n              <constant:float value=\"2.0\" />\n              <constant:boolean value=\"true\" />\n              <constant:int value=\"2\" />\n              <constant:double value=\"2.0\" />\n              <constant:long value=\"2\" />\n              <constant:string value=\"blubb\" />\n            </function:contains>\n\n            <function:exists>\n              <constant:string value=\"name\" />\n            </function:exists>\n\n            <function:exists mode=\"AT_LEAST_ONE\">\n              <constant:string value=\"bla\" />\n              <constant:string value=\"blubb\" />\n            </function:exists>\n\n            <function:greater>\n              <function:size>\n                <pip:list default=\"[]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:greater>\n\n            <function:greaterEqual>\n              <function:size>\n                <pip:list default=\"[\u0027bla\u0027, \u0027blub\u0027  ,\u0027blib\u0027]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:greaterEqual>\n\n            <function:less>\n              <function:size>\n                <pip:list default=\"[]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:less>\n\n            <function:lessEqual>\n              <function:size>\n                <pip:list default=\"[]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:lessEqual>\n\n            <function:regex regex=\".*\\.docx\">\n              <param:string name=\"bla.docx\" />\n            </function:regex>\n\n            <function:regex regex=\".*\\.docx\" mode=\"EXACTLY_ONE\">\n              <param:string name=\"blubb.docx\" />\n              <param:string name=\"bla.jpg\" />\n            </function:regex>\n\n            <function:concat>\n              <pip:boolean default=\"true\" method=\"urn:method:test:bla\" ttl=\"123\"/>\n              <pip:int default=\"1\" method=\"urn:method:test:bla\" />\n              <pip:long default=\"3\" method=\"urn:method:test:bla\" />\n              <pip:float default=\"3\" method=\"urn:method:test:bla\" />\n              <pip:double default=\"4\" method=\"urn:method:test:bla\" />\n              <pip:string default=\"true\" method=\"urn:method:test:bla\" />\n              <pip:list default=\"[]\" method=\"urn:method:test:list\"></pip:list>\n            </function:concat>\n\n          </function:equals>\n        </not>\n        <or>\n          <false />\n          <true />\n          <implies>\n            <eventMatch action=\"urn:action:test:2\">\n              <param:float name=\"123\" value=\"2\" />\n            </eventMatch>\n            <pip:boolean default=\"true\" method=\"urn:method:test:b:c:d\" />\n          </implies>\n\n        </or>\n      </and>\n    </condition>\n    <authorizationDecision name=\"default_writeData\" fallback=\"sasf\">\n      <allow>\n        <modify>\n          <param:event name=\"latitude\">\n            <function:engine name=\"delete\" />\n          </param:event>\n          <param:event name=\"longitude\">\n            <function:engine name=\"delete\" />\n          </param:event>\n        </modify>\n      </allow>\n    </authorizationDecision>\n    <fallbackAuthorizationDecision name=\"sasf\">\n      <allow>\n        <modify>\n          <param:event name=\"latitude\">\n            <function:engine name=\"blur\" />\n          </param:event>\n          <param:event name=\"longitude\">\n            <function:engine name=\"blur\" />\n          </param:event>\n        </modify>\n      </allow>\n    </fallbackAuthorizationDecision>\n    <executeAction name=\"urn:action:test:sendmail\">\n      <param:string name=\"msg\" value=\"hallo\" />\n    </executeAction>\n  </preventiveMechanism>\n\n  <preventiveMechanism id=\"aggregatePrivateTrips\">\n    <description>Decide whether to read private trips in detail or aggregated only.</description>\n    <event action=\"urn:action:test:fleet-readTripData\" isTry=\"false\">\n    </event>\n    <condition>\n      <and>\n        <not>\n          <pip:boolean method=\"urn:method:test:isAssignedDriver\" default=\"false\">\n            <param:string name=\"userId\">\n              <pip:string method=\"urn:method:test:getUserName\" default=\"UNKNOWN\">\n                <param:string name=\"contextId\" />\n              </pip:string>\n            </param:string>\n          </pip:boolean>\n        </not>\n        <and>\n          <!-- values of roleName are not known -->\n          <pip:boolean method=\"urn:method:test:hasRole\" default=\"false\">\n            <param:string name=\"contextId\" />\n            <param:string name=\"roleName\" value=\"FleetManager\" />\n            <!-- FleetManager, Driver -->\n          </pip:boolean>\n          <and>\n            <pip:boolean method=\"urn:method:test:isShowPrivateTripsAggregated\" default=\"false\">\n              <param:string name=\"userName\">\n                <pip:string method=\"urn:method:test:getUserName\" default=\"UNKNOWN\">\n                  <param:string name=\"contextId\" />\n                </pip:string>\n              </param:string>\n            </pip:boolean>\n            <pip:boolean method=\"urn:method:test:isVehicleStolen\" default=\"false\">\n              <param:string name=\"vehicleId\" />\n            </pip:boolean>\n          </and>\n        </and>\n      </and>\n    </condition>\n    <authorizationDecision name=\"default_readTripData\">\n      <inhibit>\n        <delay amount=\"234\" unit=\"MINUTES\" />\n      </inhibit>\n    </authorizationDecision>\n  </preventiveMechanism>\n\n</policy>"
}

Response structure

Path Type Description

policy

String

The policy in in its xml notation

id

Object

The id of the policy

deployed

Boolean

Deployment status

metaData

Object

Key, value pair of tags for the policy

Listing deployed Policies

A GET request will list all deployed policies.

Response structure

Path Type Description

[]

Array

The list of deployed policies

Example request

$ curl 'http://localhost:8080/ws/policy/deployed' -i -H 'Accept: application/json'

Example response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 10182

[
  {
    "id": {
      "policyType": "ILP",
      "scope": "2",
      "identifier": "3"
    },
    "deployed": false,
    "metaData": {},
    "policy": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<policy xmlns=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/enforcementLanguage\" xmlns:tns=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/enforcementLanguage\" xmlns:param=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/param\"\n  xmlns:pip=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/pip\" xmlns:function=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/function\" xmlns:constant=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/constant\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" id=\"urn:policy:test:b\" description=\"Policy for Fleet PoC Use Case 1\">\n\n  <preventiveMechanism id=\"decideOnStorageOfPositionUpdates\">\n    <description>Decides whether to store a position update coming from a vehicle.</description>\n    <event action=\"urn:action:test:cr-writeData\" isTry=\"false\">\n      <!-- is the eventType no longer a parameter of writeData? -->\n      <param:boolean name=\"eventType\">\n        <function:exists>\n          <constant:string value=\"attribute/longitude\" />\n        </function:exists>\n      </param:boolean>\n      <param:boolean name=\"basdf\" value=\"true\"/>\n      <param:int name=\"b\" value=\"2\" />\n      <param:float name=\"d\" value=\"2\" />\n      <param:double name=\"e\" value=\"2\" />\n      <param:string name=\"g\" value=\"abc\" />\n      <param:boolean name=\"h\" />\n      <param:int name=\"i\" />\n      <param:float name=\"j\" />\n      <param:double name=\"k\" />\n      <param:string name=\"l\" />\n      <param:long name=\"m\" />\n      <param:long name=\"n\" value=\"2\"/>\n    </event>\n    <condition>\n      <and>\n        <not>\n          <function:equals>\n            <function:contains mode=\"NONE\">\n              <pip:list default=\"[1, 2]\" method=\"urn:method:test:bla\" />\n              <constant:float value=\"2.0\" />\n              <constant:boolean value=\"true\" />\n              <constant:int value=\"2\" />\n              <constant:double value=\"2.0\" />\n              <constant:long value=\"2\" />\n              <constant:string value=\"blubb\" />\n            </function:contains>\n\n            <function:exists>\n              <constant:string value=\"name\" />\n            </function:exists>\n\n            <function:exists mode=\"AT_LEAST_ONE\">\n              <constant:string value=\"bla\" />\n              <constant:string value=\"blubb\" />\n            </function:exists>\n\n            <function:greater>\n              <function:size>\n                <pip:list default=\"[]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:greater>\n\n            <function:greaterEqual>\n              <function:size>\n                <pip:list default=\"[\u0027bla\u0027, \u0027blub\u0027  ,\u0027blib\u0027]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:greaterEqual>\n\n            <function:less>\n              <function:size>\n                <pip:list default=\"[]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:less>\n\n            <function:lessEqual>\n              <function:size>\n                <pip:list default=\"[]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:lessEqual>\n\n            <function:regex regex=\".*\\.docx\">\n              <param:string name=\"bla.docx\" />\n            </function:regex>\n\n            <function:regex regex=\".*\\.docx\" mode=\"EXACTLY_ONE\">\n              <param:string name=\"blubb.docx\" />\n              <param:string name=\"bla.jpg\" />\n            </function:regex>\n\n            <function:concat>\n              <pip:boolean default=\"true\" method=\"urn:method:test:bla\" ttl=\"123\"/>\n              <pip:int default=\"1\" method=\"urn:method:test:bla\" />\n              <pip:long default=\"3\" method=\"urn:method:test:bla\" />\n              <pip:float default=\"3\" method=\"urn:method:test:bla\" />\n              <pip:double default=\"4\" method=\"urn:method:test:bla\" />\n              <pip:string default=\"true\" method=\"urn:method:test:bla\" />\n              <pip:list default=\"[]\" method=\"urn:method:test:list\"></pip:list>\n            </function:concat>\n\n          </function:equals>\n        </not>\n        <or>\n          <false />\n          <true />\n          <implies>\n            <eventMatch action=\"urn:action:test:2\">\n              <param:float name=\"123\" value=\"2\" />\n            </eventMatch>\n            <pip:boolean default=\"true\" method=\"urn:method:test:b:c:d\" />\n          </implies>\n\n        </or>\n      </and>\n    </condition>\n    <authorizationDecision name=\"default_writeData\" fallback=\"sasf\">\n      <allow>\n        <modify>\n          <param:event name=\"latitude\">\n            <function:engine name=\"delete\" />\n          </param:event>\n          <param:event name=\"longitude\">\n            <function:engine name=\"delete\" />\n          </param:event>\n        </modify>\n      </allow>\n    </authorizationDecision>\n    <fallbackAuthorizationDecision name=\"sasf\">\n      <allow>\n        <modify>\n          <param:event name=\"latitude\">\n            <function:engine name=\"blur\" />\n          </param:event>\n          <param:event name=\"longitude\">\n            <function:engine name=\"blur\" />\n          </param:event>\n        </modify>\n      </allow>\n    </fallbackAuthorizationDecision>\n    <executeAction name=\"urn:action:test:sendmail\">\n      <param:string name=\"msg\" value=\"hallo\" />\n    </executeAction>\n  </preventiveMechanism>\n\n  <preventiveMechanism id=\"aggregatePrivateTrips\">\n    <description>Decide whether to read private trips in detail or aggregated only.</description>\n    <event action=\"urn:action:test:fleet-readTripData\" isTry=\"false\">\n    </event>\n    <condition>\n      <and>\n        <not>\n          <pip:boolean method=\"urn:method:test:isAssignedDriver\" default=\"false\">\n            <param:string name=\"userId\">\n              <pip:string method=\"urn:method:test:getUserName\" default=\"UNKNOWN\">\n                <param:string name=\"contextId\" />\n              </pip:string>\n            </param:string>\n          </pip:boolean>\n        </not>\n        <and>\n          <!-- values of roleName are not known -->\n          <pip:boolean method=\"urn:method:test:hasRole\" default=\"false\">\n            <param:string name=\"contextId\" />\n            <param:string name=\"roleName\" value=\"FleetManager\" />\n            <!-- FleetManager, Driver -->\n          </pip:boolean>\n          <and>\n            <pip:boolean method=\"urn:method:test:isShowPrivateTripsAggregated\" default=\"false\">\n              <param:string name=\"userName\">\n                <pip:string method=\"urn:method:test:getUserName\" default=\"UNKNOWN\">\n                  <param:string name=\"contextId\" />\n                </pip:string>\n              </param:string>\n            </pip:boolean>\n            <pip:boolean method=\"urn:method:test:isVehicleStolen\" default=\"false\">\n              <param:string name=\"vehicleId\" />\n            </pip:boolean>\n          </and>\n        </and>\n      </and>\n    </condition>\n    <authorizationDecision name=\"default_readTripData\">\n      <inhibit>\n        <delay amount=\"234\" unit=\"MINUTES\" />\n      </inhibit>\n    </authorizationDecision>\n  </preventiveMechanism>\n\n</policy>"
  }
]

Add a policy

A POST request that adds a new policy to the list of policies. The content of the post is the policy in its xml notation.

Example request

$ curl 'http://localhost:8080/policy/' -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<policy xmlns=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/enforcementLanguage\" xmlns:tns=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/enforcementLanguage\" xmlns:param=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/param\"\n  xmlns:pip=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/pip\" xmlns:function=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/function\" xmlns:constant=\"http://www.iese.fraunhofer.de/ind2uce/3.0.25/constant\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" id=\"urn:policy:test:b\" description=\"Policy for Fleet PoC Use Case 1\">\n\n  <preventiveMechanism id=\"decideOnStorageOfPositionUpdates\">\n    <description>Decides whether to store a position update coming from a vehicle.</description>\n    <event action=\"urn:action:test:cr-writeData\" isTry=\"false\">\n      <!-- is the eventType no longer a parameter of writeData? -->\n      <param:boolean name=\"eventType\">\n        <function:exists>\n          <constant:string value=\"attribute/longitude\" />\n        </function:exists>\n      </param:boolean>\n      <param:boolean name=\"basdf\" value=\"true\"/>\n      <param:int name=\"b\" value=\"2\" />\n      <param:float name=\"d\" value=\"2\" />\n      <param:double name=\"e\" value=\"2\" />\n      <param:string name=\"g\" value=\"abc\" />\n      <param:boolean name=\"h\" />\n      <param:int name=\"i\" />\n      <param:float name=\"j\" />\n      <param:double name=\"k\" />\n      <param:string name=\"l\" />\n      <param:long name=\"m\" />\n      <param:long name=\"n\" value=\"2\"/>\n    </event>\n    <condition>\n      <and>\n        <not>\n          <function:equals>\n            <function:contains mode=\"NONE\">\n              <pip:list default=\"[1, 2]\" method=\"urn:method:test:bla\" />\n              <constant:float value=\"2.0\" />\n              <constant:boolean value=\"true\" />\n              <constant:int value=\"2\" />\n              <constant:double value=\"2.0\" />\n              <constant:long value=\"2\" />\n              <constant:string value=\"blubb\" />\n            </function:contains>\n\n            <function:exists>\n              <constant:string value=\"name\" />\n            </function:exists>\n\n            <function:exists mode=\"AT_LEAST_ONE\">\n              <constant:string value=\"bla\" />\n              <constant:string value=\"blubb\" />\n            </function:exists>\n\n            <function:greater>\n              <function:size>\n                <pip:list default=\"[]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:greater>\n\n            <function:greaterEqual>\n              <function:size>\n                <pip:list default=\"[\u0027bla\u0027, \u0027blub\u0027  ,\u0027blib\u0027]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:greaterEqual>\n\n            <function:less>\n              <function:size>\n                <pip:list default=\"[]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:less>\n\n            <function:lessEqual>\n              <function:size>\n                <pip:list default=\"[]\" method=\"urn:method:test:bla\" />\n              </function:size>\n              <constant:double value=\"234\" />\n            </function:lessEqual>\n\n            <function:regex regex=\".*\\.docx\">\n              <param:string name=\"bla.docx\" />\n            </function:regex>\n\n            <function:regex regex=\".*\\.docx\" mode=\"EXACTLY_ONE\">\n              <param:string name=\"blubb.docx\" />\n              <param:string name=\"bla.jpg\" />\n            </function:regex>\n\n            <function:concat>\n              <pip:boolean default=\"true\" method=\"urn:method:test:bla\" ttl=\"123\"/>\n              <pip:int default=\"1\" method=\"urn:method:test:bla\" />\n              <pip:long default=\"3\" method=\"urn:method:test:bla\" />\n              <pip:float default=\"3\" method=\"urn:method:test:bla\" />\n              <pip:double default=\"4\" method=\"urn:method:test:bla\" />\n              <pip:string default=\"true\" method=\"urn:method:test:bla\" />\n              <pip:list default=\"[]\" method=\"urn:method:test:list\"></pip:list>\n            </function:concat>\n\n          </function:equals>\n        </not>\n        <or>\n          <false />\n          <true />\n          <implies>\n            <eventMatch action=\"urn:action:test:2\">\n              <param:float name=\"123\" value=\"2\" />\n            </eventMatch>\n            <pip:boolean default=\"true\" method=\"urn:method:test:b:c:d\" />\n          </implies>\n\n        </or>\n      </and>\n    </condition>\n    <authorizationDecision name=\"default_writeData\" fallback=\"sasf\">\n      <allow>\n        <modify>\n          <param:event name=\"latitude\">\n            <function:engine name=\"delete\" />\n          </param:event>\n          <param:event name=\"longitude\">\n            <function:engine name=\"delete\" />\n          </param:event>\n        </modify>\n      </allow>\n    </authorizationDecision>\n    <fallbackAuthorizationDecision name=\"sasf\">\n      <allow>\n        <modify>\n          <param:event name=\"latitude\">\n            <function:engine name=\"blur\" />\n          </param:event>\n          <param:event name=\"longitude\">\n            <function:engine name=\"blur\" />\n          </param:event>\n        </modify>\n      </allow>\n    </fallbackAuthorizationDecision>\n    <executeAction name=\"urn:action:test:sendmail\">\n      <param:string name=\"msg\" value=\"hallo\" />\n    </executeAction>\n  </preventiveMechanism>\n\n  <preventiveMechanism id=\"aggregatePrivateTrips\">\n    <description>Decide whether to read private trips in detail or aggregated only.</description>\n    <event action=\"urn:action:test:fleet-readTripData\" isTry=\"false\">\n    </event>\n    <condition>\n      <and>\n        <not>\n          <pip:boolean method=\"urn:method:test:isAssignedDriver\" default=\"false\">\n            <param:string name=\"userId\">\n              <pip:string method=\"urn:method:test:getUserName\" default=\"UNKNOWN\">\n                <param:string name=\"contextId\" />\n              </pip:string>\n            </param:string>\n          </pip:boolean>\n        </not>\n        <and>\n          <!-- values of roleName are not known -->\n          <pip:boolean method=\"urn:method:test:hasRole\" default=\"false\">\n            <param:string name=\"contextId\" />\n            <param:string name=\"roleName\" value=\"FleetManager\" />\n            <!-- FleetManager, Driver -->\n          </pip:boolean>\n          <and>\n            <pip:boolean method=\"urn:method:test:isShowPrivateTripsAggregated\" default=\"false\">\n              <param:string name=\"userName\">\n                <pip:string method=\"urn:method:test:getUserName\" default=\"UNKNOWN\">\n                  <param:string name=\"contextId\" />\n                </pip:string>\n              </param:string>\n            </pip:boolean>\n            <pip:boolean method=\"urn:method:test:isVehicleStolen\" default=\"false\">\n              <param:string name=\"vehicleId\" />\n            </pip:boolean>\n          </and>\n        </and>\n      </and>\n    </condition>\n    <authorizationDecision name=\"default_readTripData\">\n      <inhibit>\n        <delay amount=\"234\" unit=\"MINUTES\" />\n      </inhibit>\n    </authorizationDecision>\n  </preventiveMechanism>\n\n</policy>"'

Example response

The response contains true if creating the policy was successful.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 4

true

Deploy an existing policy

A POST request that deploys an existing policy. The policy is defined by the id that is part of the url.

Example request

$ curl 'http://localhost:8080/policy/urn:policy:2:3/deploy' -i -H 'Accept: application/json'

Example response

The response contains true if deployment was successful.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 4

true

Revokes an existing policy

A GET request that revokes (undeployes) an existing policy. The policy is defined by the id that is part of the url.

Example request

$ curl 'http://localhost:8080/policy/urn:policy:2:3/revoke' -i -H 'Accept: application/json'

Example response

The response contains true if the undeployment was successful.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 4

true

Removes an existing policy

A DELETE request that removes an existing policy. The policy is defined by the id that is part of the url. If the policy is deployed, PMP undeployes it first.

Example request

$ curl 'http://localhost:8080/policy/urn:policy:2:3' -i -X DELETE -H 'Accept: application/json'

Example response

The response contains true if deletion was successful.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 4

true

Status of an existing policy

A GET request that retreives the deployment status of an existing policy. The policy is defined by the id that is part of the url.

Example request

$ curl 'http://localhost:8080/ws/policy/urn:policy:2:3/status' -i -H 'Accept: application/json'

Example response

The response contains true if the policy is currently being deployed.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 4

true

List of ids for all existing policies

A GET request that retreives the ids of all policies.

Example request

$ curl 'http://localhost:8080/ws/policyId/test' -i -H 'Accept: application/json'

Example response

The response contains the ids all the policies.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 76

[
  {
    "policyType": "ILP",
    "scope": "2",
    "identifier": "3"
  }
]

Response structure

The id consists of 3 parts appended with ":".

Path Type Description

[0].policyType

String

One of ILP,SLP,SLPT,ILPT

[0].scope

String

1st part of the id, the scope of the policy

[0].identifier

String

2nd part of the id, the specific identifier of the policy

List of ids for all deployed policies

A GET request that retreives the ids of all deployed policies.

Example request

$ curl 'http://localhost:8080/ws/policyId/test' -i -H 'Accept: application/json'

Example response

The response contains the ids all deployed policies. The response struture is described in All PolicyIds.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 76

[
  {
    "policyType": "ILP",
    "scope": "2",
    "identifier": "3"
  }
]

Components

Lookup Component

A GET request that retreives a component by its id.

Example request

$ curl 'http://localhost:8080/ws/component/urn:component:test:pip:211' -i -H 'Accept: application/json'

Example response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 119

{
  "componentInterfaces": [],
  "id": {
    "componentType": "PIP",
    "identifier": "211",
    "scope": "test"
  }
}

Register a Component

A POST request to register a component (PEP,PIP,PXP) at PMP

Example request

$ curl 'http://localhost:8080/ws/component' -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
  "componentInterfaces": [],
  "id": {
    "componentType": "PIP",
    "identifier": "211",
    "scope": "test"
  }
}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 4

true

Fake Component Registration

The following JSON snippets can be used to register fake components using Swagger-UI (http://localhost:8080/swagger-ui.html#!/component-controller/registerComponentUsingPOST)

PEP events

{
  "id": {
    "componentType" : "PEP",
    "identifier": "urn:component:test:pep:example1"
  },
  "urls": [
    "rmi://localhost:1111/ind2ucePEP"
  ],
  "componentInterfaces": [
    {
      "type": "PepInterfaceDescription",
      "event": {
        "platform":"test",
        "context":"local",
        "action": "createConstructionSite"
      },
      "preventive": true,
      "methodName": "delete",
      "returnType": "java.lang.Boolean",
      "description": "Log",
      "parameters": []
    },
    {
      "type": "PepInterfaceDescription",
      "event": {
        "platform":"test",
        "context":"local",
        "action": "closeConstructionSite"
      },
      "preventive": true,
      "methodName": "delete",
      "returnType": "java.lang.Boolean",
      "description": "Log",
      "parameters": [
        {
          "name": "id",
          "description": "id of construction site",
          "type": "java.lang.String"
        }
      ]
    },
    {
      "type": "PepInterfaceDescription",
      "event": {
        "platform":"test",
        "context":"local",
        "action": "showEmployee"
      },
      "preventive": true,
      "methodName": "delete",
      "returnType": "java.lang.Boolean",
      "description": "Log",
      "parameters": [
        {
          "name": "id",
          "description": "id of employee",
          "type": "java.lang.String"
        },{
          "name": "role",
          "description": "role of employee",
          "type": "java.lang.String"
        }
      ]
    }
  ]
}

PIP methods

{
  "id": {
    "componentType": "PIP",
    "identifier": "pipDummy1"
  },
  "urls": [
    "http://localhost:1111/ind2ucePIP1"
  ],
  "componentInterfaces": [
    {
      "type": "InterfaceDescription",
      "methodName": "getName",
      "returnType": "java.lang.String",
      "description": "Name magic",
      "parameters": [
        {
          "name": "id",
          "description": "Id of employee",
          "type": "java.lang.String",
          "mandatory": true
        }
      ]
    },
 {
      "type": "InterfaceDescription",
      "methodName": "getAddress",
      "returnType": "java.lang.String",
      "description": "Address magic",
      "parameters": [
        {
          "name": "id",
          "description": "Id of employee",
          "type": "java.lang.String",
          "mandatory": true
        }
      ]
    },
{
      "type": "InterfaceDescription",
      "methodName": "isConstructionSiteManager",
      "returnType": "java.lang.Boolean",
      "description": "check if construction site manager",
      "parameters": [
        {
          "name": "id",
          "description": "Id of employee",
          "type": "java.lang.String",
          "mandatory": true
        }
      ]
    },
    {
      "type": "InterfaceDescription",
      "methodName": "isAllWorkDone",
      "returnType": "java.lang.Boolean",
      "description": "check if construction site manager",
      "parameters": [
        {
          "name": "siteId",
          "description": "Id of construction site",
          "type": "java.lang.String",
          "mandatory": true
        },
        {
          "name": "fulfillmentRate",
          "description": "fulfillment rate of all work in percentage",
          "type": "java.lang.Float",
          "mandatory": false
        }
      ]
    },
{
      "type": "InterfaceDescription",
      "methodName": "getEmployees",
      "returnType": "java.util.List",
      "description": "List of all employees on construction site",
      "parameters": []
    },
    {
      "type": "InterfaceDescription",
      "methodName": "getCityOfConstructionSite",
      "returnType": "java.lang.String",
      "description": "Get city in which construction site is located",
      "parameters": [
        {
          "name": "siteId",
          "description": "id of construction site",
          "type": "java.lang.String",
          "mandatory": true
        },
{
          "name": "country",
          "description": "country of construction site",
          "type": "java.lang.String",
          "mandatory": false
        }
      ]
    },
    {
      "type": "InterfaceDescription",
      "methodName": "getConstructionSiteMatchingTo",
      "returnType": "java.lang.String",
      "description": "Find construction site",
      "parameters": [
        {
          "name": "name",
          "description": "search for string in construction site name",
          "type": "java.lang.String",
          "mandatory": true
        },
{
          "name": "active",
          "description": "is the construction site still active",
          "type": "java.lang.Boolean",
          "mandatory": true
        }
        ,{
          "name": "numberOfEmployee",
          "description": "number of employees",
          "type": "java.lang.Integer",
          "mandatory": false
        }
      ]
    }
  ]
}

PXP actions

{
  "id": {
    "componentType":"PXP",
    "identifier": "pxpDummy1"
  },
  "urls": [
    "rmi://localhost:1111/ind2ucePXP"
  ],
  "componentInterfaces": [
    {
      "type": "InterfaceDescription",
      "methodName": "urn:action:test:log",
      "returnType": "java.lang.Boolean",
      "description": "Log",
      "parameters": [{
          "name": "message",
          "description": "Message to log",
          "type": "java.lang.String",
          "mandatory": true
        }]
    },
    {
      "type": "InterfaceDescription",
      "methodName": "urn:action:test:sendMail",
      "returnType": "java.lang.Boolean",
      "description": "Send a message to receiver",
      "parameters": [{
          "name": "address",
          "description": "Email address",
          "type": "java.lang.String",
          "mandatory": true
        },
        {
          "name": "content",
          "description": "Content of Email",
          "type": "java.lang.String",
          "mandatory": true
        }]
    },
    {
      "type": "InterfaceDescription",
      "methodName": "urn:action:test:alertOnSite",
      "returnType": "java.lang.Boolean",
      "description": "Honk the alert horn on construction site",
      "parameters": [{
          "name": "duration",
          "description": "Duration of alert",
          "type": "java.lang.Integer",
          "mandatory": true
        }]
    },
    {
      "type": "InterfaceDescription",
      "methodName": "urn:action:test:fireEmployee",
      "returnType": "java.lang.Boolean",
      "description": "Fire an employee",
      "parameters": [{
          "name": "daysUntilFiring",
          "description": "Duration of action",
          "type": "java.lang.Integer",
          "mandatory": true
        },{
          "name": "isFiringDoneNicely",
          "description": "is firing done nicely",
          "type": "java.lang.Boolean",
          "mandatory": false
        },{
          "name": "messageToTell",
          "description": "Message to tell the employee",
          "type": "java.lang.String",
          "mandatory": true
        }]
    }
  ]
}