Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to digitalpy 0.3.14 #675

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FreeTAKServer/components/core/cot_parser/xml_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class XmlSerializer(SerializerAbstract):
def serialize_model_to_CoT(self, modelObject, tagName="event", level=0):
from lxml.etree import Element # pylint: disable=no-name-in-module

if modelObject.__class__.__name__ == "Event":
if modelObject.__class__.__name__ == "event":
request = ObjectFactory.get_new_instance("request")
request.set_action("ConvertHumanReadableToMachineReadable")
request.set_context("MEMORY")
Expand Down Expand Up @@ -222,7 +222,7 @@ def from_fts_object_to_format(
"""
# this function is responsible for converting the base type from
# human readable back to machine readable
if FTSObject.__class__.__name__ == "Event":
if FTSObject.__class__.__name__ == "event":
request = ObjectFactory.get_new_instance("request")
request.set_action("ConvertHumanReadableToMachineReadable")
request.set_context("MEMORY")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
pathlib.PurePath(CURRENT_COMPONENT_PATH, "configuration/manifest.ini")
)

BASE_OBJECT_NAME = "Event"
BASE_OBJECT_NAME = "event"
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[actionmapping]
??GetNodeParent = FreeTAKServer.components.core.fts_domain.fts_domain_facade.FtsDomain.get_parent

??CreateNode = FreeTAKServer.components.core.fts_domain.fts_domain_facade.FtsDomain.create_node

??DictToNode = FreeTAKServer.components.core.fts_domain.fts_domain_facade.FtsDomain.convert_dict_to_node

??SerializeToNode = FreeTAKServer.components.core.fts_domain.controllers.serialization.serializer.Serializer.serialize_to_node

??SerializeFromNode = FreeTAKServer.components.core.fts_domain.controllers.serialization.serializer.Serializer.serialize_from_node

??HealthCheck = FreeTAKServer.components.core.fts_domain.fts_domain_facade.FtsDomain.get_health

??GetMetrics = FreeTAKServer.components.core.fts_domain.fts_domain_facade.FtsDomain.get_metrics

??TestMetrics = FreeTAKServer.components.core.fts_domain.fts_domain_facade.FtsDomain.test_metrics

??GetTraces = FreeTAKServer.components.core.fts_domain.fts_domain_facade.FtsDomain.get_traces

??TestTracing = FreeTAKServer.components.core.fts_domain.fts_domain_facade.FtsDomain.test_tracing

[Request]
__class = digitalpy.core.zmanager.impl.default_request.DefaultRequest

[ActionMapper]
__class = digitalpy.core.zmanager.impl.default_action_mapper.DefaultActionMapper

[event_manager]
__class = digitalpy.core.main.impl.default_event_manager.DefaultEventManager

[Response]
__class = digitalpy.core.zmanager.impl.default_response.DefaultResponse

[FtsDomain]
__class = FreeTAKServer.components.core.fts_domain.fts_domain_facade.FtsDomain

[DomainMetrics]
__class = digitalpy.core.component_management.impl.opentel_metrics.OpenTelMetrics
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[DomainManifest]
name=domain
[fts_domainmanifest]
name=fts_domain
requiredAlfaVersion=0.2.7
version=0.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DICTIONARY = "dictionary"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from digitalpy.core.zmanager.response import Response
from digitalpy.core.zmanager.action_mapper import ActionMapper
from digitalpy.core.digipy_configuration.configuration import Configuration
from digitalpy.core.parsing.load_configuration import Configuration as LoadConf
from digitalpy.core.parsing.load_configuration import ModelConfiguration as LoadConf
from digitalpy.core.domain.node import Node
from .domain import Domain
from lxml import etree
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from digitalpy.core.digipy_configuration.configuration import Configuration
from digitalpy.core.zmanager.request import Request
from digitalpy.core.zmanager.response import Response
from digitalpy.core.parsing.load_configuration import Configuration
from digitalpy.core.parsing.load_configuration import ModelConfiguration
from digitalpy.core.domain.node import Node
from digitalpy.core.main.controller import Controller
from digitalpy.core.main.object_factory import ObjectFactory
Expand Down Expand Up @@ -40,7 +40,7 @@ def add_child(self, node: Node, child: Node, **kwargs) -> None:
"""
return node.add_child(child)

def create_node(self, configuration: Configuration, object_class_name: str, id:str=None, **kwargs) -> Node:
def create_node(self, configuration: ModelConfiguration, object_class_name: str, id:str=None, **kwargs) -> Node:
"""this method creates a new node object

Args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class XmlSerializer(SerializerAbstract):
def serialize_model_to_CoT(self, modelObject, tagName="event", level=0):
from lxml.etree import Element # pylint: disable=no-name-in-module

if modelObject.__class__.__name__ == "Event":
if modelObject.__class__.__name__ == "event":
request = ObjectFactory.get_new_instance("request")
request.set_action("ConvertHumanReadableToMachineReadable")
request.set_context("MEMORY")
Expand Down Expand Up @@ -225,7 +225,7 @@ def from_fts_object_to_format(
"""
# this function is responsible for converting the base type from
# human readable back to machine readable
if FTSObject.__class__.__name__ == "Event":
if FTSObject.__class__.__name__ == "event":
request = ObjectFactory.get_new_instance("request")
request.set_action("ConvertHumanReadableToMachineReadable")
request.set_context("MEMORY")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
should be defined as follows, _name.py containing a class Name with the class
exported here as Name. The class must be exported here as it is used by the
domain controller class to get classes based on the object configurations"""
from ._event import Event as Event
from ._event import event as event
from ._detail import detail as detail
from ._link import link as link
from ._contact import contact as contact
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from FreeTAKServer.model.FTSModel.fts_protocol_object import FTSProtocolObject
from FreeTAKServer.model.FTSModelVariables.DestVariables import DestVariables as vars
from FreeTAKServer.components.core.abstract_component.cot_property import CoTProperty
from digitalpy.core.parsing.load_configuration import Configuration
from digitalpy.core.parsing.load_configuration import ModelConfiguration
from FreeTAKServer.components.core.abstract_component.cot_node import CoTNode


class dest(CoTNode):
def __init__(self, configuration: Configuration, model, oid=None):
def __init__(self, configuration: ModelConfiguration, model, oid=None):
super().__init__(self.__class__.__name__, configuration, model, oid)
self.cot_attributes["callsign"] = None
self.cot_attributes["mission"] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class detail(CoTNode):

__index = -1

def __init__(self, configuration, model):
super().__init__(self.__class__.__name__, configuration, model)
def __init__(self, configuration, model, oid=None):
super().__init__(self.__class__.__name__, configuration, model, oid)

@CoTProperty
def marti(self) -> 'marti':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from digitalpy.core.parsing.load_configuration import Configuration
from digitalpy.core.parsing.load_configuration import ModelConfiguration
from .model_constants import EventVariables as vars
import uuid
from typing import TYPE_CHECKING
Expand All @@ -13,7 +13,7 @@

DATETIME_FMT = "%Y-%m-%dT%H:%M:%S.%fZ"
DEFAULT_STALE_TIME = 60
class Event(CoTNode):
class event(CoTNode):
# TODO: fix emergency methods
# Event.py
"""Python implementation of the Class Event
Expand All @@ -29,7 +29,7 @@ class Event(CoTNode):

# default constructor

def __init__(self, configuration: Configuration, model, oid=None):
def __init__(self, configuration: ModelConfiguration, model, oid=None):

super().__init__(self.__class__.__name__, configuration, model, oid)
# modify the xml object to be event instead of Event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from FreeTAKServer.model.FTSModel.fts_protocol_object import FTSProtocolObject
from FreeTAKServer.model.FTSModel.Dest import Dest as DestObject
from digitalpy.core.parsing.load_configuration import Configuration
from digitalpy.core.parsing.load_configuration import ModelConfiguration
from FreeTAKServer.components.core.abstract_component.cot_node import CoTNode
from FreeTAKServer.components.core.abstract_component.cot_property import CoTProperty

Expand All @@ -20,10 +20,10 @@ class marti(
): # ignore this because the class name must match that of the CoT ignore pylint: disable=invalid-name
__counter = counter()

def __init__(self, configuration: Configuration, model):
def __init__(self, configuration: ModelConfiguration, model, oid=None):
# self.__dest = [DestObject(self.__counter)]
# self.__tempdest = self.__dest
super().__init__(self.__class__.__name__, configuration, model)
super().__init__(self.__class__.__name__, configuration, model, oid)
self.cot_attributes["dest"] = []
self.__index = 0
# self.__firstrun = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from FreeTAKServer.components.extended.mission.domain import details

if TYPE_CHECKING:
from FreeTAKServer.components.core.domain.domain import MissionContentData
from FreeTAKServer.components.core.fts_domain.domain import MissionContentData
from FreeTAKServer.components.extended.mission.domain import externalData

class MissionChangeRecord(CoTNode):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from FreeTAKServer.components.core.abstract_component.cot_node import CoTNode
from FreeTAKServer.components.core.abstract_component.cot_property import CoTProperty

from digitalpy.core.parsing.load_configuration import Configuration
from digitalpy.core.parsing.load_configuration import ModelConfiguration

class usericon(CoTNode):
def __init__(self, configuration: Configuration, model):
def __init__(self, configuration: ModelConfiguration, model):

super().__init__(self.__class__.__name__, configuration, model)
self.cot_attributes["iconsetpath"] = None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from digitalpy.core.component_management.impl.default_facade import DefaultFacade
from FreeTAKServer.core.configuration.MainConfig import MainConfig
from FreeTAKServer.components.core.domain.configuration.domain_constants import (
from FreeTAKServer.components.core.fts_domain.configuration.domain_constants import (
ACTION_MAPPING_PATH,
LOGGING_CONFIGURATION_PATH,
INTERNAL_ACTION_MAPPING_PATH,
Expand All @@ -14,7 +14,7 @@
config = MainConfig.instance()


class Domain(DefaultFacade):
class FtsDomain(DefaultFacade):
"""This is the facade class for the domain component, it is responsible
for handling all public routing and forwards all requests to the internal routing
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"type": "object",
"anyOf": [
{
"$ref": "#/definitions/Event"
"$ref": "#/definitions/event"
}
]
}
},
"definitions": {
"Event": {
"event": {
"type": "object",
"description": "represents a TAK event: this class is instantiated with a standard set of values.",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
pathlib.PurePath(CURRENT_COMPONENT_PATH, "persistence/xml_serializer.json")
)

BASE_OBJECT_NAME = "Event"
BASE_OBJECT_NAME = "event"

XML_SERIALIZER = "xml_serializer"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from digitalpy.core.parsing.load_configuration import Configuration
from digitalpy.core.parsing.load_configuration import ModelConfiguration
import uuid
from datetime import datetime as dt
from FreeTAKServer.components.core.abstract_component.cot_node import CoTNode
from FreeTAKServer.components.core.abstract_component.cot_property import CoTProperty


class Event(CoTNode):
def __init__(self, configuration: Configuration, model):
def __init__(self, configuration: ModelConfiguration, model):
super().__init__(self.__class__.__name__, configuration, model)
self.cot_attributes["version"] = None
self.cot_attributes["uid"] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

CONFIGURATION_FORMAT = "json"

BASE_OBJECT_NAME = "Event"
BASE_OBJECT_NAME = "event"

CURRENT_COMPONENT_PATH = pathlib.Path(__file__).parent.parent.absolute()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"type": "object",
"anyOf": [
{
"$ref": "#/definitions/Event"
"$ref": "#/definitions/event"
}
]
}
},
"definitions": {
"Event": {
"event": {
"type": "object",
"description": "represents a TAK event: this class is instantiated with a standard set of values.",
"properties": {
Expand Down
4 changes: 2 additions & 2 deletions FreeTAKServer/components/extended/cotmanager/domain/_event.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from digitalpy.core.parsing.load_configuration import Configuration
from digitalpy.core.parsing.load_configuration import ModelConfiguration
import uuid
from datetime import datetime as dt
from FreeTAKServer.components.core.abstract_component.cot_node import CoTNode
from FreeTAKServer.components.core.abstract_component.cot_property import CoTProperty


class Event(CoTNode):
def __init__(self, configuration: Configuration, model):
def __init__(self, configuration: ModelConfiguration, model):
super().__init__(self.__class__.__name__, configuration, model)
self.cot_attributes["version"] = None
self.cot_attributes["uid"] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
)


BASE_OBJECT_NAME = "Event"
BASE_OBJECT_NAME = "event"

EMERGENCY_OFF = "emergency_delete"

Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
DEST_CLASS,
)

from FreeTAKServer.components.core.domain.domain._event import Event
from FreeTAKServer.components.core.fts_domain.domain._event import event
from FreeTAKServer.core.configuration.MainConfig import MainConfig
import pickle
from geopy import distance
Expand Down Expand Up @@ -59,7 +59,7 @@ def convert_type(self, model_object, **kwargs)->None:
response = self.execute_sub_action("ConvertHumanReadableToMachineReadable")
model_object.type = response.get_value("machine_readable_type")

def filter_by_distance(self, emergency: Event):
def filter_by_distance(self, emergency: event):
"""filter who receives this emergency based on their distance from the emergency"""
if config.EmergencyRadius==0:
self.request.set_value('recipients', "*")
Expand All @@ -69,7 +69,7 @@ def filter_by_distance(self, emergency: Event):
if self.validate_user_distance(emergency, connection_obj):
self.request.get_value('recipients').append(str(connection_obj.get_oid()))

def validate_user_distance(self, emergency: Event, connection):
def validate_user_distance(self, emergency: event, connection):
connection_model_object = connection.model_object
connection_location = connection_model_object.point

Expand Down
Loading
Loading