Example #1
0
    def __init__(self, monolithe_config, api_info):
        """ Initializes a _JavaSDKAPIVersionFileWriter

        """
        super(APIVersionWriter,
              self).__init__(package="monolithe.generators.lang.java")

        self.api_version = api_info["version"]
        self._api_version_string = SDKUtils.get_string_version(
            self.api_version)
        self.api_root = api_info["root"]
        self.api_prefix = api_info["prefix"]

        self.monolithe_config = monolithe_config
        self._output = self.monolithe_config.get_option(
            "output", "transformer")
        self._name = self.monolithe_config.get_option("name", "transformer")
        self._class_prefix = ""
        self._product_accronym = self.monolithe_config.get_option(
            "product_accronym")
        self._product_name = self.monolithe_config.get_option("product_name")
        self._url = self.monolithe_config.get_option("url", "transformer")

        self._package_prefix = self._get_package_prefix(self._url)
        self._package_name = self._package_prefix + '.' + self._name + '.' + SDKUtils.get_string_version(
            self.api_version)
        self._package_subdir = self._package_name.replace('.', '/')

        self._base_output_directory = "%s/java" % (self._output)
        self.output_directory = "%s/src/main/java/%s" % (
            self._base_output_directory, self._package_subdir)
        self.override_folder = os.path.normpath("%s/__overrides" %
                                                self._base_output_directory)
        self.fetchers_path = "/fetchers/"

        self.attrs_defaults = RawConfigParser()
        path = "%s/java/__attributes_defaults/attrs_defaults.ini" % self._output
        self.attrs_defaults.optionxform = str
        self.attrs_defaults.read(path)

        self.attrs_types = RawConfigParser()
        path = "%s/java/__attributes_defaults/attrs_types.ini" % self._output
        self.attrs_types.optionxform = str
        self.attrs_types.read(path)

        self.library_version = self.monolithe_config.get_option(
            "version", "transformer")

        with open("%s/java/__code_header" % self._output, "r") as f:
            self.header_content = f.read()
Example #2
0
    def __init__(self, monolithe_config, api_info):
        """ Initializes a _JavaSDKAPIVersionFileWriter

        """
        super(APIVersionWriter, self).__init__(package="monolithe.generators.lang.java")

        self.api_version = api_info["version"]
        self._api_version_string = SDKUtils.get_string_version(self.api_version)
        self.api_root = api_info["root"]
        self.api_prefix = api_info["prefix"]

        self.monolithe_config = monolithe_config
        self._output = self.monolithe_config.get_option("output", "transformer")
        self._name = self.monolithe_config.get_option("name", "transformer")
        self._class_prefix = ""
        self._product_accronym = self.monolithe_config.get_option("product_accronym")
        self._product_name = self.monolithe_config.get_option("product_name")

        self.output_directory = "%s/java/%s/%s" % (self._output, self._name, self._api_version_string)
        self.override_folder = os.path.normpath("%s/../../__overrides" % self.output_directory)
        self.fetchers_path = "/fetchers/"
        self.enums_path = "/enums"

        with open("%s/java/__code_header" % self._output, "r") as f:
            self.header_content = f.read()
