Classes to insulate code generator from JAXB generated classes. This set
9 | of classes is used to create an abstract syntax tree for a WADL description
10 | independent from how that description is serialized.
11 |
12 |
13 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/main/java/org/jvnet/ws/wadl/util/MessageListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package org.jvnet.ws.wadl.util;
6 |
7 | /**
8 | * A public class that allows an implementor to deal with messages output
9 | * by the generator. Also allow us to remove a direct API dependency
10 | * on the internals of generator.
11 | *
12 | * @author gdavison
13 | **/
14 | public interface MessageListener {
15 |
16 | /**
17 | * Report a warning.
18 | *
19 | * @param message The message to display to the user, if null the message
20 | * from the throwable is used instead.
21 | * @param throwable The exception that triggered this message, can be null
22 | * if the message is not null.
23 | */
24 | public void warning(String message, Throwable throwable);
25 |
26 | /**
27 | * Report informative message.
28 | *
29 | * @param message The message to display to the user.
30 | */
31 | public void info(String message);
32 |
33 | /**
34 | * Report an error.
35 | *
36 | * @param message The message to display to the user, if null the message
37 | * from the throwable is used instead.
38 | * @param throwable The exception that triggered this message, can be null
39 | * if the message is not null.
40 | */
41 | public void error(String message, Throwable throwable);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/main/java/org/jvnet/ws/wadl2java/Resolver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The contents of this file are subject to the terms
3 | * of the Common Development and Distribution License
4 | * (the "License"). You may not use this file except
5 | * in compliance with the License.
6 | *
7 | * You can obtain a copy of the license at
8 | * http://www.opensource.org/licenses/cddl1.php
9 | * See the License for the specific language governing
10 | * permissions and limitations under the License.
11 | */
12 | package org.jvnet.ws.wadl2java;
13 |
14 | import javax.xml.namespace.QName;
15 |
16 | import com.sun.codemodel.JType;
17 | import java.net.URI;
18 | import org.jvnet.ws.wadl.ast.AbstractNode;
19 |
20 | /**
21 | * This is a simple interface to replace reference to the S2JJAXModel
22 | * class that is passed around to resolve QName element or URI references
23 | * to type references.
24 | *
25 | * @author gdavison
26 | */
27 | public interface Resolver {
28 |
29 | /**
30 | * @param element The element to resolve, can be a QName in the case
31 | * of a JAX-B xml definition or a URI in the case of a JSON-Schema
32 | * reference
33 | *
34 | * @return the java type that is used to represent this element, might
35 | * actually be a XmlType rather than a XmlElement
36 | */
37 | public JType resolve (Object element);
38 |
39 |
40 | /**
41 | * @param context The object that we are loading relative to
42 | * @return A URI relative to the base URI of the document that context
43 | * is loaded from
44 | */
45 |
46 | public URI resolveURI(AbstractNode context, String path);
47 |
48 |
49 | /**
50 | * Do we need to configure the client for JSON
51 | * @return true if required
52 | */
53 | public boolean isThereJsonMapping();
54 | }
55 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/main/java/org/jvnet/ws/wadl2java/ResourceClassGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package org.jvnet.ws.wadl2java;
6 |
7 | import com.sun.codemodel.JClassAlreadyExistsException;
8 | import java.net.URI;
9 | import org.jvnet.ws.wadl.ast.ResourceNode;
10 | import org.jvnet.ws.wadl.ast.ResourceTypeNode;
11 |
12 | /**
13 | * A simplified interface to the resource class generators
14 | * @author gdavison
15 | */
16 | public interface ResourceClassGenerator {
17 | //
18 | // /**
19 | // * Generate a bean setter and getter for a parameter.
20 | // *
21 | // * @param $impl The class or interface to add the bean setter and getter to.
22 | // * @param p the WADL parameter for which to create the setter and getter.
23 | // * @param isAbstract controls whether a method body is created {@code false} or not {@code true}. Set to {@code true}
24 | // * for interface methods, {@code false} for class methods.
25 | // */
26 | // void generateBeanProperty(JDefinedClass $impl, List matrixParameters, Param p, boolean isAbstract);
27 |
28 | /**
29 | * Create a class that acts as a container for a hierarchy
30 | * of static inner classes, one for each resource described by the WADL file.
31 | *
32 | * @param rootResource the root URI to the WADL so we can generate the required annotations
33 | * @param root the resource element that corresponds to the root of the resource tree
34 | * @throws com.sun.codemodel.JClassAlreadyExistsException if, during code
35 | * generation, the WADL processor attempts to create a duplicate
36 | * class. This indicates a structural problem with the WADL file, e.g. duplicate
37 | * peer resource entries.
38 | */
39 | public void generateEndpointClass(
40 | URI rootResource, ResourceNode root)
41 | throws JClassAlreadyExistsException ;
42 |
43 |
44 | // /**
45 | // * Generate a static member class that represents a WADL resource.
46 | // *
47 | // * @param parentClass the parent class for the generated class.
48 | // * @param $global_base_uri a reference to the field that contains the base URI.
49 | // * @return the generated class.
50 | // * @throws com.sun.codemodel.JClassAlreadyExistsException if a class with
51 | // * the same name already exists.
52 | // */
53 | // JDefinedClass generateClass(JDefinedClass parentClass, JVar $global_base_uri) throws JClassAlreadyExistsException;
54 | //
55 | // /**
56 | // * Generate a set of method declarations for a WADL method element.
57 | // *
58 | // *
Generates two Java methods per returned representation type for each request
59 | // * type, one with all optional parameters and one without. I.e. if the WADL method
60 | // * specifies two possible request representation formats and three supported
61 | // * response representation formats, this method will generate twelve Java methods,
62 | // * one for each combination.
63 | // *
64 | // * @param isAbstract controls whether the generated methods will have a body {@code false}
65 | // * or not {@code true}.
66 | // * @param method the WADL method element to process.
67 | // */
68 | // void generateMethodDecls(MethodNode method, boolean isAbstract);
69 |
70 |
71 | /**
72 | * Generate Java interfaces for WADL resource types
73 | * @throws com.sun.codemodel.JClassAlreadyExistsException if the interface to be generated already exists
74 | */
75 | public void generateResourceTypeInterface(ResourceTypeNode n)throws JClassAlreadyExistsException;
76 |
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/main/java/org/jvnet/ws/wadl2java/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | WADL tools for Java
6 |
7 |
8 |
Implements a WADL to Java tool that generates client-side stubs for the
9 | resources and methods declared in a WADL file.
Specifies the package used for generated code, e.g. com.example.test
20 |
-o directory
21 |
Specifies the directory to which files will be written. E.g. if the package
22 | is com.example.test and the directory is gen-src then
23 | files will be written to ./gen-src/com/example/test. The directory
24 | dir must exist, subdirectories will be created as required.
45 |
46 | @see WADL Specification
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/main/resources/org/jvnet/ws/wadl/ast/ast.properties:
--------------------------------------------------------------------------------
1 | # Sample ResourceBundle properties file
2 | template.value.missing=No value for required template parameter: {0}
3 | matrix.value.missing=No value for required matrix parameter: {0}
4 |
5 |
6 | processing=Processing: {0}
7 |
8 |
9 | missing.id.method=Missing id property on method element
10 | missing.id.resourceType=Missing id property on resourceType element
11 | missing.id.representation=Missing id property on representation element
12 | missing.id.param=Missing id property on param element
13 |
14 | missing.method.name=Missing method name property on method element
15 |
16 | lonely.href.method=A method with a href should not have any other WADL parameters or children
17 | lonely.href.resourceType=A resourceType with a href should not have any other WADL parameters or children
18 | lonely.href.representation=A representation with a href should not have any other WADL parameters or children
19 | lonely.href.param=A param with a href should not have any other WADL parameters or children
20 |
21 | skipping.reference=Reference {0} not found
22 | skipping.reference.type=Reference {0} identifies the wrong kind of element
23 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/main/resources/org/jvnet/ws/wadl2java/Wadl2Java.properties:
--------------------------------------------------------------------------------
1 | # Sample ResourceBundle properties file
2 |
3 | logger.info = Info: {0}
4 | logger.warning = Warning: {0}
5 | logger.error = Error: {0}
6 |
7 | usage=Usage: wadl2java -o outputDir -s style -p package [-a] [-c customizationFile]* [-xjcArgument argument]* file.wadl
8 | invalid.generation.style = Invalid generation style {0} should be one of {1}
9 | unknown.option=Unknown option: {0}
10 | not.a.file={0} is not a file
11 | not.a.directory={0} is not a directory
12 | package.attribute.required=package attribute must be specified
13 | target.attribute.required=target attribute must be specified
14 | target.directory.must.exist=target directory {0} must exist
15 | target.attribute.directory=target attribute {0} must specify a directory
16 | description.required=description attribute must be specified
17 | wadl.description.must.exist=WADL description {0} must exist
18 | wadl.description.file=WADL description {0} must be a file
19 | skipping.compilation=Generated code is up to date, skipping compilation
20 | jaxb.processing.failed=Generating JAX-B binding types failed
21 | processing.failed=WADL file processing failed
22 | processing=Processing: {0}
23 |
24 |
25 | warning=Warning:{0}
26 | file = {0}, line {1}, col {2}, file {3}
27 | warning.file=Warning: {0}, line {1}, col {2}, file {3}
28 | error=Error: {0}, line {1}, col {2}, file {3}
29 | error.fatal="Fatal Error: {0}, line {1}, col {2}, file {3}
30 | info=Info: {0}, line {1}, col {2}, file {3}
31 | element.not.found=Warning: element {0} not found
32 | fault.no.element=Warning: skipping fault with no XML element
33 | parameter.required=Parameter {0} of method {1} is required and must not be null
34 | invocation.failed=Invocation failed, see FaultInfo property for details
35 | create.instance=Create new instance
36 | create.instance.client=Create new instance using existing Client instance, and a base URI and any parameters
37 | create.instance.client.uri=Create new instance using existing Client instance, and the URI from which the parameters will be extracted
38 |
39 | create.client=Create a new Client instance
40 | create.client.instance=Template method to allow tooling to override Client factory
41 | create.client.customize=Template method to allow tooling to customize the new Client
--------------------------------------------------------------------------------
/wadl/wadl-core/src/test/java/com/sun/research/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/javaee/wadl/cef9a66435ca6f2a3a15310c6c8910bdec818120/wadl/wadl-core/src/test/java/com/sun/research/.gitkeep
--------------------------------------------------------------------------------
/wadl/wadl-core/src/test/java/org/jvnet/ws/wadl/ast/PathSegmentTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The contents of this file are subject to the terms
3 | * of the Common Development and Distribution License
4 | * (the "License"). You may not use this file except
5 | * in compliance with the License.
6 | *
7 | * You can obtain a copy of the license at
8 | * http://www.opensource.org/licenses/cddl1.php
9 | * See the License for the specific language governing
10 | * permissions and limitations under the License.
11 | */
12 |
13 | /*
14 | * PathSegmentTest.java
15 | * JUnit based test
16 | *
17 | * Created on August 7, 2006, 2:32 PM
18 | */
19 |
20 | package org.jvnet.ws.wadl.ast;
21 |
22 | import org.jvnet.ws.wadl.ast.PathSegment;
23 | import org.jvnet.ws.wadl.ast.InvalidWADLException;
24 | import junit.framework.*;
25 | import org.jvnet.ws.wadl.Param;
26 | import org.jvnet.ws.wadl.ParamStyle;
27 | import org.jvnet.ws.wadl.Resource;
28 | import java.util.HashMap;
29 | import java.util.List;
30 |
31 | /**
32 | *
33 | * @author mh124079
34 | */
35 | public class PathSegmentTest extends TestCase {
36 |
37 | public PathSegmentTest(String testName) {
38 | super(testName);
39 | }
40 |
41 | @Override
42 | protected void setUp() throws Exception {
43 | }
44 |
45 | @Override
46 | protected void tearDown() throws Exception {
47 | }
48 |
49 | /**
50 | * Test of getTemplateParameters method, of class org.jvnet.ws.wadl2java.PathSegment.
51 | */
52 | public void testGetTemplateParameters() throws InvalidWADLException {
53 | System.out.println("getTemplateParameters");
54 |
55 | Resource r = new Resource();
56 | r.setPath("fred/{param1}/bob/{param2}");
57 | Param p = new Param();
58 | p.setName("param1");
59 | p.setRequired(true);
60 | r.getParam().add(p);
61 |
62 | PathSegment instance = new PathSegment(r,null,null);
63 | List result = instance.getTemplateParameters();
64 |
65 | assertEquals(result.get(0).getName(), "param1");
66 | assertTrue(result.get(0).isRequired() == Boolean.TRUE);
67 | assertEquals(result.get(1).getName(), "param2");
68 | assertFalse(result.get(1).isRequired() == Boolean.TRUE);
69 | }
70 |
71 | public void testEvaluate() throws InvalidWADLException {
72 | System.out.println("evaluate");
73 | Resource r = new Resource();
74 | r.setPath("fred/{param1}/bob/{param2}");
75 | Param p = new Param();
76 | p.setName("param1");
77 | p.setRequired(true);
78 | r.getParam().add(p);
79 | p = new Param();
80 | p.setName("param3");
81 | p.setStyle(ParamStyle.MATRIX);
82 | r.getParam().add(p);
83 | p = new Param();
84 | p.setName("param4");
85 | p.setStyle(ParamStyle.MATRIX);
86 | r.getParam().add(p);
87 | p = new Param();
88 | p.setName("param5");
89 | p.setStyle(ParamStyle.MATRIX);
90 | r.getParam().add(p);
91 |
92 | PathSegment instance = new PathSegment(r,null,null);
93 | HashMap params = new HashMap();
94 | params.put("param1", "value1");
95 | params.put("param2", "value2");
96 | params.put("param3", "value3");
97 | params.put("param4", true);
98 | params.put("param5", false);
99 | String result = instance.evaluate(params);
100 |
101 | assertEquals(result, "fred/value1/bob/value2;param3=value3;param4");
102 |
103 | PathSegment instance2 = new PathSegment("fred/{xyzzy}/bob/");
104 | result = instance2.evaluate(null);
105 | assertEquals(result, "fred//bob/");
106 | }
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/test/java/org/jvnet/ws/wadl/ast/WadlAstBuilderTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package org.jvnet.ws.wadl.ast;
6 |
7 | import java.io.IOException;
8 | import java.net.URISyntaxException;
9 | import java.util.List;
10 | import java.util.ArrayList;
11 | import org.junit.Test;
12 | import org.jvnet.ws.wadl.util.MessageListener;
13 | import org.w3c.dom.Element;
14 | import org.xml.sax.InputSource;
15 |
16 | import static org.hamcrest.MatcherAssert.assertThat;
17 | import static org.hamcrest.Matchers.*;
18 |
19 |
20 | /**
21 | * Provide unit tests for the AST
22 | * @author gdavison
23 | */
24 | public class WadlAstBuilderTest {
25 |
26 |
27 | /**
28 | * Whilst investigating a bug, make sure that the AST is properly reporting
29 | * the number of methods.
30 | */
31 | @Test
32 | public void testSoapUIYahooSearch() throws InvalidWADLException, IOException, URISyntaxException
33 | {
34 | WadlAstBuilder builder = new WadlAstBuilder(
35 | new WadlAstBuilder.SchemaCallback() {
36 |
37 | public void processSchema(InputSource is) {
38 | }
39 |
40 | public void processSchema(String uri, Element node) {
41 | }
42 | },
43 | new MessageListener() {
44 |
45 | public void warning(String message, Throwable throwable) {
46 | }
47 |
48 | public void info(String message) {
49 | }
50 |
51 | public void error(String message, Throwable throwable) {
52 | }
53 | });
54 |
55 | ApplicationNode an =
56 | builder.buildAst(WadlAstBuilderTest.class.getResource("SoapUIYahooSearch.wadl").toURI());
57 | List methods = an.getResources().get(0).getChildResources().get(0).getMethods();
58 |
59 | // Sanity check that the reference doesn't duplicate the values
60 | assertThat("Only one method",
61 | methods.size(), equalTo(1));
62 |
63 | // Check that the status on the upgraded fault message
64 | // has correctly been upgrade to the 2009 WADL version
65 | List supportedOutputs = new ArrayList();
66 | for (List nodeList : methods.get(0).getSupportedOutputs().values()) {
67 | for (RepresentationNode node : nodeList)
68 | {
69 | supportedOutputs.add(node);
70 | }
71 | }
72 | assertThat("Only one output",
73 | supportedOutputs.size(), equalTo(1));
74 | assertThat("Only one fault",
75 | methods.get(0).getFaults().size(), equalTo(1));
76 |
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/test/java/org/jvnet/ws/wadl/util/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/javaee/wadl/cef9a66435ca6f2a3a15310c6c8910bdec818120/wadl/wadl-core/src/test/java/org/jvnet/ws/wadl/util/.gitkeep
--------------------------------------------------------------------------------
/wadl/wadl-core/src/test/java/org/jvnet/ws/wadl2java/GeneratorUtilTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * GeneratorUtilTest.java
3 | * JUnit based test
4 | *
5 | * Created on February 16, 2007, 10:02 AM
6 | */
7 |
8 | package org.jvnet.ws.wadl2java;
9 |
10 | import junit.framework.*;
11 | import com.sun.codemodel.ClassType;
12 | import com.sun.codemodel.JClass;
13 | import com.sun.codemodel.JClassAlreadyExistsException;
14 | import com.sun.codemodel.JCodeModel;
15 | import com.sun.codemodel.JDefinedClass;
16 | import com.sun.codemodel.JEnumConstant;
17 | import com.sun.codemodel.JExpr;
18 | import com.sun.codemodel.JFieldVar;
19 | import com.sun.codemodel.JMethod;
20 | import com.sun.codemodel.JMod;
21 | import com.sun.codemodel.JVar;
22 | import org.jvnet.ws.wadl.Option;
23 | import org.jvnet.ws.wadl.Param;
24 | import org.jvnet.ws.wadl.ast.ResourceNode;
25 | import java.util.Arrays;
26 | import java.util.HashSet;
27 | import javax.xml.namespace.QName;
28 |
29 | /**
30 | *
31 | * @author mh124079
32 | */
33 | public class GeneratorUtilTest extends TestCase {
34 |
35 | public GeneratorUtilTest(String testName) {
36 | super(testName);
37 | }
38 |
39 | protected void setUp() throws Exception {
40 | }
41 |
42 | protected void tearDown() throws Exception {
43 | }
44 |
45 | /**
46 | * Test of makeConstantName method, of class org.jvnet.ws.wadl2java.GeneratorUtil.
47 | */
48 | public void testMakeConstantName() {
49 | System.out.println("makeConstantName");
50 |
51 | assertEquals("FOO", GeneratorUtil.makeConstantName("foo"));
52 | assertEquals("FOO", GeneratorUtil.makeConstantName("FOO"));
53 | assertEquals("FOO", GeneratorUtil.makeConstantName("Foo"));
54 | assertEquals("FOO_BAR", GeneratorUtil.makeConstantName("foo bar"));
55 | assertEquals("CLASS", GeneratorUtil.makeConstantName("class"));
56 | }
57 |
58 | /**
59 | * Test of makeClassName method, of class org.jvnet.ws.wadl2java.GeneratorUtil.
60 | */
61 | public void testMakeClassName() {
62 | System.out.println("makeClassName");
63 |
64 | assertEquals("Foo", GeneratorUtil.makeClassName("foo"));
65 | assertEquals("FOO", GeneratorUtil.makeClassName("FOO"));
66 | assertEquals("Foo", GeneratorUtil.makeClassName("Foo"));
67 | assertEquals("FooBar", GeneratorUtil.makeClassName("foo bar"));
68 | assertEquals("Class", GeneratorUtil.makeClassName("class"));
69 | }
70 |
71 | /**
72 | * Test of makeClassName method with something that looks like an IP
73 | */
74 | public void testMakeClassNameIP() {
75 | System.out.println("makeIPClassName");
76 |
77 | assertEquals("IP120001", GeneratorUtil.makeClassName("120001"));
78 | }
79 |
80 |
81 | /**
82 | * Test of makeParamName method, of class org.jvnet.ws.wadl2java.GeneratorUtil.
83 | */
84 | public void testMakeParamName() {
85 | System.out.println("makeParamName");
86 |
87 | assertEquals("foo", GeneratorUtil.makeParamName("foo"));
88 | assertEquals("foo", GeneratorUtil.makeParamName("FOO"));
89 | assertEquals("foo", GeneratorUtil.makeParamName("Foo"));
90 | assertEquals("fooBar", GeneratorUtil.makeParamName("foo bar"));
91 | assertEquals("_class", GeneratorUtil.makeParamName("class"));
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/test/java/org/jvnet/ws/wadl2java/MainTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The contents of this file are subject to the terms
3 | * of the Common Development and Distribution License
4 | * (the "License"). You may not use this file except
5 | * in compliance with the License.
6 | *
7 | * You can obtain a copy of the license at
8 | * http://www.opensource.org/licenses/cddl1.php
9 | * See the License for the specific language governing
10 | * permissions and limitations under the License.
11 | */
12 |
13 | /*
14 | * MainTest.java
15 | * JUnit based test
16 | *
17 | * Created on April 27, 2006, 4:59 PM
18 | */
19 |
20 | package org.jvnet.ws.wadl2java;
21 |
22 | import junit.framework.*;
23 | import javax.xml.bind.JAXBContext;
24 | import javax.xml.bind.JAXBException;
25 | import javax.xml.bind.Unmarshaller;
26 | import org.jvnet.ws.wadl.*;
27 | import java.io.File;
28 | import java.util.List;
29 |
30 | /**
31 | *
32 | * @author mh124079
33 | */
34 | public class MainTest extends TestCase {
35 |
36 | public MainTest(String testName) {
37 | super(testName);
38 | }
39 |
40 | protected void setUp() throws Exception {
41 | }
42 |
43 | protected void tearDown() throws Exception {
44 | }
45 |
46 | public static Test suite() {
47 | TestSuite suite = new TestSuite(MainTest.class);
48 |
49 | return suite;
50 | }
51 |
52 | /**
53 | * Test of process method, of class org.jvnet.ws.wadl2java.Main.
54 | */
55 | /* public void testProcess() {
56 | System.out.println("process");
57 |
58 | Main instance = new Main(new File("YahooSearch.wadl"));
59 | instance.process();
60 | }
61 | */
62 | /**
63 | * Test of main method, of class org.jvnet.ws.wadl2java.Main.
64 | */
65 | public void testMain() {
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/test/resources/org/jvnet/ws/wadl/ast/NewsSearchError.xsd:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/test/resources/org/jvnet/ws/wadl/ast/NewsSearchResponse.xsd:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/wadl/wadl-core/src/test/resources/org/jvnet/ws/wadl/ast/SoapUIYahooSearch.wadl:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
16 | The Yahoo News Search service provides online searching of news
17 | stories from around the world.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | The Yahoo News Search service provides online searching of news
29 | stories from around the world.
30 |
31 |
32 | The application ID. See Application IDs for more information.
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
49 |
52 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | The format for the output. If json is requested, the results will be returned in JSON format. If php is requested, the results will be returned in Serialized PHP format.
72 |
73 |
74 |
75 |
76 |
77 | The name of the callback function to wrap around the JSON data. The following characters are allowed: A-Z a-z 0-9 . [] and _. If output=json has not been requested, this parameter has no effect. More information on the callback can be found in the Yahoo! Developer Network JSON Documentation.
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/wadl/wadl-dist/src/assembly/dist.xml:
--------------------------------------------------------------------------------
1 |
2 | bin
3 |
4 | zip
5 |
6 |
7 |
8 | ${basedir}/src/main/resources/LICENSE.txt
9 | /
10 | false
11 |
12 |
13 | ${basedir}/src/main/resources/README.txt
14 | /
15 | true
16 |
17 |
18 | ${basedir}/src/main/resources/README.html
19 | /
20 | true
21 |
22 |
23 | ${basedir}/src/main/resources/samples/README.html
24 | samples
25 | true
26 |
27 |
28 | ${basedir}/src/main/resources/samples/README.txt
29 | samples
30 | true
31 |
32 |
33 | ${basedir}/src/main/resources/samples/maven/pom.xml
34 | samples/maven
35 | true
36 |
37 |
38 | ${basedir}/src/main/resources/bin/wadl2java
39 | bin
40 | unix
41 | 0744
42 | true
43 |
44 |
45 | ${basedir}/src/main/resources/bin/wadl2java.bat
46 | bin
47 | dos
48 | true
49 |
50 |
51 |
52 |
53 | ${basedir}/src/main/resources/samples/share
54 | samples/share
55 |
56 | *.wadl
57 | *.xsd
58 | *.xjb
59 |
60 |
61 |
62 | ${basedir}/src/main/resources/samples/ant
63 | samples/ant
64 |
65 | build.xml
66 |
67 |
68 |
69 | ${basedir}/src/main/resources/samples/cmdline
70 | samples/cmdline
71 |
72 | *.formatted
73 | *.cmd
74 | *.bat
75 |
76 | unix
77 | 0744
78 |
79 |
80 | ${basedir}/src/main/resources/samples/cmdline
81 | samples/cmdline
82 |
83 | *.formatted
84 |
85 |
86 | *.cmd
87 | *.bat
88 |
89 | dos
90 |
91 |
92 | ${project.build.directory}/endorsed
93 | lib/endorsed
94 |
95 | *.jar
96 |
97 |
98 |
99 |
100 |
101 | lib
102 | false
103 | runtime
104 |
105 |
106 |
--------------------------------------------------------------------------------
/wadl/wadl-dist/src/com/sun/research/wadl2java/yahoo/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The contents of this file are subject to the terms
3 | * of the Common Development and Distribution License
4 | * (the "License"). You may not use this file except
5 | * in compliance with the License.
6 | *
7 | * You can obtain a copy of the license at
8 | * http://www.opensource.org/licenses/cddl1.php
9 | * See the License for the specific language governing
10 | * permissions and limitations under the License.
11 | */
12 |
13 | /*
14 | * Main.java
15 | *
16 | * Created on May 1, 2006, 5:10 PM
17 | *
18 | */
19 |
20 | package com.sun.research.wadl2java.yahoo;
21 |
22 | import com.yahoo.search.Endpoint.NewsSearch;
23 | import com.yahoo.search.Output;
24 | import com.yahoo.search.Sort;
25 | import com.yahoo.search.Type;
26 | import yahoo.yn.Result;
27 | import yahoo.yn.ResultSet;
28 |
29 | /**
30 | * Simple command line example to query the Yahoo News Search service
31 | * @author mh124079
32 | */
33 | public class Main {
34 |
35 | /**
36 | * Query the Yahoo News Search service for stories that contain the word Java.
37 | * @param args the command line arguments
38 | */
39 | public static void main(String[] args) {
40 | try {
41 | NewsSearch s = new NewsSearch();
42 | ResultSet resultSet = s.getAsResultSet(
43 | "jaxws_restful_sample", "java sun", Type.ALL, 10, 1,
44 | Sort.DATE, "en", Output.XML, null);
45 | for (Result result: resultSet.getResultList()) {
46 | System.out.printf("%s (%s)\n", result.getTitle(),
47 | result.getClickUrl());
48 | }
49 | } catch (Exception ex) {
50 | ex.printStackTrace();
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/wadl/wadl-dist/src/main/resources/README.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | README
4 |
5 |
6 |
README
7 |
WADL v. ${version}
8 |
9 | WADL is designed to provide a machine process-able description of
10 | HTTP-based Web applications. To date such applications have
11 | been mainly described using a combination of textual description
12 | and XML schema, WADL aims to provide a machine process-able
13 | description of such applications.
14 |
15 |
16 | This distribution contains the following files:
17 |
18 |
19 |
./bin
20 |
Scripts for running the commandline tool.
21 |
./lib
22 |
The libraries required to run the commandline tools and the Ant task.
23 |
./samples
24 |
Some examples, showing how to use the different tools provided.
25 |
26 |
27 |
--------------------------------------------------------------------------------
/wadl/wadl-dist/src/main/resources/README.txt:
--------------------------------------------------------------------------------
1 | README
2 |
3 | WADL v. ${version}
4 |
5 | WADL is designed to provide a machine process-able description of
6 | HTTP-based Web applications. To date such applications have
7 | been mainly described using a combination of textual description
8 | and XML schema, WADL aims to provide a machine process-able
9 | description of such applications.
10 |
11 | This distribution contains the following files:
12 |
13 | ./bin
14 | Scripts for running the commandline tool.
15 |
16 | ./lib
17 | The libraries required to run the commandline tools and the Ant
18 | task.
19 |
20 | ./samples
21 | Some examples, showing how to use the different tools provided.
22 |
--------------------------------------------------------------------------------
/wadl/wadl-dist/src/main/resources/bin/wadl2java:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ----------------------------------------------------------------------------
3 | # The contents of this file are subject to the terms
4 | # of the Common Development and Distribution License
5 | # (the "License"). You may not use this file except
6 | # in compliance with the License.
7 |
8 | # You can obtain a copy of the license at
9 | # http://www.opensource.org/licenses/cddl1.php
10 | # See the License for the specific language governing
11 | # permissions and limitations under the License.
12 | # ----------------------------------------------------------------------------
13 |
14 | if [ -f /etc/wadlrc ] ; then
15 | . /etc/wadlrc
16 | fi
17 |
18 | if [ -f "$HOME/.wadlrc" ] ; then
19 | . "$HOME/.wadlrc"
20 | fi
21 |
22 | # OS specific support. $var _must_ be set to either true or false.
23 | cygwin=false;
24 | darwin=false;
25 | case "`uname`" in
26 | CYGWIN*) cygwin=true ;;
27 | Darwin*) darwin=true
28 | if [ -z "$JAVA_VERSION" ] ; then
29 | JAVA_VERSION="CurrentJDK"
30 | else
31 | echo "Using Java version: $JAVA_VERSION"
32 | fi
33 | if [ -z "$JAVA_HOME" ] ; then
34 | JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
35 | fi
36 | ;;
37 | esac
38 |
39 | if [ -z "$JAVA_HOME" ] ; then
40 | if [ -e /etc/gentoo-release ] ; then
41 | JAVA_HOME=`java-config --jre-home`
42 | fi
43 | fi
44 |
45 | if [ -z "$WADL_HOME" ] ; then
46 | # try to find WADL
47 | if [ -d /opt/wadl ] ; then
48 | WADL_HOME=/opt/wadl
49 | fi
50 |
51 | if [ -d "$HOME/wadl" ] ; then
52 | WADL_HOME="$HOME/wadl"
53 | fi
54 |
55 | ## resolve links - $0 may be a link to wadl's home
56 | PRG="$0"
57 |
58 | # need this for relative symlinks
59 | while [ -h "$PRG" ] ; do
60 | ls=`ls -ld "$PRG"`
61 | link=`expr "$ls" : '.*-> \(.*\)$'`
62 | if expr "$link" : '/.*' > /dev/null; then
63 | PRG="$link"
64 | else
65 | PRG="`dirname "$PRG"`/$link"
66 | fi
67 | done
68 |
69 | saveddir=`pwd`
70 |
71 | WADL_HOME=`dirname "$PRG"`/..
72 |
73 | # make it fully qualified
74 | WADL_HOME=`cd "$WADL_HOME" && pwd`
75 |
76 | cd "$saveddir"
77 | # echo Using wadl at $WADL_HOME
78 | fi
79 |
80 | # For Cygwin, ensure paths are in UNIX format before anything is touched
81 | if $cygwin ; then
82 | [ -n "$WADL_HOME" ] &&
83 | WADL_HOME=`cygpath --unix "$WADL_HOME"`
84 | [ -n "$JAVA_HOME" ] &&
85 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
86 | [ -n "$CLASSPATH" ] &&
87 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
88 | fi
89 |
90 | if [ -z "$JAVACMD" ] ; then
91 | if [ -n "$JAVA_HOME" ] ; then
92 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
93 | # IBM's JDK on AIX uses strange locations for the executables
94 | JAVACMD="$JAVA_HOME/jre/sh/java"
95 | else
96 | JAVACMD="$JAVA_HOME/bin/java"
97 | fi
98 | else
99 | JAVACMD=java
100 | fi
101 | fi
102 |
103 | if [ ! -x "$JAVACMD" ] ; then
104 | echo "Error: JAVA_HOME is not defined correctly."
105 | echo " We cannot execute $JAVACMD"
106 | exit 1
107 | fi
108 |
109 | if [ -z "$JAVA_HOME" ] ; then
110 | echo "Warning: JAVA_HOME environment variable is not set."
111 | fi
112 |
113 | CLASSWORLDS_LAUNCHER=org.codehaus.classworlds.Launcher
114 |
115 | # For Cygwin, switch paths to Windows format before running java
116 | if $cygwin; then
117 | [ -n "$WADL_HOME" ] &&
118 | WADL_HOME=`cygpath --path --windows "$WADL_HOME"`
119 | [ -n "$JAVA_HOME" ] &&
120 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
121 | [ -n "$HOME" ] &&
122 | HOME=`cygpath --path --windows "$HOME"`
123 | fi
124 |
125 | exec "$JAVACMD" \
126 | $WADL_OPTS \
127 | "-Djava.endorsed.dirs=%WADL_HOME%/lib/endorsed" \
128 | "-Dwadl.home=${WADL_HOME}" \
129 | -jar ${WADL_HOME}/lib/wadl-cmdline-${project.version}.jar \
130 | "$@"
131 |
132 |
--------------------------------------------------------------------------------
/wadl/wadl-dist/src/main/resources/samples/README.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | README
4 |
5 |
6 |
README
7 |
8 | Each of the examples in this directory documents a way to
9 | convert a WADL file to a collection of Java sources.
10 |
11 |
12 |
./ant
13 |
14 | Convert a WADL file to Java sources using the Ant task.
15 |
16 |
17 |
18 |
./maven
19 |
20 | Convert a WADL file to Java sources using the Maven 2
21 | plugin. Note that the plugin will actually be downloaded from
22 | the Maven repository. The plugin itself is not shipping as
23 | part of this distribution.
24 |
25 |
26 |
27 |
./cmdline
28 |
29 | Convert a WADL file to Java sources using the commandline tool
30 | found in the bin directory in this distribution.
31 |
32 |
33 |
34 |
./shared
35 |
36 | The WADL file and schemas used as input in each of these
37 | examples.
38 |