Commit 4fac8d76 authored by Fotis Soldatos's avatar Fotis Soldatos
Browse files

Merge branch 'policy/create-policy-domain-objects' into 'develop'

feat(policy): create policy domain objects

See merge request teraflow-h2020/controller!108
parents fe5badc2 8f66b535
Loading
Loading
Loading
Loading
+4 −11
Original line number Diff line number Diff line
@@ -16,15 +16,8 @@

package eu.teraflow.policy.context.model;

public class Uuid {

    private String id;

    public Uuid(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }
public enum ConfigActionEnum {
    UNDEFINED,
    SET,
    DELETE
}
+49 −0
Original line number Diff line number Diff line
/*
* Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package eu.teraflow.policy.context.model;

public class ConfigRule {

    private final ConfigActionEnum action;
    private final String resourceKey;
    private final String resourceValue;

    public ConfigRule(ConfigActionEnum action, String resourceKey, String resourceValue) {
        this.action = action;
        this.resourceKey = resourceKey;
        this.resourceValue = resourceValue;
    }

    public ConfigActionEnum getAction() {
        return action;
    }

    public String getResourceKey() {
        return resourceKey;
    }

    public String getResourceValue() {
        return resourceValue;
    }

    @Override
    public String toString() {
        return String.format(
                "%s:{action:\"%s\", resourceKey:\"%s\", resourceValue:\"%s\"}",
                getClass().getSimpleName(), action.toString(), resourceKey, resourceValue);
    }
}
+43 −0
Original line number Diff line number Diff line
/*
* Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package eu.teraflow.policy.context.model;

public class Constraint {

    private final String constraintType;
    private final String constraintValue;

    public Constraint(String constraintType, String constraintValue) {
        this.constraintType = constraintType;
        this.constraintValue = constraintValue;
    }

    public String getConstraintType() {
        return constraintType;
    }

    public String getConstraintValue() {
        return constraintValue;
    }

    @Override
    public String toString() {
        return String.format(
                "%s:{constraintType:\"%s\", constraintValue:\"%s\"}",
                getClass().getSimpleName(), constraintType, constraintValue);
    }
}
+49 −0
Original line number Diff line number Diff line
/*
* Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package eu.teraflow.policy.context.model;

public class EndPointId {

    private final TopologyId topologyId;
    private final String deviceId;
    private final String id;

    public EndPointId(TopologyId topologyId, String deviceId, String id) {
        this.topologyId = topologyId;
        this.deviceId = deviceId;
        this.id = id;
    }

    public TopologyId getTopologyId() {
        return topologyId;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public String getId() {
        return id;
    }

    @Override
    public String toString() {
        return String.format(
                "%s:{%s, deviceId:\"%s\", id:\"%s\"}",
                getClass().getSimpleName(), topologyId, deviceId, id);
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -33,4 +33,11 @@ public class Event {
    public EventTypeEnum getEventTypeEnum() {
        return eventType;
    }

    @Override
    public String toString() {
        return String.format(
                "%s:{timestamp:\"%f\", eventType:\"%s\"}",
                getClass().getSimpleName(), timestamp, eventType.toString());
    }
}
Loading