コード例 #1
0
    def write(self):
        """
        """
        task_manager = TaskManager()

        self.writer = SDKDocFileWriter(self.monolithe_config)
        self.writer.write_index()
        self.writer.write_conf()
        self.writer.write_general_concepts()

        # bambou
        bambou_module = importlib.import_module("bambou")
        bambou_classes = self._parse_module(bambou_module)

        self.writer.write_bambou_reference()
        for bambou_class in bambou_classes:
            task_manager.start_task(self._write_class_references, bambou_class,
                                    "bambou", "bambou", "bambou")

        # sdk
        generated_sdk_path = "%s/%s" % (self._sdk_output, self._sdk_name)

        for folder in os.listdir(generated_sdk_path):

            if folder == "cli":
                continue

            if not os.path.isdir("%s/%s" % (generated_sdk_path, folder)):
                continue

            version = SDKUtils.get_float_version(folder)
            self.writer.write_sdk_version_reference(version)

            # sdk model
            sdk_model_module_name = "%s.%s" % (self._sdk_name, folder)
            sdk_model_module = importlib.import_module(sdk_model_module_name)
            sdk_model_classes = self._parse_module(sdk_model_module)

            for sdk_model_class in sdk_model_classes:
                task_manager.start_task(self._write_class_references,
                                        sdk_model_class, sdk_model_module_name,
                                        "models",
                                        "%s/%s" % (self._sdk_name, version))

            # sdk fetchers
            sdk_fetcher_module_name = "%s.%s.fetchers" % (self._sdk_name,
                                                          folder)
            sdk_fetcher_module = importlib.import_module(
                sdk_fetcher_module_name)
            sdk_fetcher_classes = self._parse_module(sdk_fetcher_module)

            for sdk_fetcher_class in sdk_fetcher_classes:
                task_manager.start_task(self._write_class_references,
                                        sdk_fetcher_class,
                                        sdk_fetcher_module_name, "fetchers",
                                        "%s/%s" % (self._sdk_name, version))

        task_manager.wait_until_exit()
コード例 #2
0
 def perform(self, specifications):
     self.model_filenames = dict()
     self.fetcher_filenames = dict()
     task_manager = TaskManager()
     for rest_name, specification in specifications.items():
         task_manager.start_task(
             method=self._write_model, specification=specification, specification_set=specifications
         )
     task_manager.wait_until_exit()
コード例 #3
0
    def _write_o11plugin_core(self, specifications):
        """
        """
        output_directory = "%s/o11nplugin-%s-core" % (self.output_directory,
                                                      self._name.lower())
        self._write_file(output_directory, "o11nplugin-core/pom.xml.tpl",
                         "pom.xml")

        source_output_directory = "%s/src/main/java/%s" % (
            output_directory, self._package_subdir)
        self._write_modulebuilder(source_output_directory,
                                  package_name=self._package_name)
        self._write_pluginadaptor(source_output_directory,
                                  package_name=self._package_name)
        self._write_pluginfactory(specifications,
                                  source_output_directory,
                                  package_name=self._package_name)

        model_package_name = self._package_name + ".model"
        model_source_output_directory = "%s/model" % (source_output_directory)
        self._write_constants(specifications,
                              model_source_output_directory,
                              package_name=model_package_name)
        self._write_sessionmanager(model_source_output_directory,
                                   package_name=model_package_name)
        self._write_session(specifications,
                            model_source_output_directory,
                            package_name=model_package_name)
        self._write_modelhelper(specifications,
                                model_source_output_directory,
                                package_name=model_package_name)

        task_manager = TaskManager()
        for rest_name, specification in specifications.items():
            task_manager.start_task(
                method=self._write_model,
                specification=specification,
                specification_set=specifications,
                output_directory=model_source_output_directory,
                package_name=model_package_name)
            task_manager.start_task(
                method=self._write_fetcher,
                specification=specification,
                specification_set=specifications,
                output_directory=model_source_output_directory,
                package_name=model_package_name)
            for attribute in specification.attributes:
                if attribute.type == "enum" or attribute.subtype == "enum":
                    task_manager.start_task(
                        method=self._write_enum,
                        specification=specification,
                        attribute=attribute,
                        output_directory=model_source_output_directory,
                        package_name=model_package_name)

        task_manager.wait_until_exit()
コード例 #4
0
    def perform(self, specifications):
        """
        """

        task_manager = TaskManager()
        for rest_name, specification in specifications.items():
            task_manager.start_task(method=self._write_specification, specification=specification, specification_set=specifications)
        task_manager.wait_until_exit()

        self._write_index(specifications)