Example #3
0
 def _write_documentation(self, apiversions):
     destination = "%s/doc" % self.output_directory
     self.write(
         destination=destination,
         filename="index.rst",
         template_name="index.rst.tpl",
         apiversions=[SDKUtils.get_string_version(version) for version in apiversions]
     )
    def __init__(self, monolithe_config, api_info):
        """ Initializes a _JavaSDKAPIVersionFileWriter

        """
        super(APIVersionWriter, self).__init__(package="monolithe.generators.lang.java")

        self.api_version = api_info["version"]
        self._api_version_string = SDKUtils.get_string_version(self.api_version)
        self.api_root = api_info["root"]
        self.api_prefix = api_info["prefix"]

        self.monolithe_config = monolithe_config
        self._output = self.monolithe_config.get_option("output", "transformer")
        self._name = self.monolithe_config.get_option("name", "transformer")
        self._class_prefix = ""
        self._product_accronym = self.monolithe_config.get_option("product_accronym")
        self._product_name = self.monolithe_config.get_option("product_name")
        self._url = self.monolithe_config.get_option("url", "transformer")

        self._package_prefix = self._get_package_prefix(self._url)
        self._package_name = self._package_prefix + '.' + self._name + '.' + SDKUtils.get_string_version(self.api_version)
        self._package_subdir = self._package_name.replace('.', '/')

        self._base_output_directory = "%s/java" % (self._output)
        self.output_directory = "%s/src/main/java/%s" % (self._base_output_directory, self._package_subdir)
        self.override_folder = os.path.normpath("%s/__overrides" % self._base_output_directory)
        self.fetchers_path = "/fetchers/"

        self.attrs_defaults = RawConfigParser()
        path = "%s/java/__attributes_defaults/attrs_defaults.ini" % self._output
        self.attrs_defaults.optionxform = str
        self.attrs_defaults.read(path)

        self.attrs_types = RawConfigParser()
        path = "%s/java/__attributes_defaults/attrs_types.ini" % self._output
        self.attrs_types.optionxform = str
        self.attrs_types.read(path)

        library_info = RawConfigParser()
        path = "%s/java/__attributes_defaults/library.ini" % self._output
        library_info.optionxform = str
        library_info.read(path)
        self.library_version = library_info.get(self.api_version, "libraryVersion")

        with open("%s/java/__code_header" % self._output, "r") as f:
            self.header_content = f.read()
Example #5
0
 def _write_documentation(self, apiversions):
     destination = "%s/doc" % self.output_directory
     self.write(destination=destination,
                filename="index.rst",
                template_name="index.rst.tpl",
                apiversions=[
                    SDKUtils.get_string_version(version)
                    for version in apiversions
                ])
Example #6
0
    def _write_main_index(self, apiversions):
        """
        """
        versions = {}

        for v in apiversions:
            versions[v] = SDKUtils.get_string_version(v)

        self.write(destination=self.output_directory, filename="index.html", template_name="main_index.html.tpl",
                   apiversion=versions,
                   product_name=self._product_name)
Example #7
0
 def _write_manifest(self, apiversions):
     """
     """
     self.write(destination=self.output_directory,
                filename="MANIFEST.in",
                template_name="MANIFEST.in.tpl",
                name=self._transformation_name,
                apiversions=[
                    SDKUtils.get_string_version(version)
                    for version in apiversions
                ])
Example #8
0
    def __init__(self, monolithe_config, api_info):
        """
        """
        super(APIVersionWriter, self).__init__(package="monolithe.generators.lang.html")

        self.monolithe_config = monolithe_config

        self._api_version = api_info["version"]
        self._output = self.monolithe_config.get_option("output", "transformer")
        self._product_name = self.monolithe_config.get_option("product_name")

        self.output_directory = "%s/html/%s" % (self._output, SDKUtils.get_string_version(self._api_version))
Example #9
0
    def _write_main_index(self, apiversions):
        """
        """
        versions = {}

        for v in apiversions:
            versions[v] = SDKUtils.get_string_version(v)

        self.write(destination=self.output_directory,
                   filename="index.html",
                   template_name="main_index.html.tpl",
                   apiversion=versions,
                   product_name=self._product_name)
    def __init__(self, monolithe_config, api_info):
        super(DocumentationWriter, self).__init__(package="monolithe.generators.lang.python")
        self.api_version = api_info["version"]
        self.api_root = api_info["root"]
        self.api_prefix = api_info["prefix"]

        self.monolithe_config = monolithe_config
        self._output = self.monolithe_config.get_option("output", "transformer")
        self._transformation_name = self.monolithe_config.get_option("name", "transformer")
        self._class_prefix = self.monolithe_config.get_option("class_prefix", "transformer")
        self._product_accronym = self.monolithe_config.get_option("product_accronym")
        self._product_name = self.monolithe_config.get_option("product_name")

        self.output_directory = "%s/python/doc/%s" % (self._output, SDKUtils.get_string_version(self.api_version))
