org.axway.grapes.server.db.mongo
Class MongodbHandler

java.lang.Object
  extended by org.axway.grapes.server.db.mongo.MongodbHandler
All Implemented Interfaces:
RepositoryHandler

public class MongodbHandler
extends Object
implements RepositoryHandler

Mongodb Handler

Repository Handler designed for mongodb

Author:
jdcoffre

Constructor Summary
MongodbHandler(DataBaseConfig config)
           
 
Method Summary
 void addLicenseToArtifact(DbArtifact artifact, String licenseId)
          Add a license to an existing artifact
 void addModulesOrganization(String corporateGidPrefix, DbOrganization organization)
          Updates all module that matches the corporate GID prefix setting the Organization name
 void addUserRole(String user, DbCredential.AvailableRoles role)
          Add a role to the targeted user
 void approveLicense(DbLicense license, Boolean approved)
          Approve or reject a license
 void deleteArtifact(String gavc)
          Delete the targeted artifact
 void deleteLicense(String name)
          Delete the targeted license from the database
 void deleteModule(String moduleId)
          Delete the targeted module
 void deleteOrganization(String organizationId)
          Remove an organization
 void deleteProduct(String name)
          Deletes a product from the database
 List<DbLicense> getAllLicenses()
          Retrieve all licenses from the database
 List<DbOrganization> getAllOrganizations()
          Returns all the Organizations form the database
 List<DbModule> getAncestors(DbArtifact artifact, FiltersHolder filters)
          Retrieve the list of the modules the use the targeted artifact
 DbArtifact getArtifact(String gavc)
          Return the targeted artifact
 List<DbArtifact> getArtifacts(FiltersHolder filters)
          Return a list of all the artifacts that match the filters
 List<String> getArtifactVersions(DbArtifact artifact)
          Return the list of all the available versions of the targeted artifacts
 DbCredential getCredential(String user)
          Returns the credentials of a user
 List<String> getGavcs(FiltersHolder filters)
          Return the list of all the artifacts gavcs that match the provided filters
 List<String> getGroupIds(FiltersHolder filters)
          Return the list of all the artifacts groupIds that match the provided filters
 DbLicense getLicense(String name)
          Retrieve the targeted license from the database
 List<String> getLicenseNames(FiltersHolder filters)
          Return a list of all the available licenses regarding the provided filters
 DbModule getModule(String moduleId)
          Return the targeted module
 List<String> getModuleNames(FiltersHolder filters)
          Return the list of all the module names that match the provided filters
 DbModule getModuleOf(String gavc)
          Return the module or the submodule that contains the gavc.
 List<DbModule> getModules(FiltersHolder filters)
          Return a list od module regarding the filters
 List<String> getModuleVersions(String name, FiltersHolder filters)
          Retrieve the list of all the available versions of a module
 DbOrganization getOrganization(String name)
          Returns an organization
 List<String> getOrganizationNames()
          Returns all the organization names
 DbProduct getProduct(String name)
          Returns a product regarding its name
 List<String> getProductNames()
          Returns the list of product names
 DbModule getRootModuleOf(String gavc)
          Return the module that contains the gavc.
 void promoteModule(DbModule module)
          Promote the targeted module
 void removeLicenseFromArtifact(DbArtifact artifact, String licenseId)
          Remove a license from an existing artifact
 void removeModulesOrganization(DbOrganization organization)
          Updates all module reference to the organization removing the Organization field
 void removeModulesOrganization(String corporateGidPrefix, DbOrganization organization)
          Updates all module that matches the corporate GID prefix AND that reference to the organization removing the Organization field
 void removeUserRole(String user, DbCredential.AvailableRoles role)
          Remove a role to the targeted user
 void store(DbArtifact artifact)
          Create a new artifact or update an existing one in the database
 void store(DbCredential credential)
          Store a new credential or update an existing one
 void store(DbLicense license)
          Store a new license or update an existing one
 void store(DbModule module)
          Create a new module or update an existing one into the database
 void store(DbOrganization organization)
          Stores an organization into the database
 void store(DbProduct dbProduct)
          Stores a product in Grapes db
 void updateDoNotUse(DbArtifact artifact, Boolean doNotUse)
          Update "DO_NOT_USE" field of an artifact
 void updateDownloadUrl(DbArtifact artifact, String downLoadUrl)
          Update the download url field of an artifact
 void updateProvider(DbArtifact artifact, String provider)
          Update provider field of an artifact
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongodbHandler

