org.axway.grapes.server.webapp.resources
Class ArtifactResource

java.lang.Object
  extended by com.yammer.dropwizard.views.View
      extended by org.axway.grapes.server.webapp.resources.AbstractResource
          extended by org.axway.grapes.server.webapp.resources.ArtifactResource

public class ArtifactResource
extends AbstractResource

Artifact Resource

This server resource handles all the request about artifacts.
This resource extends DepManViews to holds its own documentation. The documentation is available in ArtifactResourceDocumentation.ftl file.

Author:
jdcoffre

Constructor Summary
ArtifactResource(RepositoryHandler repoHandler, GrapesServerConfig dmConfig)
           
 
Method Summary
 javax.ws.rs.core.Response addLicense(DbCredential credential, String gavc, String licenseId)
          Add a license to an artifact
 javax.ws.rs.core.Response delete(DbCredential credential, String gavc)
          Delete an Artifact regarding its gavc.
 javax.ws.rs.core.Response deleteLicense(DbCredential credential, String gavc, String licenseId)
          Removes a license from an artifact
 javax.ws.rs.core.Response get(String gavc)
          Return an Artifact regarding its gavc.
 javax.ws.rs.core.Response getAll(javax.ws.rs.core.UriInfo uriInfo)
          Return all the artifacts that matches the filters.
 javax.ws.rs.core.Response getAncestors(String gavc, javax.ws.rs.core.UriInfo uriInfo)
          Return the list of ancestor of an artifact.
 javax.ws.rs.core.Response getDoNotUse(String gavc)
          Return true if the targeted artifact is flagged with "DO_NOT_USE".
 javax.ws.rs.core.Response getGavcs(javax.ws.rs.core.UriInfo uriInfo)
          Return a list of gavc, stored in Grapes, regarding the filters passed in the query parameters.
 javax.ws.rs.core.Response getGroupIds(javax.ws.rs.core.UriInfo uriInfo)
          Return a list of groupIds, stored in Grapes.
 javax.ws.rs.core.Response getLastVersion(String gavc)
          Returns the list of available versions of an artifact This method is call via GET /artifact//versions
 javax.ws.rs.core.Response getLicenses(String gavc, javax.ws.rs.core.UriInfo uriInfo)
          Returns the list of licenses used by an artifact.
 javax.ws.rs.core.Response getModule(String gavc, javax.ws.rs.core.UriInfo uriInfo)
          Returns the Module of an artifact.
 javax.ws.rs.core.Response getOrganization(String gavc, javax.ws.rs.core.UriInfo uriInfo)
          Returns the Organization of an artifact.
 javax.ws.rs.core.Response getVersions(String gavc)
          Returns the list of available versions of an artifact This method is call via GET /artifact//versions
 javax.ws.rs.core.Response postArtifact(DbCredential credential, Artifact artifact)
          Handle artifact posts when the server got a request POST /artifact & MIME that contains the artifact.
 javax.ws.rs.core.Response postDoNotUse(DbCredential credential, String gavc, com.yammer.dropwizard.jersey.params.BooleanParam doNotUse)
          Add "DO_NOT_USE" flag to an artifact
 javax.ws.rs.core.Response updateDownloadUrl(DbCredential credential, String gavc, String downLoadUrl)
          Update an artifact download url.
 javax.ws.rs.core.Response updateProvider(DbCredential credential, String gavc, String provider)
          Update an artifact download url.
 
Methods inherited from class org.axway.grapes.server.webapp.resources.AbstractResource
getArtifactHandler, getArtifactJsonModel, getConfig, getDependencyHandler, getDependencyJsonModel, getDocumentation, getGraphsHandler, getIssueTrackerUrl, getLicenseHandler, getLicenseJsonModel, getModelMapper, getModuleHandler, getModuleJsonModel, getOnlineDocumentation, getOrganizationHandler, getOrganizationJsonModel, getProductHandler, getProgramVersion, getScopes
 
Methods inherited from class com.yammer.dropwizard.views.View
getCharset, getTemplateName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArtifactResource

public ArtifactResource(RepositoryHandler repoHandler,
                        GrapesServerConfig dmConfig)
Method Detail

postArtifact

public javax.ws.rs.core.Response postArtifact(@Auth
                                              DbCredential credential,
                                              Artifact artifact)
Handle artifact posts when the server got a request POST /artifact & MIME that contains the artifact.

Parameters:
credential - DbCredential
artifact - The artifact to add to Grapes database
Returns:
Response An acknowledgment:
- 400 if the artifact is MIME is malformed
- 500 if internal error
- 201 if ok

getGavcs

public javax.ws.rs.core.Response getGavcs(@Context
                                          javax.ws.rs.core.UriInfo uriInfo)
Return a list of gavc, stored in Grapes, regarding the filters passed in the query parameters. This method is call via GET /artifact/gavcs

