Remove Petstore from examples (moved to separate Gitbox).
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/04.DtoExamples.html b/juneau-doc/docs/Topics/17.juneau-examples-rest/03.DtoExamples.html
similarity index 100%
rename from juneau-doc/docs/Topics/17.juneau-examples-rest/04.DtoExamples.html
rename to juneau-doc/docs/Topics/17.juneau-examples-rest/03.DtoExamples.html
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/03.PetStoreResource.html b/juneau-doc/docs/Topics/17.juneau-examples-rest/03.PetStoreResource.html
deleted file mode 100644
index c30f263..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/03.PetStoreResource.html
+++ /dev/null
@@ -1,1382 +0,0 @@
-<!--
-/***************************************************************************************************************************
- * 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.
- ***************************************************************************************************************************/
- -->
-
-PetStore
-
-<p>
- The <c>PetStore</c> application is an functional application meant to demonstrate the following:
-</p>
-<ul class='spaced-list'>
- <li>
- Creating a Juneau-based REST interface on top of JPA beans.
- <li>
- Creating sophisticated Swagger UI using only annotations.
-</ul>
-<p>
- When you click the <l>petstore</l> link on the home page of the examples app, you should see this page:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.1.png'>
-
-<p>
- The contents of this page is primarily defined via annotations defined on the <l>PetStoreResource</l> class:
-</p>
-
-<h5 class='figure'>PetStoreResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestResource</ja>(
- path=<js><js>"/petstore"</js></js>,
- title=<js><js>"Petstore application"</js></js>,
- description= {
- <js><js>"This is a sample server Petstore server based on the Petstore sample at Swagger.io."</js></js>,
- <js>"You can find out more about Swagger at <a class='link' href='http://swagger.io'>http://swagger.io</a>."</js>,
- },
- htmldoc=<ja>@HtmlDoc</ja>(
- widgets={
- ContentTypeMenuItem.<jk>class</jk>,
- ThemeMenuItem.<jk>class</jk>,
- },
- navlinks={
- <js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>,
- <js>"$W{ContentTypeMenuItem}"</js>,
- <js>"$W{ThemeMenuItem}"</js>,
- <js>"source: $C{Source/gitHub}/org/apache/juneau/examples/rest/petstore/$R{servletClassSimple}.java"</js>
- },
- head={
- <js>"<link rel='icon' href='$U{servlet:/htdocs/cat.png}'/>"</js> <jc>// Add a cat icon to the page.</jc>
- },
- header={
- <js>"<h1>$R{resourceTitle}</h1>"</js>,
- <js>"<h2>$R{methodSummary}</h2>"</js>,
- <js>"$C{PetStore/headerImage}"</js>
- },
- aside={
- <js>"<div style='max-width:400px' class='text'>"</js>,
- <js>" <p>This page shows a standard nested REST resource.</p>"</js>,
- <js>" <p>It shows how different properties can be rendered on the same bean in different views.</p>"</js>,
- <js>" <p>It also shows examples of HtmlRender classes and @BeanProperty(format) annotations.</p>"</js>,
- <js>" <p>It also shows how the Queryable converter and query widget can be used to create searchable interfaces.</p>"</js>,
- <js>"</div>"</js>
- },
- stylesheet=<js>"servlet:/htdocs/themes/dark.css"</js> <jc>// Use dark theme by default.</jc>
- ),
- ...
- staticFiles={<js>"htdocs:htdocs"</js>}, <jc>// Expose static files in htdocs subpackage.</jc>
- children={
- SqlQueryResource.<jk>class</jk>,
- PhotosResource.<jk>class</jk>
- }
- )
- <jk>public class</jk> PetStoreResource <jk>extends</jk> BasicRestJena {
-</p>
-<p>
- The inner contents of the page are generated from this method which is used to define a jumping-off
- page for the application:
-</p>
-<h5 class='figure'>PetStoreResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestMethod</ja>(
- name=<jsf>GET</jsf>,
- path=<js>"/"</js>,
- summary=<js>"Navigation page"</js>,
- htmldoc=<ja>@HtmlDoc</ja>(
- style={
- <js>"INHERIT"</js>, <jc>// Flag for inheriting resource-level CSS.</jc>
- <js>"body { "</js>,
- <js>"background-image: url('petstore/htdocs/background.jpg'); "</js>,
- <js>"background-color: black; "</js>,
- <js>"background-size: cover; "</js>,
- <js>"background-attachment: fixed; "</js>,
- <js>"}"</js>
- }
- )
- )
- <jk>public</jk> ResourceDescriptions getTopPage() {
- <jk>return new</jk> ResourceDescriptions()
- .append(<js>"pet"</js>, <js>"All pets in the store"</js>)
- .append(<js>"store"</js>, <js>"Orders and inventory"</js>)
- .append(<js>"user"</js>, <js>"Petstore users"</js>)
- .append(<js>"photos"</js>, <js>"Photos service"</js>)
- .append(<js>"sql"</js>, <js>"SQL query service"</js>)
- ;
- }
-</p>
-<p>
- Note how we used the <ja>@HtmlDoc</ja> annotation to add some CSS to our page
- that renders our background image.
-</p>
-<p>
- The {@link oajr.helper.ResourceDescriptions} class used above is a convenience class for creating
- hyperlinks to child resources.
-</p>
-<hr>
-<p>
- The application itself is defined in 3 packages:
-</p>
-<ul class='javatree'>
- <li class='jp'><c>org.apache.juneau.rest.examples.rest.petstore</c>
- <br>Defines the service for storing and retrieving Petstore data.
- <br><img class='bordered' style='width:250px' src='doc-files/juneau-examples-rest.PetStoreResource.2a.png'>
- <li class='jp'><c>org.apache.juneau.rest.examples.rest.petstore.dto</c>
- <br>Data transfer objects.
- <br>These are JPA beans that are used both to store data in our database and are serialized
- directly by our REST interface.
- <br><img class='bordered' style='width:250px' src='doc-files/juneau-examples-rest.PetStoreResource.2b.png'>
- <li class='jp'><c>org.apache.juneau.rest.examples.rest.petstore.rest</c>
- <br>The classes used for our REST interface.
- <br><img class='bordered' style='width:250px' src='doc-files/juneau-examples-rest.PetStoreResource.2c.png'>
-</ul>
-<p>
- We also define some static files in the <c>org.apache.juneau.rest.examples.rest.petstore</c> package:
-</p>
-<img class='bordered' style='width:250px' src='doc-files/juneau-examples-rest.PetStoreResource.2d.png'>
-<hr>
-<p>
- The <l>PetStoreService</l> class is a pretty-straightforward service for storing and retrieving JPA beans:
-</p>
-<h5 class='figure'>PetStoreService.java</h5>
-<p class='bpcode w800'>
- <jk>public class</jk> PetStoreService <jk>extends</jk> AbstractPersistenceService {
-
- <jk>public</jk> Pet getPet(<jk>long</jk> id) <jk>throws</jk> IdNotFound {
- <jk>return</jk> find(Pet.<jk>class</jk>, id);
- }
-
- <jk>public</jk> List<Pet> getPets() {
- <jk>return</jk> query(<js>"select X from PetstorePet X"</js>, Pet.<jk>class</jk>, (SearchArgs)<jk>null</jk>);
- }
-
- <jk>public</jk> Pet create(CreatePet c) {
- <jk>return</jk> merge(new Pet().status(PetStatus.<jsf>AVAILABLE</jsf>).apply(c));
- }
-
- <jk>public</jk> Pet update(UpdatePet u) <jk>throws</jk> IdNotFound {
- EntityManager em = getEntityManager();
- <jk>return</jk> merge(em, find(em, Pet.<jk>class</jk>, u.getId()).apply(u));
- }
-
- <jk>public void</jk> removePet(<jk>long</jk> id) <jk>throws</jk> IdNotFound {
- EntityManager em = getEntityManager();
- remove(em, find(em, Pet.<jk>class</jk>, id));
- }
-
- ...
- }
-</p>
-<p>
- The DTOs are simply beans that combine both JPA and Juneau bean annotations:
-</p>
-<h5 class='figure'>Pet.java</h5>
-<p class='bpcode w800'>
- <ja>@Bean</ja>(typeName=<js>"Pet"</js>, fluentSetters=<jk>true</jk>, properties=<js>"id,species,name,tags,price,status,photo"</js>)
- <ja>@Entity</ja>(name=<js>"PetstorePet"</js>)
- <jk>public class</jk> Pet {
-
- <ja>@Column @Id @GeneratedValue</ja>
- <ja>@Schema</ja>(description=<js>"Unique identifier for this pet."</js>)
- <ja>@Html</ja>(link=<js>"servlet:/pet/{id}"</js>)
- <jk>private long</jk> <jf>id</jf>;
-
- <ja>@Column</ja>(length=50)
- <ja>@Schema</ja>(description=<js>"Pet name."</js>, minLength=3, maxLength=50)
- <jk>private</jk> String <jf>name</jf>;
-
- ...
-
- <jk>public long</jk> getId() {
- <jk>return</jk> <jf>id</jf>;
- }
-
- <jk>public</jk> Pet id(<jk>long</jk> id) {
- <jk>this</jk>.<jf>id</jf> = id;
- <jk>return this</jk>;
- }
-
- <jk>public</jk> String getName() {
- <jk>return</jk> <jf>name</jf>;
- }
-
- <jk>public</jk> Pet name(String name) {
- <jk>this</jk>.<jf>name</jf> = name;
- <jk>return this</jk>;
- }
-
- ...
- }
-</p>
-<p>
- The beans are found by JPA by adding them to the JPA persistence file.
-</p>
-<h5 class='figure'>META-INF/persistence.xml</h5>
-<p class='bpcode w800'>
- <xt><persistence></xt>
- <xt><persistence-unit</xt> <xa>name</xa>=<xs>"test"</xs> <xa>transaction-type</xa>=<xs>"RESOURCE_LOCAL"</xs>></xt>
- <xt><class></xt>org.apache.juneau.examples.rest.petstore.dto.Pet<xt></class></xt>
- <xt><class></xt>org.apache.juneau.examples.rest.petstore.dto.Order<xt></class></xt>
- <xt><class></xt>org.apache.juneau.examples.rest.petstore.dto.User<xt></class></xt>
- <xt><properties></xt>
- <xt><property</xt> <xa>name</xa>=<xs>"javax.persistence.jdbc.driver"</xs> <xa>value</xa>=<xs>"org.apache.derby.jdbc.EmbeddedDriver"</xs> <xt>/></xt>
- <xt><property</xt> <xa>name</xa>=<xs>"javax.persistence.jdbc.url"</xs> <xa>value</xa>=<xs>"jdbc:derby:target/derby/testDB;create=true"</xs> <xt>/></xt>
- <xt><property</xt> <xa>name</xa>=<xs>"javax.persistence.jdbc.user"</xs> <xa>value</xa>=<xs>""</xs> <xt>/></xt>
- <xt><property</xt> <xa>name</xa>=<xs>"javax.persistence.jdbc.password"</xs> <xa>value</xa>=<xs>""</xs> <xt>/></xt>
- <xt><property</xt> <xa>name</xa>=<xs>"hibernate.dialect"</xs> <xa>value</xa>=<xs>"org.hibernate.dialect.DerbyDialect"</xs> <xt>/></xt>
- <xt><property</xt> <xa>name</xa>=<xs>"hibernate.hbm2ddl.auto"</xs> <xa>value</xa>=<xs>"create-drop"</xs> <xt>/></xt>
- <xt><property</xt> <xa>name</xa>=<xs>"show_sql"</xs> <xa>value</xa>=<xs>"true"</xs> <xt>/></xt>
- <xt><property</xt> <xa>name</xa>=<xs>"hibernate.temp.use_jdbc_metadata_defaults"</xs> <xa>value</xa>=<xs>"false"</xs> <xt>/></xt>
- <xt></properties></xt>
- <xt></persistence-unit></xt>
- <xt></persistence></xt>
-</p>
-<p>
- The Petstore service is instantiated in our REST interface using a hook.
- Note that a real-world scenario would likely use some other means such as injection.
-</p>
-<h5 class='figure'>PetStoreResource.java</h5>
-<p class='bpcode w800'>
- <jk>public class</jk> PetStoreResource <jk>extends</jk> BasicRestJena <jk>implements</jk> PetStore {
-
- <jk>private</jk> PetStoreService <jf>store</jf>;
-
- <ja>@RestHook</ja>(<jsf>INIT</jsf>)
- <jk>public void</jk> startup(RestContextBuilder builder) <jk>throws</jk> Exception {
- <jf>store</jf> = <jk>new</jk> PetStoreService();
- }
-
- ...
-</p>
-<hr>
-<p>
- The Petstore database is empty by default.
- The <l>INIT</l> link brings you to a page to initialize the contents of the database
- from sample data:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/init
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.3a.png'>
-<p>
- You can try loading the Petstore database using direct JPA or via REST calls through a client-side proxy.
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.3b.png'>
-<p>
- The initialize page is rendered using the following methods in our <l>PetStoreResource</l> class.
- Note that we're using HTML5 beans to render the contents of the page, and
- the use of a direct unbuffered writer allowing for the creation
- of a console-like window in an iframe.
-</p>
-<h5 class='figure'>PetStoreResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestMethod</ja>(
- summary=<js>"Initialize database form entry page"</js>
- )
- <jk>public</jk> Div getInit() {
- <jk>return</jk> <jsm>div</jsm>(
- <jsm>form</jsm>(<js>"servlet:/init"</js>).method(<jsf>POST</jsf>).target(<js>"buf"</js>).children(
- <jsm>table</jsm>(
- <jsm>tr</jsm>(
- <jsm>th</jsm>(<js>"Initialize petstore database:"</js>),
- <jsm>td</jsm>(<jsm>input</jsm>(<js>"radio"</js>).name(<js>"init-method"</js>).value(<js>"direct"</js>).checked(<jk>true</jk>), <js>"direct"</js>, <jsm>input</jsm>(<js>"radio"</js>).name(<js>"init-method"</js>).value(<js>"rest"</js>), <js>"rest"</js>),
- <jsm>td</jsm>(<jsm>button</jsm>(<js>"submit"</js>, <js>"Submit"</js>).style(<js>"float:right"</js>).onclick(<js>"scrolling=true"</js>))
- )
- )
- ),
- <jsm>br</jsm>(),
- <jsm>iframe</jsm>().id(<js>"buf"</js>).name(<js>"buf"</js>).style(<js>"width:800px;height:600px;"</js>).onload(<js>"window.parent.scrolling=false;"</js>),
- <jsm>script</jsm>(<js>"text/javascript"</js>,
- <js>"var scrolling = false;"</js>,
- <js>"function scroll() { if (scrolling) { document.getElementById('buf').contentWindow.scrollBy(0,50); } setTimeout('scroll()',200); } "</js>,
- <js>"scroll();"</js>
- )
- );
- }
-
- <ja>@RestMethod</ja>(
- summary=<js>"Initialize database"</js>
- )
- <jk>public void</jk> postInit(
- <ja>@FormData</ja>(<js>"init-method"</js>) String initMethod,
- RestResponse res
- ) <jk>throws</jk> Exception {
- res.setHeader(<js>"Content-Encoding"</js>, <js>"identity"</js>);
- <jk>if</jk> (<js>"direct"</js>.equals(initMethod))
- <jf>store</jf>.initDirect(res.getDirectWriter(<js>"text/plain"</js>));
- <jk>else</jk>
- <jf>store</jf>.initViaRest(res.getDirectWriter(<js>"text/plain"</js>));
- }
-</p>
-<p>
- The direct initialization uses direct JPA to store beans in the database.
- The following code in <l>PetStoreService</l> reads and parses DTOs from our init JSON files (e.g. <js>"init/Pets.json"</js>)
- and stores them using the JPA <l>EntityManager</l> class.
-</p>
-<h5 class='figure'>PetStoreService.java</h5>
-<p class='bpcode w800'>
- <jk>public</jk> PetStoreService initDirect(PrintWriter w) <jk>throws</jk> Exception {
-
- EntityManager em = getEntityManager();
- EntityTransaction et = em.getTransaction();
- JsonParser parser = JsonParser.<jsm>create</jsm>().build();
-
- et.begin();
-
- <jk>for</jk> (Pet x : em.createQuery(<js>"select X from PetstorePet X"</js>, Pet.<jk>class</jk>).getResultList()) {
- em.remove(x);
- w.println(<jsm>format</jsm>(<js>"Deleted pet: id={0}"</js>, x.getId()));
- }
- ...
-
- et.commit();
- et.begin();
-
- <jk>for</jk> (Pet x : parser.parse(getStream(<js>"init/Pets.json"</js>), Pet[].<jk>class</jk>)) {
- x = em.merge(x);
- w.println(<jsm>format</jsm>(<js>"Created pet: id={0}, name={1}"</js>, x.getId(), x.getName()));
- }
- ...
-
- et.commit();
-
- <jk>return this</jk>;
- }
-
- <jk>private</jk> InputStream getStream(String fileName) {
- <jk>return</jk> getClass().getResourceAsStream(fileName);
- }
-</p>
-<p>
- The REST initialization uses a REST proxy interface to delete and store values in the database:
-
-</p>
-<h5 class='figure'>PetStoreService.java</h5>
-<p class='bpcode w800'>
- <jk>public</jk> PetStoreService initViaRest(PrintWriter w) <jk>throws</jk> Exception {
- JsonParser parser = JsonParser.<jsm>create</jsm>().ignoreUnknownBeanProperties().build();
-
- <jk>try</jk> (RestClient rc = RestClient.<jsm>create</jsm>().json().rootUrl(<js>"http://localhost:10000"</js>).build()) {
- PetStore ps = rc.getRemoteResource(PetStore.<jk>class</jk>);
-
- <jk>for</jk> (Pet x : ps.getPets()) {
- ps.deletePet(<js>"apiKey"</js>, x.getId());
- w.println(<jsm>format</jsm>(<js>"Deleted pet: id={0}"</js>, x.getId()));
- }
- ...
- <jk>for</jk> (CreatePet x : parser.parse(getStream(<js>"init/Pets.json"</js>), CreatePet[].<jk>class</jk>)) {
- <jk>long</jk> id = ps.postPet(x);
- w.println(<jsm>format</jsm>(<js>"Created pet: id={0}, name={1}"</js>, id, x.getName()));
- }
- ...
- }
-
- <jk>return this</jk>;
- }
-</p>
-<p>
- The <l>PetStore</l> class is an interface annotated with <ja>@RemoteResource</ja> and <ja>@RemoteMethod</ja>
- annotations defining how to communicate with our REST interface:
-</p>
-<h5 class='figure'>PetStore.java</h5>
-<p class='bpcode w800'>
- <ja>@RemoteResource</ja>(path=<js>"/petstore"</js>)
- <jk>public interface</jk> PetStore {
-
- <ja>@RemoteMethod</ja>(method=<jsf>GET</jsf>, path=<js>"/pet"</js>)
- <jk>public</jk> Collection<Pet> getPets() <jk>throws</jk> NotAcceptable;
-
- <ja>@RemoteMethod</ja>(path=<js>"/pet/{petId}"</js>) <jc>/* method inferred from method name */</jc>
- <jk>public</jk> Pet getPet(
- <ja>@Path</ja>(
- name=<js>"petId"</js>,
- description=<js>"ID of pet to return"</js>,
- example=<js>"123"</js>
- )
- <jk>long</jk> petId
- ) <jk>throws</jk> IdNotFound, NotAcceptable;
-
- <ja>@RemoteMethod</ja> <jc>/* method and path inferred from method name */</jc>
- <jk>public long</jk> postPet(
- <ja>@Body</ja>(
- description=<js>"Pet object to add to the store"</js>
- ) CreatePet pet
- ) <jk>throws</jk> IdConflict, NotAcceptable, UnsupportedMediaType;
-
- <ja>@RemoteMethod</ja>(method=<jsf>PUT</jsf>, path=<js>"/pet/{petId}"</js>)
- <jk>public</jk> Ok updatePet(
- <ja>@Body</ja>(
- description=<js>"Pet object that needs to be added to the store"</js>
- ) UpdatePet pet
- ) <jk>throws</jk> IdNotFound, NotAcceptable, UnsupportedMediaType;
-
- <ja>@RemoteMethod</ja>(method=<jsf>DELETE</jsf>, path=<js>"/pet/{petId}"</js>)
- <jk>public</jk> Ok deletePet(
- <ja>@Header</ja>(
- name=<js>"api_key"</js>,
- description=<js>"Security API key"</js>,
- required=<jk>true</jk>,
- example=<js>"foobar"</js>
- )
- String apiKey,
- <ja>@Path</ja>(
- name=<js>"petId"</js>,
- description=<js>"Pet id to delete"</js>,
- example=<js>"123"</js>
- )
- <jk>long</jk> petId
- ) <jk>throws</jk> IdNotFound, NotAcceptable;
-
- ...
- }
-</p>
-<p>
- Note that this is the same interface used to define our server-side REST implementation!
- The annotations defined on the method parameters used for client-side proxies are also
- inherited by and used for our server-side implementation class.
-</p>
-<h5 class='figure'>PetStoreResource.java</h5>
-<p class='bpcode w800'>
- <jk>public class</jk> PetStoreResource <jk>extends</jk> BasicRestJena <jk>implements</jk> PetStore {
-
- <ja>@Override</ja> <jc>/* PetStore */</jc>
- <ja>@RestMethod</ja>(
- name=<jsf>GET</jsf>,
- path=<js>"/pet"</js>,
- summary=<js>"All pets in the store"</js>,
- swagger=<ja>@MethodSwagger</ja>(
- tags=<js>"pet"</js>,
- parameters={
- Queryable.<jsf>SWAGGER_PARAMS</jsf>
- }
- ),
- bpx=<js>"Pet: tags,photo"</js>,
- htmldoc=<ja>@HtmlDoc</ja>(
- widgets={
- QueryMenuItem.<jk>class</jk>,
- AddPetMenuItem.<jk>class</jk>
- },
- navlinks={
- <js>"INHERIT"</js>, <jc>// Inherit links from class.</jc>
- <js>"[2]:$W{QueryMenuItem}"</js>, <jc>// Insert QUERY link in position 2.</jc>
- <js>"[3]:$W{AddPetMenuItem}"</js> <jc>// Insert ADD link in position 3.</jc>
- }
- ),
- converters={Queryable.<jk>class</jk>}
- )
- <jk>public</jk> Collection<Pet> getPets() <jk>throws</jk> NotAcceptable {
- <jk>return</jk> <jf>store</jf>.getPets();
- }
-
- <ja>@Override</ja> <jc>/* PetStore */</jc>
- <ja>@RestMethod</ja>(
- name=<jsf>GET</jsf>,
- path=<js>"/pet/{petId}"</js>,
- summary=<js>"Find pet by ID"</js>,
- description=<js>"Returns a single pet"</js>,
- swagger=<ja>@MethodSwagger</ja>(
- tags=<js>"pet"</js>,
- value={
- <js>"security:[ { api_key:[] } ]"</js>
- }
- )
- )
- <jk>public</jk> Pet getPet(<jk>long</jk> petId) <jk>throws</jk> IdNotFound, NotAcceptable {
- <jk>return</jk> <jf>store</jf>.getPet(petId);
- }
-
- <ja>@Override</ja> <jc>/* PetStore */</jc>
- <ja>@RestMethod</ja>(
- summary=<js>"Add a new pet to the store"</js>,
- swagger=<ja>@MethodSwagger</ja>(
- tags=<js>"pet"</js>,
- value={
- <js>"security:[ { petstore_auth:['write:pets','read:pets'] } ]"</js>
- }
- )
- )
- <jk>public long</jk> postPet(CreatePet pet) <jk>throws</jk> IdConflict, NotAcceptable, UnsupportedMediaType {
- <jk>return</jk> <jf>store</jf>.create(pet).getId();
- }
-
- <ja>@Override</ja> <jc>/* PetStore */</jc>
- <ja>@RestMethod</ja>(
- name=<jsf>PUT</jsf>,
- path=<js>"/pet/{petId}"</js>,
- summary=<js>"Update an existing pet"</js>,
- swagger=<ja>@MethodSwagger</ja>(
- tags=<js>"pet"</js>,
- value={
- <js>"security:[ { petstore_auth: ['write:pets','read:pets'] } ]"</js>
- }
- )
- )
- <jk>public</jk> Ok updatePet(UpdatePet pet) <jk>throws</jk> IdNotFound, NotAcceptable, UnsupportedMediaType {
- <jf>store</jf>.update(pet);
- <jk>return</jk> <jsf>OK</jsf>;
- }
-
- <ja>@Override</ja> <jc>/* PetStore */</jc>
- <ja>@RestMethod</ja>(
- name=<jsf>DELETE</jsf>,
- path=<js>"/pet/{petId}"</js>,
- summary=<js>"Deletes a pet"</js>,
- swagger=<ja>@MethodSwagger</ja>(
- tags=<js>"pet"</js>,
- value={
- <js>"security:[ { petstore_auth:[ 'write:pets','read:pets' ] } ]"</js>
- }
- )
- )
- <jk>public</jk> Ok deletePet(String apiKey, <jk>long</jk> petId) <jk>throws</jk> IdNotFound, NotAcceptable {
- <jf>store</jf>.removePet(petId);
- <jk>return</jk> <jsf>OK</jsf>;
- }
- ...
- }
-</p>
-<p>
- The advantage to using a common interface for both your server-side and client-side APIs is that you
- have less of a chance of a mismatch between the server and client side definitions.
-</p>
-<hr>
-<p>
- Now that we've initialized the contents of our database, we can start exploring the REST interface.
- We can start by click the <l>pet</l> link on the home page which takes you to a summary page of <l>Pet</l>
- objects:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/pet
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.4a.png'>
-
-<p>
- Clicking on one of the ID links takes you to a details page:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/pet/1
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.4b.png'>
-<p>
- You'll notice the details page shows <l>tags</l> and <l>photo</l> fields not shown on the summary page.
- This was accomplished with the <c>bpx=<js>"Pet: tags,photo"</js></c> annotation on the <l>getPets()</l>
- method which excludes those two properties from the view.
- This is a common way of defining summary and details views for POJOs.
-</p>
-<p>
- The hyperlinks and special rendering for <l>Pet</l> objects is done through <ja>@Html</ja> annotations
- and {@link oaj.html.HtmlRender} objects.
-</p>
-<h5 class='figure'>Pet.java</h5>
-<p class='bpcode w800'>
- <jk>public class</jk> Pet {
-
- <ja>@Html</ja>(link=<js>"servlet:/pet/{id}"</js>)
- <jk>private long</jk> <jf>id</jf>;
-
- <ja>@Html</ja>(render=PriceRender.<jk>class</jk>)
- <jk>private float</jk> <jf>price</jf>;
-
- <jk>private</jk> Species <jf>species</jf>;
-
- <jk>private</jk> PetStatus <jf>status</jf>;
-
- ...
-
- <jk>public static final class</jk> PriceRender <jk>extends</jk> HtmlRender<Float> {
- <ja>@Override</ja> <jc>/* HtmlRender */</jc>
- <jk>public</jk> Object getContent(SerializerSession session, Float value) {
- <jk>return</jk> value == <jk>null</jk> ? <jk>null</jk> : String.<jsm>format</jsm>(<js>"$%.2f"</js>, value);
- }
- }
-
- ...
-</p>
-
-<h5 class='figure'>Species.java</h5>
-<p class='bpcode w800'>
- <ja>@Html</ja>(render=Species.SpeciesRender.<jk>class</jk>)
- <jk>public enum</jk> Species {
-
- <jsf>BIRD</jsf>, <jsf>CAT</jsf>, <jsf>DOG</jsf>, <jsf>FISH</jsf>, <jsf>MOUSE</jsf>, <jsf>RABBIT</jsf>, <jsf>SNAKE</jsf>;
-
- <jk>public static class</jk> SpeciesRender <jk>extends</jk> HtmlRender<Species> {
- <ja>@Override</ja> <jc>/* HtmlRender */</jc>
- <jk>public</jk> Object getContent(SerializerSession session, Species value) {
- <jk>return new</jk> Img().src(<js>"servlet:/htdocs/"</js>+value.name().toLowerCase()+<js>".png"</js>);
- }
- <ja>@Override</ja> <jc>/* HtmlRender */</jc>
- <jk>public</jk> String getStyle(SerializerSession session, Species value) {
- <jk>return</jk> <js>"background-color:#FDF2E9"</js>;
- }
- }
- }
-</p>
-
-<h5 class='figure'>PetStatus.java</h5>
-<p class='bpcode w800'>
- <ja>@Html</ja>(render=PetStatus.PetStatusRender.<jk>class</jk>)
- <jk>public enum</jk> PetStatus {
-
- <jsf>AVAILABLE</jsf>, <jsf>PENDING</jsf>, <jsf>SOLD</jsf>, <jsf>UNKNOWN</jsf>;
-
- <jk>public static class</jk> PetStatusRender <jk>extends</jk> HtmlRender<PetStatus> {
- <ja>@Override</ja> <jc>/* HtmlRender */</jc>
- <jk>public</jk> String getStyle(SerializerSession session, PetStatus value) {
- <jk>switch</jk>(value) {
- <jk>case</jk> <jsf>AVAILABLE</jsf>: <jk>return</jk> <js>"background-color:#5cb85c;text-align:center;vertical-align:middle;"</js>;
- <jk>case</jk> <jsf>PENDING</jsf>: <jk>return</jk> <js>"background-color:#f0ad4e;text-align:center;vertical-align:middle;"</js>;
- <jk>case</jk> <jsf>SOLD</jsf>: <jk>return</jk> <js>"background-color:#888;text-align:center;vertical-align:middle;"</js>;
- <jk>default</jk>: <jk>return</jk> <js>"background-color:#777;text-align:center;vertical-align:middle;"</js>;
- }
- }
- }
- }
-</p>
-<p>
- The <l>CONTENT-TYPE</l> menu items gives a shorthand way of showing our POJOs in any of the supported
- serialization languages:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/pet/1
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.5a.png'>
-<p>
- For example, selecting <l>APPLICATION/JSON+SIMPLE</l> shows us simplified JSON:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/pet?plainText=true&Accept=application%2Fjson%2Bsimple
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.5b.png'>
-<p>
- Note that we're using the convenience feature for specifying an <c>Accept</c> header via a query parameter.
-</p>
-<p>
- The <l>THEME</l> menu items allows you to quickly change the stylesheet used on the page:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/pet/1
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.6a.png'>
-<p>
- For example, selecting <l>LIGHT</l> shows us the page rendered using the light look-and-feel:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/pet?stylesheet=htdocs%2Fthemes%2Flight.css
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.6b.png'>
-<p>
- Both the <l>CONTENT-TYPE</l> and <l>THEMES</l> menu items are implemented as widgets and
- associated with the page contents through the use of <l>$W</l> variables in the navigation links:
-</p>
-<h5 class='figure'>PetStoreResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestResource</ja>(
- htmldoc=<ja>@HtmlDoc</ja>(
- widgets={
- ContentTypeMenuItem.<jk>class</jk>,
- ThemeMenuItem.<jk>class</jk>,
- },
- navlinks={
- <js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>,
- <js>"init: servlet:/init"</js>,
- <js>"$W{ContentTypeMenuItem}"</js>,
- <js>"$W{ThemeMenuItem}"</js>,
- <js>"source: $C{Source/gitHub}/org/apache/juneau/examples/rest/petstore/$R{servletClassSimple}.java"</js>
- },
- ...
- ),
- ...
-</p>
-<p>
- The implementation of a menu item contains methods for retrieving the label and HTML5 content of the menu item.
-</p>
-<h5 class='figure'>ContentTypeMenuItem.java</h5>
-<p class='bpcode w800'>
- <jk>public class</jk> ContentTypeMenuItem <jk>extends</jk> MenuItemWidget {
-
- <ja>@Override</ja> <jc>/* MenuItemWidget */</jc>
- <jk>public</jk> String getLabel(RestRequest req) {
- <jk>return</jk> <js>"content-type"</js>;
- }
-
- <ja>@Override</ja> <jc>/* MenuItemWidget */</jc>
- <jk>public</jk> Div getContent(RestRequest req) {
- Div div = <jsm>div</jsm>();
- Set<MediaType> l = <jk>new</jk> TreeSet<>();
- <jk>for</jk> (Serializer s : req.getSerializers().getSerializers())
- l.add(s.getPrimaryMediaType());
- <jk>for</jk> (MediaType mt : l) {
- URI uri = req.getUri(<jk>true</jk>, <jk>new</jk> AMap<String,String>().append(<js>"plainText"</js>,<js>"true"</js>).append(<js>"Accept"</js>,mt.toString()));
- div.children(<jsm>a</jsm>(uri, mt), <jsm>br</jsm>());
- }
- <jk>return</jk> div;
- }
- }
-</p>
-
-<h5 class='figure'>ThemeMenuItem.java</h5>
-<p class='bpcode w800'>
- <jk>public class</jk> ThemeMenuItem <jk>extends</jk> MenuItemWidget {
-
- <jk>private static final</jk> String[] <jsf>BUILT_IN_STYLES</jsf> = {<js>"devops"</js>, <js>"light"</js>, <js>"original"</js>, <js>"dark"</js>};
-
- <ja>@Override</ja> <jc>/* Widget */</jc>
- <jk>public</jk> String getLabel(RestRequest req) {
- <jk>return</jk> "themes";
- }
-
- <ja>@Override</ja> <jc>/* MenuItemWidget */</jc>
- <jk>public</jk> Div getContent(RestRequest req) <jk>throws</jk> Exception {
- Div div = <jsm>div</jsm>();
- <jk>for</jk> (String s : <jsf>BUILT_IN_STYLES</jsf>) {
- java.net.URI uri = req.getUri(<jk>true</jk>, <jk>new</jk> AMap<String,String>().append(<js>"stylesheet"</js>, <js>"htdocs/themes/"</js>+s+<js>".css"</js>));
- div.children(<jsm>a</jsm>(uri, s), <jsm>br</jsm>());
- }
- <jk>return</jk> div;
- }
- }
-</p>
-<p>
- The <l>QUERY</l> menu item shows off the capabilities of the {@link oajr.converters.Queryable} converter.
-</p>
-
-<p class='bpcode w800'>
- http://localhost:10000/petstore/pet
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.7a.png'>
-<p>
- The converter will take the POJOs to be serialized and filter them based on the provided query/view/sort/paging attributes:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/pet?s=name%3DHoppy*&v=species%2Cname&o=name&p=0&l=20
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.7b.png'>
-<p>
- The <l>ADD</l> menu item is a custom menu item created for the petstore app for adding pets through the
- web interface.
-</p>
-
-<p class='bpcode w800'>
- http://localhost:10000/petstore/pet
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.8a.png'>
-
-<p>
- Both the <l>QUERY</l> and <l>ADD</l> menu items are only applicable for this page, and so are defined
- on the <l>getPets()</l> method:
-</p>
-
-<h5 class='figure'>PetStoreResource.java</h5>
-<p class='bpcode w800'>
- <ja>@Override</ja> <jc>/* PetStore */</jc>
- <ja>@RestMethod</ja>(
- name=<jsf>GET</jsf>,
- path=<js>"/pet"</js>,
- summary=<js>"All pets in the store"</js>,
- swagger=<ja>@MethodSwagger</ja>(
- tags=<js>"pet"</js>,
- parameters={
- Queryable.<jsf>SWAGGER_PARAMS</jsf>
- }
- ),
- bpx=<js>"Pet: tags,photo"</js>,
- htmldoc=<ja>@HtmlDoc</ja>(
- widgets={
- QueryMenuItem.<jk>class</jk>,
- AddPetMenuItem.<jk>class</jk>
- },
- navlinks={
- <js>"INHERIT"</js>, <jc>// Inherit links from class.</jc>
- <js>"[2]:$W{QueryMenuItem}"</js>, <jc>// Insert QUERY link in position 2.</jc>
- <js>"[3]:$W{AddPetMenuItem}"</js> <jc>// Insert ADD link in position 3.</jc>
- }
- ),
- converters={Queryable.<jk>class</jk>}
- )
- <jk>public</jk> Collection<Pet> getPets() <jk>throws</jk> NotAcceptable {
- <jk>return</jk> <jf>store</jf>.getPets();
- }
-</p>
-
-<h5 class='figure'>QueryMenuItem.java</h5>
-<p class='bpcode w800'>
- <jk>public class</jk> QueryMenuItem <jk>extends</jk> MenuItemWidget {
-
- <ja>@Override</ja> <jc>/* Widget */</jc>
- <jk>public</jk> String getStyle(RestRequest req) <jk>throws</jk> Exception {
- <jk>return super</jk>.getStyle(req)
- + <js>"\n"</js>
- + <jsm>loadStyle</jsm>(<js>"QueryMenuItem.css"</js>);
- }
-
- <ja>@Override</ja> <jc>/* MenuItemWidget */</jc>
- <jk>public</jk> String getLabel(RestRequest req) <jk>throws</jk> Exception {
- <jk>return</jk> <js>"query"</js>;
- }
-
- <ja>@Override</ja> <jc>/* MenuItemWidget */</jc>
- <jk>public</jk> String getContent(RestRequest req) <jk>throws</jk> Exception {
- <jk>return</jk> <jsm>loadHtml</jsm>(<js>"QueryMenuItem.html"</js>);
- }
- }
-</p>
-
-<h5 class='figure'>AddPetMenuItem.java</h5>
-<p class='bpcode w800'>
- <jk>public class</jk> AddPetMenuItem <jk>extends</jk> MenuItemWidget {
-
- <ja>@Override</ja> <jc>/* MenuItemWidget */</jc>
- <jk>public</jk> String getLabel(RestRequest req) <jk>throws</jk> Exception {
- <jk>return</jk> <js>"add"</js>;
- }
-
- <ja>@Override</ja> <jc>/* Widget */</jc>
- <jk>public</jk> Object getContent(RestRequest req) <jk>throws</jk> Exception {
- <jk>return</jk> <jsm>div</jsm>(
- <jsm>form</jsm>().id(<js>"form"</js>).action(<js>"servlet:/pet"</js>).method(<jsf>POST</jsf>).children(
- <jsm>table</jsm>(
- <jsm>tr</jsm>(
- <jsm>th</jsm>(<js>"Name:"</js>),
- <jsm>td</jsm>(<jsm>input</jsm>().name(<js>"name"</js>).type(<js>"text"</js>)),
- <jsm>td</jsm>(<jk>new</jk> Tooltip(<js>"&#x2753;"</js>, <js>"The name of the pet."</js>, <jsm>br</jsm>(), <js>"e.g. 'Fluffy'"</js>))
- ),
- <jsm>tr</jsm>(
- <jsm>th</jsm>(<js>"Species:"</js>),
- <jsm>td</jsm>(
- <jsm>select</jsm>().name(<js>"species"</js>).children(
- <jsm>option</jsm>(<js>"CAT"</js>), <jsm>option</jsm>(<js>"DOG"</js>), <jsm>option</jsm>(<js>"BIRD"</js>), <jsm>option</jsm>(<js>"FISH"</js>), <jsm>option</jsm>(<js>"MOUSE"</js>), <jsm>option</jsm>(<js>"RABBIT"</js>), <jsm>option</jsm>(<js>"SNAKE"</js>)
- )
- ),
- <jsm>td</jsm>(<jk>new</jk> Tooltip(<js>"&#x2753;"</js>, <js>"The kind of animal."</js>))
- ),
- <jsm>tr</jsm>(
- <jsm>th</jsm>(<js>"Price:"</js>),
- <jsm>td</jsm>(<jsm>input</jsm>().name(<js>"price"</js>).type(<js>"number"</js>).placeholder(<js>"1.0"</js>).step(<js>"0.01"</js>).min(1).max(100).value(9.99)),
- <jsm>td</jsm>(<jk>new</jk> Tooltip(<js>"&#x2753;"</js>, <js>"The price to charge for this pet."</js>))
- ),
- <jsm>tr</jsm>(
- <jsm>th</jsm>(<js>"Tags:"</js>),
- <jsm>td</jsm>(<jsm>input</jsm>().name(<js>"tags"</js>).type(<js>"text"</js>)),
- <jsm>td</jsm>(<jk>new</jk> Tooltip(<js>"&#x2753;"</js>, <js>"Arbitrary textual tags (comma-delimited)."</js>, <jsm>br</jsm>(), <js>"e.g. 'fluffy,friendly'"</js>))
- ),
- <jsm>tr</jsm>(
- <jsm>td</jsm>().colspan(2).style(<js>"text-align:right"</js>).children(
- <jsm>button</jsm>(<js>"reset"</js>, <js>"Reset"</js>),
- <jsm>button</jsm>(<js>"button"</js>,<js>"Cancel"</js>).onclick(<js>"window.location.href='/'"</js>),
- <jsm>button</jsm>(<js>"submit"</js>, <js>"Submit"</js>)
- )
- )
- ).style(<js>"white-space:nowrap"</js>)
- )
- );
- }
- }
-</p>
-<hr>
-<p>
- The <l>OPTIONS</l> menu items takes you to the auto-generated Swagger UI for the application:
-</p>
-<p class='bpcode w900'>
- http://localhost:10000/petstore/pet?method=OPTIONS
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.9a.png'>
-<p>
- Since we've defined tags on our annotations, the pet-related operations are all grouped under the <l>pet</l> tag:
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.9b.png'>
-<p>
- Information for all HTTP parts is automatically generated:
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.9h.png'>
-<p>
- The schema models for POJO models is available in the <l>Responses</l> section of an operation:
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.9c.png'>
-<p>
- Auto-generated examples are available for all supported languages:
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.9d.png'>
-<p>
- For example, <l>application/json+simple</l>:
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.9e.png'>
-<p>
- Examples can be derived in a number of ways. In our case, we've defined a static method on our <l>Pet</l>
- class annotated with <ja>@Example</ja>:
-</p>
-<h5 class='figure'>Pet.java</h5>
-<p class='bpcode w800'>
- <ja>@Example</ja>
- <jk>public static</jk> Pet example() {
- <jk>return new</jk> Pet()
- .id(123)
- .species(Species.<jsf>DOG</jsf>)
- .name(<js>"Doggie"</js>)
- .tags(<js>"friendly"</js>,<js>"smart"</js>)
- .status(PetStatus.<jsf>AVAILABLE</jsf>);
- }
-</p>
-<p>
- Similar functionality exists for request bodies as well:
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.9f.png'>
-<p>
- At the bottom of the page is a listing of the POJO models in the app:
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.9g.png'>
-<hr>
-<p>
- The <l>PhotosResource</l> class provides capabilities for uploading and viewing image files.
- It demonstrates the capabilities of defining your own custom serializers and parsers and using
- multi-part form posts to upload binary data.
-</p>
-
-<p class='bpcode w800'>
- http://localhost:10000/petstore/photos
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.10a.png'>
-
-<p>
- The <l>PhotoResource</l> 'database' is simply a map of keys to <l>Photo</l> beans and uses the Java-provided
- <l>BufferedImage</l> class for representing images.
-</p>
-
-<h5 class='figure'>PhotosResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestResource</ja>(
- path=<js>"/photos"</js>,
- ...
- )
- <jk>public class</jk> PhotosResource <jk>extends</jk> BasicRestServlet {
-
- <jd>/** Our cache of photos */</jd>
- <jk>private</jk> Map<String,Photo> <jf>photos</jf> = <jk>new</jk> TreeMap<>();
-
- <jd>/** Our bean class for storing photos */</jd>
- <jk>public static class</jk> Photo {
- String <jf>id</jf>;
- BufferedImage <jf>image</jf>;
-
- Photo(String id, BufferedImage image) {
- <jk>this</jk>.<jf>id</jf> = id;
- <jk>this</jk>.<jf>image</jf> = image;
- }
-
- <jk>public</jk> URI getURI() <jk>throws</jk> URISyntaxException {
- <jk>return new</jk> URI(<js>"servlet:/"</js> + id);
- }
- }
-</p>
-
-<p>
- The contents of the home page simply renders our collection of photo beans:
-</p>
-<h5 class='figure'>PhotosResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestMethod</ja>(
- name=<jsf>GET</jsf>,
- path=<js>"/"</js>,
- summary=<js>"Show the list of all currently loaded photos"</js>
- )
- <jk>public</jk> Collection<Photo> getAllPhotos() <jk>throws</jk> Exception {
- <jk>return</jk> <jf>photos</jf>.values();
- }
-</p>
-
-<p>
- Clicking on one of the hyperlinks renders the stored image for us:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/photos/cat
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.10b.png'>
-
-<p>
- The method for retrieving images simply returns a <l>BufferedImage</l> file:
-</p>
-<h5 class='figure'>PhotosResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestMethod</ja>(
- name=<jsf>GET</jsf>,
- path=<js>"/{id}"</js>,
- serializers=ImageSerializer.<jk>class</jk>,
- summary=<js>"Get a photo by ID"</js>,
- description=<js>"Shows how to use a custom serializer to serialize a BufferedImage object to a stream."</js>
- )
- <ja>@Response</ja>(
- schema=<ja>@Schema</ja>(type=<js>"file"</js>)
- )
- <jk>public</jk> BufferedImage getPhoto(<ja>@Path</ja>(<js>"id"</js>) String id) <jk>throws</jk> NotFound {
- Photo p = <jf>photos</jf>.get(id);
- <jk>if</jk> (p == <jk>null</jk>)
- <jk>throw new</jk> NotFound(<js>"Photo not found"</js>);
- <jk>return</jk> p.<jf>image</jf>;
- }
-</p>
-
-<p>
- The <l>BufferedImage</l> object is converted to a stream using a custom {@link oaj.serializer.OutputStreamSerializer}:
-</p>
-<h5 class='figure'>PhotosResource.java</h5>
-<p class='bpcode w800'>
- <jd>/** Serializer for converting images to byte streams */</jd>
- <jk>public static class</jk> ImageSerializer <jk>extends</jk> OutputStreamSerializer {
-
- <jk>public</jk> ImageSerializer(PropertyStore ps) {
- <jk>super</jk>(ps, <jk>null</jk>, <js>"image/png,image/jpeg"</js>);
- }
-
- <ja>@Override</ja> <jc>/* Serializer */</jc>
- <jk>public</jk> OutputStreamSerializerSession createSession(SerializerSessionArgs args) {
- <jk>return new</jk> OutputStreamSerializerSession(args) {
-
- <ja>@Override</ja> <jc>/* SerializerSession */</jc>
- <jk>protected void</jk> doSerialize(SerializerPipe out, Object o) <jk>throws</jk> Exception {
- RenderedImage image = (RenderedImage)o;
- String mediaType = getProperty(<js>"mediaType"</js>, String.<jk>class</jk>, (String)<jk>null</jk>);
- ImageIO.<jsm>write</jsm>(image, mediaType.substring(mediaType.indexOf(<js>'/'</js>)+1), out.getOutputStream());
- }
- };
- }
- }
-</p>
-<p>
- Likewise, the body of requests can also be instances of <l>BufferedImage</l>:
-</p>
-<h5 class='figure'>PhotosResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestMethod</ja>(
- name=<jsf>PUT</jsf>,
- path=<js>"/{id}"</js>,
- parsers=ImageParser.<jf>class</jf>,
- summary=<js>"Add or overwrite a photo"</js>,
- description=<js>"Shows how to use a custom parser to parse a stream into a BufferedImage object."</js>
- )
- <jk>public</jk> String addPhoto(
- <ja>@Path</ja>(<js>"id"</js>) String id,
- <ja>@Body</ja>(
- description=<js>"Binary contents of image."</js>,
- schema=<ja>@Schema</ja>(type=<js>"file"</js>)
- )
- BufferedImage image
- ) <jk>throws</jk> Exception {
- <jf>photos</jf>.put(id, <jk>new</jk> Photo(id, image));
- <jk>return</jk> <js>"OK"</js>;
- }
-</p>
-<p>
- The <l>BufferedImage</l> object is created from a stream using a custom {@link oaj.parser.InputStreamParser}:
-</p>
-
-<h5 class='figure'>PhotosResource.java</h5>
-<p class='bpcode w800'>
- <jd>/** Parser for converting byte streams to images */</jd>
- <jk>public static class</jk> ImageParser <jk>extends</jk> InputStreamParser {
-
- <jk>public</jk> ImageParser(PropertyStore ps) {
- <jk>super</jk>(ps, <js>"image/png"</js>, <js>"image/jpeg"</js>);
- }
-
- <ja>@Override</ja> <jc>/* Parser */</jc>
- <jk>public</jk> InputStreamParserSession createSession(<jk>final</jk> ParserSessionArgs args) {
- <jk>return new</jk> InputStreamParserSession(args) {
-
- <ja>@Override</ja> <jc>/* ParserSession */</jc>
- <jk>protected</jk> <T> T doParse(ParserPipe pipe, ClassMeta<T> type) <jk>throws</jk> Exception {
- <jk>return</jk> (T)ImageIO.read(pipe.getInputStream());
- }
- };
- }
- }
-</p>
-<p>
- A custom menu item is provided for uploading new images:
-</p>
-<p class='bpcode w800'>
- http://localhost:10000/petstore/photos
-</p>
-<img class='bordered w800' src='doc-files/juneau-examples-rest.PetStoreResource.10c.png'>
-
-<p>
- The menu item is defined as a <l>MenuItemWidget</l>:
-</p>
-
-<h5 class='figure'>UploadPhotoMenuItem.java</h5>
-<p class='bpcode w800'>
- <jk>public class</jk> UploadPhotoMenuItem <jk>extends</jk> MenuItemWidget {
-
- <ja>@Override</ja> <jc>/* MenuItemWidget */</jc>
- <jk>public</jk> String getLabel(RestRequest req) <jk>throws</jk> Exception {
- <jk>return</jk> <js>"upload"</js>;
- }
-
- <ja>@Override</ja> <jc>/* Widget */</jc>
- <jk>public</jk> Object getContent(RestRequest req) <jk>throws</jk> Exception {
- <jk>return</jk> <jsm>div</jsm>(
- <jsm>form</jsm>().id(<js>"form"</js>).action(<js>"servlet:/upload"</js>).method(<jsf>POST</jsf>).enctype(<js>"multipart/form-data"</js>).children(
- <jsm>table</jsm>(
- <jsm>tr</jsm>(
- <jsm>th</jsm>(<js>"ID:"</js>),
- <jsm>td</jsm>(<jsm>input</jsm>().name(<js>"id"</js>).type(<js>"text"</js>)),
- <jsm>td</jsm>(<jk>new</jk> Tooltip(<js>"&#x2753;"</js>, <js>"The unique identifier of the photo."</js>, <jsm>br</jsm>(), <js>"e.g. 'Fluffy'"</js>))
- ),
- <jsm>tr</jsm>(
- <jsm>th</jsm>(<js>"File:"</js>),
- <jsm>td</jsm>(<jsm>input</jsm>().name(<js>"file"</js>).type(<js>"file"</js>).accept(<js>"image/*"</js>)),
- <jsm>td</jsm>(<jk>new</jk> Tooltip(<js>"&#x2753;"</js>, <js>"The image file."</js>))
- ),
- <jsm>tr</jsm>(
- <jsm>td</jsm>().colspan(2).style(<js>"text-align:right"</js>).children(
- <jsm>button</jsm>(<js>"reset"</js>, <js>"Reset"</js>),
- <jsm>button</jsm>(<js>"button"</js>,<js>"Cancel"</js>).onclick(<js>"window.location.href='/'"</js>),
- <jsm>button</jsm>(<js>"submit"</js>, <js>"Submit"</js>)
- )
- )
- ).style(<js>"white-space:nowrap"</js>)
- )
- );
- }
- }
-</p>
-<p>
- The menu item then submits multi-part form posts to the following method:
-</p>
-<h5 class='figure'>PhotosResource.java</h5>
-<hr>
-<p>
- The <l>SqlQueryResource</l> class is a simple utility for performing raw SQL queries against our Derby database:
-</p>
-<p class='bpcode w900'>
- http://localhost:10000/petstore/sql
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.11a.png'>
-<p>
- For example, viewing all of the <l>Pet</l> objects in the database:
-</p>
-<p class='bpcode w900'>
- http://localhost:10000/petstore/sql?sql=select+*+from+PetstorePet
-</p>
-<img class='bordered w900' src='doc-files/juneau-examples-rest.PetStoreResource.11b.png'>
-
-<p>
- The <l>SqlQueryResource</l> is implemented as a single class with database connection information:
-</p>
-
-<h5 class='figure'>SqlQueryResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestResource</ja>(
- path=<js>"/sql"</js>,
- title=<js>"SQL query service"</js>,
- description=<js>"Executes queries against the local derby '$C{SqlQueryResource/connectionUrl}' database"</js>,
- htmldoc=<ja>@HtmlDoc</ja>(
- widgets={
- ThemeMenuItem.<jk>class</jk>
- },
- navlinks={
- <js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>,
- <js>"$W{ThemeMenuItem}"</js>,
- <js>"source: $C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java"</js>
- },
- aside={
- <js>"<div style='min-width:200px' class='text'>"</js>,
- <js>" <p>An example of a REST interface over a relational database that serializes ResultSet objects.</p>"</js>,
- <js>" <p>Specify one or more queries delimited by semicolons.</p>"</js>,
- <js>" <h5>Examples:</h5>"</js>,
- <js>" <ul>"</js>,
- <js>" <li><a class='link' href='?sql=select+*+from+sys.systables'>Tables</a>"</js>,
- <js>" <li><a class='link' href='?sql=select+*+from+PetstorePet'>Pets</a>"</js>,
- <js>" <li><a class='link' href='?sql=select+*+from+PetstoreOrder'>Orders</a>"</js>,
- <js>" <li><a class='link' href='?sql=select+*+from+PetstoreUser'>Users</a>"</js>,
- <js>" </ul>"</js>,
- <js>"</div>"</js>
- },
- stylesheet=<js>"servlet:/htdocs/themes/dark.css"</js>
- ),
- swagger=<ja>@ResourceSwagger</ja>(
- contact=<ja>@Contact</ja>(name=<js>"Juneau Developer"</js>,email=<js>"dev@juneau.apache.org"</js>),
- license=<ja>@License</ja>(name=<js>"Apache 2.0"</js>,url=<js>"http://www.apache.org/licenses/LICENSE-2.0.html"</js>),
- version=<js>"2.0"</js>,
- termsOfService=<js>"You are on your own."</js>,
- externalDocs=<ja>@ExternalDocs</ja>(description=<js>"Apache Juneau"</js>,url=<js>"http://juneau.apache.org"</js>)
- )
- )
- <jk>public class</jk> SqlQueryResource <jk>extends</jk> BasicRestServlet {
-
- <jk>private</jk> String <jf>driver</jf>, <jf>connectionUrl</jf>;
- <jk>private boolean</jk> <jf>allowUpdates</jf>, <jf>allowTempUpdates</jf>, <jf>includeRowNums</jf>;
-
- ...
-</p>
-<p>
- The connection information is pulled from the <l>examples.cfg</l> file using an init hook:
-</p>
-<h5 class='figure'>SqlQueryResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestHook</ja>(<jsf>INIT</jsf>)
- <jk>public void</jk> initConnection(RestContextBuilder builder) <jk>throws</jk> Exception {
- Config cf = builder.getConfig();
-
- <jf>driver</jf> = cf.getString(<js>"SqlQueryResource/driver"</js>);
- <jf>connectionUrl</jf> = cf.getString(<js>"SqlQueryResource/connectionUrl"</js>);
- <jf>allowUpdates</jf> = cf.getBoolean(<js>"SqlQueryResource/allowUpdates"</js>, <jk>false</jk>);
- <jf>allowTempUpdates</jf> = cf.getBoolean(<js>"SqlQueryResource/allowTempUpdates"</js>, <jk>false</jk>);
- <jf>includeRowNums</jf> = cf.getBoolean(<js>"SqlQueryResource/includeRowNums"</js>, <jk>false</jk>);
-
- <jk>try</jk> {
- Class.<jsm>forName</jsm>(<jf>driver</jf>).newInstance();
- } <jk>catch</jk> (Exception e) {
- <jk>throw new</jk> RuntimeException(e);
- }
- }
-</p>
-<p>
- The query entry page is rendered using HTML5 beans:
-</p>
-<h5 class='figure'>SqlQueryResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestMethod</ja>(
- summary=<js>"Display the query entry page"</js>
- )
- <jk>public</jk> Div get(
- <ja>@Query</ja>(
- name=<js>"sql"</js>,
- description=<js>"Text to prepopulate the SQL query field with."</js>,
- example=<js>"select * from sys.systables"</js>
- )
- String sql
- ) {
-
- <jk>return</jk> <jsm>div</jsm>(
- <jsm>script</jsm>(<js>"text/javascript"</js>,
- <js>"// Quick and dirty function to allow tabs in textarea."</js>,
- <js>"function checkTab(e) {"</js>,
- <js>" if (e.keyCode == 9) {"</js>,
- <js>" var t = e.target;"</js>,
- <js>" var ss = t.selectionStart, se = t.selectionEnd;"</js>,
- <js>" t.value = t.value.slice(0,ss).concat('\\t').concat(t.value.slice(ss,t.value.length));"</js>,
- <js>" e.preventDefault();"</js>,
- <js>" }"</js>,
- <js>"}"</js>,
- <js>"// Load results from IFrame into this document."</js>,
- <js>"function loadResults(b) {"</js>,
- <js>" var doc = b.contentDocument || b.contentWindow.document;"</js>,
- <js>" var data = doc.getElementById('data') || doc.getElementsByTagName('body')[0];"</js>,
- <js>" document.getElementById('results').innerHTML = data.innerHTML;"</js>,
- <js>"}"</js>
- ),
- <jsm>form</jsm>(<js>"servlet:/"</js>).method(<jsf>POST</jsf>).target(<js>"buf"</js>).children(
- <jsm>table</jsm>(
- <jsm>tr</jsm>(
- <jsm>th</jsm>(<js>"Position (1-10000):"</js>).style(<js>"white-space:nowrap"</js>),
- <jsm>td</jsm>(<jsm>input</jsm>().name(<js>"pos"</js>).type(<js>"number"</js>).value(1)),
- <jsm>th</jsm>(<js>"Limit (1-10000):"</js>).style(<js>"white-space:nowrap"</js>),
- <jsm>td</jsm>(<jsm>input</jsm>().name(<js>"limit"</js>).type(<js>"number"</js>).value(100)),
- <jsm>td</jsm>(button(<js>"submit"</js>, <js>"Submit"</js>), <jsm>button</jsm>(<js>"reset"</js>, <js>"Reset"</js>))
- ),
- <jsm>tr</jsm>(
- <jsm>td</jsm>().colspan(5).children(
- <jsm>textarea</jsm>().name(<js>"sql"</js>).text(sql == <jk>null</jk> ? " " : sql).style(<js>"width:100%;height:200px;font-family:Courier;font-size:9pt;"</js>).onkeydown(<js>"checkTab(event)"</js>)
- )
- )
- )
- ),
- <jsm>br</jsm>(),
- <jsm>div</jsm>().id(<js>"results"</js>),
- <jsm>iframe</jsm>().name(<js>"buf"</js>).style(<js>"display:none"</js>).onload(<js>"parent.loadResults(this)"</js>)
- );
- }
-</p>
-<p>
- The form then submits its results to the following method using a form input bean:
-</p>
-<h5 class='figure'>SqlQueryResource.java</h5>
-<p class='bpcode w800'>
- <ja>@RestMethod</ja>(
- summary=<js>"Execute one or more queries"</js>
- )
- <ja>@Response</ja>(
- description=<js>"Query results.\nEach entry in the array is a result of one query.\nEach result can be a result set (for queries) or update count (for updates)."</js>
- )
- <jk>public</jk> List<Object> post(
- <ja>@Body</ja>(
- description=<js>"Query input"</js>,
- example=<js>"{sql:'select * from sys.systables',pos:1,limit:100}"</js>
- )
- PostInput in
- ) <jk>throws</jk> BadRequest {
-
- List<Object> results = <jk>new</jk> LinkedList<>();
-
- <jc>// Don't try to submit empty input.</jc>
- <jk>if</jk> (isEmpty(in.<jf>sql</jf>))
- <jk>return</jk> results;
-
- <jk>if</jk> (in.<jf>pos</jf> < 1 || in.<jf>pos</jf> > 10000)
- <jk>throw new</jk> BadRequest(<js>"Invalid value for position. Must be between 1-10000"</js>);
- <jk>if</jk> (in.<jf>limit</jf> < 1 || in.<jf>limit</jf> > 10000)
- <jk>throw new</jk> BadRequest(<js>"Invalid value for limit. Must be between 1-10000"</js>);
-
- String sql = <jk>null</jk>;
-
- <jc>// Create a connection and statement.
- // If these fails, let the exception filter up as a 500 error.</jc>
- <jk>try</jk> (Connection c = DriverManager.<jsm>getConnection</jsm>(connectionUrl)) {
- c.setAutoCommit(<jk>false</jk>);
- <jk>try</jk> (Statement st = c.createStatement()) {
- <jk>for</jk> (String s : in.<jf>sql</jf>.split(<js>";"</js>)) {
- sql = s.trim();
- <jk>if</jk> (! sql.isEmpty()) {
- Object o = <jk>null</jk>;
- <jk>if</jk> (<jf>allowUpdates</jf> || (<jf>allowTempUpdates</jf> && ! sql.matches(<js>"(?:i)commit.*"</js>))) {
- <jk>if</jk> (st.execute(sql)) {
- <jk>try</jk> (ResultSet rs = st.getResultSet()) {
- o = <jk>new</jk> ResultSetList(rs, in.<jf>pos</jf>, in.<jf>limit</jf>, <jf>includeRowNums</jf>);
- }
- } <jk>else</jk> {
- o = st.getUpdateCount();
- }
- } <jk>else</jk> {
- <jk>try</jk> (ResultSet rs = st.executeQuery(sql)) {
- o = <jk>new</jk> ResultSetList(rs, in.<jf>pos</jf>, in.<jf>limit</jf>, <jf>includeRowNums</jf>);
- }
- }
- results.add(o);
- }
- }
- }
- <jk>if</jk> (<jf>allowUpdates</jf>)
- c.commit();
- <jk>else if</jk> (<jf>allowTempUpdates</jf>)
- c.rollback();
- } <jk>catch</jk> (SQLException e) {
- <jk>throw new</jk> BadRequest(e, <js>"Invalid query: {0}"</js>, sql);
- }
-
- <jk>return</jk> results;
- }
-
- <jk>public static class</jk> PostInput {
- <jk>public</jk> String <jf>sql</jf> = <js>""</js>;
- <jk>public int</jk> <jf>pos</jf> = 1, <jf>limit</jf> = 100;
- }
-</p>
-<p>
- Note that we could have also used <ja>@FormData</ja> parameters as well.
-</p>
-
-
-
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/05.ConfigResource.html b/juneau-doc/docs/Topics/17.juneau-examples-rest/04.ConfigResource.html
similarity index 100%
rename from juneau-doc/docs/Topics/17.juneau-examples-rest/05.ConfigResource.html
rename to juneau-doc/docs/Topics/17.juneau-examples-rest/04.ConfigResource.html
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/06.LogsResource.html b/juneau-doc/docs/Topics/17.juneau-examples-rest/05.LogsResource.html
similarity index 100%
rename from juneau-doc/docs/Topics/17.juneau-examples-rest/06.LogsResource.html
rename to juneau-doc/docs/Topics/17.juneau-examples-rest/05.LogsResource.html
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.1.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.1.png
deleted file mode 100644
index fc65f06..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.1.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.10a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.10a.png
deleted file mode 100644
index 7c4fa71..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.10a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.10b.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.10b.png
deleted file mode 100644
index 86c1242..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.10b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.10c.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.10c.png
deleted file mode 100644
index 744a558..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.10c.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.11a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.11a.png
deleted file mode 100644
index 7ec5aa9..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.11a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.11b.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.11b.png
deleted file mode 100644
index 97d4ff3..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.11b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2a.png
deleted file mode 100644
index 9515c5c..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2b.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2b.png
deleted file mode 100644
index 2afcbcf..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2c.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2c.png
deleted file mode 100644
index 7e27708..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2c.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2d.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2d.png
deleted file mode 100644
index 014fcf6..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.2d.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.3a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.3a.png
deleted file mode 100644
index ae029d8..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.3a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.3b.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.3b.png
deleted file mode 100644
index 9193b1d..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.3b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.4a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.4a.png
deleted file mode 100644
index 2f47259..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.4a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.4b.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.4b.png
deleted file mode 100644
index 5a91391..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.4b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.5a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.5a.png
deleted file mode 100644
index 5c88c5a..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.5a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.5b.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.5b.png
deleted file mode 100644
index 46cd848..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.5b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.6a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.6a.png
deleted file mode 100644
index ddbee32..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.6a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.6b.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.6b.png
deleted file mode 100644
index 9c04552..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.6b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.7a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.7a.png
deleted file mode 100644
index ffd41ce..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.7a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.7b.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.7b.png
deleted file mode 100644
index e65d56c..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.7b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.8a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.8a.png
deleted file mode 100644
index 3cc3f6f..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.8a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9a.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9a.png
deleted file mode 100644
index 33a1791..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9b.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9b.png
deleted file mode 100644
index 85720f2..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9c.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9c.png
deleted file mode 100644
index 23a3e7f..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9c.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9d.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9d.png
deleted file mode 100644
index f183863..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9d.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9e.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9e.png
deleted file mode 100644
index 286a78f..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9e.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9f.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9f.png
deleted file mode 100644
index dd0013c..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9f.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9g.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9g.png
deleted file mode 100644
index a5c0b6c..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9g.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9h.png b/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9h.png
deleted file mode 100644
index 084e7ce..0000000
--- a/juneau-doc/docs/Topics/17.juneau-examples-rest/doc-files/juneau-examples-rest.PetStoreResource.9h.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.1.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.1.png
deleted file mode 100644
index fc65f06..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.1.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.10a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.10a.png
deleted file mode 100644
index 7c4fa71..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.10a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.10b.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.10b.png
deleted file mode 100644
index 86c1242..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.10b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.10c.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.10c.png
deleted file mode 100644
index 744a558..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.10c.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.11a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.11a.png
deleted file mode 100644
index 7ec5aa9..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.11a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.11b.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.11b.png
deleted file mode 100644
index 97d4ff3..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.11b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2a.png
deleted file mode 100644
index 9515c5c..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2b.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2b.png
deleted file mode 100644
index 2afcbcf..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2c.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2c.png
deleted file mode 100644
index 7e27708..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2c.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2d.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2d.png
deleted file mode 100644
index 014fcf6..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.2d.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.3a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.3a.png
deleted file mode 100644
index ae029d8..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.3a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.3b.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.3b.png
deleted file mode 100644
index 9193b1d..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.3b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.4a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.4a.png
deleted file mode 100644
index 2f47259..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.4a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.4b.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.4b.png
deleted file mode 100644
index 5a91391..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.4b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.5a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.5a.png
deleted file mode 100644
index 5c88c5a..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.5a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.5b.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.5b.png
deleted file mode 100644
index 46cd848..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.5b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.6a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.6a.png
deleted file mode 100644
index ddbee32..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.6a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.6b.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.6b.png
deleted file mode 100644
index 9c04552..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.6b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.7a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.7a.png
deleted file mode 100644
index ffd41ce..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.7a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.7b.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.7b.png
deleted file mode 100644
index e65d56c..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.7b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.8a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.8a.png
deleted file mode 100644
index 3cc3f6f..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.8a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9a.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9a.png
deleted file mode 100644
index 33a1791..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9a.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9b.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9b.png
deleted file mode 100644
index 85720f2..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9b.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9c.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9c.png
deleted file mode 100644
index 23a3e7f..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9c.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9d.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9d.png
deleted file mode 100644
index f183863..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9d.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9e.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9e.png
deleted file mode 100644
index 286a78f..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9e.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9f.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9f.png
deleted file mode 100644
index dd0013c..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9f.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9g.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9g.png
deleted file mode 100644
index a5c0b6c..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9g.png
+++ /dev/null
Binary files differ
diff --git a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9h.png b/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9h.png
deleted file mode 100644
index 084e7ce..0000000
--- a/juneau-doc/src/main/javadoc/doc-files/juneau-examples-rest.PetStoreResource.9h.png
+++ /dev/null
Binary files differ
diff --git a/juneau-examples/juneau-examples-petstore/.gitignore b/juneau-examples/juneau-examples-petstore/.gitignore
deleted file mode 100644
index 34acf88..0000000
--- a/juneau-examples/juneau-examples-petstore/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/target/
-**/.DS_Store
-.classpath
-.project
-/.settings/
-/bin/
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/.gitignore b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/.gitignore
deleted file mode 100644
index 34acf88..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/target/
-**/.DS_Store
-.classpath
-.project
-/.settings/
-/bin/
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/pom.xml b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/pom.xml
deleted file mode 100644
index 59943c8..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-examples-petstore</artifactId>
- <version>8.1.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>juneau-examples-petstore-api</artifactId>
- <name>Apache Juneau Petstore Example - Common API</name>
- <description>Apache Juneau Petstore Example, Common API</description>
-
- <properties>
- <encoding>UTF-8</encoding>
- <maven.javadoc.skip>true</maven.javadoc.skip>
-
- <!-- Skip javadoc generation since we generate them in the aggregate pom -->
- <maven.javadoc.skip>true</maven.javadoc.skip>
-
- <!-- Java 8 required because Jetty requires it. -->
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- </properties>
-
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-marshall</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Needed for JPA persistence annotations -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${hibernate.version}</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <escapeString>\</escapeString>
- </configuration>
- <executions>
- <execution>
- <id>juneau-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <finalName>juneau-examples-petstore-api-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/bin.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/assembly/bin.xml b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/assembly/bin.xml
deleted file mode 100644
index 17e8ca8..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/assembly/bin.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-
-<!--
- This assembly is used to create the template zip file that developers use to import into Eclipse to start their
- own projects.
- -->
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
- <id>bin</id>
- <formats>
- <format>zip</format>
- </formats>
- <baseDirectory>/</baseDirectory>
- <includeBaseDirectory>true</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}/../juneau-examples-petstore-api</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>src/main/**</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>src/main/**</include>
- <include>files/**</include>
- <include>.settings/**</include>
- <include>.project</include>
- <include>*.launch</include>
- <include>*.cfg</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/build-overlay</directory>
- <outputDirectory>/</outputDirectory>
- <filtered>true</filtered>
- </fileSet>
- </fileSets>
-
-</assembly>
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java
deleted file mode 100644
index 8bdfd47..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java
+++ /dev/null
@@ -1,421 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore;
-
-import static org.apache.juneau.http.HttpMethodName.*;
-
-import java.util.*;
-
-import org.apache.juneau.jsonschema.annotation.Items;
-import org.apache.juneau.petstore.dto.*;
-import org.apache.juneau.*;
-import org.apache.juneau.http.annotation.*;
-import org.apache.juneau.http.remote.*;
-import org.apache.juneau.http.exception.*;
-import org.apache.juneau.http.response.*;
-
-/**
- * Defines the interface for both the server-side and client-side pet store application.
- *
- * <p>
- * On the server side, this interface is implemented by the <c>PetStoreResource</c> class.
- *
- * <p>
- * On the client side, this interface is instantiated as a proxy using the <c>RestClient.getRemoteProxy()</c> method.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@RemoteResource(path="/petstore")
-public interface PetStore {
-
- //------------------------------------------------------------------------------------------------------------------
- // Pets
- //------------------------------------------------------------------------------------------------------------------
-
- /**
- * Returns all pets in the database.
- *
- * @return All pets in the database.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/pet")
- public Collection<Pet> getPets() throws NotAcceptable;
-
- /**
- * Returns a pet from the database.
- *
- * @param petId The ID of the pet to retrieve.
- * @return The pet.
- * @throws IdNotFound Pet was not found.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(path="/pet/{petId}") /* method inferred from method name */
- public Pet getPet(
- @Path(
- name="petId",
- description="ID of pet to return",
- example="123"
- )
- long petId
- ) throws IdNotFound, NotAcceptable;
-
- /**
- * Adds a pet to the database.
- *
- * @param pet The pet data to add to the database.
- * @return {@link Ok} if successful.
- * @throws IdConflict ID already in use.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
- */
- @RemoteMethod(method=POST, path="/pet")
- public long createPet(
- @Body(
- description="Pet object to add to the store"
- ) CreatePet pet
- ) throws IdConflict, NotAcceptable, UnsupportedMediaType;
-
- /**
- * Updates a pet in the database.
- *
- * @param pet The pet data to add to the database.
- * @return {@link Ok} if successful.
- * @throws IdNotFound ID not found.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
- */
- @RemoteMethod(method=PUT, path="/pet/{petId}")
- public Ok updatePet(
- @Body(
- description="Pet object that needs to be added to the store"
- ) UpdatePet pet
- ) throws IdNotFound, NotAcceptable, UnsupportedMediaType;
-
- /**
- * Find all pets with the matching statuses.
- *
- * @param status The statuses to match against.
- * @return The pets that match the specified statuses.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/pet/findByStatus")
- public Collection<Pet> findPetsByStatus(
- @Query(
- name="status",
- description="Status values that need to be considered for filter.",
- required=true,
- type="array",
- collectionFormat="csv",
- items=@Items(
- type="string",
- _enum="AVAILABLE,PENDING,SOLD",
- _default="AVAILABLE"
- ),
- example="AVALIABLE,PENDING"
- )
- PetStatus[] status
- ) throws NotAcceptable;
-
- /**
- * Find all pets with the specified tags.
- *
- * @param tags The tags to match against.
- * @return The pets that match the specified tags.
- * @throws InvalidTag Invalid tag was specified.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/pet/findByTags")
- @Deprecated
- public Collection<Pet> findPetsByTags(
- @Query(
- name="tags",
- description="Tags to filter by",
- required=true,
- example="['tag1','tag2']"
- )
- String[] tags
- ) throws InvalidTag, NotAcceptable;
-
- /**
- * Deletes the specified pet.
- *
- * @param apiKey Security key.
- * @param petId ID of pet to delete.
- * @return {@link Ok} if successful.
- * @throws IdNotFound Pet not found.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=DELETE, path="/pet/{petId}")
- public Ok deletePet(
- @Header(
- name="api_key",
- description="Security API key",
- required=true,
- example="foobar"
- )
- String apiKey,
- @Path(
- name="petId",
- description="Pet id to delete",
- example="123"
- )
- long petId
- ) throws IdNotFound, NotAcceptable;
-
- //------------------------------------------------------------------------------------------------------------------
- // Orders
- //------------------------------------------------------------------------------------------------------------------
-
- /**
- * Returns all orders in the database.
- *
- * @return All orders in the database.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/store/order")
- public Collection<Order> getOrders() throws NotAcceptable;
-
- /**
- * Returns an order from the database.
- *
- * @param orderId The ID of the order to retreieve.
- * @return The retrieved order.
- * @throws InvalidId ID was invalid.
- * @throws IdNotFound Order was not found.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/store/order/{orderId}")
- public Order getOrder(
- @Path(
- name="orderId",
- description="ID of order to fetch",
- maximum="1000",
- minimum="1",
- example="123"
- )
- long orderId
- ) throws InvalidId, IdNotFound, NotAcceptable;
-
- /**
- * Adds an order to the database.
- *
- * @param petId Id of pet to order.
- * @param username The username of the user placing the order.
- * @return The ID of the order.
- * @throws IdConflict ID was already in use.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
- */
- @RemoteMethod(method=POST, path="/store/order")
- public long placeOrder(
- @FormData(
- name="petId",
- description="Pet ID"
- )
- long petId,
- @FormData(
- name="username",
- description="The username of the user creating the order"
- )
- String username
- ) throws IdConflict, NotAcceptable, UnsupportedMediaType;
-
- /**
- * Deletes an order from the database.
- *
- * @param orderId The order ID.
- * @return {@link Ok} if successful.
- * @throws InvalidId ID not valid.
- * @throws IdNotFound Order not found.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=DELETE, path="/store/order/{orderId}")
- public Ok deleteOrder(
- @Path(
- name="orderId",
- description="ID of the order that needs to be deleted",
- minimum="1",
- example="5"
- )
- long orderId
- ) throws InvalidId, IdNotFound, NotAcceptable;
-
- /**
- * Returns an inventory of pet statuses and counts.
- *
- * @return An inventory of pet statuses and counts.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/store/inventory")
- public Map<PetStatus,Integer> getStoreInventory() throws NotAcceptable;
-
- //------------------------------------------------------------------------------------------------------------------
- // Users
- //------------------------------------------------------------------------------------------------------------------
-
- /**
- * Returns all users in the database.
- *
- * @return All users in the database.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/user")
- public Collection<User> getUsers() throws NotAcceptable;
-
- /**
- * Returns a user from the database.
- *
- * @param username The username.
- * @return The user.
- * @throws InvalidUsername Invalid username.
- * @throws IdNotFound username not found.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/user/{username}")
- public User getUser(
- @Path(
- name="username",
- description="The name that needs to be fetched. Use user1 for testing."
- )
- String username
- ) throws InvalidUsername, IdNotFound, NotAcceptable;
-
- /**
- * Adds a new user to the database.
- *
- * @param user The user to add to the database.
- * @return {@link Ok} if successful.
- * @throws InvalidUsername Username was invalid.
- * @throws IdConflict Username already in use.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
- */
- @RemoteMethod(method=POST, path="/user")
- public Ok createUser(
- @Body(
- description="Created user object"
- )
- User user
- ) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType;
-
- /**
- * Bulk creates users.
- *
- * @param users The users to add to the database.
- * @return {@link Ok} if successful.
- * @throws InvalidUsername Username was invalid.
- * @throws IdConflict Username already in use.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
- */
- @RemoteMethod(method=POST, path="/user/createWithArray")
- public Ok createUsers(
- @Body(
- description="List of user objects"
- )
- User[] users
- ) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType;
-
- /**
- * Updates a user in the database.
- *
- * @param username The username.
- * @param user The updated information.
- * @return {@link Ok} if successful.
- * @throws InvalidUsername Username was invalid.
- * @throws IdNotFound User was not found.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
- */
- @RemoteMethod(method=PUT, path="/user/{username}")
- public Ok updateUser(
- @Path(
- name="username",
- description="Name that need to be updated"
- )
- String username,
- @Body(
- description="Updated user object"
- )
- User user
- ) throws InvalidUsername, IdNotFound, NotAcceptable, UnsupportedMediaType;
-
- /**
- * Deletes a user from the database.
- *
- * @param username The username.
- * @return {@link Ok} if successful.
- * @throws InvalidUsername Username was not valid.
- * @throws IdNotFound User was not found.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=DELETE, path="/user/{username}")
- public Ok deleteUser(
- @Path(
- name="username",
- description="The name that needs to be deleted"
- )
- String username
- ) throws InvalidUsername, IdNotFound, NotAcceptable;
-
- /**
- * User login.
- *
- * @param username The username for login.
- * @param password The password for login in clear text.
- * @param rateLimit Calls per hour allowed by the user.
- * @param expiresAfter The <bc>Expires-After</bc> response header.
- * @param req The servlet request.
- * @param res The servlet response.
- * @return {@link Ok} if successful.
- * @throws InvalidLogin Login was unsuccessful.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/user/login")
- public Ok login(
- @Query(
- name="username",
- description="The username for login.",
- required=true,
- example="myuser"
- )
- String username,
- @Query(
- name="password",
- description="The password for login in clear text.",
- required=true,
- example="abc123"
- )
- String password,
- @ResponseHeader(
- name="X-Rate-Limit",
- type="integer",
- format="int32",
- description="Calls per hour allowed by the user.",
- example="123"
- )
- Value<Integer> rateLimit,
- Value<ExpiresAfter> expiresAfter
- ) throws InvalidLogin, NotAcceptable;
-
- /**
- * User logout.
- *
- * @return {@link Ok} if successful.
- * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
- */
- @RemoteMethod(method=GET, path="/user/logout")
- public Ok logout() throws NotAcceptable;
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreateOrder.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreateOrder.java
deleted file mode 100644
index db9686e..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreateOrder.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.annotation.*;
-
-/**
- * Bean for creating {@link Order} objects.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Bean(fluentSetters=true, properties="petId,username")
-public class CreateOrder {
-
- private long petId;
- private String username;
-
- /**
- * Optional constructor.
- *
- * @param petId The <bc>petId</bc> property value.
- * @param username The <bc>username</bc> property value.
- */
- @BeanConstructor(properties="petId,username")
- public CreateOrder(long petId, String username) {
- this.petId = petId;
- this.username = username;
- }
-
- /**
- * Constructor needed by JPA.
- */
- public CreateOrder() {}
-
- //-----------------------------------------------------------------------------------------------------------------
- // Bean properties
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * @return The <bc>petId</bc> property value.
- */
- public long getPetId() {
- return petId;
- }
-
- /**
- * @param value The <bc>petId</bc> property value.
- * @return This object (for method chaining).
- */
- public CreateOrder petId(long value) {
- this.petId = value;
- return this;
- }
-
- /**
- * @return The <bc>username</bc> property value.
- */
- public String getUsername() {
- return username;
- }
-
- /**
- * @param value The <bc>username</bc> property value.
- * @return This object (for method chaining).
- */
- public CreateOrder username(String value) {
- this.username = value;
- return this;
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Other
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * Used to populate Swagger examples.
- * Example is inferred from the method name.
- *
- * @return An example POJO.
- */
- public static CreateOrder example() {
- return new CreateOrder(123, "sampleuser");
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreatePet.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreatePet.java
deleted file mode 100644
index 2064cc2..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreatePet.java
+++ /dev/null
@@ -1,139 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.jsonschema.annotation.*;
-
-/**
- * Bean for creating {@link Pet} objects.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Bean(fluentSetters=true, properties="name,price,species,tags")
-public class CreatePet {
-
- @Schema(description="Pet name.", minLength=3, maxLength=50)
- private String name;
-
- @Schema(description="Price of pet.", maximum="999.99")
- private float price;
-
- @Schema(description="Pet species.")
- private Species species;
-
- @Schema(description="Pet attributes.", example="friendly,smart")
- private String[] tags;
-
- /**
- * Constructor.
- *
- * @param name The <bc>name</bc> property value.
- * @param price The <bc>price</bc> property value.
- * @param species The <bc>species</bc> property value.
- * @param tags The <bc>tags</bc> property value.
- * @param photo The <bc>photo</bc> property value.
- */
- public CreatePet(String name, float price, Species species, String[] tags) {
- this.name = name;
- this.price = price;
- this.species = species;
- this.tags = tags;
- }
-
- /**
- * Empty constructor.
- */
- public CreatePet() {}
-
- //-----------------------------------------------------------------------------------------------------------------
- // Bean properties
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * @return The <bc>name</bc> property value.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param value The <bc>name</bc> property value.
- * @return This object (for method chaining).
- */
- public CreatePet name(String value) {
- this.name = value;
- return this;
- }
-
- /**
- * @return The <bc>price</bc> property value.
- */
- public float getPrice() {
- return price;
- }
-
- /**
- * @param value The <bc>price</bc> property value.
- * @return This object (for method chaining).
- */
- public CreatePet price(float value) {
- this.price = value;
- return this;
- }
-
- /**
- * @return The <bc>species</bc> property value.
- */
- public Species getSpecies() {
- return species;
- }
-
- /**
- * @param value The <bc>species</bc> property value.
- * @return This object (for method chaining).
- */
- public CreatePet species(Species value) {
- this.species = value;
- return this;
- }
-
- /**
- * @return The <bc>tags</bc> property value.
- */
- public String[] getTags() {
- return tags;
- }
-
- /**
- * @param value The <bc>tags</bc> property value.
- * @return This object (for method chaining).
- */
- public CreatePet tags(String...value) {
- this.tags = value;
- return this;
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Other
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * @return An example POJO.
- */
- public static CreatePet example() {
- return new CreatePet("Doggie", 9.99f, Species.DOG, new String[]{"smart","friendly"});
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/ExpiresAfter.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/ExpiresAfter.java
deleted file mode 100644
index 8273edf..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/ExpiresAfter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import java.util.*;
-
-import org.apache.juneau.http.annotation.*;
-
-/**
- * X-Expires-After custom HTTP header.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@ResponseHeader(
- name="X-Expires-After",
- type="string",
- format="date-time",
- description="Date in UTC when token expires",
- example="2012-10-21"
-)
-public class ExpiresAfter {
- private final Calendar c;
-
- /**
- * Constructor.
- *
- * @param d The header value.
- */
- public ExpiresAfter(Date d) {
- this.c = new GregorianCalendar();
- c.setTime(d);
- }
-
- /**
- * The header value.
- * @return The header value.
- */
- public Calendar toCalendar() {
- return c;
- }
-}
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/IdConflict.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/IdConflict.java
deleted file mode 100644
index 5a22a1d..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/IdConflict.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.http.annotation.*;
-import org.apache.juneau.http.exception.*;
-
-/**
- * Exception thrown when trying to add an entry where the ID is already in use.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@SuppressWarnings("serial")
-@Response(description="ID already in use")
-public class IdConflict extends Conflict {
-
- /**
- * Constructor.
- *
- * @param id The duplicate ID.
- * @param c The object type..
- */
- public IdConflict(Object id, Class<?> c) {
- super("ID ''{0}'' already in use for type ''{1}''", id, c.getSimpleName());
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/IdNotFound.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/IdNotFound.java
deleted file mode 100644
index b086f8e..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/IdNotFound.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.http.annotation.*;
-import org.apache.juneau.http.exception.*;
-
-/**
- * Exception thrown when trying to add an entry where the ID is already in use.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@SuppressWarnings("serial")
-@Response(description="ID not found")
-public class IdNotFound extends NotFound {
-
- /**
- * Constructor.
- *
- * @param id The duplicate ID.
- * @param c The object type..
- */
- public IdNotFound(Object id, Class<?> c) {
- super("ID ''{0}'' not found for type ''{1}''", id, c.getSimpleName());
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidId.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidId.java
deleted file mode 100644
index d7ee807..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidId.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.http.annotation.*;
-import org.apache.juneau.http.exception.*;
-
-/**
- * Exception thrown when trying to add an entry where the ID is already in use.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@SuppressWarnings("serial")
-@Response(description="Invalid ID provided")
-public class InvalidId extends BadRequest {
-
- /**
- * Constructor.
- */
- public InvalidId() {
- super("Invalid ID provided.");
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidLogin.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidLogin.java
deleted file mode 100644
index 25f6bd9..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidLogin.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.http.annotation.*;
-import org.apache.juneau.http.exception.*;
-
-/**
- * Exception thrown when an invalid username or password is provided.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@SuppressWarnings("serial")
-@Response(description="Invalid username or password provided")
-public class InvalidLogin extends Unauthorized {
-
- /**
- * Constructor.
- */
- public InvalidLogin() {
- super("Invalid username or password.");
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidSpecies.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidSpecies.java
deleted file mode 100644
index 19cef69..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidSpecies.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.http.annotation.*;
-import org.apache.juneau.http.exception.*;
-
-/**
- * Exception thrown when an invalid species is looked up.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@SuppressWarnings("serial")
-@Response(description="Invalid species provided")
-public class InvalidSpecies extends BadRequest {
-
- /**
- * Constructor.
- */
- public InvalidSpecies() {
- super("Invalid species provided.");
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidTag.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidTag.java
deleted file mode 100644
index 4e2199e..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidTag.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.http.annotation.*;
-import org.apache.juneau.http.exception.*;
-
-/**
- * Exception thrown when trying to add an entry where the ID is already in use.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@SuppressWarnings("serial")
-@Response(description="Invalid tag provided")
-public class InvalidTag extends BadRequest {
-
- /**
- * Constructor.
- */
- public InvalidTag() {
- super("Invalid tag provided. Must be at most 8 characters or digits.");
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidUsername.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidUsername.java
deleted file mode 100644
index 46644a3..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/InvalidUsername.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.http.annotation.*;
-import org.apache.juneau.http.exception.*;
-
-/**
- * Exception thrown when trying to add an entry where the ID is already in use.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@SuppressWarnings("serial")
-@Response(description="Invalid username provided")
-public class InvalidUsername extends BadRequest {
-
- /**
- * Constructor.
- */
- public InvalidUsername() {
- super("Invalid username provided. Must be between 3 and 8 characters or digits.");
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Order.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Order.java
deleted file mode 100644
index 27fb0b3..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Order.java
+++ /dev/null
@@ -1,194 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import static javax.persistence.TemporalType.*;
-
-import java.util.*;
-
-import javax.persistence.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.html.annotation.*;
-import org.apache.juneau.internal.*;
-import org.apache.juneau.jsonschema.annotation.*;
-import org.apache.juneau.transforms.*;
-
-/**
- * Order bean.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Bean(fluentSetters=true, properties="id,petId,username,status,shipDate")
-@Example("{id:123,petId:456,shipDate:'2012-12-21',status:'APPROVED'}")
-@Entity(name="PetstoreOrder")
-public class Order {
-
- @Column @Id @GeneratedValue
- @Schema(description="Unique identifier for this order.")
- @Html(link="servlet:/store/order/{id}")
- private long id;
-
- @Column
- @Schema(description="Pet unique identifier.")
- @Html(link="servlet:/pet/{id}")
- private long petId;
-
- @Column(length=20)
- @Schema(description="User who created this order.", minLength=3, maxLength=20)
- @Html(link="servlet:/user/{username}")
- private String username;
-
- @Column
- @Enumerated(EnumType.STRING)
- @Schema(description="The current order status.")
- private OrderStatus status;
-
- @Column @Temporal(TIMESTAMP)
- @Schema(description="The ship date for this order.", format="date-time")
- @Swap(TemporalDateSwap.IsoLocalDate.class)
- private Date shipDate;
-
- /**
- * Applies the specified create data to this order.
- *
- * @param o The create data to apply.
- * @return This object.
- */
- public Order apply(CreateOrder o) {
- this.petId = o.getPetId();
- this.username = o.getUsername();
- return this;
- }
-
- /**
- * Applies the specified order this order.
- *
- * @param o The order to apply.
- * @return This object.
- */
- public Order apply(Order o) {
- this.id = o.getId();
- this.petId = o.getPetId();
- this.username = o.getUsername();
- this.status = o.getStatus();
- this.shipDate = o.getShipDate();
- return this;
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Bean properties
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * @return The <bc>id</bc> property value.
- */
- public long getId() {
- return id;
- }
-
- /**
- * @param value The <bc>id</bc> property value.
- * @return This object (for method chaining).
- */
- public Order id(long value) {
- this.id = value;
- return this;
- }
-
- /**
- * @return The <bc>shipDate</bc> property value.
- */
- public Date getShipDate() {
- return shipDate;
- }
-
- /**
- * @param value The <bc>shipDate</bc> property value.
- * @return This object (for method chaining).
- */
- public Order shipDate(Date value) {
- this.shipDate = value;
- return this;
- }
-
- /**
- * @return The <bc>status</bc> property value.
- */
- public OrderStatus getStatus() {
- return status;
- }
-
- /**
- * @param value The <bc>status</bc> property value.
- * @return This object (for method chaining).
- */
- public Order status(OrderStatus value) {
- this.status = value;
- return this;
- }
-
- /**
- * @return The <bc>petId</bc> property value.
- */
- public long getPetId() {
- return petId;
- }
-
- /**
- * @param value The <bc>petId</bc> property value.
- * @return This object (for method chaining).
- */
- public Order petId(long value) {
- this.petId = value;;
- return this;
- }
-
- /**
- * @return The <bc>username</bc> property value.
- */
- public String getUsername() {
- return username;
- }
-
- /**
- * @param value The <bc>username</bc> property value.
- * @return This object (for method chaining).
- */
- public Order username(String value) {
- this.username = value;
- return this;
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Other
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * This shows an example generated from a static method.
- *
- * @return The example POJO.
- */
- @Example
- public static Order example() {
- return new Order()
- .id(123)
- .username("sampleuser")
- .petId(456)
- .status(OrderStatus.APPROVED)
- .shipDate(DateUtils.parseISO8601("2020-10-10"))
- ;
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/OrderStatus.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/OrderStatus.java
deleted file mode 100644
index 0c5e01e..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/OrderStatus.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.html.*;
-import org.apache.juneau.html.annotation.*;
-import org.apache.juneau.serializer.*;
-
-/**
- * Enum of all possible order statuses.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Html(render=OrderStatus.OrderStatusRender.class)
-@SuppressWarnings("javadoc")
-public enum OrderStatus {
- PLACED, APPROVED, DELIVERED;
-
- /**
- * Used to control how this enum is rendered in HTML view.
- */
- public static class OrderStatusRender extends HtmlRender<OrderStatus> {
- @Override /* HtmlRender */
- public String getStyle(SerializerSession session, OrderStatus value) {
- switch(value) {
- case PLACED: return "background-color:#5cb85c;text-align:center;vertical-align:middle;";
- case APPROVED: return "background-color:#f0ad4e;text-align:center;vertical-align:middle;";
- case DELIVERED: return "background-color:#777;text-align:center;vertical-align:middle;";
- default: return "background-color:#888;text-align:center;vertical-align:middle;";
- }
- }
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java
deleted file mode 100644
index cb9dff0..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java
+++ /dev/null
@@ -1,261 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import static javax.persistence.EnumType.*;
-
-import java.util.*;
-
-import javax.persistence.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.html.*;
-import org.apache.juneau.html.annotation.*;
-import org.apache.juneau.jsonschema.annotation.*;
-import org.apache.juneau.serializer.*;
-
-/**
- * Pet bean.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Bean(typeName="Pet", fluentSetters=true, properties="id,species,name,tags,price,status")
-@Entity(name="PetstorePet")
-public class Pet {
-
- @Column @Id @GeneratedValue
- @Schema(description="Unique identifier for this pet.")
- @Html(link="servlet:/pet/{id}")
- private long id;
-
- @Column(length=50)
- @Schema(description="Pet name.", minLength=3, maxLength=50)
- private String name;
-
- @Column
- @Schema(description="Price of pet.", maximum="999.99")
- @Html(render=PriceRender.class)
- private float price;
-
- @Column
- @Schema(description="Pet species.")
- private Species species;
-
- @ElementCollection @OrderColumn
- @Schema(description="Pet attributes.", example="friendly,smart")
- private List<String> tags;
-
- @Column @Enumerated(STRING)
- @Schema(description="Pet species.")
- private PetStatus status;
-
- /**
- * Applies the specified data to this object.
- *
- * @param x The data to apply.
- * @return This object.
- */
- public Pet apply(CreatePet x) {
- this.name = x.getName();
- this.price = x.getPrice();
- this.species = x.getSpecies();
- this.tags = x.getTags() == null ? null : Arrays.asList(x.getTags());
- return this;
- }
-
- /**
- * Applies the specified data to this object.
- *
- * @param x The data to apply.
- * @return This object.
- */
- public Pet apply(UpdatePet x) {
- this.id = x.getId();
- this.name = x.getName();
- this.price = x.getPrice();
- this.species = x.getSpecies();
- this.tags = Arrays.asList(x.getTags());
- this.status = x.getStatus();
- return this;
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Bean properties
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * @return The <bc>id</jc> property value.
- */
- public long getId() {
- return id;
- }
-
- /**
- * @param value The <bc>id</jc> property value.
- * @return This object (for method chaining).
- */
- public Pet id(long value) {
- this.id = value;
- return this;
- }
-
- /**
- * @return The <bc>name</jc> property value.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param value The <bc>name</jc> property value.
- * @return This object (for method chaining).
- */
- public Pet name(String value) {
- this.name = value;
- return this;
- }
-
- /**
- * @return The <bc>price</jc> property value.
- */
- public float getPrice() {
- return price;
- }
-
- /**
- * @param value The <bc>price</jc> property value.
- * @return This object (for method chaining).
- */
- public Pet price(float value) {
- this.price = value;
- return this;
- }
-
- /**
- * @return The <bc>species</jc> property value.
- */
- public Species getSpecies() {
- return species;
- }
-
- /**
- * @param value The <bc>species</jc> property value.
- * @return This object (for method chaining).
- */
- public Pet species(Species value) {
- this.species = value;
- return this;
- }
-
- /**
- * @return The <bc>tags</jc> property value.
- */
- public List<String> getTags() {
- return tags;
- }
-
- /**
- * @param value The <bc>tags</jc> property value.
- * @return This object (for method chaining).
- */
- public Pet tags(List<String> value) {
- this.tags = value;
- return this;
- }
-
- /**
- * @param value The <bc>tags</jc> property value.
- * @return This object (for method chaining).
- */
- public Pet tags(String...value) {
- this.tags = Arrays.asList(value);
- return this;
- }
-
- /**
- * @return The <bc>status</jc> property value.
- */
- public PetStatus getStatus() {
- return status;
- }
-
- /**
- * @param value The <bc>status</jc> property value.
- * @return This object (for method chaining).
- */
- public Pet status(PetStatus value) {
- this.status = value;
- return this;
- }
-
- /**
- * @param statuses The statuses to match against.
- * @return <jk>true</jk> if this pet matches at least one of the specified statuses.
- */
- public boolean hasStatus(PetStatus...statuses) {
- for (PetStatus status : statuses)
- if (this.status == status)
- return true;
- return false;
- }
-
- /**
- * @param tags The tags to match against.
- * @return <jk>true</jk> if this pet matches at least one of the specified tags.
- */
- public boolean hasTag(String...tags) {
- for (String tag : tags)
- for (String t : this.tags)
- if (t.equals(tag))
- return true;
- return false;
- }
-
- /**
- * @return Edit page link.
- */
- public java.net.URI getEdit() {
- return java.net.URI.create("servlet:/pet/edit/{id}");
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Other
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * This shows an example generated from a static method.
- *
- * @return POJO example.
- */
- @Example
- public static Pet example() {
- return new Pet()
- .id(123)
- .species(Species.DOG)
- .name("Doggie")
- .tags("friendly","smart")
- .status(PetStatus.AVAILABLE);
- }
-
- /**
- * Used to control format of prices in HTML view.
- */
- public static final class PriceRender extends HtmlRender<Float> {
- @Override
- public Object getContent(SerializerSession session, Float value) {
- return value == null ? null : String.format("$%.2f", value);
- }
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/PetStatus.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/PetStatus.java
deleted file mode 100644
index 42abc3a..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/PetStatus.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.html.*;
-import org.apache.juneau.html.annotation.*;
-import org.apache.juneau.serializer.*;
-
-/**
- * Enum of all possible pet statuses.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Html(render=PetStatus.PetStatusRender.class)
-@SuppressWarnings("javadoc")
-public enum PetStatus {
- AVAILABLE, PENDING, SOLD, UNKNOWN;
-
- /**
- * Used to control how this enum is rendered in HTML view.
- */
- public static class PetStatusRender extends HtmlRender<PetStatus> {
- @Override /* HtmlRender */
- public String getStyle(SerializerSession session, PetStatus value) {
- switch(value) {
- case AVAILABLE: return "background-color:#5cb85c;text-align:center;vertical-align:middle;";
- case PENDING: return "background-color:#f0ad4e;text-align:center;vertical-align:middle;";
- case SOLD: return "background-color:#888;text-align:center;vertical-align:middle;";
- default: return "background-color:#777;text-align:center;vertical-align:middle;";
- }
- }
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/PetTag.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/PetTag.java
deleted file mode 100644
index 34577ab..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/PetTag.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import java.util.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.internal.*;
-
-/**
- * Pet tag bean.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Bean(typeName="Tag", fluentSetters=true)
-@Swap(PetTagNameSwap.class)
-public class PetTag {
- private long id;
- private String name;
-
- /**
- * @return The <bc>id</jc> property value.
- */
- public long getId() {
- return id;
- }
-
- /**
- * @param value The <bc>id</jc> property value.
- * @return This object (for method chaining).
- */
- public PetTag id(long value) {
- this.id = value;
- return this;
- }
-
- /**
- * @return The <bc>name</jc> property value.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param value The <bc>name</jc> property value.
- * @return This object (for method chaining).
- */
- public PetTag name(String value) {
- this.name = value;
- return this;
- }
-
- /**
- * @return POJO example.
- */
- @Example
- public static PetTag example() {
- return new PetTag()
- .id(123)
- .name("MyTag");
- }
-
- /**
- * @param tags Tags to convert to a simple string.
- * @return The specified tags as a simple comma-delimited list.
- */
- public static String asString(List<PetTag> tags) {
- if (tags == null)
- return "";
- List<String> l = new ArrayList<>(tags.size());
- for (PetTag t : tags)
- l.add(t.getName());
- return StringUtils.join(l, ',');
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/PetTagNameSwap.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/PetTagNameSwap.java
deleted file mode 100644
index 7e1442f..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/PetTagNameSwap.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.*;
-import org.apache.juneau.http.*;
-import org.apache.juneau.transform.*;
-
-/**
- * Swap for {@link PetTag} beans.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-public class PetTagNameSwap extends PojoSwap<PetTag,String> {
-
- /**
- * Swap PetTag with name.
- */
- @Override
- public String swap(BeanSession bs, PetTag o) throws Exception {
- return o.getName();
- }
-
- /**
- * This is only applicable to HTML serialization.
- */
- @Override
- public MediaType[] forMediaTypes() {
- return new MediaType[] { MediaType.HTML };
- }
-}
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Species.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Species.java
deleted file mode 100644
index 90a54e3..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Species.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-/**
- * Enum of all possible animal types.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-public enum Species {
- BIRD, CAT, DOG, FISH, MOUSE, RABBIT, SNAKE;
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UpdatePet.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UpdatePet.java
deleted file mode 100644
index d4b671f..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UpdatePet.java
+++ /dev/null
@@ -1,122 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.jsonschema.annotation.*;
-
-/**
- * Bean for updating {@link Pet} objects.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Bean(fluentSetters=true, properties="id,name,price,species,tags,status")
-public class UpdatePet extends CreatePet {
-
- @Schema(description="Pet identifier.", minimum="1")
- private long id;
-
- @Schema(description="Updated pet status.")
- private PetStatus status;
-
- /**
- * Constructor.
- *
- * @param id The <bc>id</bc> property value.
- * @param name The <bc>name</bc> property value.
- * @param price The <bc>price</bc> property value.
- * @param species The <bc>species</bc> property value.
- * @param tags The <bc>tags</bc> property value.
- * @param status The <bc>status</bc> property value.
- */
- public UpdatePet(long id, String name, float price, Species species, String[] tags, PetStatus status) {
- super(name, price, species, tags);
- this.id = id;
- this.status = status;
- }
-
- /**
- * Empty constructor.
- */
- public UpdatePet() {}
-
- //-----------------------------------------------------------------------------------------------------------------
- // Bean properties
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * @return The <bc>id</jc> property value.
- */
- public long getId() {
- return id;
- }
-
- /**
- * @param value The <bc>id</jc> property value.
- * @return This object (for method chaining).
- */
- public UpdatePet id(long value) {
- this.id = value;
- return this;
- }
-
- /**
- * @return The <bc>status</jc> property value.
- */
- public PetStatus getStatus() {
- return status;
- }
-
- /**
- * @param value The <bc>status</jc> property value.
- * @return This object (for method chaining).
- */
- public UpdatePet status(PetStatus value) {
- this.status = value;
- return this;
- }
-
- @Override
- public UpdatePet name(String value) {
- super.name(value);
- return this;
- }
-
- @Override
- public UpdatePet price(float value) {
- super.price(value);
- return this;
- }
-
- @Override
- public UpdatePet species(Species value) {
- super.species(value);
- return this;
- }
-
- @Override
- public UpdatePet tags(String...value) {
- super.tags(value);
- return this;
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Other
- //-----------------------------------------------------------------------------------------------------------------
-
- public static UpdatePet example() {
- return new UpdatePet(123, "Doggie", 9.99f, Species.DOG, new String[]{"smart","friendly"}, PetStatus.SOLD);
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/User.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/User.java
deleted file mode 100644
index eefa4c5..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/User.java
+++ /dev/null
@@ -1,213 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import static javax.persistence.EnumType.*;
-
-import javax.persistence.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.html.annotation.*;
-import org.apache.juneau.jsonschema.annotation.*;
-
-/**
- * User bean.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Bean(typeName="User", fluentSetters=true, properties="username,firstName,lastName,email,password,phone,userStatus")
-@Entity(name="PetstoreUser")
-public class User {
-
- @Id
- @Column(length=8)
- @Schema(description="Username.", minLength=3, maxLength=8)
- @Html(link="servlet:/user/{username}")
- private String username;
-
- @Column(length=50)
- @Schema(description="First name.", maxLength=50)
- private String firstName;
-
- @Column(length=50)
- @Schema(description="First name.", maxLength=50)
- private String lastName;
-
- @Column(length=50)
- @Schema(description="First name.", maxLength=50, pattern="\\S+\\@\\S+")
- private String email;
-
- @Column(length=8)
- @Schema(description="Password.", minLength=3, maxLength=8, pattern="[\\w\\d]{3,8}")
- private String password;
-
- @Column
- @Schema(description="Phone number.", minLength=12, maxLength=12, pattern="\\d{3}\\-\\d{3}\\-\\d{4}")
- private String phone;
-
- @Column
- @Enumerated(STRING)
- private UserStatus userStatus;
-
- /**
- * Applies the specified data to this object.
- *
- * @param c The data to apply.
- * @return This object.
- */
- public User apply(User c) {
- this.username = c.getUsername();
- this.firstName = c.getFirstName();
- this.lastName = c.getLastName();
- this.email = c.getEmail();
- this.password = c.getPassword();
- this.phone = c.getPhone();
- this.userStatus = c.getUserStatus();
- return this;
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Bean properties
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * @return The <bc>username</jc> property value.
- */
- public String getUsername() {
- return username;
- }
-
- /**
- * @param value The <bc>username</jc> property value.
- * @return This object (for method chaining).
- */
- public User username(String value) {
- this.username = value;
- return this;
- }
-
- /**
- * @return The <bc>firstName</jc> property value.
- */
- public String getFirstName() {
- return firstName;
- }
-
- /**
- * @param value The <bc>firstName</jc> property value.
- * @return This object (for method chaining).
- */
- public User firstName(String value) {
- this.firstName = value;
- return this;
- }
-
- /**
- * @return The <bc>lastName</jc> property value.
- */
- public String getLastName() {
- return lastName;
- }
-
- /**
- * @param value The <bc>lastName</jc> property value.
- * @return This object (for method chaining).
- */
- public User lastName(String value) {
- this.lastName = value;
- return this;
- }
-
- /**
- * @return The <bc>email</jc> property value.
- */
- public String getEmail() {
- return email;
- }
-
- /**
- * @param value The <bc>email</jc> property value.
- * @return This object (for method chaining).
- */
- public User email(String value) {
- this.email = value;
- return this;
- }
-
- /**
- * @return The <bc>password</jc> property value.
- */
- public String getPassword() {
- return password;
- }
-
- /**
- * @param value The <bc>password</jc> property value.
- * @return This object (for method chaining).
- */
- public User password(String value) {
- this.password = value;
- return this;
- }
-
- /**
- * @return The <bc>phone</jc> property value.
- */
- public String getPhone() {
- return phone;
- }
-
- /**
- * @param value The <bc>phone</jc> property value.
- * @return This object (for method chaining).
- */
- public User phone(String value) {
- this.phone = value;
- return this;
- }
-
- /**
- * @return The <bc>userStatus</jc> property value.
- */
- public UserStatus getUserStatus() {
- return userStatus;
- }
-
- /**
- * @param value The <bc>userStatus</jc> property value.
- * @return This object (for method chaining).
- */
- public User userStatus(UserStatus value) {
- this.userStatus = value;
- return this;
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Other
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * This shows an example generated from a static method.
- */
- @Example
- public static User EXAMPLE = new User()
- .username("billy")
- .firstName("Billy")
- .lastName("Bob")
- .email("billy@apache.org")
- .userStatus(UserStatus.ACTIVE)
- .phone("111-222-3333");
-
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UserStatus.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UserStatus.java
deleted file mode 100644
index 1049c45..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UserStatus.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.dto;
-
-import org.apache.juneau.html.*;
-import org.apache.juneau.html.annotation.*;
-import org.apache.juneau.serializer.*;
-
-/**
- * Enum of all possible user statuses.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@Html(render=UserStatus.UserStatusRender.class)
-@SuppressWarnings("javadoc")
-public enum UserStatus {
- ACTIVE, INACTIVE;
-
- /**
- * Used to control how this enum is rendered in HTML view.
- */
- public static class UserStatusRender extends HtmlRender<UserStatus> {
- @Override /* HtmlRender */
- public String getStyle(SerializerSession session, UserStatus value) {
- switch(value) {
- case ACTIVE: return "background-color:#5cb85c;text-align:center;vertical-align:middle;";
- case INACTIVE: return "background-color:#888;text-align:center;vertical-align:middle;";
- default: return "";
- }
- }
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/package-info.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/package-info.java
deleted file mode 100755
index 3b1ff90..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-// ***************************************************************************************************************************
-// * 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. *
-// ***************************************************************************************************************************
-
-/**
- * Examples
- */
-package org.apache.juneau.petstore.dto;
-
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/package-info.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/package-info.java
deleted file mode 100755
index 7f2bf15..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-// ***************************************************************************************************************************
-// * 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. *
-// ***************************************************************************************************************************
-
-/**
- * Examples
- */
-package org.apache.juneau.petstore;
-
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/.gitignore b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/.gitignore
deleted file mode 100644
index 34acf88..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/target/
-**/.DS_Store
-.classpath
-.project
-/.settings/
-/bin/
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/pom.xml b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/pom.xml
deleted file mode 100644
index dd5aa42..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-examples-petstore</artifactId>
- <version>8.1.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>juneau-examples-petstore-client</artifactId>
- <name>Apache Juneau Petstore Example - Client Code</name>
- <description>Apache Juneau Petstore Example, Client Code</description>
-
- <properties>
- <encoding>UTF-8</encoding>
- <maven.javadoc.skip>true</maven.javadoc.skip>
-
- <!-- Skip javadoc generation since we generate them in the aggregate pom -->
- <maven.javadoc.skip>true</maven.javadoc.skip>
-
- <!-- Java 8 required because Jetty requires it. -->
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- <springframework.version>2.0.1.RELEASE</springframework.version>
- </properties>
-
-
- <dependencies>
-
-
- <dependency>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-examples-petstore-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-rest-client</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <escapeString>\</escapeString>
- </configuration>
- <executions>
- <execution>
- <id>juneau-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <finalName>juneau-examples-rest-petstore-client-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/bin.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/assembly/bin.xml b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/assembly/bin.xml
deleted file mode 100644
index ad917d5..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/assembly/bin.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-
-<!--
- This assembly is used to create the template zip file that developers use to import into Eclipse to start their
- own projects.
- -->
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
- <id>bin</id>
- <formats>
- <format>zip</format>
- </formats>
- <baseDirectory>/</baseDirectory>
- <includeBaseDirectory>true</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}/../juneau-examples-petstore-client</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>src/main/**</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>src/main/**</include>
- <include>files/**</include>
- <include>.settings/**</include>
- <include>.project</include>
- <include>*.launch</include>
- <include>*.cfg</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/build-overlay</directory>
- <outputDirectory>/</outputDirectory>
- <filtered>true</filtered>
- </fileSet>
- </fileSets>
-
-</assembly>
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/java/org/apache/juneau/petstore/Main.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/java/org/apache/juneau/petstore/Main.java
deleted file mode 100644
index d005383..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/java/org/apache/juneau/petstore/Main.java
+++ /dev/null
@@ -1,112 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore;
-
-import static java.text.MessageFormat.*;
-
-import java.io.*;
-import java.util.*;
-
-import org.apache.juneau.json.*;
-import org.apache.juneau.marshall.*;
-import org.apache.juneau.parser.*;
-import org.apache.juneau.petstore.dto.*;
-import org.apache.juneau.rest.client.*;
-
-/**
- * Example code showing how to connect to the PetStore application using a remote proxy.
- *
- * <p>
- * The remote proxy allows you to make REST calls against our REST interface through Java interface method calls.
- */
-public class Main {
-
- private static final JsonParser JSON_PARSER = JsonParser.create().ignoreUnknownBeanProperties().build();
-
- public static void main(String[] args) {
-
- // Create a RestClient with JSON serialization support.
- try (RestClient rc = RestClient.create(SimpleJsonSerializer.class, JsonParser.class).build()) {
-
- // Instantiate our proxy.
- PetStore petStore = rc.getRemoteResource(PetStore.class, "http://localhost:5000");
-
- // Print out the pets in the store.
- Collection<Pet> pets = petStore.getPets();
-
- // Pretty-print them to SYSOUT.
- SimpleJson.DEFAULT_READABLE.println(pets);
-
- // Initialize the application through REST calls.
- init(new PrintWriter(System.out), petStore);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Initialize the petstore database by using a remote resource interface against our REST.
- *
- * @param w Console output.
- * @return This object (for method chaining).
- * @throws ParseException Malformed input encountered.
- * @throws IOException Thrown by client stream.
- */
- public static void init(PrintWriter w, PetStore ps) throws ParseException, IOException {
-
- for (Pet x : ps.getPets()) {
- ps.deletePet("apiKey", x.getId());
- w.println(format("Deleted pet: id={0}", x.getId()));
- }
-
- for (Order x : ps.getOrders()) {
- ps.deleteOrder(x.getId());
- w.println(format("Deleted order: id={0}", x.getId()));
- }
-
- for (User x : ps.getUsers()) {
- ps.deleteUser(x.getUsername());
- w.println(format("Deleted user: username={0}", x.getUsername()));
- }
-
- for (CreatePet x : load("init/Pets.json", CreatePet[].class)) {
- long id = ps.createPet(x);
- w.println(format("Created pet: id={0}, name={1}", id, x.getName()));
- }
-
- for (Order x : load("init/Orders.json", Order[].class)) {
- long id = ps.placeOrder(x.getPetId(), x.getUsername());
- w.println(format("Created order: id={0}", id));
- }
-
- for (User x : load("init/Users.json", User[].class)) {
- ps.createUser(x);
- w.println(format("Created user: username={0}", x.getUsername()));
- }
-
- w.flush();
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Helper methods
- //-----------------------------------------------------------------------------------------------------------------
-
- private static <T> T load(String fileName, Class<T> c) throws ParseException, IOException {
- return JSON_PARSER.parse(getStream(fileName), c);
- }
-
- private static InputStream getStream(String fileName) {
- return Main.class.getResourceAsStream(fileName);
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Orders.json b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Orders.json
deleted file mode 100644
index b306aa8..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Orders.json
+++ /dev/null
@@ -1,18 +0,0 @@
-// ***************************************************************************************************************************
-// * 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. *
-// ***************************************************************************************************************************
-
-[
- {id:101,petId:101,shipDate:'2018-01-01',status:'PLACED'},
- {id:102,petId:102,shipDate:'2018-01-01',status:'APPROVED'},
- {id:103,petId:103,shipDate:'2018-01-01',status:'DELIVERED'}
-]
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Pets.json b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Pets.json
deleted file mode 100644
index c0aa31f..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Pets.json
+++ /dev/null
@@ -1,24 +0,0 @@
-// ***************************************************************************************************************************
-// * 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. *
-// ***************************************************************************************************************************
-
-[
- {species:'CAT', name:'Mr. Frisky', price:39.99, tags:['friendly'], status:'AVAILABLE'},
- {species:'DOG', name:'Kibbles', price:99.99, tags:['loyal'], status:'AVAILABLE'},
- {species:'RABBIT', name:'Hoppy', price:49.99, tags:['friendly','smells nice'], status:'AVAILABLE'},
- {species:'RABBIT', name:'Hoppy 2', price:49.99, status:'AVAILABLE'},
- {species:'RABBIT', name:'Hoppy 3', price:49.99, status:'AVAILABLE'},
- {species:'RABBIT', name:'Hoppy 4', price:49.99, status:'AVAILABLE'},
- {species:'FISH', name:'Gorton', price:1.99, status:'PENDING'},
- {species:'MOUSE', name:'Hackwrench', price:4.99, status:'SOLD'},
- {species:'SNAKE', name:'Just Snake', price:9.99, status:'SOLD'}
-]
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Users.json b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Users.json
deleted file mode 100644
index 7f02a3c..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Users.json
+++ /dev/null
@@ -1,18 +0,0 @@
-// ***************************************************************************************************************************
-// * 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. *
-// ***************************************************************************************************************************
-
-[
- {username:'mwatson',firstName:'Marie',lastName:'Watson',email:'marie.watson@fakemail.com',password:'123456',phone:'444-555-7777',userStatus:'ACTIVE'},
- {username:'dvaughn',firstName:'Daniel',lastName:'Vaughn',email:'daniel.vaughn@test.com',password:'123456',phone:'666-777-3333',userStatus:'ACTIVE'},
- {username:'bfuller',firstName:'Brenda',lastName:'Fuller',email:'brenda.fuller@example.com',password:'123456',phone:'777-888-3333',userStatus:'INACTIVE'}
-]
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/.gitignore b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/.gitignore
deleted file mode 100644
index aefe663..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/target/
-**/.DS_Store
-.classpath
-.project
-/.settings/
-/bin/
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/juneau-examples-petstore-server.launch b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/juneau-examples-petstore-server.launch
deleted file mode 100644
index bba6035..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/juneau-examples-petstore-server.launch
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
- <listEntry value="/juneau-examples-petstore-app/src/main/java/org/apache/juneau/petstore/server/App.java"/>
- </listAttribute>
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
- <listEntry value="1"/>
- </listAttribute>
- <booleanAttribute key="org.eclipse.jdt.debug.ui.CONSIDER_INHERITED_MAIN" value="true"/>
- <booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
- <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
- <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
- <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.juneau.petstore.server.App"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="juneau-examples-petstore-server"/>
-</launchConfiguration>
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/pom.xml b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/pom.xml
deleted file mode 100644
index 262cabe..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/pom.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-examples-petstore</artifactId>
- <version>8.1.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>juneau-examples-petstore-server</artifactId>
- <name>Apache Juneau Petstore Example - Server Code</name>
- <description>Apache Juneau Petstore Example, Server Code</description>
-
- <properties>
- <encoding>UTF-8</encoding>
- <maven.javadoc.skip>true</maven.javadoc.skip>
-
- <!-- Skip javadoc generation since we generate them in the aggregate pom -->
- <maven.javadoc.skip>true</maven.javadoc.skip>
-
- <!-- Java 8 required because Jetty requires it. -->
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- <springframework.version>2.0.1.RELEASE</springframework.version>
- </properties>
-
-
- <dependencies>
- <!-- Juneau dependencies -->
- <dependency>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-examples-petstore-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-rest-server-springboot</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Spring Boot dependencies-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- <version>${springframework.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- Needed for @Inject support -->
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <version>${javax.inject.version}</version>
- </dependency>
-
- <!-- Needed for JPA persistence of PetStore beans -->
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${hibernate.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>${hibernate.version}</version>
- </dependency>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>${xml.apis.version}</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <escapeString>\</escapeString>
- </configuration>
- <executions>
- <execution>
- <id>juneau-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <finalName>juneau-examples-rest-petstore-server-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/bin.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/assembly/bin.xml b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/assembly/bin.xml
deleted file mode 100644
index 491e69e..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/assembly/bin.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-
-<!--
- This assembly is used to create the template zip file that developers use to import into Eclipse to start their
- own projects.
- -->
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
- <id>bin</id>
- <formats>
- <format>zip</format>
- </formats>
- <baseDirectory>/</baseDirectory>
- <includeBaseDirectory>true</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}/../juneau-examples-petstore-server</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>src/main/**</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>src/main/**</include>
- <include>files/**</include>
- <include>.settings/**</include>
- <include>.project</include>
- <include>*.launch</include>
- <include>*.cfg</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/build-overlay</directory>
- <outputDirectory>/</outputDirectory>
- <filtered>true</filtered>
- </fileSet>
- </fileSets>
-
-</assembly>
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/App.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/App.java
deleted file mode 100644
index f04953b..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/App.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore;
-
-import org.apache.juneau.rest.springboot.JuneauRestInitializer;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-
-/**
- * Entry point for PetStore application.
- */
-@SpringBootApplication
-public class App {
-
- public static void main(String[] args) {
- new App().start(args);
- }
-
- protected void start(String[] args) {
- new SpringApplicationBuilder(App.class)
- .initializers(new JuneauRestInitializer(App.class)) // Needed for Juneau resources as injectible Spring beans.
- .run(args);
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/AppConfiguration.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/AppConfiguration.java
deleted file mode 100644
index d3d7370..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/AppConfiguration.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore;
-
-import org.apache.juneau.petstore.rest.*;
-import org.apache.juneau.petstore.service.*;
-import org.apache.juneau.rest.springboot.annotation.JuneauRestRoot;
-import org.springframework.boot.web.servlet.*;
-import org.springframework.context.annotation.*;
-import org.springframework.web.filter.*;
-
-@Configuration
-public class AppConfiguration {
-
- //-----------------------------------------------------------------------------------------------------------------
- // Services
- //-----------------------------------------------------------------------------------------------------------------
-
- @Bean
- public PetStoreService petStoreService() {
- return new PetStoreService();
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // REST
- //-----------------------------------------------------------------------------------------------------------------
-
- @Bean
- @JuneauRestRoot
- public RootResources rootResources() {
- return new RootResources();
- }
-
- @Bean
- public PetStoreResource petStoreResource() {
- return new PetStoreResource();
- }
-
- /**
- * We want to be able to consume url-encoded-form-post bodies, but HiddenHttpMethodFilter triggers the HTTP
- * body to be consumed. So disable it.
- *
- * @param filter The filter.
- * @return Filter registration bean.
- */
- @Bean
- public FilterRegistrationBean<HiddenHttpMethodFilter> registration(HiddenHttpMethodFilter filter) {
- FilterRegistrationBean<HiddenHttpMethodFilter> registration = new FilterRegistrationBean<>(filter);
- registration.setEnabled(false);
- return registration;
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java
deleted file mode 100644
index de79d12..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java
+++ /dev/null
@@ -1,541 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.rest;
-
-import static org.apache.juneau.dto.swagger.ui.SwaggerUI.*;
-import static org.apache.juneau.http.HttpMethodName.*;
-import static org.apache.juneau.http.response.Ok.*;
-
-import java.util.*;
-import java.util.Map;
-
-import javax.inject.*;
-
-import org.apache.juneau.jsonschema.annotation.*;
-import org.apache.juneau.petstore.*;
-import org.apache.juneau.petstore.dto.*;
-import org.apache.juneau.petstore.service.*;
-import org.apache.juneau.*;
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.html.annotation.*;
-import org.apache.juneau.http.annotation.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.http.exception.*;
-import org.apache.juneau.rest.helper.*;
-import org.apache.juneau.http.response.*;
-import org.apache.juneau.rest.widget.*;
-import org.apache.juneau.transforms.*;
-import org.apache.juneau.rest.converters.*;
-
-/**
- * Sample Petstore application.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@RestResource(
- path="/petstore",
- title="Petstore application",
- description={
- "This is a sample server Petstore server based on the Petstore sample at Swagger.io.",
- "You can find out more about Swagger at http://swagger.io.",
- },
- properties= {
- // Resolve recursive references when showing schema info in the swagger.
- @Property(name=SWAGGERUI_resolveRefsMaxDepth, value="99")
- },
- swagger=@ResourceSwagger(
- version="1.0.0",
- title="Swagger Petstore",
- termsOfService="You are on your own.",
- contact=@Contact(
- name="Juneau Development Team",
- email="dev@juneau.apache.org",
- url="http://juneau.apache.org"
- ),
- license=@License(
- name="Apache 2.0",
- url="http://www.apache.org/licenses/LICENSE-2.0.html"
- ),
- externalDocs=@ExternalDocs(
- description="Find out more about Juneau",
- url="http://juneau.apache.org"
- ),
- tags={
- @Tag(
- name="pet",
- description="Everything about your Pets",
- externalDocs=@ExternalDocs(
- description="Find out more",
- url="http://juneau.apache.org"
- )
- ),
- @Tag(
- name="store",
- description="Access to Petstore orders"
- ),
- @Tag(
- name="user",
- description="Operations about user",
- externalDocs=@ExternalDocs(
- description="Find out more about our store",
- url="http://juneau.apache.org"
- )
- )
- }
- ),
- staticFiles={"htdocs:/htdocs"} // Expose static files in htdocs subpackage.
-)
-@HtmlDocConfig(
- widgets={
- ContentTypeMenuItem.class,
- ThemeMenuItem.class,
- },
- navlinks={
- "up: request:/..",
- "options: servlet:/?method=OPTIONS",
- "$W{ContentTypeMenuItem}",
- "$W{ThemeMenuItem}",
- "source: $C{Source/gitHub}/org/apache/juneau/petstore/rest/$R{servletClassSimple}.java"
- },
- head={
- "<link rel='icon' href='$U{servlet:/htdocs/cat.png}'/>" // Add a cat icon to the page.
- },
- header={
- "<h1>$R{resourceTitle}</h1>",
- "<h2>$R{methodSummary}</h2>",
- "$C{PetStore/headerImage}"
- },
- aside={
- "<div style='max-width:400px' class='text'>",
- " <p>This page shows a standard nested REST resource.</p>",
- " <p>It shows how different properties can be rendered on the same bean in different views.</p>",
- " <p>It also shows examples of HtmlRender classes and @BeanProperty(format) annotations.</p>",
- " <p>It also shows how the Queryable converter and query widget can be used to create searchable interfaces.</p>",
- "</div>"
- },
- stylesheet="servlet:/htdocs/themes/dark.css" // Use dark theme by default.
-)
-public class PetStoreResource extends BasicRest implements PetStore {
-
- @Inject
- private PetStoreService store;
-
- /**
- * Navigation page
- *
- * @return Navigation page contents.
- */
- @RestMethod(
- name=GET,
- path="/",
- summary="Navigation page"
- )
- @HtmlDocConfig(
- style={
- "INHERIT", // Flag for inheriting resource-level CSS.
- "body { ",
- "background-image: url('petstore/htdocs/background.jpg'); ",
- "background-color: black; ",
- "background-size: cover; ",
- "background-attachment: fixed; ",
- "}"
- }
- )
- public ResourceDescriptions getTopPage() {
- return new ResourceDescriptions()
- .append("pet", "All pets in the store")
- .append("store", "Orders and inventory")
- .append("user", "Petstore users")
- ;
- }
-
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- // Pets
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
- @Override /* PetStore */
- @RestMethod(
- name=GET,
- path="/pet",
- summary="All pets in the store",
- swagger=@MethodSwagger(
- tags="pet",
- parameters={
- Queryable.SWAGGER_PARAMS
- }
- ),
- converters={Queryable.class}
- )
- @BeanConfig(
- bpx="Pet: tags,photo"
- )
- public Collection<Pet> getPets() throws NotAcceptable {
- return store.getPets();
- }
-
- @Override /* PetStore */
- @RestMethod(
- name=GET,
- path="/pet/{petId}",
- summary="Find pet by ID",
- description="Returns a single pet",
- swagger=@MethodSwagger(
- tags="pet",
- value={
- "security:[ { api_key:[] } ]"
- }
- )
- )
- public Pet getPet(long petId) throws IdNotFound, NotAcceptable {
- return store.getPet(petId);
- }
-
- @Override /* PetStore */
- @RestMethod(
- name=POST,
- path="/pet",
- summary="Add a new pet to the store",
- swagger=@MethodSwagger(
- tags="pet",
- value={
- "security:[ { petstore_auth:['write:pets','read:pets'] } ]"
- }
- )
- )
- public long createPet(CreatePet pet) throws IdConflict, NotAcceptable, UnsupportedMediaType {
- return store.create(pet).getId();
- }
-
- @Override /* PetStore */
- @RestMethod(
- name=PUT,
- path="/pet/{petId}",
- summary="Update an existing pet",
- swagger=@MethodSwagger(
- tags="pet",
- value={
- "security:[ { petstore_auth: ['write:pets','read:pets'] } ]"
- }
- )
- )
- public Ok updatePet(UpdatePet pet) throws IdNotFound, NotAcceptable, UnsupportedMediaType {
- store.update(pet);
- return OK;
- }
-
- @Override /* PetStore */
- @RestMethod(
- name=GET,
- path="/pet/findByStatus",
- summary="Finds Pets by status",
- description="Multiple status values can be provided with comma separated strings.",
- swagger=@MethodSwagger(
- tags="pet",
- value={
- "security:[{petstore_auth:['write:pets','read:pets']}]"
- }
- )
- )
- public Collection<Pet> findPetsByStatus(PetStatus[] status) throws NotAcceptable {
- return store.getPetsByStatus(status);
- }
-
- @Override /* PetStore */
- @RestMethod(
- name=GET,
- path="/pet/findByTags",
- summary="Finds Pets by tags",
- description="Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
- swagger=@MethodSwagger(
- tags="pet",
- value={
- "security:[ { petstore_auth:[ 'write:pets','read:pets' ] } ]"
- }
- )
- )
- @Deprecated
- public Collection<Pet> findPetsByTags(String[] tags) throws InvalidTag, NotAcceptable {
- return store.getPetsByTags(tags);
- }
-
- @Override /* PetStore */
- @RestMethod(
- name=DELETE,
- path="/pet/{petId}",
- summary="Deletes a pet",
- swagger=@MethodSwagger(
- tags="pet",
- value={
- "security:[ { petstore_auth:[ 'write:pets','read:pets' ] } ]"
- }
- )
- )
- public Ok deletePet(String apiKey, long petId) throws IdNotFound, NotAcceptable {
- store.removePet(petId);
- return OK;
- }
-
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- // Orders
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
- /**
- * Store navigation page.
- *
- * @return Store navigation page contents.
- */
- @RestMethod(
- summary="Store navigation page",
- swagger=@MethodSwagger(
- tags="store"
- )
- )
- public ResourceDescriptions getStore() {
- return new ResourceDescriptions()
- .append("store/order", "Petstore orders")
- .append("store/inventory", "Petstore inventory")
- ;
- }
-
- @Override
- @RestMethod(
- name=GET,
- path="/store/order",
- summary="Petstore orders",
- swagger=@MethodSwagger(
- tags="store"
- )
- )
- @HtmlDocConfig(
- widgets={
- QueryMenuItem.class
- },
- navlinks={
- "INHERIT", // Inherit links from class.
- "[2]:$W{QueryMenuItem}", // Insert QUERY link in position 2.
- "[3]:$W{AddOrderMenuItem}" // Insert ADD link in position 3.
- }
- )
- public Collection<Order> getOrders() throws NotAcceptable {
- return store.getOrders();
- }
-
- @Override
- @RestMethod(
- name=GET,
- path="/store/order/{orderId}",
- summary="Find purchase order by ID",
- description="Returns a purchase order by ID.",
- swagger=@MethodSwagger(
- tags="store"
- )
- )
- public Order getOrder(long orderId) throws InvalidId, IdNotFound, NotAcceptable {
- if (orderId < 1 || orderId > 1000)
- throw new InvalidId();
- return store.getOrder(orderId);
- }
-
- @Override
- @RestMethod(
- name=POST,
- path="/store/order",
- summary="Place an order for a pet",
- swagger=@MethodSwagger(
- tags="store"
- ),
- pojoSwaps={
- TemporalDateSwap.IsoLocalDate.class
- }
- )
- public long placeOrder(long petId, String username) throws IdConflict, NotAcceptable, UnsupportedMediaType {
- CreateOrder co = new CreateOrder(petId, username);
- return store.create(co).getId();
- }
-
- @Override
- @RestMethod(
- name=DELETE,
- path="/store/order/{orderId}",
- summary="Delete purchase order by ID",
- description= {
- "For valid response try integer IDs with positive integer value.",
- "Negative or non-integer values will generate API errors."
- },
- swagger=@MethodSwagger(
- tags="store"
- )
- )
- public Ok deleteOrder(long orderId) throws InvalidId, IdNotFound, NotAcceptable {
- if (orderId < 0)
- throw new InvalidId();
- store.removeOrder(orderId);
- return OK;
- }
-
- @Override
- @RestMethod(
- name=GET,
- path="/store/inventory",
- summary="Returns pet inventories by status",
- description="Returns a map of status codes to quantities",
- swagger=@MethodSwagger(
- tags="store",
- responses={
- "200:{ 'x-example':{AVAILABLE:123} }",
- },
- value={
- "security:[ { api_key:[] } ]"
- }
- )
- )
- public Map<PetStatus,Integer> getStoreInventory() throws NotAcceptable {
- return store.getInventory();
- }
-
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- // Users
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
- @Override
- @RestMethod(
- name=GET,
- path="/user",
- summary="Petstore users",
- bpx="User: email,password,phone",
- swagger=@MethodSwagger(
- tags="user"
- )
- )
- public Collection<User> getUsers() throws NotAcceptable {
- return store.getUsers();
- }
-
- @Override
- @RestMethod(
- name=GET,
- path="/user/{username}",
- summary="Get user by user name",
- swagger=@MethodSwagger(
- tags="user"
- )
- )
- public User getUser(String username) throws InvalidUsername, IdNotFound, NotAcceptable {
- return store.getUser(username);
- }
-
- @Override
- @RestMethod(
- name=POST,
- path="/user",
- summary="Create user",
- description="This can only be done by the logged in user.",
- swagger=@MethodSwagger(
- tags="user"
- )
- )
- public Ok createUser(User user) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType {
- store.create(user);
- return OK;
- }
-
- @Override
- @RestMethod(
- name=POST,
- path="/user/createWithArray",
- summary="Creates list of users with given input array",
- swagger=@MethodSwagger(
- tags="user"
- )
- )
- public Ok createUsers(User[] users) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType {
- for (User user : users)
- store.create(user);
- return OK;
- }
-
- @Override
- @RestMethod(
- name=PUT,
- path="/user/{username}",
- summary="Update user",
- description="This can only be done by the logged in user.",
- swagger=@MethodSwagger(
- tags="user"
- )
- )
- public Ok updateUser(String username, User user) throws InvalidUsername, IdNotFound, NotAcceptable, UnsupportedMediaType {
- store.update(user);
- return OK;
- }
-
- @Override
- @RestMethod(
- name=DELETE,
- path="/user/{username}",
- summary="Delete user",
- description="This can only be done by the logged in user.",
- swagger=@MethodSwagger(
- tags="user"
- )
- )
- public Ok deleteUser(String username) throws InvalidUsername, IdNotFound, NotAcceptable {
- store.removeUser(username);
- return OK;
- }
-
- @Override
- @RestMethod(
- name=GET,
- path="/user/login",
- summary="Logs user into the system",
- swagger=@MethodSwagger(
- tags="user"
- )
- )
- public Ok login(
- String username,
- String password,
- Value<Integer> rateLimit,
- Value<ExpiresAfter> expiresAfter
- ) throws InvalidLogin, NotAcceptable {
-
- RestRequest req = getRequest();
-
- if (! store.isValid(username, password))
- throw new InvalidLogin();
-
- Date d = new Date(System.currentTimeMillis() + 30 * 60 * 1000);
- req.getSession().setAttribute("login-expires", d);
- rateLimit.set(1000);
- expiresAfter.set(new ExpiresAfter(d));
- return OK;
- }
-
- @Override
- @RestMethod(
- name=GET,
- path="/user/logout",
- summary="Logs out current logged in user session",
- swagger=@MethodSwagger(
- tags="user"
- )
- )
- public Ok logout() throws NotAcceptable {
- getRequest().getSession().removeAttribute("login-expires");
- return OK;
- }
-}
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/RootResources.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/RootResources.java
deleted file mode 100644
index a92d9de..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/RootResources.java
+++ /dev/null
@@ -1,66 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.rest;
-
-import org.apache.juneau.html.annotation.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.rest.widget.*;
-import org.apache.juneau.serializer.annotation.*;
-
-/**
- * Sample REST resource showing how to implement a "router" resource page.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-@RestResource(
- path="/*",
- title="Root resources",
- description="Example of a router resource page.",
- children={
- PetStoreResource.class
- }
-)
-@HtmlDocConfig(
- widgets={
- ContentTypeMenuItem.class,
- ThemeMenuItem.class
- },
- navlinks={
- "options: ?method=OPTIONS",
- "$W{ContentTypeMenuItem}",
- "$W{ThemeMenuItem}",
- "source: $C{Source/gitHub}/org/apache/juneau/petstore/rest/$R{servletClassSimple}.java"
- },
- aside={
- "<div style='max-width:400px' class='text'>",
- " <p>This is an example of a 'router' page that serves as a jumping-off point to child resources.</p>",
- " <p>Resources can be nested arbitrarily deep through router pages.</p>",
- " <p>Note the <span class='link'>options</span> link provided that lets you see the generated swagger doc for this page.</p>",
- " <p>Also note the <span class='link'>sources</span> link on these pages to view the source code for the page.</p>",
- " <p>All content on pages in the UI are serialized POJOs. In this case, it's a serialized array of beans with 2 properties, 'name' and 'description'.</p>",
- " <p>Other features (such as this aside) are added through annotations.</p>",
- "</div>"
- }
-)
-@SerializerConfig(
- // For testing purposes, we want to use single quotes in all the serializers so it's easier to do simple
- // String comparisons.
- // You can apply any of the Serializer/Parser/BeanContext settings this way.
- quoteChar="'"
-)
-public class RootResources extends BasicRestServletGroup {
- private static final long serialVersionUID = 1L;
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/service/AbstractPersistenceService.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/service/AbstractPersistenceService.java
deleted file mode 100644
index 4e2aedf..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/service/AbstractPersistenceService.java
+++ /dev/null
@@ -1,273 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.service;
-
-import java.util.*;
-
-import javax.persistence.*;
-
-import org.apache.juneau.pojotools.*;
-
-/**
- * Superclass for DAOs that use the JPA entity manager.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-public class AbstractPersistenceService {
-
- private final EntityManagerFactory entityManagerFactory;
-
- /**
- * Constructor.
- */
- public AbstractPersistenceService() {
- entityManagerFactory = Persistence.createEntityManagerFactory("test");
- }
-
- /**
- * Retrieves an entity manager session.
- *
- * @return The entity manager session.
- */
- protected EntityManager getEntityManager() {
- return entityManagerFactory.createEntityManager();
- }
-
- /**
- * Retrieves the specified JPA bean from the repository.
- *
- * @param em The entity manager to use to retrieve the bean.
- * @param t The bean type to retrieve.
- * @param id The primary key value.
- * @return The JPA bean, or null if not found.
- */
- protected <T> T find(EntityManager em, Class<T> t, Object id) {
- return em.find(t, id);
- }
-
- /**
- * Same as {@link #find(EntityManager, Class, Object)} but uses a new entity manager.
- *
- * @param t The bean type to retrieve.
- * @param id The primary key value.
- * @return The JPA bean, or null if not found.
- */
- protected <T> T find(Class<T> t, Object id) {
- return find(getEntityManager(), t, id);
- }
-
- /**
- * Store the specified JPA bean in the repository.
- *
- * @param em The entity manager to use to store and merge the bean.
- * @param t The bean to store.
- * @return The merged JPA bean returned by the {@link EntityManager#merge(Object)} method, or null if the bean was null.
- */
- protected <T> T merge(EntityManager em, T t) {
- if (t == null)
- return null;
- try {
- EntityTransaction et = em.getTransaction();
- et.begin();
- t = em.merge(t);
- et.commit();
- return t;
- } finally {
- em.close();
- }
- }
-
- /**
- * Same as {@link #merge(EntityManager, Object)} but uses a new entity manager.
- *
- * @param t The bean to store.
- * @return The merged JPA bean returned by the {@link EntityManager#merge(Object)} method, or null if the bean was null.
- */
- protected <T> T merge(T t) {
- return merge(getEntityManager(), t);
- }
-
- /**
- * Store the specified JPA beans in the repository.
- *
- * All values are persisted in the same transaction.
- *
- * @param em The entity manager to use to store and merge the beans.
- * @param c The collection of beans to store.
- * @return The merged JPA beans returned by the {@link EntityManager#merge(Object)} method.
- */
- protected <T> Collection<T> merge(EntityManager em, Collection<T> c) {
- Collection<T> c2 = new ArrayList<>();
- try {
- EntityTransaction et = em.getTransaction();
- et.begin();
- for (T t : c)
- c2.add(em.merge(t));
- et.commit();
- return c2;
- } finally {
- em.close();
- }
- }
-
- /**
- * Same as {@link #merge(EntityManager, Collection)} but uses a new entity manager.
- *
- * @param c The collection of beans to store.
- * @return The merged JPA beans returned by the {@link EntityManager#merge(Object)} method.
- */
- protected <T> Collection<T> merge(Collection<T> c) {
- return merge(getEntityManager(), c);
- }
-
- /**
- * Remove the specified JPA bean from the repository.
- *
- * @param t The bean type to remove.
- * @param id The primary key value.
- */
- protected <T> void remove(Class<T> t, Object id) {
- EntityManager em = getEntityManager();
- remove(em, find(em, t, id));
- }
-
- /**
- * Remove the specified JPA bean from the repository.
- *
- * @param em The entity manager used to retrieve the bean.
- * @param t The bean to remove. Can be null.
- */
- protected <T> void remove(EntityManager em, T t) {
- if (t == null)
- return;
- try {
- EntityTransaction et = em.getTransaction();
- et.begin();
- em.remove(t);
- et.commit();
- } finally {
- em.close();
- }
- }
-
- /**
- * Runs a JPA query and returns the results.
- *
- * @param <T> The bean type.
- * @param em The entity manager to use to retrieve the beans.
- * @param query The JPA query.
- * @param t The bean type.
- * @param searchArgs Optional search arguments.
- * @return The results.
- */
- protected <T> List<T> query(EntityManager em, String query, Class<T> t, SearchArgs searchArgs, PageArgs pageArgs) {
- TypedQuery<T> q = em.createQuery(query, t);
- if (pageArgs != null) {
- q.setMaxResults(pageArgs.getLimit() == 0 ? 100 : pageArgs.getLimit());
- q.setFirstResult(pageArgs.getPosition());
- }
- return em.createQuery(query, t).getResultList();
- }
-
- /**
- * Same as {@link #query(EntityManager,String,Class,SearchArgs)} but uses a new entity manager.
- *
- * @param <T> The bean type.
- * @param query The JPA query.
- * @param t The bean type.
- * @param searchArgs Optional search arguments.
- * @return The results.
- */
- protected <T> List<T> query(String query, Class<T> t, SearchArgs searchArgs, PageArgs pageArgs) {
- return query(getEntityManager(), query, t, searchArgs, pageArgs);
- }
-
- /**
- * Runs a JPA parameterized query and returns the results.
- *
- * @param em The entity manager to use to retrieve the beans.
- * @param query The JPA query.
- * @param t The bean type.
- * @param params The query parameter values.
- * @return The results.
- */
- protected <T> List<T> query(EntityManager em, String query, Class<T> t, Map<String,Object> params) {
- TypedQuery<T> tq = em.createQuery(query, t);
- for (Map.Entry<String,Object> e : params.entrySet()) {
- tq.setParameter(e.getKey(), e.getValue());
- }
- return tq.getResultList();
- }
-
- /**
- * Same as {@link #query(EntityManager,String,Class,Map)} but uses a new entity manager.
- *
- * @param query The JPA query.
- * @param t The bean type.
- * @param params The query parameter values.
- * @return The results.
- */
- protected <T> List<T> query(String query, Class<T> t, Map<String,Object> params) {
- return query(getEntityManager(), query, t, params);
- }
-
- /**
- * Runs a JPA update statement.
- *
- * @param em The entity manager to use to run the statement.
- * @param query The JPA update statement.
- * @return The number of rows modified.
- */
- protected int update(EntityManager em, String query) {
- return em.createQuery(query).executeUpdate();
- }
-
- /**
- * Same as {@link #update(EntityManager,String)} but uses a new entity manager.
- *
- * @param query The JPA update statement.
- * @return The number of rows modified.
- */
- protected int update(String query) {
- return update(getEntityManager(), query);
- }
-
- /**
- * Runs a JPA parameterized update statement.
- *
- * @param em The entity manager to use to run the statement.
- * @param query The JPA update statement.
- * @param params The query parameter values.
- * @return The number of rows modified.
- */
- protected int update(EntityManager em, String query, Map<String,Object> params) {
- Query q = em.createQuery(query);
- for (Map.Entry<String,Object> e : params.entrySet()) {
- q.setParameter(e.getKey(), e.getValue());
- }
- return q.executeUpdate();
- }
-
- /**
- * Same as {@link #update(EntityManager,String,Map)} but uses a new entity manager.
- *
- * @param query The JPA update statement.
- * @param params The query parameter values.
- * @return The number of rows modified.
- */
- protected int update(String query, Map<String,Object> params) {
- return update(getEntityManager(), query, params);
- }
-}
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/service/PetStoreService.java b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/service/PetStoreService.java
deleted file mode 100644
index ac83c4c..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/service/PetStoreService.java
+++ /dev/null
@@ -1,329 +0,0 @@
-// ***************************************************************************************************************************
-// * 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.apache.juneau.petstore.service;
-
-import static java.text.MessageFormat.*;
-
-import java.io.*;
-import java.util.*;
-
-import javax.persistence.*;
-
-import org.apache.juneau.json.*;
-import org.apache.juneau.parser.*;
-import org.apache.juneau.petstore.dto.*;
-import org.apache.juneau.pojotools.*;
-import org.apache.juneau.pojotools.SearchArgs;
-
-/**
- * Pet store database application.
- * <p>
- * Uses JPA persistence to store and retrieve PetStore DTOs.
- * JPA beans are defined in <c>META-INF/persistence.xml</c>.
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-public class PetStoreService extends AbstractPersistenceService {
-
- //-----------------------------------------------------------------------------------------------------------------
- // Initialization methods.
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * Initialize the petstore database using JPA.
- *
- * @param w Console output.
- * @return This object (for method chaining).
- * @throws ParseException Malformed input encountered.
- * @throws IOException File could not be read from file system.
- */
- public PetStoreService initDirect(PrintWriter w) throws ParseException, IOException {
-
- EntityManager em = getEntityManager();
- EntityTransaction et = em.getTransaction();
- JsonParser parser = JsonParser.create().build();
-
- et.begin();
-
- for (Pet x : em.createQuery("select X from PetstorePet X", Pet.class).getResultList()) {
- em.remove(x);
- w.println(format("Deleted pet: id={0}", x.getId()));
- }
- for (Order x : em.createQuery("select X from PetstoreOrder X", Order.class).getResultList()) {
- em.remove(x);
- w.println(format("Deleted order: id={0}", x.getId()));
- }
- for (User x : em.createQuery("select X from PetstoreUser X", User.class).getResultList()) {
- em.remove(x);
- w.println(format("Deleted user: username={0}", x.getUsername()));
- }
-
- et.commit();
- et.begin();
-
- for (Pet x : parser.parse(getStream("init/Pets.json"), Pet[].class)) {
- x = em.merge(x);
- w.println(format("Created pet: id={0}, name={1}", x.getId(), x.getName()));
- }
- for (Order x : parser.parse(getStream("init/Orders.json"), Order[].class)) {
- x = em.merge(x);
- w.println(format("Created order: id={0}", x.getId()));
- }
- for (User x: parser.parse(getStream("init/Users.json"), User[].class)) {
- x = em.merge(x);
- w.println(format("Created user: username={0}", x.getUsername()));
- }
-
- et.commit();
-
- return this;
- }
-
-
- //-----------------------------------------------------------------------------------------------------------------
- // Service methods.
- //-----------------------------------------------------------------------------------------------------------------
-
- /**
- * Returns the pet with the specified ID.
- *
- * @param id The pet ID.
- * @return The pet with the specified ID. Never <jk>null</jk>.
- * @throws IdNotFound If pet was not found.
- */
- public Pet getPet(long id) throws IdNotFound {
- return find(Pet.class, id);
- }
-
- /**
- * Returns the order with the specified ID.
- *
- * @param id The order ID.
- * @return The order with the specified ID. Never <jk>null</jk>.
- * @throws IdNotFound If order was not found.
- */
- public Order getOrder(long id) throws IdNotFound {
- return find(Order.class, id);
- }
-
- /**
- * Returns the user with the specified username.
- *
- * @param username The username.
- * @return The user with the specified username. Never <jk>null</jk>.
- * @throws InvalidUsername Username was not valid.
- * @throws IdNotFound If order was not found.
- */
- public User getUser(String username) throws InvalidUsername, IdNotFound {
- assertValidUsername(username);
- return find(User.class, username);
- }
-
- /**
- * Returns all pets in the database.
- *
- * @return All pets in the database.
- */
- public List<Pet> getPets() {
- return query("select X from PetstorePet X", Pet.class, (SearchArgs)null, (PageArgs)null);
- }
-
- /**
- * Returns all orders in the database.
- *
- * @return All orders in the database.
- */
- public List<Order> getOrders() {
- return query("select X from PetstoreOrder X", Order.class, (SearchArgs)null, (PageArgs)null);
- }
-
- /**
- * Returns all users in the database.
- *
- * @return All users in the database.
- */
- public List<User> getUsers() {
- return query("select X from PetstoreUser X", User.class, (SearchArgs)null, (PageArgs)null);
- }
-
- /**
- * Creates a new pet in the database.
- *
- * @param c The pet input data.
- * @return a new {@link Pet} object.
- */
- public Pet create(CreatePet c) {
- return merge(new Pet().status(PetStatus.AVAILABLE).apply(c));
- }
-
- /**
- * Creates a new order in the database.
- *
- * @param c The order input data.
- * @return a new {@link Order} object.
- */
- public Order create(CreateOrder c) {
- return merge(new Order().status(OrderStatus.PLACED).apply(c));
- }
-
- /**
- * Creates a new user in the database.
- *
- * @param c The user input data.
- * @return a new {@link User} object.
- */
- public User create(User c) {
- return merge(new User().apply(c));
- }
-
- /**
- * Updates a pet in the database.
- *
- * @param u The update information.
- * @return The updated {@link Pet} object.
- * @throws IdNotFound Pet was not found.
- */
- public Pet update(UpdatePet u) throws IdNotFound {
- EntityManager em = getEntityManager();
- return merge(em, find(em, Pet.class, u.getId()).apply(u));
- }
-
- /**
- * Updates an order in the database.
- *
- * @param o The update information.
- * @return The updated {@link Order} object.
- * @throws IdNotFound Order was not found.
- */
- public Order update(Order o) throws IdNotFound {
- EntityManager em = getEntityManager();
- return merge(em, find(em, Order.class, o.getId()).apply(o));
- }
-
- /**
- * Updates a user in the database.
- *
- * @param u The update information.
- * @return The updated {@link User} object.
- * @throws IdNotFound User was not found.
- * @throws InvalidUsername The username was not valid.
- */
- public User update(User u) throws IdNotFound, InvalidUsername {
- assertValidUsername(u.getUsername());
- EntityManager em = getEntityManager();
- return merge(em, find(em, User.class, u.getUsername()).apply(u));
- }
-
- /**
- * Removes a pet from the database.
- *
- * @param id The pet ID.
- * @throws IdNotFound Pet was not found.
- */
- public void removePet(long id) throws IdNotFound {
- EntityManager em = getEntityManager();
- remove(em, find(em, Pet.class, id));
- }
-
- /**
- * Removes an order from the database.
- *
- * @param id The order ID.
- * @throws IdNotFound Order was not found.
- */
- public void removeOrder(long id) throws IdNotFound {
- EntityManager em = getEntityManager();
- remove(em, find(em, Order.class, id));
- }
-
- /**
- * Removes a user from the database.
- *
- * @param username The username.
- * @throws IdNotFound User was not found.
- */
- public void removeUser(String username) throws IdNotFound {
- EntityManager em = getEntityManager();
- remove(em, find(em, User.class, username));
- }
-
- /**
- * Returns all pets with the specified statuses.
- *
- * @param status Pet statuses.
- * @return Pets with the specified statuses.
- */
- public Collection<Pet> getPetsByStatus(PetStatus[] status) {
- return getEntityManager()
- .createQuery("select X from PetstorePet X where X.status in :status", Pet.class)
- .setParameter("status", status)
- .getResultList();
- }
-
- /**
- * Returns all pets with the specified tags.
- *
- * @param tags Pet tags.
- * @return Pets with the specified tags.
- * @throws InvalidTag Tag name was invalid.
- */
- public Collection<Pet> getPetsByTags(String[] tags) throws InvalidTag {
- return getEntityManager()
- .createQuery("select X from PetstorePet X where X.tags in :tags", Pet.class)
- .setParameter("tags", tags)
- .getResultList();
- }
-
- /**
- * Returns a summary of pet statuses and counts.
- *
- * @return A summary of pet statuses and counts.
- */
- public Map<PetStatus,Integer> getInventory() {
- Map<PetStatus,Integer> m = new LinkedHashMap<>();
- for (Pet p : getPets()) {
- PetStatus ps = p.getStatus();
- if (! m.containsKey(ps))
- m.put(ps, 1);
- else
- m.put(ps, m.get(ps) + 1);
- }
- return m;
- }
-
- /**
- * Returns <jk>true</jk> if the specified username and password is valid.
- *
- * @param username The username.
- * @param password The password.
- * @return <jk>true</jk> if the specified username and password is valid.
- */
- public boolean isValid(String username, String password) {
- return getUser(username).getPassword().equals(password);
- }
-
- //-----------------------------------------------------------------------------------------------------------------
- // Helper methods
- //-----------------------------------------------------------------------------------------------------------------
-
- private void assertValidUsername(String username) throws InvalidUsername {
- if (username == null || ! username.matches("[\\w\\d]{3,8}"))
- throw new InvalidUsername();
- }
-
- private InputStream getStream(String fileName) {
- return getClass().getResourceAsStream(fileName);
- }
-}
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/META-INF/persistence.xml b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index 8db6a41..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-<persistence
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
- version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
- <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
- <class>org.apache.juneau.petstore.dto.Pet</class>
- <class>org.apache.juneau.petstore.dto.Order</class>
- <class>org.apache.juneau.petstore.dto.User</class>
- <properties>
- <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
- <property name="javax.persistence.jdbc.url" value="jdbc:derby:target/derby/testDB;create=true" />
- <property name="javax.persistence.jdbc.user" value="" />
- <property name="javax.persistence.jdbc.password" value="" />
- <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
- <property name="hibernate.hbm2ddl.auto" value="create-drop" />
- <property name="show_sql" value="true" />
- <property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
- </properties>
- </persistence-unit>
-</persistence>
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/application.properties b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/application.properties
deleted file mode 100644
index 768c87b..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/application.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-// ***************************************************************************************************************************
-// * 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. *
-// ****************************************************************************************************************************
-
-logging.level.org.springframework=INFO
-server.port=5000
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/htdocs/background.jpg b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/htdocs/background.jpg
deleted file mode 100644
index d75bcf1..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/htdocs/background.jpg
+++ /dev/null
Binary files differ
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/htdocs/cat.png b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/htdocs/cat.png
deleted file mode 100644
index 917abc6..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/htdocs/cat.png
+++ /dev/null
Binary files differ
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/juneau.cfg b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/juneau.cfg
deleted file mode 100755
index 98e4574..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/juneau.cfg
+++ /dev/null
@@ -1,70 +0,0 @@
-# ***************************************************************************************************************************
-# * 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. *
-# ***************************************************************************************************************************
-
-#=======================================================================================================================
-# REST settings
-#=======================================================================================================================
-[REST]
-
-# Comma-delimited list of key-value pairs that represent locations of static files that can be served up by your @RestResource-annotated
-# classes. These are static files that are served up by the servlet under the specified sub-paths.
-# For example, given the following setting...
-# staticFiles = htdocs:my-docs,styles/my-styles
-# ...the URI "/servletPath/htdocs/javadoc.css" resolves to the path "/my-docs/javadoc.css".
-# This path can be relative to the working directory, classpath root, or package of your resource class.
-# Used by the BasicRestConfig interface that defines the following value:
-# staticFiles="$C{REST/staticFiles}"
-staticFiles = htdocs:htdocs
-
-# Stylesheet to use for HTML views.
-# Used by the BasicRestConfig interface that defines the following value:
-# stylesheet="$C{REST/theme,servlet:/htdocs/themes/devops.css}"
-theme = servlet:/htdocs/themes/devops.css
-
-# Various look-and-feel settings used in the BasicRestConfig interface.
-headerIcon = servlet:/htdocs/images/juneau.png
-headerLink = http://juneau.apache.org
-footerIcon = servlet:/htdocs/images/asf.png
-footerLink = http://www.apache.org
-favicon = $C{REST/headerIcon}
-head = <link rel='icon' href='$U{$C{REST/favicon}}'/>
-header =
- <a href='$U{$C{REST/headerLink}}'>
- <img src='$U{$C{REST/headerIcon}}' style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/>
- </a>
-footer =
- <a href='$U{$C{REST/footerLink}}'>
- <img style='float:right;padding-right:20px;height:32px' src='$U{$C{REST/footerIcon}}'>
- </a>
-
-#=======================================================================================================================
-# SqlQueryResource properties
-#=======================================================================================================================
-[SqlQueryResource]
-driver = org.apache.derby.jdbc.EmbeddedDriver
-directory = target/derby/testDB
-connectionUrl = jdbc:derby:$C{SqlQueryResource/directory};create=true
-allowTempUpdates = true
-includeRowNums = false
-
-#=======================================================================================================================
-# Source code location
-#=======================================================================================================================
-[Source]
-gitHub = https://github.com/apache/juneau/blob/master/juneau-examples/juneau-examples-rest/src/main/java
-
-#=======================================================================================================================
-# PetStoreResource properties
-#=======================================================================================================================
-[PetStore]
-headerImage = <a href='http://swagger.io'><img src='$U{servlet:/htdocs/cat.png}' style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/></a>
diff --git a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/log4j.xml b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/log4j.xml
deleted file mode 100644
index 18b0d7c..0000000
--- a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/resources/log4j.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
- <appender name="console" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
- </layout>
- </appender>
-
- <root>
- <priority value="INFO"/>
- <appender-ref ref="console"/>
- </root>
-
-</log4j:configuration>
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-petstore/pom.xml b/juneau-examples/juneau-examples-petstore/pom.xml
deleted file mode 100644
index 363686e..0000000
--- a/juneau-examples/juneau-examples-petstore/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-examples</artifactId>
- <version>8.1.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>juneau-examples-petstore</artifactId>
- <packaging>pom</packaging>
- <name>Apache Juneau Petstore Example</name>
- <description>Apache Juneau Petstore Example</description>
-
- <modules>
- <module>juneau-examples-petstore-api</module>
- <module>juneau-examples-petstore-server</module>
- <module>juneau-examples-petstore-client</module>
- </modules>
-
-</project>