public MongodbHandler(DataBaseConfig config)
               throws UnknownHostException
Throws:
UnknownHostException
Method Detail

store

public void store(DbCredential credential)
Description copied from interface: RepositoryHandler
Store a new credential or update an existing one

Specified by:
store in interface RepositoryHandler
Parameters:
credential - DbCredential

addUserRole

public void addUserRole(String user,
                        DbCredential.AvailableRoles role)
Description copied from interface: RepositoryHandler
Add a role to the targeted user

Specified by:
addUserRole in interface RepositoryHandler
Parameters:
user - String
role - AvailableRoles

removeUserRole

public void removeUserRole(String user,
                           DbCredential.AvailableRoles role)
Description copied from interface: RepositoryHandler
Remove a role to the targeted user

Specified by:
removeUserRole in interface RepositoryHandler
Parameters:
user - String
role - AvailableRoles

getCredential

public DbCredential getCredential(String user)
Description copied from interface: RepositoryHandler
Returns the credentials of a user

Specified by:
getCredential in interface RepositoryHandler
Parameters:
user - String
Returns:
DbCredential

store

public void store(DbLicense license)
Description copied from interface: RepositoryHandler
Store a new license or update an existing one

Specified by:
store in interface RepositoryHandler
Parameters:
license - DbLicense

getLicenseNames

public List<String> getLicenseNames(FiltersHolder filters)
Description copied from interface: RepositoryHandler
Return a list of all the available licenses regarding the provided filters

Specified by:
getLicenseNames in interface RepositoryHandler
Parameters:
filters - FiltersHolder
Returns:
List

getAllLicenses

public List<DbLicense> getAllLicenses()
Description copied from interface: RepositoryHandler
Retrieve all licenses from the database

Specified by:
getAllLicenses in interface RepositoryHandler
Returns:
List

getLicense

public DbLicense getLicense(String name)
Description copied from interface: RepositoryHandler
Retrieve the targeted license from the database

Specified by:
getLicense in interface RepositoryHandler
Parameters:
name - String
Returns:
DbLicense

deleteLicense

public void deleteLicense(String name)
Description copied from interface: RepositoryHandler
Delete the targeted license from the database

Specified by:
deleteLicense in interface RepositoryHandler
Parameters:
name - String

getArtifacts

public List<DbArtifact> getArtifacts(FiltersHolder filters)
Description copied from interface: RepositoryHandler
Return a list of all the artifacts that match the filters

Specified by:
getArtifacts in interface RepositoryHandler
Parameters:
filters - FiltersHolder
Returns:
List

addLicenseToArtifact

public void addLicenseToArtifact(DbArtifact artifact,
                                 String licenseId)
Description copied from interface: RepositoryHandler
Add a license to an existing artifact

Specified by:
addLicenseToArtifact in interface RepositoryHandler
Parameters:
artifact - DbArtifact
licenseId - String

removeLicenseFromArtifact

public void removeLicenseFromArtifact(DbArtifact artifact,
                                      String licenseId)
Description copied from interface: RepositoryHandler
Remove a license from an existing artifact

Specified by:
removeLicenseFromArtifact in interface RepositoryHandler
Parameters:
artifact - DbArtifact
licenseId - String

approveLicense

public void approveLicense(DbLicense license,
                           Boolean approved)
Description copied from interface: RepositoryHandler
Approve or reject a license

Specified by:
approveLicense in interface RepositoryHandler
Parameters:
license - DbLicense
approved - Boolean

store

public void store(DbArtifact artifact)
Description copied from interface: RepositoryHandler
Create a new artifact or update an existing one in the database