Example #11
0
    def __init__(self, monolithe_config, api_info):
        """
        """
        super(APIVersionWriter,
              self).__init__(package="monolithe.generators.lang.html")

        self.monolithe_config = monolithe_config

        self._api_version = api_info["version"]
        self._output = self.monolithe_config.get_option(
            "output", "transformer")
        self._product_name = self.monolithe_config.get_option("product_name")

        self.output_directory = "%s/html/%s" % (
            self._output, SDKUtils.get_string_version(self._api_version))
Example #12
0
    def __init__(self, monolithe_config, api_info):
        super(DocumentationWriter,
              self).__init__(package="monolithe.generators.lang.python")
        self.api_version = api_info["version"]
        self.api_root = api_info["root"]
        self.api_prefix = api_info["prefix"]

        self.monolithe_config = monolithe_config
        self._output = self.monolithe_config.get_option(
            "output", "transformer")
        self._transformation_name = self.monolithe_config.get_option(
            "name", "transformer")
        self._class_prefix = self.monolithe_config.get_option(
            "class_prefix", "transformer")
        self._product_accronym = self.monolithe_config.get_option(
            "product_accronym")
        self._product_name = self.monolithe_config.get_option("product_name")

        self.output_directory = "%s/python/doc/%s" % (
            self._output, SDKUtils.get_string_version(self.api_version))
Example #13
0
    def __init__(self, monolithe_config, api_info):
        """ Initializes a _SDKAPIVersionFileWriter

        """
        super(_SDKAPIVersionFileWriter, self).__init__(package="monolithe.generators.sdk")

        self.api_version = api_info["version"]
        self.api_root = api_info["root"]
        self.api_prefix = api_info["prefix"]

        self.monolithe_config = monolithe_config
        self._sdk_output = self.monolithe_config.get_option("sdk_output", "sdk")
        self._sdk_name = self.monolithe_config.get_option("sdk_name", "sdk")
        self._sdk_class_prefix = self.monolithe_config.get_option("sdk_class_prefix", "sdk")
        self._product_accronym = self.monolithe_config.get_option("product_accronym")
        self._product_name = self.monolithe_config.get_option("product_name")

        self.output_directory = "%s/%s/%s" % (self._sdk_output, self._sdk_name, SDKUtils.get_string_version(self.api_version))
        self.override_folder = os.path.normpath("%s/../../__overrides" % self.output_directory)
        self.fetchers_path = "/fetchers/"

        with open("%s/__code_header" % self._sdk_output, "r") as f:
            self.header_content = f.read()
Example #14
0
 def _write_manifest(self, apiversions):
     """
     """
     self.write(destination=self.output_directory, filename="MANIFEST.in", template_name="MANIFEST.in.tpl",
                name=self._transformation_name,
                apiversions=[SDKUtils.get_string_version(version) for version in apiversions])
    def __init__(self, monolithe_config, api_info):
        """ Initializes a _JavaSDKAPIVersionFileWriter

        """
        super(APIVersionWriter, self).__init__(package="monolithe.generators.lang.vro")

        self.api_version = api_info["version"]
        self._api_version_string = SDKUtils.get_string_version(self.api_version)
        self.api_root = api_info["root"]
        self.api_prefix = api_info["prefix"]

        self.monolithe_config = monolithe_config
        self._output = self.monolithe_config.get_option("output", "transformer")
        self._name = self.monolithe_config.get_option("name", "transformer")
        self._class_prefix = ""
        self._product_accronym = self.monolithe_config.get_option("product_accronym")
        self._product_name = self.monolithe_config.get_option("product_name")
        self._url = self.monolithe_config.get_option("url", "transformer")

        self._package_prefix = self._get_package_prefix(self._url)
        self._package_name = self._package_prefix + ".vro." + self._name
        self._package_subdir = self._package_name.replace('.', '/')

        self.output_directory = "%s/vro" % (self._output)
        self.override_folder = os.path.normpath("%s/__overrides" % self.output_directory)
        self.fetchers_path = "/fetchers/"
        self.enums_path = "/enums/"

        self.attrs_defaults = RawConfigParser()
        path = "%s/vro/__attributes_defaults/attrs_defaults.ini" % self._output
        self.attrs_defaults.optionxform = str
        self.attrs_defaults.read(path)

        self.inventory_entities = RawConfigParser()
        path = "%s/vro/__attributes_defaults/inventory_entities.ini" % self._output
        self.inventory_entities.optionxform = str
        self.inventory_entities.read(path)

        self.workflow_attrs = RawConfigParser()
        path = "%s/vro/__attributes_defaults/workflow_attrs.ini" % self._output
        self.workflow_attrs.optionxform = str
        self.workflow_attrs.read(path)

        self.attrs_types = RawConfigParser()
        path = "%s/vro/__attributes_defaults/attrs_types.ini" % self._output
        self.attrs_types.optionxform = str
        self.attrs_types.read(path)

        plugin_info = RawConfigParser()
        path = "%s/vro/__attributes_defaults/plugin.ini" % self._output
        plugin_info.optionxform = str
        plugin_info.read(path)
        self.plugin_version = plugin_info.get(self.api_version, "pluginVersion")

        workflow_info = RawConfigParser()
        path = "%s/vro/__attributes_defaults/workflow.ini" % self._output
        workflow_info.optionxform = str
        workflow_info.read(path)
        self.workflow_version = workflow_info.get(self.api_version, "workflowVersion")

        with open("%s/vro/__code_header" % self._output, "r") as f:
            self.header_content = f.read()
