For given groupId, artifactId, version, classifier and type, how can I download the corresponding artifact using REST?
use the gavc search to get the URL and from there you can download the artefact:
GAVC Search
Description: Search by Maven coordinates: GroupId, ArtifactId, Version
& Classifier. Search must contain at least one argument. Can limit
search to specific repositories (local and remote-cache). Since: 2.2.0
Security: Requires a privileged user (can be anonymous) Usage: GET
/api/search/gavc?[g=groupId][&a=artifactId][&v=version][&c=classifier][&repos=x[,y]]
Headers (Optionally): X-Result-Detail: info (To add all extra
information of the found artifact), X-Result-Detail: properties (to
get the properties of the found artifact), X-Result-Detail: info,
properties (for both). Produces:
application/vnd.org.jfrog.artifactory.search.GavcSearchResult+json
Sample Output:
GET /api/search/gavc?g=org.acme&a=artifact&v=1.0&c=sources&repos=libs-release-local
{
"results": [
{
"uri": "http://localhost:8080/artifactory/api/storage/libs-release-local/org/acme/artifact/1.0/artifact-1.0-sources.jar"
},{
"uri": "http://localhost:8080/artifactory/api/storage/libs-release-local/org/acme/artifactB/1.0/artifactB-1.0-sources.jar"
}
]
}
Taken from the API-Documenation.
In the Artifactory docs about their REST service you have an example here: https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RetrieveArtifact
Related
We are using ElasticsearchClient instance to build our query and communicate with elasticsearch hosted on elastic-cloud version 8.5.3.
We could not find any information on how to inject nested path while creating GeoDistanceSort object.
Sort query that we are trying to build using Java:
"sort":[
{
"_geo_distance":{
"nested":{
"path":"facility"
},
"facility.location":{
"lat":25.240995,
"lon":55.751156
},
"unit":"km",
"order":"asc",
"mode" : "min",
"distance_type" : "arc",
"ignore_unmapped": true
}
}
]
Maven dependency:
<dependency>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<version>8.5.3</version>
</dependency>
We have referred to the following official elastic documentation for JavaClient 8.5.3:
https://artifacts.elastic.co/javadoc/co/elastic/clients/elasticsearch-java/8.5.3/co/elastic/clients/elasticsearch/_types/SortOptions.html
https://artifacts.elastic.co/javadoc/co/elastic/clients/elasticsearch-java/8.5.3/co/elastic/clients/elasticsearch/_types/GeoDistanceSort.html
https://artifacts.elastic.co/javadoc/co/elastic/clients/elasticsearch-java/8.5.3/co/elastic/clients/elasticsearch/_types/GeoDistanceSort.Builder.html
I am building my own ROM and want to use a aar file Library in one system service.
Is there any way this could be achieved?
If you are using Android.bp this can be done via android_library_import module type (link to soong spec).
Also, if you try to grep the AOSP source tree, you will easily find many examples of its use, for example: packages/apps/Settings/Android.bp:
android_library_import {
name: "contextualcards",
aars: ["libs/contextualcards.aar"],
}
android_library {
name: "Settings-core",
....
srcs: ["src/**/*.java"],
static_libs: [
...
"contextualcards",
...
}
I am using cloudformation to deploy my code. In my yml file I ahve this DependsOn attribute for which I am trying to add value as "AppApiv1Stage". I have tried multiple things, everytime it gives different errors not sure what I am doing wrong. In the below code snippet first I added it in double quotes like this:"AppApiv1Stage" then it showed error. Again I tried with below code, then it showed me error as "DependsOn must be a string or list of strings"
Parameters:
ApiStageSecondDeploymentName:
Description: API Stage name to use
Type: String
Default: v1
Resources:
AppAPI:
Type: AWS::Serverless::Api
DependsOn: AuthFunction
Properties:
Name: !Sub ${AWS::StackName}
StageName: !Ref ApiStageSecondDeploymentName
Variables:
LocalTLD: local # Deploys a Dev stage to use for tests and development
MethodSettings:
- LoggingLevel: ERROR
MetricsEnabled: True
DataTraceEnabled: True
HttpMethod: '*'
ResourcePath: '/*'
ThrottlingBurstLimit: !Ref ApiBurstLimit
ThrottlingRateLimit: !Ref ApiRateLimit
ApiMapping:
DependsOn: !Sub AppAPI !Ref ${ApiStageSecondDeploymentName}Stage
Type: AWS::ApiGateway::BasePathMapping
Properties:
BasePath: !Ref ApiStageSecondDeploymentName
DomainName:
Fn::ImportValue: !Sub ${CustomDomainStack}-DNSName
RestApiId: !Ref AppAPI
I also tried with Join! but showing error again.
not sure what I am doing wrong
DependsOn, as the error says, must be a string, or list of strings. Not an intrinsic function (Sub, Ref).
What's more, intrinsic functions can be only used in few places in a template, none of which is DependsOn. From docs:
You can use intrinsic functions only in specific parts of a template. Currently, you can use intrinsic functions in resource properties, outputs, metadata attributes, and update policy attributes. You can also use intrinsic functions to conditionally create stack resources.
I have configured Apache Solr 6.6.2 to index and search documents later. I am facing some problems. If there is a number in document like 1234, I want it should be mapped (copied) to corresponding Urdu numerics like ۱۲۳۴. It will ultimately help to retrieve document if either user enter 1234 or ۱۲۳۴.
Is there any built in solution in Solr or how I can come into this functionality?
If you are using Java/SolrJ client for indexing ...
Add junidecode dependency to your project
for gradle
compile group: 'junidecode', name: 'junidecode', version: '0.1.1'
for maven:
<dependency>
<groupId>junidecode</groupId>
<artifactId>junidecode</artifactId>
<version>0.1.1</version>
</dependency>
while indexing ... index an additional field ...
import net.sf.junidecode.Junidecode;
String converted = Junidecode.unidecode("۱۲۳۴")
// converted == 1234
Is there a Java library similar to libconfig for C++, where the config file is stored in a JSON-like format that can be edited by humans, and later read from the program?
I don't want to use Spring or any of the larger frameworks. What I'm looking for is a small, fast, self-contained library. I looked at java.util.Properties, but it doesn't seem to support hierarchical/nested config data.
I think https://github.com/typesafehub/config is exactly what you are looking for. The format is called HOCON for Human-Optimized Config Object Notation and it a super-set of JSON.
Examples of HOCON:
HOCON that is also valid JSON:
{
"foo" : {
"bar" : 10,
"baz" : 12
}
}
HOCON also supports standard properties format, so the following is valid as well:
foo.bar=10
foo.baz=12
One of the features I find very useful is inheritance, this allows you to layer configurations. For instance a library would have a reference.conf, and the application using the library would have an application.conf. The settings in the application.conf will override the defaults in reference.conf.
Standard Behavior for loading configs:
The convenience method ConfigFactory.load() loads the following
(first-listed are higher priority):
system properties application.conf (all resources on classpath with
this name)
application.json (all resources on classpath with this
name)
application.properties (all resources on classpath with this
name)
reference.conf (all resources on classpath with this name)
I found this HOCON example:
my.organization {
project {
name = "DeathStar"
description = ${my.organization.project.name} "is a tool to take control over whole world. By world I mean couch, computer and fridge ;)"
}
team {
members = [
"Aneta"
"Kamil"
"Lukasz"
"Marcin"
]
}
}
my.organization.team.avgAge = 26
to read values:
val config = ConfigFactory.load()
config.getString("my.organization.project.name") // => DeathStar
config.getString("my.organization.project.description") // => DeathStar is a tool to take control over whole world. By world I mean couch, computer and fridge ;)
config.getInt("my.organization.team.avgAge") // => 26
config.getStringList("my.organization.team.members") // => [Aneta, Kamil, Lukasz, Marcin]
Reference: marcinkubala.wordpress.com
Apache Commons Configuration API and Constretto seem to be somewhat popular and support multiple formats (no JSON mentioned, though). I've personally never tried either, so YMMV.
There's a Java library to handle JSON files if that's what you're looking for:
http://www.json.org/java/index.html
Check out other tools on the main page:
http://json.org/