All Downloads are FREE. Search and download functionalities are using the official Maven repository.

archetype-resources.quickstart-template.json Maven / Gradle / Ivy

Go to download

Creates a new CXF JAX-RS using CDI running in a standalone Java Container

There is a newer version: 2.2.197
Show newest version
#set( $H = '##' )
#set( $D = '$' )
{
  "apiVersion": "v1",
  "kind": "Template",
  "labels": {},
  "metadata": {
    "annotations": {
      "description": "# CDI CXF QuickStart\n\nThis quick start demonstrates how to create a RESTful (JAX-RS) web service using Apache CXF and expose it using CDI running in a Java standalone container.\n\nThe REST service provides a customer service that supports the following operations\n \n- PUT /customerservice/customers/ - to create or update a customer\n- GET /customerservice/customers/{id} - to view a customer with the given id\n- DELETE /customerservice/customers/{id} - to delete a customer with the given id\n- GET /customerservice/orders/{orderId} - to view an order with the given id\n- GET /customerservice/orders/{orderId}/products/{productId} - to view a specific product on an order with the given id\n\nWhen the application is deployed, you can access the REST service using a web browser.\n\n\n${H}# Building\n\nThe example can be built with\n\n    mvn clean install\n\n\n${H}# Running the example locally\n\nThe example can be run locally using the following Maven goal:\n\n    mvn clean install exec:java\n\n\n${H}# Running the example in fabric8\n\nIt is assumed a running Kubernetes platform is already running. If not you can find details how to [get started](http://fabric8.io/guide/getStarted/index.html).\n\nThe example can be built and deployed using a single goal:\n\n    mvn -Pf8-local-deploy\n\nWhen the example runs in fabric8, you can use the OpenShift client tool to inspect the status\n\nTo list all the running pods:\n\n    oc get pods\n\nThen find the name of the pod that runs this quickstart, and output the logs from the running pods with:\n\n    oc logs \n\nYou can also use the fabric8 [web console](http://fabric8.io/guide/console.html) to manage the\nrunning pods, and view logs and much more.\n\n\n${H}# Access services using a web browser\n\nYou can use any browser to perform a HTTP GET.  This allows you to very easily test a few of the RESTful services we defined:\n\nNotice: As it depends on your OpenShift setup, the hostname (route) might vary. Verify with `oc get routes` which \nhostname is valid for you\n\nUse this URL to display the root of the REST service, which also allows to access the WADL of the service:\n\n    http://quickstart-java-cxf-cdi.vagrant.f8/cxfcdi\n\nUse this URL to display the XML representation for customer 123:\n\n    http://quickstart-java-cxf-cdi.vagrant.f8/cxfcdi/customerservice/customers/123\n\nYou can also access the XML representation for order 223 ...\n\n    http://quickstart-java-cxf-cdi.vagrant.f8/rest/cxf/customerservice/customers/123\n\n**Note:** if you use Safari, you will only see the text elements but not the XML tags - you can view the entire document with 'View Source'\n\n\n${H}# To run a command-line utility:\n\nYou can use a command-line utility, such as cURL or wget, to perform the HTTP requests.  We have provided a few files with sample XML representations in `src/test/resources`, so we will use those for testing our services.\n\n1. Open a command prompt and change directory to `cxf-cdi`.\n2. Run the following curl commands (curl commands may not be available on all platforms):\n    \n    * Create a customer\n \n            curl -X POST -T src/test/resources/add_customer.xml -H \"Content-Type: text/xml\" http://quickstart-java-cxf-cdi.vagrant.f8/cxfcdi/customerservice/customers\n  \n    * Retrieve the customer instance with id 123\n    \n            curl http://localhost:8080/cxfcdi/cxfcdi/customerservice/customers/123\n\n    * Update the customer instance with id 123\n  \n            curl -X PUT -T src/test/resources/update_customer.xml -H \"Content-Type: text/xml\" http://quickstart-java-cxf-cdi.vagrant.f8/cxfcdi/customerservice/customers\n\n    * Delete the customer instance with id 123\n  \n             curl -X DELETE http://quickstart-java-cxf-cdi.vagrant.f8/cxfcdi/customerservice/customers/123\n\n\n${H}# More details\n\nYou can find more details about running this [quickstart](http://fabric8.io/guide/quickstarts/running.html) on the website. This also includes instructions how to change the Docker image user and registry.\n\n",
      "iconClass": "icon-java"
    },
    "labels": {},
    "name": "s2i-quickstart-cdi-cxf"
  },
  "parameters": [
    {
      "name": "APP_NAME",
      "value": "s2i-quickstart-cdi-cxf",
      "description": "Application Name"
    },
    {
      "name": "GIT_REPO",
      "required": true,
      "description": "Git repository, required"
    },
    {
      "name": "GIT_REF",
      "value": "master",
      "description": "Git ref to build"
    },
    {
      "name": "SERVICE_NAME",
      "value": "s2i-qs-cdi-cxf",
      "description": "Exposed Service name"
    },
    {
      "name": "BUILDER_VERSION",
      "value": "1.2.5",
      "description": "Builder version"
    },
    {
      "name": "APP_VERSION",
      "value": "2.2.64-SNAPSHOT",
      "description": "Application version"
    },
    {
      "name": "MAVEN_ARGS",
      "value": "package -DskipTests -e",
      "description": "Arguments passed to mvn in the build"
    },
    {
      "name": "MAVEN_ARGS_APPEND",
      "description": "Extra arguments passed to mvn, e.g. for multi-module builds"
    },
    {
      "name": "ARTIFACT_DIR",
      "description": "Maven build directory"
    },
    {
      "generate": "expression",
      "name": "BUILD_SECRET",
      "description": "The secret needed to trigger a build",
      "from": "[a-zA-Z0-9]{8}"
    }
  ],
  "objects": [
    {
      "apiVersion": "v1",
      "kind": "Route",
      "metadata": {
        "labels": {
          "container": "java",
          "component": "${D}{APP_NAME}",
          "provider": "s2i",
          "project": "${D}{APP_NAME}",
          "version": "${D}{APP_VERSION}",
          "group": "quickstarts"
        },
        "name": "${D}{SERVICE_NAME}-route"
      },
      "spec": {
        "to": {
          "kind": "Service",
          "name": "${D}{SERVICE_NAME}"
        }
      }
    },
    {
      "apiVersion": "v1",
      "kind": "Service",
      "metadata": {
        "annotations": {
          "apiman.io/descriptionpath": "cxfcdi/swagger.json",
          "apiman.io/servicepath": "cxfcdi",
          "prometheus.io/port": "9779",
          "apiman.io/servicetype": "REST",
          "prometheus.io/scrape": "true",
          "apiman.io/descriptiontype": "SwaggerJSON"
        },
        "labels": {
          "component": "${D}{APP_NAME}",
          "container": "java",
          "group": "quickstarts",
          "project": "${D}{APP_NAME}",
          "provider": "s2i",
          "version": "${D}{APP_VERSION}"
        },
        "name": "${D}{SERVICE_NAME}"
      },
      "spec": {
        "deprecatedPublicIPs": [],
        "ports": [
          {
            "port": 80,
            "protocol": "TCP",
            "targetPort": 9092
          }
        ],
        "selector": {
          "component": "${D}{APP_NAME}",
          "container": "java",
          "group": "quickstarts",
          "project": "${D}{APP_NAME}",
          "provider": "s2i",
          "version": "${D}{APP_VERSION}"
        }
      }
    },
    {
      "kind": "ImageStream",
      "apiVersion": "v1",
      "metadata": {
        "name": "s2i-java-${D}{APP_NAME}",
        "creationTimestamp": null,
        "labels": {
          "component": "${D}{APP_NAME}",
          "container": "java",
          "group": "quickstarts",
          "project": "${D}{APP_NAME}",
          "provider": "s2i",
          "version": "${D}{APP_VERSION}"
        }
      },
      "spec": {
        "dockerImageRepository": "fabric8/s2i-java:${D}{BUILDER_VERSION}"
      },
      "status": {
        "dockerImageRepository": ""
      }
    },
    {
      "kind": "ImageStream",
      "apiVersion": "v1",
      "metadata": {
        "name": "${D}{APP_NAME}",
        "creationTimestamp": null,
        "labels": {
          "component": "${D}{APP_NAME}",
          "container": "java",
          "group": "quickstarts",
          "project": "${D}{APP_NAME}",
          "provider": "s2i",
          "version": "${D}{APP_VERSION}"
        }
      },
      "spec": {},
      "status": {
        "dockerImageRepository": ""
      }
    },
    {
      "kind": "BuildConfig",
      "apiVersion": "v1",
      "metadata": {
        "name": "${D}{APP_NAME}",
        "creationTimestamp": null,
        "labels": {
          "component": "${D}{APP_NAME}",
          "container": "java",
          "group": "quickstarts",
          "project": "${D}{APP_NAME}",
          "provider": "s2i",
          "version": "${D}{APP_VERSION}"
        }
      },
      "spec": {
        "triggers": [
          {
            "type": "GitHub",
            "github": {
              "secret": "${D}{BUILD_SECRET}"
            }
          },
          {
            "type": "Generic",
            "generic": {
              "secret": "${D}{BUILD_SECRET}"
            }
          },
          {
            "type": "ConfigChange"
          },
          {
            "type": "ImageChange",
            "imageChange": {}
          }
        ],
        "source": {
          "type": "Git",
          "git": {
            "uri": "${D}{GIT_REPO}",
            "ref": "${D}{GIT_REF}"
          }
        },
        "strategy": {
          "type": "Source",
          "sourceStrategy": {
            "from": {
              "kind": "ImageStreamTag",
              "name": "s2i-java-${D}{APP_NAME}:${D}{BUILDER_VERSION}"
            },
            "forcePull": true,
            "env": [
              {
                "name": "BUILD_LOGLEVEL",
                "value": "5"
              },
              {
                "name": "ARTIFACT_DIR",
                "value": "${D}{ARTIFACT_DIR}"
              },
              {
                "name": "MAVEN_ARGS",
                "value": "${D}{MAVEN_ARGS}"
              },
              {
                "name": "MAVEN_ARGS_APPEND",
                "value": "${D}{MAVEN_ARGS_APPEND}"
              }
            ]
          }
        },
        "output": {
          "to": {
            "kind": "ImageStreamTag",
            "name": "${D}{APP_NAME}:latest"
          }
        },
        "resources": {}
      },
      "status": {
        "lastVersion": 0
      }
    },
    {
      "kind": "DeploymentConfig",
      "apiVersion": "v1",
      "metadata": {
        "name": "${D}{APP_NAME}",
        "creationTimestamp": null,
        "labels": {
          "component": "${D}{APP_NAME}",
          "container": "java",
          "group": "quickstarts",
          "project": "${D}{APP_NAME}",
          "provider": "s2i",
          "version": "${D}{APP_VERSION}"
        }
      },
      "spec": {
        "strategy": {
          "resources": {}
        },
        "triggers": [
          {
            "type": "ConfigChange"
          },
          {
            "type": "ImageChange",
            "imageChangeParams": {
              "automatic": true,
              "containerNames": [
                "${D}{APP_NAME}"
              ],
              "from": {
                "kind": "ImageStreamTag",
                "name": "${D}{APP_NAME}:latest"
              }
            }
          }
        ],
        "replicas": 1,
        "selector": {
          "component": "${D}{APP_NAME}",
          "container": "java",
          "deploymentconfig": "${D}{APP_NAME}",
          "group": "quickstarts",
          "project": "${D}{APP_NAME}",
          "provider": "s2i",
          "version": "${D}{APP_VERSION}"
        },
        "template": {
          "metadata": {
            "creationTimestamp": null,
            "labels": {
              "component": "${D}{APP_NAME}",
              "container": "java",
              "deploymentconfig": "${D}{APP_NAME}",
              "group": "quickstarts",
              "project": "${D}{APP_NAME}",
              "provider": "s2i",
              "version": "${D}{APP_VERSION}"
            }
          },
          "spec": {
            "containers": [
              {
                "name": "${D}{APP_NAME}",
                "image": "library/${D}{APP_NAME}:latest",
                "readinessProbe": {
                  "exec": {
                    "command": [
                      "/bin/bash",
                      "-c",
                      "(curl -f 127.0.0.1:9092) >/dev/null 2>&1; test $? != 7"
                    ]
                  },
                  "initialDelaySeconds": 30,
                  "timeoutSeconds": 5
                },
                "ports": [
                  {
                    "containerPort": 9092,
                    "name": "http"
                  },
                  {
                    "containerPort": 9779,
                    "name": "metrics"
                  },
                  {
                    "containerPort": 8778,
                    "name": "jolokia"
                  }
                ],
                "resources": {}
              }
            ]
          }
        }
      },
      "status": {}
    }
  ]
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy