aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraishkashyap <as00476394@techmahindra.com>2018-01-15 13:55:18 +0530
committeraishkashyap <as00476394@techmahindra.com>2018-01-15 13:55:31 +0530
commit808cf997318c94f5f3268049a8b80f395141eb3e (patch)
treede7417047ca501ac96ab012c54fee045b17fb678
parent78c96d11932a849a1702ab134391918a723f01ef (diff)
Sonar Minor:Define a constant instead of literal.
Define a constant instead of duplicating this literal depth. Sonar Link: https://sonar.onap.org/component_issues/index?id=org.onap.aai.traversal%3Atraversal#resolved=false|assignees=aishkashyap Location: src/main/java/org/onap/aai/rest/QueryConsumer.java Line No:186 Issue-ID: AAI-656 Change-Id: I92e4753aa501d939bd1b85732fcadeaebfbdef16 Signed-off-by: aishkashyap <as00476394@techmahindra.com>
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java b/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java
index b5f2658..9e7edeb 100644
--- a/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java
+++ b/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java
@@ -70,6 +70,8 @@ import com.google.gson.JsonParser;
@Path("{version: v9|v1[012]}/query")
public class QueryConsumer extends RESTAPI {
+
+ private static final String DEPTH = "depth";
/** The introspector factory type. */
private ModelType introspectorFactoryType = ModelType.MOXY;
@@ -183,8 +185,8 @@ public class QueryConsumer extends RESTAPI {
public void checkQueryParams(MultivaluedMap<String, String> params) throws AAIException {
- if (params.containsKey("depth") && params.getFirst("depth").matches("\\d+")) {
- String depth = params.getFirst("depth");
+ if (params.containsKey(DEPTH) && params.getFirst(DEPTH).matches("\\d+")) {
+ String depth = params.getFirst(DEPTH);
Integer i = Integer.parseInt(depth);
if (i > 1) {
throw new AAIException("AAI_3303");
l { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
# Developing a ODLUX application

## Introduction

ODLUX bundle contains the Browser based Grapical User Interface for SDN-R.
ODLUX is available as OSGi bundle that is running in Opendaylight Karaf environment, using the configured jetty server of Opendaylight.
Since ONAP Frankfurt a second WEB Server setup "sdncweb" is available, that extracts the JavaScrip files.

## Prerequisites

Actual version in framework pom.xml in the frontend-maven-plugin definition.
  * Node
  * Yarn
  * Lerna

You can install these globally or let it be installed by maven due "mvn clean install"

* Maven: 3 or higher
* Java: 8

## Dev-Environment Installation

 * install NodeJS LTS https://nodejs.org/en/ or via packetmanager
 * sudo npm install -g yarn
 * sudo yarn global add lerna
 * get framework from repository: git clone https://gerrit.onap.org/r/ccsdk/features
 * in features/sdnr/wt/odlux you find a structure like this:
 ```
  odlux
  |-apps
  |-core
  |-framework

 ```
 * go to features/sdnr/wt/odlux/apps and create your app:
 ```
 mvn archetype:generate -DarchetypeGroupId=org.onap.ccsdk.features.sdnr.wt \
  -DarchetypeArtifactId=odlux-app-archetype \
  -DgroupId=<groupId> \
  -DartifactId=<artifactId> \
  -Dversion=<version> \
  -DappName=<applicationName>
 ```

 * your start folder for your web application is src/
 * in src2/main/java are located the Java files and in src2/main/resources/ is the blueprint located
 * with ```yarn start``` you can run your application due runtime in your application folder
 * by default this will run on http://localhost:3100/index.html
 * if you have added new dependencies you have to run ```lerna bootstrap``` in odlux/
 * build your app for development version you can use ```yarn run build``` or ```yarn run build:dev```
 * build for karaf with ```mvn clean install```


## Including app into karaf environment

 * copy maven repository files to karaf repository e.g.: ```cp ~/.m2/repository/path/of/groupId/artifactId $KARAF_HOME/system/path/of/groupId/```
 * check if odlux-core is started in karaf console: ```feature:list | grep odlux```
 * if not install: ```sdnr-wt-odlux-core-feature```
 * start your app in karaf console: ```bundle:install -s mvn:<groupId>/<artifactId>/<version>```

## Including into ONAP sdnc docker container

 * add maven module to odlux/pom.xml
 * add dependency to odlux/apps/app-feature/pom.xml and odlux/apps/app-installer/pom.xml
 * build odlux/pom.xml
 * this will automatically package your app into the packaged zip file of the installer

## Details

### Default menu positions

 * from 0 for top to 999 for bottom.

```
0    Connect
10    Fault
20    Maintenance
30    Configuration
40    Protection
50    Performance
60    Security
70    Inventory
80    Topology
90    Mediator
100    Help
```

### blueprint.xml

```
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
    <reference id="loadersvc" availability="mandatory" activation="eager" interface="org.onap.ccsdk.features.sdnr.wt.odlux.model.bundles.OdluxBundleLoader"/>
    <bean id="bundle" init-method="initialize" destroy-method="clean" class="org.onap.ccsdk.features.sdnr.wt.odlux.bundles.MyOdluxBundle">
        <property name="loader" ref="loadersvc"/>
        <property name="bundleName" value="demoApp"/>
        <property name="index" value="999"/>
    </bean>
</blueprint>
```
 * bundleName defines the applicationName => default javascript file: <applicationName>.js
 * index defines the menu position.

### MyOdluxBundle.java

 * is just for getting access to the resources of its bundle (implemented because of OSGi access restrictions)

### pom.xml

 * The pom.xml in the framework subdirectory is the reference for ODLUX creation. [framework pom](framework/pom.xml)
 * The node and yarn versions are specified
 * A specific variant of "frontend-maven-plugin" is used to create the environment to compile to javascript. This modified frontend-maven-plugin installs node, yarn and (optionally lerna) to compile the typescript sources to javascript. These will be build into the dist folder.