public class MpackManager extends Object
Constructor and Description |
---|
MpackManager(File mpacksStagingLocation,
File stackRootDir,
MpackDAO mpackDAOObj,
StackDAO stackDAOObj) |
Modifier and Type | Method and Description |
---|---|
Path |
downloadMpack(String mpackURI,
String mpackDefinitionLocation)
Download the mpack from the given uri
|
List<Module> |
getModules(Long mpackId)
Fetches the mpack info stored in the memory for mpacks/{mpack_id} call.
|
Map<Long,Mpack> |
getMpackMap() |
protected Long |
populateDB(Mpack mpacks)
Make an entry in the mpacks database for the newly registered mpack.
|
protected void |
populateStackDB(Mpack mpack)
Makes an entry or updates the entry in the stack table to establish a link between the mpack and the
associated stack
|
MpackResponse |
registerMpack(MpackRequest mpackRequest)
Parses mpack.json to fetch mpack and associated packlet information and
stores the mpack to the database and mpackMap
|
boolean |
removeMpack(MpackEntity mpackEntity,
StackEntity stackEntity)
Remove the mpack and stack directories when a request comes in to delete a particular mpack.
|
void |
setMpackMap(Map<Long,Mpack> mpackMap) |
protected boolean |
validateMpackInfo(String expectedMpackName,
String expectedMpackVersion,
String actualMpackName,
String actualMpackVersion)
Compares if the user's mpack information matches the downloaded mpack information.
|
public MpackResponse registerMpack(MpackRequest mpackRequest) throws IOException, IllegalArgumentException, ResourceAlreadyExistsException
mpackRequest
- IOException
IllegalArgumentException
ResourceAlreadyExistsException
public Path downloadMpack(String mpackURI, String mpackDefinitionLocation) throws IOException
mpackURI
- mpackDefinitionLocation
- IOException
protected boolean validateMpackInfo(String expectedMpackName, String expectedMpackVersion, String actualMpackName, String actualMpackVersion)
expectedMpackName
- expectedMpackVersion
- actualMpackName
- actualMpackVersion
- protected Long populateDB(Mpack mpacks) throws IOException
mpacks
- IOException
protected void populateStackDB(Mpack mpack) throws IOException, ResourceAlreadyExistsException
mpack
- IOException
ResourceAlreadyExistsException
public List<Module> getModules(Long mpackId)
mpackId
- Module
public boolean removeMpack(MpackEntity mpackEntity, StackEntity stackEntity) throws IOException
mpackEntity
- IOException
Copyright © 2022 Apache Software Foundation. All rights reserved.