Specified by:
store in interface RepositoryHandler
Parameters:
artifact - DbArtifact

getGavcs

public List<String> getGavcs(FiltersHolder filters)
Description copied from interface: RepositoryHandler
Return the list of all the artifacts gavcs that match the provided filters

Specified by:
getGavcs in interface RepositoryHandler
Parameters:
filters - FiltersHolder
Returns:
List

getGroupIds

public List<String> getGroupIds(FiltersHolder filters)
Description copied from interface: RepositoryHandler
Return the list of all the artifacts groupIds that match the provided filters

Specified by:
getGroupIds in interface RepositoryHandler
Parameters:
filters - FiltersHolder
Returns:
List

getArtifactVersions

public List<String> getArtifactVersions(DbArtifact artifact)
Description copied from interface: RepositoryHandler
Return the list of all the available versions of the targeted artifacts

Specified by:
getArtifactVersions in interface RepositoryHandler
Parameters:
artifact - DbArtifact
Returns:
List

getArtifact

public DbArtifact getArtifact(String gavc)
Description copied from interface: RepositoryHandler
Return the targeted artifact

Specified by:
getArtifact in interface RepositoryHandler
Parameters:
gavc - String
Returns:
DbArtifact

deleteArtifact

public void deleteArtifact(String gavc)
Description copied from interface: RepositoryHandler
Delete the targeted artifact

Specified by:
deleteArtifact in interface RepositoryHandler
Parameters:
gavc - String

updateDoNotUse

public void updateDoNotUse(DbArtifact artifact,
                           Boolean doNotUse)
Description copied from interface: RepositoryHandler
Update "DO_NOT_USE" field of an artifact

Specified by:
updateDoNotUse in interface RepositoryHandler
Parameters:
artifact - DbArtifact
doNotUse - Boolean

updateDownloadUrl

public void updateDownloadUrl(DbArtifact artifact,
                              String downLoadUrl)
Description copied from interface: RepositoryHandler
Update the download url field of an artifact

Specified by:
updateDownloadUrl in interface RepositoryHandler
Parameters:
artifact - DbArtifact
downLoadUrl - String

updateProvider

public void updateProvider(DbArtifact artifact,
                           String provider)
Description copied from interface: RepositoryHandler
Update provider field of an artifact

Specified by:
updateProvider in interface RepositoryHandler
Parameters:
artifact - DbArtifact
provider - String

getAncestors

public List<DbModule> getAncestors(DbArtifact artifact,
                                   FiltersHolder filters)
Description copied from interface: RepositoryHandler
Retrieve the list of the modules the use the targeted artifact

Specified by:
getAncestors in interface RepositoryHandler
Parameters:
artifact - String
filters - FiltersHolder
Returns:
List

store

public void store(DbModule module)
Description copied from interface: RepositoryHandler
Create a new module or update an existing one into the database

Specified by:
store in interface RepositoryHandler
Parameters:
module - DbModule

getModuleNames

public List<String> getModuleNames(FiltersHolder filters)
Description copied from interface: RepositoryHandler
Return the list of all the module names that match the provided filters

Specified by:
getModuleNames in interface RepositoryHandler
Parameters:
filters - FiltersHolder
Returns:
List

getModuleVersions

public List<String> getModuleVersions(String name,
                                      FiltersHolder filters)
Description copied from interface: RepositoryHandler
Retrieve the list of all the available versions of a module

Specified by:
getModuleVersions in interface RepositoryHandler
Parameters:
name - String
filters - FiltersHolder
Returns:
List

getModule

public DbModule getModule(String moduleId)
Description copied from interface: RepositoryHandler
Return the targeted module

Specified by:
getModule in interface RepositoryHandler
Parameters:
moduleId - String
Returns:
DbModule

getModules

public List<DbModule> getModules(FiltersHolder filters)
Description copied from interface: RepositoryHandler
Return a list od module regarding the filters

Specified by:
getModules in interface RepositoryHandler
Parameters:
filters - FiltersHolder
Returns:
List