コード例 #5
0
    def _write_o11plugin_core(self, specifications):
        """
        """
        output_directory = "%s/o11nplugin-%s-core" % (self.output_directory, self._name.lower())
        self._write_file(output_directory, "o11nplugin-core/pom.xml.tpl", "pom.xml")
        
        source_output_directory = "%s/src/main/java/%s" % (output_directory, self._package_subdir)
        self._write_modulebuilder(source_output_directory, package_name=self._package_name)
        self._write_pluginadaptor(source_output_directory, package_name=self._package_name)
        self._write_pluginfactory(specifications, source_output_directory, package_name=self._package_name)

        model_package_name = self._package_name + ".model"
        model_source_output_directory = "%s/model" % (source_output_directory)
        self._write_constants(specifications, model_source_output_directory, package_name=model_package_name)
        self._write_sessionmanager(model_source_output_directory, package_name=model_package_name)
        self._write_session(specifications, model_source_output_directory, package_name=model_package_name)
        self._write_modelhelper(specifications, model_source_output_directory, package_name=model_package_name)

        task_manager = TaskManager()
        for rest_name, specification in specifications.items():
            task_manager.start_task(method=self._write_model, specification=specification, specification_set=specifications, output_directory=model_source_output_directory, package_name=model_package_name)
            task_manager.start_task(method=self._write_fetcher, specification=specification, specification_set=specifications, output_directory=model_source_output_directory, package_name=model_package_name)
            for attribute in specification.attributes:
                if attribute.type == "enum" or attribute.subtype == "enum":
                    task_manager.start_task(method=self._write_enum, specification=specification, attribute=attribute, output_directory=model_source_output_directory, package_name=model_package_name)

        task_manager.wait_until_exit()
コード例 #6
0
    def write(self, specifications, api_info):
        """ Write all files according to data

            Args:
                specifications: A dict of all specifications to manage
                api_info: the version of the api

            Returns:
                Writes specifications and fetchers files

        """
        model_filenames = dict()
        fetcher_filenames = dict()
        override_filenames = dict()

        self.api_info = api_info

        self.writer = _SDKAPIVersionFileWriter(monolithe_config=self.monolithe_config, api_info=self.api_info)

        task_manager = TaskManager()

        for rest_name, specification in specifications.iteritems():
            task_manager.start_task(method=self._write_models, specification=specification, filenames=model_filenames, specification_set=specifications)
            task_manager.start_task(method=self._write_fetcher_file, specification=specification, filenames=fetcher_filenames, specification_set=specifications)

        task_manager.wait_until_exit()

        self.writer.write_session()
        self.writer.write_sdk_info()
        self.writer.write_init_models(filenames=model_filenames)
        self.writer.write_init_fetchers(filenames=fetcher_filenames)
        self.writer.write_attrs_defaults()
コード例 #7
0
ファイル: apidocwriter.py プロジェクト: nsalady/monolithe
    def write(self, specifications, api_info):
        """
        """
        filenames = dict()
        task_manager = TaskManager()

        self.api_info = api_info
        self.writer = APIDocFileWriter(monolithe_config=self.monolithe_config, api_info=self.api_info)

        for specification in specifications.values():
            task_manager.start_task(method=self._write_specification, specification=specification, specification_set=specifications, filenames=filenames)

        task_manager.wait_until_exit()

        self.writer.write_index(specifications.values())
コード例 #8
0
ファイル: sdkdocwriter.py プロジェクト: nsalady/monolithe
    def write(self):
        """
        """
        task_manager = TaskManager()

        self.writer = SDKDocFileWriter(self.monolithe_config)
        self.writer.write_index()
        self.writer.write_conf()
        self.writer.write_general_concepts()

        # bambou
        bambou_module = importlib.import_module("bambou")
        bambou_classes = self._parse_module(bambou_module)

        self.writer.write_bambou_reference()
        for bambou_class in bambou_classes:
            task_manager.start_task(self._write_class_references, bambou_class, "bambou", "bambou", "bambou")

        # sdk
        generated_sdk_path = "%s/%s" % (self._sdk_output, self._sdk_name)

        for folder in os.listdir(generated_sdk_path):

            if folder == "cli":
                continue

            if not os.path.isdir("%s/%s" % (generated_sdk_path, folder)):
                continue

            version = SDKUtils.get_float_version(folder)
            self.writer.write_sdk_version_reference(version)

            # sdk model
            sdk_model_module_name = "%s.%s" % (self._sdk_name, folder)
            sdk_model_module = importlib.import_module(sdk_model_module_name)
            sdk_model_classes = self._parse_module(sdk_model_module)

            for sdk_model_class in sdk_model_classes:
                task_manager.start_task(self._write_class_references, sdk_model_class, sdk_model_module_name, "models", "%s/%s" % (self._sdk_name, version))

            # sdk fetchers
            sdk_fetcher_module_name = "%s.%s.fetchers" % (self._sdk_name, folder)
            sdk_fetcher_module = importlib.import_module(sdk_fetcher_module_name)
            sdk_fetcher_classes = self._parse_module(sdk_fetcher_module)

            for sdk_fetcher_class in sdk_fetcher_classes:
                task_manager.start_task(self._write_class_references, sdk_fetcher_class, sdk_fetcher_module_name, "fetchers", "%s/%s" % (self._sdk_name, version))

        task_manager.wait_until_exit()
