marvin_refactor: Fix marvin build and maven pom - maven pom pointer codegenerator->xmltoapi - regression in apidocxmlwriter fixed NPE - fixed imports in generate module
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/412c34ed Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/412c34ed Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/412c34ed Branch: refs/heads/marvin_refactor Commit: 412c34ed8312eb858b92e5174eb819a14f8ee42f Parents: bc7f916 Author: Prasanna Santhanam <t...@apache.org> Authored: Sun Sep 8 13:31:25 2013 +0530 Committer: Prasanna Santhanam <t...@apache.org> Committed: Thu Oct 31 13:54:23 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/api/doc/ApiXmlDocWriter.java | 10 ++++++---- tools/marvin/marvin/generate/apitoentity.py | 6 +++--- tools/marvin/marvin/generate/linguist.py | 2 +- tools/marvin/marvin/generate/xmltoapi.py | 2 +- tools/marvin/pom.xml | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/412c34ed/server/src/com/cloud/api/doc/ApiXmlDocWriter.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java index b981abb..dc3009f 100644 --- a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java +++ b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java @@ -608,9 +608,11 @@ public class ApiXmlDocWriter { try { ObjectOutputStream out = xs.createObjectOutputStream(new FileWriter(dirName + "/alert_types.xml"), "alerts"); for (Field f : AlertManager.class.getFields()) { - String name = f.getName().substring(11); - Alert alert = new Alert(name, f.getInt(null)); - out.writeObject(alert); + if (f.getClass().isAssignableFrom(Number.class)) { + String name = f.getName().substring(11); + Alert alert = new Alert(name, f.getInt(null)); + out.writeObject(alert); + } } out.close(); } catch (IOException e) { @@ -636,4 +638,4 @@ public class ApiXmlDocWriter { } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/412c34ed/tools/marvin/marvin/generate/apitoentity.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/generate/apitoentity.py b/tools/marvin/marvin/generate/apitoentity.py index 4a05ebf..0be5d9a 100644 --- a/tools/marvin/marvin/generate/apitoentity.py +++ b/tools/marvin/marvin/generate/apitoentity.py @@ -16,9 +16,9 @@ # under the License. import os -from marvin.generate.entity import Entity -from marvin.generate.factory import Factory -from marvin.generate.linguist import * +from entity import Entity +from factory import Factory +from linguist import * LICENSE = """# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/412c34ed/tools/marvin/marvin/generate/linguist.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/generate/linguist.py b/tools/marvin/marvin/generate/linguist.py index 82a7bfc..fd2729e 100644 --- a/tools/marvin/marvin/generate/linguist.py +++ b/tools/marvin/marvin/generate/linguist.py @@ -19,7 +19,7 @@ try: import inflect except ImportError: raise Exception("inflect installation not found. use pip install inflect to continue") -from marvin.generate.verbs import grammar +from verbs import grammar def singularize(word, num=0): """Use the inflect engine to make singular nouns of the entities http://git-wip-us.apache.org/repos/asf/cloudstack/blob/412c34ed/tools/marvin/marvin/generate/xmltoapi.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/generate/xmltoapi.py b/tools/marvin/marvin/generate/xmltoapi.py index f5e61e6..f8e573a 100644 --- a/tools/marvin/marvin/generate/xmltoapi.py +++ b/tools/marvin/marvin/generate/xmltoapi.py @@ -23,7 +23,7 @@ import urllib2 from argparse import ArgumentParser from textwrap import dedent from os import path -from marvin.generate.apitoentity import generate, get_entity_action_map +from apitoentity import generate, get_entity_action_map class cmdParameterProperty(object): def __init__(self): http://git-wip-us.apache.org/repos/asf/cloudstack/blob/412c34ed/tools/marvin/pom.xml ---------------------------------------------------------------------- diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml index 25909b3..872921d 100644 --- a/tools/marvin/pom.xml +++ b/tools/marvin/pom.xml @@ -55,7 +55,7 @@ <workingDirectory>${basedir}/marvin</workingDirectory> <executable>python</executable> <arguments> - <argument>codegenerator.py</argument> + <argument>generate/xmltoapi.py</argument> <argument>-s</argument> <argument>${basedir}/commands.xml</argument> </arguments>