deleteModule

public void deleteModule(String moduleId)
Description copied from interface: RepositoryHandler
Delete the targeted module

Specified by:
deleteModule in interface RepositoryHandler
Parameters:
moduleId - String

promoteModule

public void promoteModule(DbModule module)
Description copied from interface: RepositoryHandler
Promote the targeted module

Specified by:
promoteModule in interface RepositoryHandler
Parameters:
module - String

getRootModuleOf

public DbModule getRootModuleOf(String gavc)
Description copied from interface: RepositoryHandler
Return the module that contains the gavc. It returns null if no module matches.

Specified by:
getRootModuleOf in interface RepositoryHandler
Parameters:
gavc - String
Returns:
DbModule

getModuleOf

public DbModule getModuleOf(String gavc)
Description copied from interface: RepositoryHandler
Return the module or the submodule that contains the gavc. It returns null if no module matches.

Specified by:
getModuleOf in interface RepositoryHandler
Parameters:
gavc - String
Returns:
DbModule

getOrganizationNames

public List<String> getOrganizationNames()
Description copied from interface: RepositoryHandler
Returns all the organization names

Specified by:
getOrganizationNames in interface RepositoryHandler
Returns:
List

getOrganization

public DbOrganization getOrganization(String name)
Description copied from interface: RepositoryHandler
Returns an organization

Specified by:
getOrganization in interface RepositoryHandler
Parameters:
name - String
Returns:
DbOrganization

deleteOrganization

public void deleteOrganization(String organizationId)
Description copied from interface: RepositoryHandler
Remove an organization

Specified by:
deleteOrganization in interface RepositoryHandler
Parameters:
organizationId - String

store

public void store(DbOrganization organization)
Description copied from interface: RepositoryHandler
Stores an organization into the database

Specified by:
store in interface RepositoryHandler
Parameters:
organization - DbOrganization

addModulesOrganization

public void addModulesOrganization(String corporateGidPrefix,
                                   DbOrganization organization)
Description copied from interface: RepositoryHandler
Updates all module that matches the corporate GID prefix setting the Organization name

Specified by:
addModulesOrganization in interface RepositoryHandler
Parameters:
corporateGidPrefix - String
organization - DbOrganization

removeModulesOrganization

public void removeModulesOrganization(String corporateGidPrefix,
                                      DbOrganization organization)
Description copied from interface: RepositoryHandler
Updates all module that matches the corporate GID prefix AND that reference to the organization removing the Organization field

Specified by:
removeModulesOrganization in interface RepositoryHandler
Parameters:
corporateGidPrefix - String
organization - DbOrganization

removeModulesOrganization

public void removeModulesOrganization(DbOrganization organization)
Description copied from interface: RepositoryHandler
Updates all module reference to the organization removing the Organization field

Specified by:
removeModulesOrganization in interface RepositoryHandler
Parameters:
organization - DbOrganization

getAllOrganizations

public List<DbOrganization> getAllOrganizations()
Description copied from interface: RepositoryHandler
Returns all the Organizations form the database

Specified by:
getAllOrganizations in interface RepositoryHandler
Returns:
List

store

public void store(DbProduct dbProduct)
Description copied from interface: RepositoryHandler
Stores a product in Grapes db

Specified by:
store in interface RepositoryHandler
Parameters:
dbProduct - DbProduct

getProduct

public DbProduct getProduct(String name)
Description copied from interface: RepositoryHandler
Returns a product regarding its name

Specified by:
getProduct in interface RepositoryHandler
Parameters:
name - String
Returns:
DbProduct

getProductNames

public List<String> getProductNames()
Description copied from interface: RepositoryHandler
Returns the list of product names

Specified by:
getProductNames in interface RepositoryHandler
Returns:
List

deleteProduct

public void deleteProduct(String name)
Description copied from interface: RepositoryHandler
Deletes a product from the database

Specified by:
deleteProduct in interface RepositoryHandler
Parameters:
name - String


Copyright © 2014. All Rights Reserved.