コード例 #9
0
    def perform(self, specifications):
        """
        """
        self._set_enum_list_local_type(specifications)
        self._write_info()
        self._write_session()
        self._write_build_file()

        task_manager = TaskManager()
        for rest_name, specification in specifications.items():
            task_manager.start_task(method=self._write_model, specification=specification, specification_set=specifications)
            task_manager.start_task(method=self._write_fetcher, specification=specification, specification_set=specifications)
        task_manager.wait_until_exit()
コード例 #10
0
    def perform(self, specifications):
        """
        """
        self._write_info()
        self._write_session()

        task_manager = TaskManager()
        for rest_name, specification in specifications.items():
            task_manager.start_task(method=self._write_model, specification=specification, specification_set=specifications)
            task_manager.start_task(method=self._write_fetcher, specification=specification, specification_set=specifications)
        task_manager.wait_until_exit()
コード例 #11
0
 def perform(self, specifications):
     self.model_filenames = dict()
     self.fetcher_filenames = dict()
     task_manager = TaskManager()
     for rest_name, specification in specifications.items():
         task_manager.start_task(method=self._write_model,
                                 specification=specification,
                                 specification_set=specifications)
     task_manager.wait_until_exit()
コード例 #12
0
    def perform(self, specifications):
        """
        """
        self.model_filenames = dict()
        self.fetcher_filenames = dict()

        task_manager = TaskManager()
        for rest_name, specification in specifications.items():
            task_manager.start_task(method=self._write_model, specification=specification, specification_set=specifications)
            task_manager.start_task(method=self._write_fetcher, specification=specification, specification_set=specifications)
        task_manager.wait_until_exit()

        self._write_session()
        self._write_info()
        self._write_init_models(filenames=self.model_filenames)
        self._write_init_fetchers(filenames=self.fetcher_filenames)
        self._write_attrs_defaults()
コード例 #13
0
    def perform(self, specifications):
        """
        """

        task_manager = TaskManager()
        for rest_name, specification in specifications.items():
            task_manager.start_task(method=self._write_specification,
                                    specification=specification,
                                    specification_set=specifications)
        task_manager.wait_until_exit()

        self._write_index(specifications)
コード例 #14
0
ファイル: apiversionwriter.py プロジェクト: tpretz/monolithe
    def perform(self, specifications):
        """
        """
        self.resource_filenames = dict()
        self.fetcher_filenames = dict()
        self._resolve_parent_apis(specifications)
        task_manager = TaskManager()
        resources = []
        for _, specification in specifications.items():
            create = specification.allows_create
            for parent_api in specification.parent_apis:
                if parent_api.allows_create:
                    create = True
                    break
            if create:
                resources.append(specification)
                task_manager.start_task(method=self._write_resource,
                                        specification=specification,
                                        specification_set=specifications)

        datasources = []
        for _, specification in specifications.items():
            read = specification.allows_get
            for parent_api in specification.parent_apis:
                if parent_api.allows_get:
                    read = True
                    break
            if read:
                datasources.append(specification)
                task_manager.start_task(method=self._write_datasource,
                                        specification=specification,
                                        specification_set=specifications)
        task_manager.wait_until_exit()

        self.write(destination=self.output_directory,
                   filename="provider.go",
                   template_name="provider.go.tpl",
                   class_prefix=self._class_prefix,
                   specification_set_resources=resources,
                   specification_set_datasources=datasources,
                   version=self.api_version)
コード例 #15
0
    def perform(self, specifications):
        """
        """
        self.model_filenames = dict()
        self.fetcher_filenames = dict()

        task_manager = TaskManager()
        for rest_name, specification in specifications.items():
            task_manager.start_task(method=self._write_model, specification=specification, specification_set=specifications)
            task_manager.start_task(method=self._write_fetcher, specification=specification, specification_set=specifications)
        task_manager.wait_until_exit()

        self._write_session()
        self._write_info()
        self._write_init_models(filenames=self.model_filenames)
        self._write_init_fetchers(filenames=self.fetcher_filenames)
        self._write_attrs_defaults()
コード例 #16
0
    def write(self, specifications, api_info):
        """
        """
        filenames = dict()
        task_manager = TaskManager()

        self.api_info = api_info
        self.writer = APIDocFileWriter(monolithe_config=self.monolithe_config,
                                       api_info=self.api_info)

        for specification in specifications.values():
            task_manager.start_task(method=self._write_specification,
                                    specification=specification,
                                    specification_set=specifications,
                                    filenames=filenames)

        task_manager.wait_until_exit()

        self.writer.write_index(specifications.values())