org.axway.grapes.utils.client
Class GrapesClient

java.lang.Object
  extended by org.axway.grapes.utils.client.GrapesClient

public class GrapesClient
extends Object

Abstract Client

Implemented Grapes client.

Author:
jdcoffre

Constructor Summary
GrapesClient(String host, String port)
           
 
Method Summary
 void addLicense(String gavc, String licenseId, String user, String password)
          Add a license to an artifact
 void approveLicense(String licenseId, Boolean approve, String user, String password)
          Approve or reject a license
 void deleteArtifact(String gavc, String user, String password)
          Delete an artifact in the Grapes server
 void deleteLicense(String licenseId, String user, String password)
          Delete a license in the server
 void deleteModule(String name, String version, String user, String password)
          Delete a module from Grapes server
 Artifact getArtifact(String gavc)
          Send a get artifact request
 String getArtifactLastVersion(String gavc)
          Returns the artifact last version
 Module getArtifactModule(String gavc)
          Returns the module of an artifact or null if there is none
 List<Artifact> getArtifacts(Boolean hasLicense)
          Send a get artifacts request
 List<String> getArtifactVersions(String gavc)
          Returns the artifact available versions
 License getLicense(String licenseId)
          Send a get license request
 Module getModule(String name, String version)
          Send a get module request
 List<Dependency> getModuleAncestors(String moduleName, String moduleVersion)
          Return the list of module ancestors
 List<Dependency> getModuleDependencies(String moduleName, String moduleVersion, Boolean fullRecursive, Boolean corporate, Boolean thirdParty)
          Return the list of module dependencies
 Organization getModuleOrganization(String moduleName, String moduleVersion)
          Returns the organization of a given module
 Boolean getModulePromotionStatus(String name, String version)
          Send a get module promotion status request
 List<Module> getModules(Map<String,String> filters)
          Get a list of modules regarding filters
 List<String> getModuleVersions(String name)
          Send a get module versions request
 List<String> getProductModuleNames(String projectId)
          Returns the list of module names of a product
 String getServerURL()
           
 boolean isServerAvailable()
          Checks if the dependency server is available
 Boolean moduleCanBePromoted(String name, String version)
          Promote a module in the Grapes server
 void postArtifact(Artifact artifact, String user, String password)
          Post an artifact to the Grapes server
 void postBuildInfo(String moduleName, String moduleVersion, Map<String,String> buildInfo, String user, String password)
          Post a build info to the server
 void postDoNotUseArtifact(String gavc, Boolean doNotUse, String user, String password)
          Post boolean flag "DO_NOT_USE" to an artifact
 void postLicense(License license, String user, String password)
          Post a license to the server
 void postModule(Module module, String user, String password)
          Post a module to the server
 void promoteModule(String name, String version, String user, String password)
          Promote a module in the Grapes server
 void setTimeout(Integer timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrapesClient

public GrapesClient(String host,
                    String port)
Method Detail

setTimeout

public void setTimeout(Integer timeout)

getServerURL

public String getServerURL()

isServerAvailable

public boolean isServerAvailable()
Checks if the dependency server is available

Returns:
true if the server is reachable, false otherwise

postBuildInfo

public void postBuildInfo(String moduleName,
                          String moduleVersion,
                          Map<String,String> buildInfo,
                          String user,
                          String password)
                   throws GrapesCommunicationException,
                          AuthenticationException
Post a build info to the server

Parameters:
moduleName - String
moduleVersion - String
buildInfo - Map
user - String
password - String
Throws:
GrapesCommunicationException
AuthenticationException

postModule

public void postModule(Module module,
                       String user,
                       String password)
                throws GrapesCommunicationException,
                       AuthenticationException
Post a module to the server

Parameters:
module -
user -
password -
Throws:
GrapesCommunicationException
AuthenticationException

deleteModule

public void deleteModule(String name,
                         String version,
                         String user,
                         String password)
                  throws GrapesCommunicationException,
                         AuthenticationException
Delete a module from Grapes server

Parameters:
name -
version -
Throws:
GrapesCommunicationException
AuthenticationException

getModule

public Module getModule(String name,
                        String version)
                 throws GrapesCommunicationException
Send a get module request

Parameters:
name -
version -
Returns:
the targeted module
Throws:
GrapesCommunicationException

getModules

public List<Module> getModules(Map<String,String> filters)
                        throws GrapesCommunicationException
Get a list of modules regarding filters

Parameters:
filters - Map
Returns:
List
Throws:
GrapesCommunicationException

getModuleVersions

public List<String> getModuleVersions(String name)
                               throws GrapesCommunicationException
Send a get module versions request

Parameters:
name - String
Returns:
a list of versions
Throws:
GrapesCommunicationException

getModulePromotionStatus

public Boolean getModulePromotionStatus(String name,
                                        String version)
                                 throws GrapesCommunicationException
Send a get module promotion status request

Parameters:
name - String
version - String
Returns:
a boolean
Throws:
GrapesCommunicationException

promoteModule

public void promoteModule(String name,
                          String version,
                          String user,
                          String password)
                   throws GrapesCommunicationException,
                          AuthenticationException
Promote a module in the Grapes server

Parameters:
name -
version -
Throws:
GrapesCommunicationException
AuthenticationException

moduleCanBePromoted

public Boolean moduleCanBePromoted(String name,
                                   String version)
                            throws GrapesCommunicationException
Promote a module in the Grapes server

Parameters:
name -
version -
Returns:
a boolean which is true only if the module can be promoted
Throws:
GrapesCommunicationException

postArtifact

public void postArtifact(Artifact artifact,
                         String user,
                         String password)
                  throws GrapesCommunicationException,
                         AuthenticationException
Post an artifact to the Grapes server

Parameters:
artifact -
user -
password -
Throws:
GrapesCommunicationException
AuthenticationException

deleteArtifact

public void deleteArtifact(String gavc,
                           String user,
                           String password)
                    throws GrapesCommunicationException,
                           AuthenticationException
Delete an artifact in the Grapes server

Parameters:
gavc -
Throws:
GrapesCommunicationException
AuthenticationException

getArtifact

public Artifact getArtifact(String gavc)
                     throws GrapesCommunicationException
Send a get artifact request

Parameters:
gavc -
Returns:
the targeted artifact
Throws:
GrapesCommunicationException

getArtifacts

public List<Artifact> getArtifacts(Boolean hasLicense)
                            throws GrapesCommunicationException
Send a get artifacts request

Parameters:
hasLicense -
Returns:
list of artifact
Throws:
GrapesCommunicationException

postDoNotUseArtifact

public void postDoNotUseArtifact(String gavc,
                                 Boolean doNotUse,
                                 String user,
                                 String password)
                          throws GrapesCommunicationException,
                                 AuthenticationException
Post boolean flag "DO_NOT_USE" to an artifact

Parameters:
gavc -
doNotUse -
user -
password -
Throws:
GrapesCommunicationException
AuthenticationException

getArtifactVersions

public List<String> getArtifactVersions(String gavc)
                                 throws GrapesCommunicationException
Returns the artifact available versions

Parameters:
gavc - String
Returns:
List
Throws:
GrapesCommunicationException

getArtifactLastVersion

public String getArtifactLastVersion(String gavc)
                              throws GrapesCommunicationException
Returns the artifact last version

Parameters:
gavc - String
Returns:
String
Throws:
GrapesCommunicationException

getArtifactModule

public Module getArtifactModule(String gavc)
                         throws GrapesCommunicationException
Returns the module of an artifact or null if there is none

Parameters:
gavc - String
Returns:
Module
Throws:
GrapesCommunicationException

addLicense

public void addLicense(String gavc,
                       String licenseId,
                       String user,
                       String password)
                throws GrapesCommunicationException,
                       AuthenticationException
Add a license to an artifact

Parameters:
gavc -
licenseId -
Throws:
GrapesCommunicationException
AuthenticationException

postLicense

public void postLicense(License license,
                        String user,
                        String password)
                 throws GrapesCommunicationException,
                        AuthenticationException
Post a license to the server

Parameters:
license -
user -
password -
Throws:
GrapesCommunicationException
AuthenticationException

deleteLicense

public void deleteLicense(String licenseId,
                          String user,
                          String password)
                   throws GrapesCommunicationException,
                          AuthenticationException
Delete a license in the server

Parameters:
licenseId -
Throws:
GrapesCommunicationException
AuthenticationException

getLicense

public License getLicense(String licenseId)
                   throws GrapesCommunicationException
Send a get license request

Parameters:
licenseId -
Returns:
the targeted license
Throws:
GrapesCommunicationException

approveLicense

public void approveLicense(String licenseId,
                           Boolean approve,
                           String user,
                           String password)
                    throws GrapesCommunicationException,
                           AuthenticationException
Approve or reject a license

Parameters:
licenseId -
approve -
Throws:
GrapesCommunicationException
AuthenticationException

getModuleAncestors

public List<Dependency> getModuleAncestors(String moduleName,
                                           String moduleVersion)
                                    throws GrapesCommunicationException
Return the list of module ancestors

Parameters:
moduleName -
moduleVersion -
Returns:
List
Throws:
GrapesCommunicationException

getModuleDependencies

public List<Dependency> getModuleDependencies(String moduleName,
                                              String moduleVersion,
                                              Boolean fullRecursive,
                                              Boolean corporate,
                                              Boolean thirdParty)
                                       throws GrapesCommunicationException
Return the list of module dependencies

Parameters:
moduleName -
moduleVersion -
fullRecursive -
corporate -
thirdParty -
Returns:
List
Throws:
GrapesCommunicationException

getModuleOrganization

public Organization getModuleOrganization(String moduleName,
                                          String moduleVersion)
                                   throws GrapesCommunicationException,
                                          IOException
Returns the organization of a given module

Returns:
Organization
Throws:
GrapesCommunicationException
IOException

getProductModuleNames

public List<String> getProductModuleNames(String projectId)
                                   throws GrapesCommunicationException,
                                          IOException
Returns the list of module names of a product

Returns:
List
Throws:
GrapesCommunicationException
IOException


Copyright © 2014. All Rights Reserved.