Pattern Library Management
Pattern Library Management
The Pattern Library Management screen shows all the pattern libraries that are available in your nevisAdmin 4 installation.
You can access the Pattern Library Management screen by clicking on the Pattern Libraries option from the navigation menu of the Resources tab.
The Pattern Library Management screen includes the following elements:
- A list of all libraries available in your nevisAdmin 4 installation, with their version numbers. (section A in next figure)
- Libraries are sorted by their version number.
- Pattern libraries are grouped by their name and displayed in collapsed groups. (no. 3 in figure)
- A button to upload libraries. (no. 1 in figure)
- An icon to download libraries. (no. 2 in figure)
Uploading Libraries
Normally, uploading libraries manually is not necessary, because the Nevis standard pattern libraries are included when you install and upgrade nevisAdmin 4.
In some cases, Nevis Support may request you to install an older or newer version of the standard libraries. This is explained in this section.
You can upload new libraries to nevisAdmin 4 as follows:
- Click on the Upload new libraries button. It is possible to upload one or multiple libraries at the same time.
- Select the libraries you want to upload for your project. See Editing Project Pattern Libraries for details.
The libraries are stored in the nevisAdmin 4 database and kept until they are explicitly deleted.
The Upload new libraries button is only active for users with the SUPER_ADMIN permission.
It is not possible to assign the SUPER_ADMIN permission in the nevisAdmin 4 GUI. The only way to do this is via REST. For more information on assigning global permissions, see Managing Users and Groups via REST.
The following movie shows how to do the upload:
Downloading Libraries
To download a pattern library, click on the download icon next to the relevant library. See the next figure:
This action is also available to users without the SUPER_ADMIN permission.
Advanced Topics
Uploading a Library via REST
Specify the variables in the following commands before executing the commands. Set LIBRARY to the file in the current working directory that you want to upload.
Preparation: Login to get authentication token
export NEVISADMIN_URL=http://localhost:9080
export ADMIN_USER=admin
export ADMIN_PASSWORD=admin
# for https, you can add the -k flag to all curl commands to skip certificate verification
export AUTH_RESPONSE=$(curl -v -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d "{\"userKey\":\"${ADMIN_USER}\",\"password\":\"${ADMIN_PASSWORD}\"}" "$NEVISADMIN_URL/nevisadmin/api/v1/login?tokenType=bearer")
export TOKEN=$(echo $AUTH_RESPONSE | sed -nE 's/.*"token" : "(.*)" }/\1/p')
Upload pattern library
LIBRARY=nevisadmin-plugin-nevisauth-4.4.0.91.jar
curl -H "Authorization: Bearer $TOKEN" -F "bundle=@$LIBRARY;type=application/java-archive" $NEVISADMIN_URL/nevisadmin/api/v1/bundles
Deleting Libraries via REST
By default, pattern libraries are kept forever, even if no current project is using them anymore. This can be useful if, for example, you [roll back] to an older version of a project.
In case you want to clean up old pattern libraries, you can do so via the REST API.
A configuration project will report errors if it is still referencing a deleted library. Select one of the available libraries in the project to fix the errors, or upload the missing library again. For more information, see Editing Project Pattern Libraries.
- Prepare the authentication token:
Preparation: Login to get authentication token
export NEVISADMIN_URL=http://localhost:9080
export ADMIN_USER=admin
export ADMIN_PASSWORD=admin
# for https, you can add the -k flag to all curl commands to skip certificate verification
export AUTH_RESPONSE=$(curl -v -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d "{\"userKey\":\"${ADMIN_USER}\",\"password\":\"${ADMIN_PASSWORD}\"}" "$NEVISADMIN_URL/nevisadmin/api/v1/login?tokenType=bearer")
export TOKEN=$(echo $AUTH_RESPONSE | sed -nE 's/.*"token" : "(.*)" }/\1/p')
- Create the file delete-libraries.txt, with the pattern libraries to be deleted:
delete-libraries.txt
nevisadmin-plugin-base-generation:4.5.0.64
nevisadmin-plugin-mobile-auth:4.5.0.64
nevisadmin-plugin-nevisidm:4.5.0.64
nevisadmin-plugin-nevisauth:4.5.0.64
nevisadmin-plugin-monitoring:4.5.0.64
nevisadmin-plugin-nevisproxy:4.5.0.64
If you want to see all libraries in the system, run the following command:
curl --insecure -s $NEVISADMIN_URL/nevisadmin/api/v1/bundles -H "Authorization: Bearer $TOKEN" | sed 's/ "/\n/g' | sed 's/".*$//' | grep nevisadmin-plugin
- Delete the libraries specified in the file:
cat delete-libraries.txt | while read bundleKey
do
curl --insecure -X DELETE $NEVISADMIN_URL/nevisadmin/api/v1/bundles/$bundleKey -H "Authorization: Bearer $TOKEN" -H "accept: application/json"
done