From 0c5b1b3e0c48fa4be142d43ed80ba1d715b01824 Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Thu, 11 Jun 2009 15:17:39 +0000 Subject: [PATCH] Issue 36: reorganized and revamped codegen git-svn-id: http://jclouds.googlecode.com/svn/trunk@1412 3d8758e0-26b5-11de-8745-db77d3ebf521 --- codegen/pom.xml | 106 ---------- .../jclouds/codegen/ec2/model/BaseBean.java | 79 ------- .../jclouds/codegen/ec2/model/BeanField.java | 116 ----------- .../java/org/jclouds/codegen/model/API.java | 57 ----- .../org/jclouds/codegen/model/Command.java | 67 ------ .../org/jclouds/codegen/model/DomainType.java | 39 ---- .../java/org/jclouds/codegen/model/Field.java | 116 ----------- .../org/jclouds/codegen/model/Package.java | 49 ----- .../jclouds/codegen/model/TopLevelType.java | 57 ----- .../java/org/jclouds/codegen/model/Type.java | 74 ------- .../jclouds/codegen/util/CodeGenerator.java | 196 ------------------ codegen/src/main/resources/templates/Bean.ftl | 81 -------- .../src/main/resources/templates/Command.ftl | 80 ------- .../src/main/resources/templates/Handler.ftl | 80 ------- .../src/main/resources/templates/Options.ftl | 103 --------- .../src/main/resources/templates/Response.ftl | 70 ------- .../src/main/resources/templates/Value.ftl | 70 ------- 17 files changed, 1440 deletions(-) delete mode 100644 codegen/pom.xml delete mode 100644 codegen/src/main/java/org/jclouds/codegen/ec2/model/BaseBean.java delete mode 100644 codegen/src/main/java/org/jclouds/codegen/ec2/model/BeanField.java delete mode 100644 codegen/src/main/java/org/jclouds/codegen/model/API.java delete mode 100644 codegen/src/main/java/org/jclouds/codegen/model/Command.java delete mode 100644 codegen/src/main/java/org/jclouds/codegen/model/DomainType.java delete mode 100644 codegen/src/main/java/org/jclouds/codegen/model/Field.java delete mode 100644 codegen/src/main/java/org/jclouds/codegen/model/Package.java delete mode 100644 codegen/src/main/java/org/jclouds/codegen/model/TopLevelType.java delete mode 100644 codegen/src/main/java/org/jclouds/codegen/model/Type.java delete mode 100644 codegen/src/main/java/org/jclouds/codegen/util/CodeGenerator.java delete mode 100644 codegen/src/main/resources/templates/Bean.ftl delete mode 100644 codegen/src/main/resources/templates/Command.ftl delete mode 100644 codegen/src/main/resources/templates/Handler.ftl delete mode 100644 codegen/src/main/resources/templates/Options.ftl delete mode 100644 codegen/src/main/resources/templates/Response.ftl delete mode 100644 codegen/src/main/resources/templates/Value.ftl diff --git a/codegen/pom.xml b/codegen/pom.xml deleted file mode 100644 index 8f7b6f0ade..0000000000 --- a/codegen/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - jclouds-codegen-project - org.jclouds - 1.0-SNAPSHOT - ../project/pom.xml - - 4.0.0 - jclouds-codegen-core - jclouds code generator - jar - jclouds code generator - - - scm:svn:http://jclouds.googlecode.com/svn/trunk/codegen/core - scm:svn:https://jclouds.googlecode.com/svn/trunk/codegen/core - http://jclouds.googlecode.com/svn/trunk/codegen/core - - - - - gson - http://google-gson.googlecode.com/svn/mavenrepo - - - - - - commons-io - commons-io - 1.4 - - - com.google.code.gson - gson - 1.3 - compile - - - org.freemarker - freemarker - 2.3.14 - - - com.google.collections - google-collections - 1.0-rc1 - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - org.jclouds.codegen.util.CodeGenerator - - - - - - maven-assembly-plugin - - - jar-with-dependencies - - - - - make-assembly - package - - single - - - - - - - - diff --git a/codegen/src/main/java/org/jclouds/codegen/ec2/model/BaseBean.java b/codegen/src/main/java/org/jclouds/codegen/ec2/model/BaseBean.java deleted file mode 100644 index 729a2b478d..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/ec2/model/BaseBean.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * Copyright (C) 2009 Global Cloud Specialists, Inc. - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.jclouds.codegen.ec2.model; - -import java.util.Set; - -/** - * - * @author Adrian Cole - */ -public class BaseBean { - - private String type; - private String ancestor; - private Set see; - private String exampleCode; - private Set fields; - - public void setType(String type) { - this.type = type; - } - - public String getType() { - return type; - } - - public void setAncestor(String ancestor) { - this.ancestor = ancestor; - } - - public String getAncestor() { - return ancestor; - } - - public void setSee(Set see) { - this.see = see; - } - - public Set getSee() { - return see; - } - - public void setExampleCode(String exampleCode) { - this.exampleCode = exampleCode; - } - - public String getExampleCode() { - return exampleCode; - } - - public void setFields(Set fields) { - this.fields = fields; - } - - public Set getFields() { - return fields; - } -} diff --git a/codegen/src/main/java/org/jclouds/codegen/ec2/model/BeanField.java b/codegen/src/main/java/org/jclouds/codegen/ec2/model/BeanField.java deleted file mode 100644 index 1464bc3df7..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/ec2/model/BeanField.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * - * Copyright (C) 2009 Global Cloud Specialists, Inc. - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.jclouds.codegen.ec2.model; - -import java.util.Map; - -/** - * - * @author Adrian Cole - */ -public class BeanField { - - private String ancestor; - private String children; - private String constraints; - private String defaultValue; - private String desc; - private Map valueMap; - private String name; - private String optional; - private String type; - - public void setAncestor(String ancestor) { - this.ancestor = ancestor; - } - - public String getAncestor() { - return ancestor; - } - - public void setChildren(String children) { - this.children = children; - } - - public String getChildren() { - return children; - } - - public void setConstraints(String constraints) { - this.constraints = constraints; - } - - public String getConstraints() { - return constraints; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public String getDesc() { - return desc; - } - - public void setValueMap(Map valueMap) { - this.valueMap = valueMap; - } - - public Map getValueMap() { - return valueMap; - } - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setOptional(String optional) { - this.optional = optional; - } - - public String getOptional() { - return optional; - } - - public void setType(String type) { - this.type = type; - } - - public String getType() { - return type; - } - -} diff --git a/codegen/src/main/java/org/jclouds/codegen/model/API.java b/codegen/src/main/java/org/jclouds/codegen/model/API.java deleted file mode 100644 index c69f8a1e3e..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/model/API.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - * Copyright (C) 2009 Global Cloud Specialists, Inc. - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.jclouds.codegen.model; - -import java.util.List; -import java.util.Map; - -/** - * @author Adrian Cole - * @author James Murty - */ -public class API { - private List packages; - private Map domain; - - @Override - public String toString() { - return getPackages().toString(); - } - - public void setPackages(List packages) { - this.packages = packages; - } - - public List getPackages() { - return packages; - } - - public void setDomain(Map domain) { - this.domain = domain; - } - - public Map getDomain() { - return domain; - } -} diff --git a/codegen/src/main/java/org/jclouds/codegen/model/Command.java b/codegen/src/main/java/org/jclouds/codegen/model/Command.java deleted file mode 100644 index fc1d43cc46..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/model/Command.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Copyright (C) 2009 Global Cloud Specialists, Inc. - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.jclouds.codegen.model; - -/** - * @author Adrian Cole - * @author James Murty - */ -public class Command extends TopLevelType { - private TopLevelType options; - private TopLevelType handler; - private DomainType response; - private String description; - - public void setDescription(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } - - public void setOptions(TopLevelType options) { - this.options = options; - } - - public TopLevelType getOptions() { - return options; - } - - public void setHandler(TopLevelType handler) { - this.handler = handler; - } - - public TopLevelType getHandler() { - return handler; - } - - public void setResponse(DomainType response) { - this.response = response; - } - - public DomainType getResponse() { - return response; - } -} diff --git a/codegen/src/main/java/org/jclouds/codegen/model/DomainType.java b/codegen/src/main/java/org/jclouds/codegen/model/DomainType.java deleted file mode 100644 index 3186a8a4f4..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/model/DomainType.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright (C) 2009 Global Cloud Specialists, Inc. - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.jclouds.codegen.model; - - -public class DomainType extends Type { - - private String ancestor; - - public void setAncestor(String ancestor) { - this.ancestor = ancestor; - } - - public String getAncestor() { - return ancestor; - } - -} \ No newline at end of file diff --git a/codegen/src/main/java/org/jclouds/codegen/model/Field.java b/codegen/src/main/java/org/jclouds/codegen/model/Field.java deleted file mode 100644 index 6f27899aba..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/model/Field.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * - * Copyright (C) 2009 Global Cloud Specialists, Inc. - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.jclouds.codegen.model; - -import java.util.Map; - -/** - * - * @author Adrian Cole - */ -public class Field { - - private String constraints; - private String defaultValue; - private String desc; - private String name; - private String javaName; - private boolean optional = true; - private String type; - private String javaType; - private Map valueMap; - - public void setConstraints(String constraints) { - this.constraints = constraints; - } - - public String getConstraints() { - return constraints; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public String getDesc() { - return desc; - } - - public void setValueMap(Map valueMap) { - this.valueMap = valueMap; - } - - public Map getValueMap() { - return valueMap; - } - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setOptional(boolean optional) { - this.optional = optional; - } - - public boolean getOptional() { - return optional; - } - - public void setType(String type) { - this.type = type; - } - - public String getType() { - return type; - } - - public void setJavaName(String javaName) { - this.javaName = javaName; - } - - public String getJavaName() { - return javaName; - } - - public void setJavaType(String javaType) { - this.javaType = javaType; - } - - public String getJavaType() { - return javaType; - } - -} diff --git a/codegen/src/main/java/org/jclouds/codegen/model/Package.java b/codegen/src/main/java/org/jclouds/codegen/model/Package.java deleted file mode 100644 index 142f4b8f6b..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/model/Package.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * Copyright (C) 2009 Global Cloud Specialists, Inc. - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.jclouds.codegen.model; - -import java.util.List; - -/** - * - * @author James Murty - */ -public class Package { - private String name; - private List commands; - - @Override - public String toString() { - return String.format("{'name':'%1$s', 'commands':%2$s", name, commands); - } - - public String getName() { - return name; - } - - public List getCommands() { - return commands; - } - -} diff --git a/codegen/src/main/java/org/jclouds/codegen/model/TopLevelType.java b/codegen/src/main/java/org/jclouds/codegen/model/TopLevelType.java deleted file mode 100644 index c5f05cbe5c..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/model/TopLevelType.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - * Copyright (C) 2009 Global Cloud Specialists, Inc. - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.jclouds.codegen.model; - - -public class TopLevelType extends Type { - - private String ancestor; - private String exampleCode; - private String exampleHTML; - - public void setAncestor(String ancestor) { - this.ancestor = ancestor; - } - - public String getAncestor() { - return ancestor; - } - - public void setExampleCode(String exampleCode) { - this.exampleCode = exampleCode; - } - - public String getExampleCode() { - return exampleCode; - } - - public void setExampleHTML(String exampleHTML) { - this.exampleHTML = exampleHTML; - } - - public String getExampleHTML() { - return exampleHTML; - } - -} \ No newline at end of file diff --git a/codegen/src/main/java/org/jclouds/codegen/model/Type.java b/codegen/src/main/java/org/jclouds/codegen/model/Type.java deleted file mode 100644 index babc3075cb..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/model/Type.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2009, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jclouds.codegen.model; - -import java.util.Set; - -public class Type { - - private String packageName; - private String name; - private String javaName; - private Set see; - private Set fields; - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setJavaName(String javaName) { - this.javaName = javaName; - } - - public String getJavaName() { - return javaName; - } - - public void setSee(Set see) { - this.see = see; - } - - public Set getSee() { - return see; - } - - public void setFields(Set fields) { - this.fields = fields; - } - - public Set getFields() { - return fields; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - public String getPackageName() { - return packageName; - } - -} \ No newline at end of file diff --git a/codegen/src/main/java/org/jclouds/codegen/util/CodeGenerator.java b/codegen/src/main/java/org/jclouds/codegen/util/CodeGenerator.java deleted file mode 100644 index 0d3214d635..0000000000 --- a/codegen/src/main/java/org/jclouds/codegen/util/CodeGenerator.java +++ /dev/null @@ -1,196 +0,0 @@ -/** - * - * Copyright (C) 2009 Global Cloud Specialists, Inc. - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.jclouds.codegen.util; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.util.HashMap; -import java.util.Map; - -import org.jclouds.codegen.model.API; -import org.jclouds.codegen.model.Command; -import org.jclouds.codegen.model.DomainType; -import org.jclouds.codegen.model.Package; -import org.jclouds.codegen.model.Type; - -import com.google.gson.Gson; -import com.google.gson.JsonParseException; - -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; - -/** - * Converts object models representing AWS API beans into Java classes. - *

- * This implementation is designed to perform the following steps: - *