Example #16
0
    def __init__(self, monolithe_config, api_info):
        """ Initializes a _JavaSDKAPIVersionFileWriter

        """
        super(APIVersionWriter,
              self).__init__(package="monolithe.generators.lang.vro")

        self.api_version = api_info["version"]
        self._api_version_string = SDKUtils.get_string_version(
            self.api_version)
        self.api_root = api_info["root"]
        self.api_prefix = api_info["prefix"]

        self.monolithe_config = monolithe_config
        self._output = self.monolithe_config.get_option(
            "output", "transformer")
        self._name = self.monolithe_config.get_option("name", "transformer")
        self._class_prefix = ""
        self._product_accronym = self.monolithe_config.get_option(
            "product_accronym")
        self._product_name = self.monolithe_config.get_option("product_name")
        self._url = self.monolithe_config.get_option("url", "transformer")

        self._package_prefix = self._get_package_prefix(self._url)
        self._package_name = self._package_prefix + ".vro." + self._name
        self._package_subdir = self._package_name.replace('.', '/')

        self.output_directory = "%s/vro" % (self._output)
        self.override_folder = os.path.normpath("%s/__overrides" %
                                                self.output_directory)
        self.fetchers_path = "/fetchers/"
        self.enums_path = "/enums/"

        self.attrs_defaults = RawConfigParser()
        path = "%s/vro/__attributes_defaults/attrs_defaults.ini" % self._output
        self.attrs_defaults.optionxform = str
        self.attrs_defaults.read(path)

        self.inventory_entities = RawConfigParser()
        path = "%s/vro/__attributes_defaults/inventory_entities.ini" % self._output
        self.inventory_entities.optionxform = str
        self.inventory_entities.read(path)

        self.workflow_attrs = RawConfigParser()
        path = "%s/vro/__attributes_defaults/workflow_attrs.ini" % self._output
        self.workflow_attrs.optionxform = str
        self.workflow_attrs.read(path)

        self.attrs_types = RawConfigParser()
        path = "%s/vro/__attributes_defaults/attrs_types.ini" % self._output
        self.attrs_types.optionxform = str
        self.attrs_types.read(path)

        plugin_info = RawConfigParser()
        path = "%s/vro/__attributes_defaults/plugin.ini" % self._output
        plugin_info.optionxform = str
        plugin_info.read(path)
        self.plugin_version = plugin_info.get(self.api_version,
                                              "pluginVersion")

        workflow_info = RawConfigParser()
        path = "%s/vro/__attributes_defaults/workflow.ini" % self._output
        workflow_info.optionxform = str
        workflow_info.read(path)
        self.workflow_version = workflow_info.get(self.api_version,
                                                  "workflowVersion")

        with open("%s/vro/__code_header" % self._output, "r") as f:
            self.header_content = f.read()