Returns:
Response A list (in HTML or JSON) of gavc

getGroupIds

public javax.ws.rs.core.Response getGroupIds(@Context
                                             javax.ws.rs.core.UriInfo uriInfo)
Return a list of groupIds, stored in Grapes. This method is call via GET /artifact/groupids

Returns:
Response A list (in HTML or JSON) of gavc

getVersions

public javax.ws.rs.core.Response getVersions(String gavc)
Returns the list of available versions of an artifact This method is call via GET /artifact//versions

Parameters:
gavc - String
Returns:
Response a list of versions in JSON or in HTML

getLastVersion

public javax.ws.rs.core.Response getLastVersion(String gavc)
Returns the list of available versions of an artifact This method is call via GET /artifact//versions

Parameters:
gavc - String
Returns:
Response String version in JSON

get

public javax.ws.rs.core.Response get(String gavc)
Return an Artifact regarding its gavc. This method is call via GET /artifact/

Parameters:
gavc - String
Returns:
Response An artifact in HTML or JSON

updateDownloadUrl

public javax.ws.rs.core.Response updateDownloadUrl(@Auth
                                                   DbCredential credential,
                                                   String gavc,
                                                   String downLoadUrl)
Update an artifact download url. This method is call via GET /artifact//downloadurl?url=

Parameters:
credential - DbCredential
gavc - String
downLoadUrl - String
Returns:
Response

updateProvider

public javax.ws.rs.core.Response updateProvider(@Auth
                                                DbCredential credential,
                                                String gavc,
                                                String provider)
Update an artifact download url. This method is call via GET /artifact//downloadurl?url=


delete

public javax.ws.rs.core.Response delete(@Auth
                                        DbCredential credential,
                                        String gavc)
Delete an Artifact regarding its gavc. This method is call via DELETE /artifact/

Parameters:
credential - DbCredential
gavc - String
Returns:
Response

postDoNotUse

public javax.ws.rs.core.Response postDoNotUse(@Auth
                                              DbCredential credential,
                                              String gavc,
                                              com.yammer.dropwizard.jersey.params.BooleanParam doNotUse)
Add "DO_NOT_USE" flag to an artifact

Parameters:
credential - DbCredential
gavc - String
doNotUse - boolean
Returns:
Response

getDoNotUse

public javax.ws.rs.core.Response getDoNotUse(String gavc)
Return true if the targeted artifact is flagged with "DO_NOT_USE". This method is call via GET /artifact//donotuse

Parameters:
gavc - String
Returns:
Response

getAncestors

public javax.ws.rs.core.Response getAncestors(String gavc,
                                              @Context
                                              javax.ws.rs.core.UriInfo uriInfo)
Return the list of ancestor of an artifact. This method is call via GET /artifact//ancestors

Parameters:
gavc - String
uriInfo - UriInfo
Returns:
Response A list of ancestor in HTML or JSON

getLicenses

public javax.ws.rs.core.Response getLicenses(String gavc,
                                             @Context
                                             javax.ws.rs.core.UriInfo uriInfo)
Returns the list of licenses used by an artifact. This method is call via GET /artifact/{gavc}/licenses

Parameters:
gavc -
Returns:
Response A list of dependencies in HTML or JSON

addLicense

public javax.ws.rs.core.Response addLicense(@Auth
                                            DbCredential credential,
                                            String gavc,
                                            String licenseId)
Add a license to an artifact

Parameters:
credential - DbCredential
gavc - String
licenseId - String
Returns:
Response

deleteLicense

public javax.ws.rs.core.Response deleteLicense(@Auth
                                               DbCredential credential,
                                               String gavc,
                                               String licenseId)
Removes a license from an artifact

Parameters:
credential - DbCredential
gavc - String
licenseId - String
Returns:
Response

getModule

public javax.ws.rs.core.Response getModule(String gavc,
                                           @Context
                                           javax.ws.rs.core.UriInfo uriInfo)
Returns the Module of an artifact. This method is call via GET /artifact/{gavc}/module

Parameters:
gavc - String
Returns:
Response a module in HTML or JSON

getOrganization

public javax.ws.rs.core.Response getOrganization(String gavc,
                                                 @Context
                                                 javax.ws.rs.core.UriInfo uriInfo)
Returns the Organization of an artifact. This method is call via GET /artifact/{gavc}/module

Parameters:
gavc - String
Returns:
Response a module in HTML or JSON

getAll

public javax.ws.rs.core.Response getAll(@Context
                                        javax.ws.rs.core.UriInfo uriInfo)
Return all the artifacts that matches the filters. This method is call via GET /artifact/ Following filters can be used: artifactId, classifier, groupId, hasLicense, licenseId, type, uriInfo, version

Parameters:
uriInfo - UriInfo
Returns:
Response An artifact in HTML or JSON


Copyright © 2014. All Rights Reserved.