HaikuDepot: New Mechanic for Package Data Download
The application was previously making a number of different requests to the application server in order to pull-down meta-data (ratings, localization etc...) for packages. This will now happen in one request per repo. The data is also cached locally and freshness of the data is checked back with the server before new data is pulled down.
This commit is contained in:
parent
272e1a2f97
commit
c23b641cf1
@ -4,7 +4,16 @@ UsePrivateHeaders interface shared storage package support net ;
|
||||
|
||||
# source directories
|
||||
local sourceDirs =
|
||||
edits_generic model textview ui ui_generic server server/dumpexportrepository tar util
|
||||
edits_generic
|
||||
model
|
||||
textview
|
||||
ui
|
||||
ui_generic
|
||||
server
|
||||
server/dumpexportrepository
|
||||
server/dumpexportpkg
|
||||
tar
|
||||
util
|
||||
;
|
||||
|
||||
local sourceDir ;
|
||||
@ -76,6 +85,11 @@ Application HaikuDepot :
|
||||
UserLoginWindow.cpp
|
||||
|
||||
# network + server - model
|
||||
DumpExportPkg.cpp
|
||||
DumpExportPkgCategory.cpp
|
||||
DumpExportPkgJsonListener.cpp
|
||||
DumpExportPkgScreenshot.cpp
|
||||
DumpExportPkgVersion.cpp
|
||||
DumpExportRepository.cpp
|
||||
DumpExportRepositorySource.cpp
|
||||
DumpExportRepositoryJsonListener.cpp
|
||||
@ -84,6 +98,7 @@ Application HaikuDepot :
|
||||
AbstractServerProcess.cpp
|
||||
ServerSettings.cpp
|
||||
WebAppInterface.cpp
|
||||
PkgDataUpdateProcess.cpp
|
||||
RepositoryDataUpdateProcess.cpp
|
||||
ServerIconExportUpdateProcess.cpp
|
||||
StandardMetaDataJsonEventListener.cpp
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <Directory.h>
|
||||
#include <FindDirectory.h>
|
||||
|
||||
#include "Logger.h"
|
||||
#include "ServerIconExportUpdateProcess.h"
|
||||
#include "StorageUtils.h"
|
||||
|
||||
@ -73,6 +74,10 @@ LocalIconStore::UpdateFromServerIfNecessary() const
|
||||
BPath iconStoragePath(fIconStoragePath);
|
||||
ServerIconExportUpdateProcess service(iconStoragePath);
|
||||
service.Run();
|
||||
|
||||
if (Logger::IsDebugEnabled()) {
|
||||
printf("did update the icons from server\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <Path.h>
|
||||
|
||||
#include "Logger.h"
|
||||
#include "PkgDataUpdateProcess.h"
|
||||
#include "RepositoryDataUpdateProcess.h"
|
||||
#include "StorageUtils.h"
|
||||
|
||||
@ -863,6 +864,30 @@ Model::_DumpExportRepositoryDataPath(BPath& path) const
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Model::_DumpExportPkgDataPath(BPath& path,
|
||||
const BString& repositorySourceCode) const
|
||||
{
|
||||
BPath repoDataPath;
|
||||
BString leafName;
|
||||
|
||||
leafName.SetToFormat("pkg-all-%s-%s.json.gz", repositorySourceCode.String(),
|
||||
fPreferredLanguage.String());
|
||||
|
||||
if (find_directory(B_USER_CACHE_DIRECTORY, &repoDataPath) == B_OK
|
||||
&& repoDataPath.Append("HaikuDepot") == B_OK
|
||||
&& create_directory(repoDataPath.Path(), 0777) == B_OK
|
||||
&& repoDataPath.Append(leafName.String()) == B_OK) {
|
||||
path.SetTo(repoDataPath.Path());
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
path.Unset();
|
||||
fprintf(stdout, "unable to find the user cache file for pkgs' data");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Model::PopulateWebAppRepositoryCodes()
|
||||
{
|
||||
@ -895,8 +920,7 @@ int32
|
||||
Model::_PopulateAllPackagesEntry(void* cookie)
|
||||
{
|
||||
Model* model = static_cast<Model*>(cookie);
|
||||
model->_PopulateAllPackagesThread(true);
|
||||
model->_PopulateAllPackagesThread(false);
|
||||
model->_PopulateAllPackagesThread();
|
||||
model->_PopulateAllPackagesIcons();
|
||||
return 0;
|
||||
}
|
||||
@ -948,430 +972,52 @@ Model::_PopulateAllPackagesIcons()
|
||||
|
||||
|
||||
void
|
||||
Model::_PopulateAllPackagesThread(bool fromCacheOnly)
|
||||
Model::_PopulatePackagesForDepot(const DepotInfo& depotInfo)
|
||||
{
|
||||
BString repositorySourceCode = depotInfo.WebAppRepositorySourceCode();
|
||||
BPath repositorySourcePkgDataPath;
|
||||
|
||||
if (B_OK != _DumpExportPkgDataPath(repositorySourcePkgDataPath,
|
||||
repositorySourceCode)) {
|
||||
printf("unable to obtain the path for storing data for [%s]\n",
|
||||
repositorySourceCode.String());
|
||||
} else {
|
||||
|
||||
printf("will fetch and process data for repository source [%s]\n",
|
||||
repositorySourceCode.String());
|
||||
|
||||
PkgDataUpdateProcess process(
|
||||
repositorySourcePkgDataPath,
|
||||
fLock, repositorySourceCode, fPreferredLanguage,
|
||||
depotInfo.Packages(),
|
||||
fCategories);
|
||||
|
||||
process.Run();
|
||||
|
||||
printf("did fetch and process data for repository source [%s]\n",
|
||||
repositorySourceCode.String());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::_PopulateAllPackagesThread()
|
||||
{
|
||||
int32 depotIndex = 0;
|
||||
int32 packageIndex = 0;
|
||||
PackageList bulkPackageList;
|
||||
int32 count = 0;
|
||||
|
||||
while (!fStopPopulatingAllPackages) {
|
||||
// Obtain PackageInfoRef while keeping the depot and package lists
|
||||
// locked.
|
||||
PackageInfoRef package;
|
||||
{
|
||||
BAutolock locker(&fLock);
|
||||
for (depotIndex = 0;
|
||||
depotIndex < fDepots.CountItems() && !fStopPopulatingAllPackages;
|
||||
depotIndex++) {
|
||||
const DepotInfo& depot = fDepots.ItemAt(depotIndex);
|
||||
|
||||
if (depotIndex >= fDepots.CountItems())
|
||||
break;
|
||||
const DepotInfo& depot = fDepots.ItemAt(depotIndex);
|
||||
|
||||
const PackageList& packages = depot.Packages();
|
||||
if (packageIndex >= packages.CountItems()) {
|
||||
// Need the next depot
|
||||
packageIndex = 0;
|
||||
depotIndex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
package = packages.ItemAt(packageIndex);
|
||||
packageIndex++;
|
||||
}
|
||||
|
||||
if (package.Get() == NULL)
|
||||
continue;
|
||||
|
||||
//_PopulatePackageInfo(package, fromCacheOnly);
|
||||
bulkPackageList.Add(package);
|
||||
if (bulkPackageList.CountItems() == 50) {
|
||||
_PopulatePackageInfos(bulkPackageList, fromCacheOnly);
|
||||
bulkPackageList.Clear();
|
||||
}
|
||||
// TODO: Average user rating. It needs to be shown in the
|
||||
// list view, so without the user clicking the package.
|
||||
}
|
||||
|
||||
if (bulkPackageList.CountItems() > 0) {
|
||||
_PopulatePackageInfos(bulkPackageList, fromCacheOnly);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Model::_GetCacheFile(BPath& path, BFile& file, directory_which directory,
|
||||
const char* relativeLocation, const char* fileName, uint32 openMode) const
|
||||
{
|
||||
if (find_directory(directory, &path) == B_OK
|
||||
&& path.Append(relativeLocation) == B_OK
|
||||
&& create_directory(path.Path(), 0777) == B_OK
|
||||
&& path.Append(fileName) == B_OK) {
|
||||
// Try opening the file which will fail if its
|
||||
// not a file or does not exist.
|
||||
return file.SetTo(path.Path(), openMode) == B_OK;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Model::_GetCacheFile(BPath& path, BFile& file, directory_which directory,
|
||||
const char* relativeLocation, const char* fileName,
|
||||
bool ignoreAge, time_t maxAge) const
|
||||
{
|
||||
if (!_GetCacheFile(path, file, directory, relativeLocation, fileName,
|
||||
B_READ_ONLY)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ignoreAge)
|
||||
return true;
|
||||
|
||||
time_t modifiedTime;
|
||||
file.GetModificationTime(&modifiedTime);
|
||||
time_t now;
|
||||
time(&now);
|
||||
return now - modifiedTime < maxAge;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::_PopulatePackageInfos(PackageList& packages, bool fromCacheOnly)
|
||||
{
|
||||
if (fStopPopulatingAllPackages)
|
||||
return;
|
||||
|
||||
// See if there are cached info files
|
||||
for (int i = packages.CountItems() - 1; i >= 0; i--) {
|
||||
if (fStopPopulatingAllPackages)
|
||||
return;
|
||||
|
||||
const PackageInfoRef& package = packages.ItemAtFast(i);
|
||||
|
||||
BFile file;
|
||||
BPath path;
|
||||
BString name(package->Name());
|
||||
name << ".info";
|
||||
if (_GetCacheFile(path, file, B_USER_CACHE_DIRECTORY,
|
||||
"HaikuDepot", name, fromCacheOnly, 60 * 60)) {
|
||||
// Cache file is recent enough, just use it and return.
|
||||
BMessage pkgInfo;
|
||||
if (pkgInfo.Unflatten(&file) == B_OK) {
|
||||
_PopulatePackageInfo(package, pkgInfo);
|
||||
packages.Remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fromCacheOnly || packages.IsEmpty())
|
||||
return;
|
||||
|
||||
// Retrieve info from web-app
|
||||
BMessage info;
|
||||
|
||||
StringList packageNames;
|
||||
StringList packageArchitectures;
|
||||
StringList repositoryCodes;
|
||||
|
||||
for (int i = 0; i < packages.CountItems(); i++) {
|
||||
const PackageInfoRef& package = packages.ItemAtFast(i);
|
||||
packageNames.Add(package->Name());
|
||||
|
||||
if (!packageArchitectures.Contains(package->Architecture()))
|
||||
packageArchitectures.Add(package->Architecture());
|
||||
|
||||
const DepotInfo *depot = DepotForName(package->DepotName());
|
||||
|
||||
if (depot != NULL) {
|
||||
BString repositoryCode = depot->WebAppRepositoryCode();
|
||||
|
||||
if (repositoryCode.Length() != 0
|
||||
&& !repositoryCodes.Contains(repositoryCode)) {
|
||||
repositoryCodes.Add(repositoryCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (repositoryCodes.CountItems() != 0) {
|
||||
status_t status = fWebAppInterface.RetrieveBulkPackageInfo(packageNames,
|
||||
packageArchitectures, repositoryCodes, info);
|
||||
|
||||
if (status == B_OK) {
|
||||
// Parse message
|
||||
BMessage result;
|
||||
BMessage pkgs;
|
||||
if (info.FindMessage("result", &result) == B_OK
|
||||
&& result.FindMessage("pkgs", &pkgs) == B_OK) {
|
||||
int32 index = 0;
|
||||
while (true) {
|
||||
if (fStopPopulatingAllPackages)
|
||||
return;
|
||||
BString name;
|
||||
name << index++;
|
||||
BMessage pkgInfo;
|
||||
if (pkgs.FindMessage(name, &pkgInfo) != B_OK)
|
||||
break;
|
||||
|
||||
BString pkgName;
|
||||
if (pkgInfo.FindString("name", &pkgName) != B_OK)
|
||||
continue;
|
||||
|
||||
// Find the PackageInfoRef
|
||||
bool found = false;
|
||||
for (int i = 0; i < packages.CountItems(); i++) {
|
||||
const PackageInfoRef& package = packages.ItemAtFast(i);
|
||||
if (pkgName == package->Name()) {
|
||||
_PopulatePackageInfo(package, pkgInfo);
|
||||
|
||||
// Store in cache
|
||||
BFile file;
|
||||
BPath path;
|
||||
BString fileName(package->Name());
|
||||
fileName << ".info";
|
||||
if (_GetCacheFile(path, file, B_USER_CACHE_DIRECTORY,
|
||||
"HaikuDepot", fileName,
|
||||
B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE)) {
|
||||
pkgInfo.Flatten(&file);
|
||||
}
|
||||
|
||||
packages.Remove(i);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
printf("No matching package for %s\n", pkgName.String());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("Error sending request: %s\n", strerror(status));
|
||||
int count = packages.CountItems();
|
||||
if (count >= 4) {
|
||||
// Retry in smaller chunks
|
||||
PackageList firstHalf;
|
||||
PackageList secondHalf;
|
||||
for (int i = 0; i < count / 2; i++)
|
||||
firstHalf.Add(packages.ItemAtFast(i));
|
||||
for (int i = count / 2; i < count; i++)
|
||||
secondHalf.Add(packages.ItemAtFast(i));
|
||||
packages.Clear();
|
||||
_PopulatePackageInfos(firstHalf, fromCacheOnly);
|
||||
_PopulatePackageInfos(secondHalf, fromCacheOnly);
|
||||
} else {
|
||||
while (packages.CountItems() > 0) {
|
||||
const PackageInfoRef& package = packages.ItemAtFast(0);
|
||||
_PopulatePackageInfo(package, fromCacheOnly);
|
||||
packages.Remove(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (packages.CountItems() > 0) {
|
||||
uint32 count = 0;
|
||||
bool debug_enabled = Logger::IsDebugEnabled();
|
||||
|
||||
for (int i = 0; i < packages.CountItems(); i++) {
|
||||
const PackageInfoRef& package = packages.ItemAtFast(i);
|
||||
if (depot.WebAppRepositorySourceCode().Length() > 0) {
|
||||
_PopulatePackagesForDepot(depot);
|
||||
count++;
|
||||
|
||||
if (debug_enabled) {
|
||||
printf("No package info for %s\n", package->Name().String());
|
||||
}
|
||||
}
|
||||
|
||||
printf("No package info for %" B_PRIu32 " packages\n", count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::_PopulatePackageInfo(const PackageInfoRef& package, bool fromCacheOnly)
|
||||
{
|
||||
if (fromCacheOnly)
|
||||
return;
|
||||
|
||||
BString repositoryCode;
|
||||
const DepotInfo* depot = DepotForName(package->DepotName());
|
||||
|
||||
if (depot != NULL) {
|
||||
repositoryCode = depot->WebAppRepositoryCode();
|
||||
|
||||
if (repositoryCode.Length() > 0) {
|
||||
// Retrieve info from web-app
|
||||
BMessage info;
|
||||
|
||||
status_t status = fWebAppInterface.RetrievePackageInfo(
|
||||
package->Name(), package->Architecture(), repositoryCode,
|
||||
info);
|
||||
|
||||
if (status == B_OK) {
|
||||
// Parse message
|
||||
// info.PrintToStream();
|
||||
BMessage result;
|
||||
if (info.FindMessage("result", &result) == B_OK)
|
||||
_PopulatePackageInfo(package, result);
|
||||
}
|
||||
} else {
|
||||
printf("unable to find the web app repository code for depot; %s\n",
|
||||
package->DepotName().String());
|
||||
}
|
||||
} else {
|
||||
printf("no depot for name; %s\n",
|
||||
package->DepotName().String());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
append_word_list(BString& words, const char* word)
|
||||
{
|
||||
if (words.Length() > 0)
|
||||
words << ", ";
|
||||
words << word;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::_PopulatePackageInfo(const PackageInfoRef& package, const BMessage& data)
|
||||
{
|
||||
bool debug_enabled = Logger::IsDebugEnabled();
|
||||
BAutolock locker(&fLock);
|
||||
|
||||
BString foundInfo;
|
||||
|
||||
BMessage versions;
|
||||
if (data.FindMessage("versions", &versions) == B_OK) {
|
||||
// Search a summary and description in the preferred language
|
||||
int32 index = 0;
|
||||
while (true) {
|
||||
BString name;
|
||||
name << index++;
|
||||
BMessage version;
|
||||
if (versions.FindMessage(name, &version) != B_OK)
|
||||
break;
|
||||
|
||||
BString title;
|
||||
if (version.FindString("title", &title) == B_OK) {
|
||||
package->SetTitle(title);
|
||||
|
||||
if (debug_enabled)
|
||||
append_word_list(foundInfo, "title");
|
||||
}
|
||||
BString summary;
|
||||
if (version.FindString("summary", &summary) == B_OK) {
|
||||
package->SetShortDescription(summary);
|
||||
|
||||
if (debug_enabled)
|
||||
append_word_list(foundInfo, "summary");
|
||||
}
|
||||
BString description;
|
||||
if (version.FindString("description", &description) == B_OK) {
|
||||
package->SetFullDescription(description);
|
||||
|
||||
if (debug_enabled)
|
||||
append_word_list(foundInfo, "description");
|
||||
}
|
||||
double payloadLength;
|
||||
if (version.FindDouble("payloadLength", &payloadLength) == B_OK) {
|
||||
package->SetSize((int64)payloadLength);
|
||||
|
||||
if (debug_enabled)
|
||||
append_word_list(foundInfo, "size");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BMessage categories;
|
||||
if (data.FindMessage("pkgCategoryCodes", &categories) == B_OK) {
|
||||
bool foundCategory = false;
|
||||
int32 index = 0;
|
||||
while (true) {
|
||||
BString name;
|
||||
name << index++;
|
||||
BString category;
|
||||
if (categories.FindString(name, &category) != B_OK)
|
||||
break;
|
||||
|
||||
package->ClearCategories();
|
||||
for (int i = fCategories.CountItems() - 1; i >= 0; i--) {
|
||||
const CategoryRef& categoryRef = fCategories.ItemAtFast(i);
|
||||
if (categoryRef->Name() == category) {
|
||||
package->AddCategory(categoryRef);
|
||||
foundCategory = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debug_enabled && foundCategory)
|
||||
append_word_list(foundInfo, "categories");
|
||||
}
|
||||
|
||||
double derivedRating;
|
||||
if (data.FindDouble("derivedRating", &derivedRating) == B_OK) {
|
||||
RatingSummary summary;
|
||||
summary.averageRating = derivedRating;
|
||||
package->SetRatingSummary(summary);
|
||||
|
||||
if (debug_enabled)
|
||||
append_word_list(foundInfo, "rating");
|
||||
}
|
||||
|
||||
double prominenceOrdering;
|
||||
if (data.FindDouble("prominenceOrdering", &prominenceOrdering) == B_OK) {
|
||||
package->SetProminence(prominenceOrdering);
|
||||
|
||||
if (debug_enabled)
|
||||
append_word_list(foundInfo, "prominence");
|
||||
}
|
||||
|
||||
BString changelog;
|
||||
if (data.FindString("pkgChangelogContent", &changelog) == B_OK) {
|
||||
package->SetChangelog(changelog);
|
||||
|
||||
if (debug_enabled)
|
||||
append_word_list(foundInfo, "changelog");
|
||||
}
|
||||
|
||||
BMessage screenshots;
|
||||
if (data.FindMessage("pkgScreenshots", &screenshots) == B_OK) {
|
||||
package->ClearScreenshotInfos();
|
||||
bool foundScreenshot = false;
|
||||
int32 index = 0;
|
||||
while (true) {
|
||||
BString name;
|
||||
name << index++;
|
||||
|
||||
BMessage screenshot;
|
||||
if (screenshots.FindMessage(name, &screenshot) != B_OK)
|
||||
break;
|
||||
|
||||
BString code;
|
||||
double width;
|
||||
double height;
|
||||
double dataSize;
|
||||
if (screenshot.FindString("code", &code) == B_OK
|
||||
&& screenshot.FindDouble("width", &width) == B_OK
|
||||
&& screenshot.FindDouble("height", &height) == B_OK
|
||||
&& screenshot.FindDouble("length", &dataSize) == B_OK) {
|
||||
package->AddScreenshotInfo(ScreenshotInfo(code, (int32)width,
|
||||
(int32)height, (int32)dataSize));
|
||||
foundScreenshot = true;
|
||||
}
|
||||
}
|
||||
if (debug_enabled && foundScreenshot)
|
||||
append_word_list(foundInfo, "screenshots");
|
||||
}
|
||||
|
||||
if (debug_enabled && foundInfo.Length() > 0) {
|
||||
printf("Populated package info for %s: %s\n",
|
||||
package->Name().String(), foundInfo.String());
|
||||
}
|
||||
|
||||
// If the user already clicked this package, remove it from the
|
||||
// list of populated packages, so that clicking it again will
|
||||
// populate any additional information.
|
||||
// TODO: Trigger re-populating if the package is currently showing.
|
||||
fPopulatedPackages.Remove(package);
|
||||
printf("did populate package data for %" B_PRIi32 " depots\n", count);
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,10 +153,14 @@ public:
|
||||
private:
|
||||
status_t _DumpExportRepositoryDataPath(
|
||||
BPath& path) const;
|
||||
status_t _DumpExportPkgDataPath(BPath& path,
|
||||
const BString& repositorySourceCode) const;
|
||||
void _UpdateIsFeaturedFilter();
|
||||
|
||||
static int32 _PopulateAllPackagesEntry(void* cookie);
|
||||
void _PopulateAllPackagesThread(bool fromCacheOnly);
|
||||
void _PopulateAllPackagesThread();
|
||||
void _PopulatePackagesForDepot(
|
||||
const DepotInfo& depotInfo);
|
||||
|
||||
void _PopulateAllPackagesIcons();
|
||||
|
||||
@ -171,15 +175,6 @@ private:
|
||||
const char* fileName,
|
||||
bool ignoreAge, time_t maxAge) const;
|
||||
|
||||
void _PopulatePackageInfos(
|
||||
PackageList& packages,
|
||||
bool fromCacheOnly);
|
||||
void _PopulatePackageInfo(
|
||||
const PackageInfoRef& package,
|
||||
bool fromCacheOnly);
|
||||
void _PopulatePackageInfo(
|
||||
const PackageInfoRef& package,
|
||||
const BMessage& data);
|
||||
status_t _PopulatePackageIcon(
|
||||
const PackageInfoRef& package);
|
||||
void _PopulatePackageScreenshot(
|
||||
|
@ -1000,7 +1000,8 @@ DepotInfo::DepotInfo(const BString& name)
|
||||
:
|
||||
fName(name),
|
||||
fPackages(),
|
||||
fWebAppRepositoryCode()
|
||||
fWebAppRepositoryCode(),
|
||||
fWebAppRepositorySourceCode()
|
||||
{
|
||||
}
|
||||
|
||||
@ -1010,6 +1011,7 @@ DepotInfo::DepotInfo(const DepotInfo& other)
|
||||
fName(other.fName),
|
||||
fPackages(other.fPackages),
|
||||
fWebAppRepositoryCode(other.fWebAppRepositoryCode),
|
||||
fWebAppRepositorySourceCode(other.fWebAppRepositorySourceCode),
|
||||
fBaseURL(other.fBaseURL)
|
||||
{
|
||||
}
|
||||
@ -1022,6 +1024,7 @@ DepotInfo::operator=(const DepotInfo& other)
|
||||
fPackages = other.fPackages;
|
||||
fBaseURL = other.fBaseURL;
|
||||
fWebAppRepositoryCode = other.fWebAppRepositoryCode;
|
||||
fWebAppRepositorySourceCode = other.fWebAppRepositorySourceCode;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
275
src/apps/haikudepot/server/PkgDataUpdateProcess.cpp
Normal file
275
src/apps/haikudepot/server/PkgDataUpdateProcess.cpp
Normal file
@ -0,0 +1,275 @@
|
||||
/*
|
||||
* Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "PkgDataUpdateProcess.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <Autolock.h>
|
||||
#include <FileIO.h>
|
||||
#include <Url.h>
|
||||
|
||||
#include "Logger.h"
|
||||
#include "ServerSettings.h"
|
||||
#include "StorageUtils.h"
|
||||
#include "DumpExportPkg.h"
|
||||
#include "DumpExportPkgCategory.h"
|
||||
#include "DumpExportPkgJsonListener.h"
|
||||
#include "DumpExportPkgScreenshot.h"
|
||||
#include "DumpExportPkgVersion.h"
|
||||
|
||||
|
||||
/*! This package listener (not at the JSON level) is feeding in the
|
||||
packages as they are parsed and processing them.
|
||||
*/
|
||||
|
||||
class PackageFillingPkgListener : public DumpExportPkgListener {
|
||||
public:
|
||||
PackageFillingPkgListener(
|
||||
const PackageList& packages,
|
||||
const CategoryList& categories,
|
||||
BLocker& lock);
|
||||
virtual ~PackageFillingPkgListener();
|
||||
|
||||
virtual void Handle(DumpExportPkg* item);
|
||||
virtual void Complete();
|
||||
|
||||
private:
|
||||
int32 IndexOfPackageByName(const BString& name) const;
|
||||
int32 IndexOfCategoryByName(
|
||||
const BString& name) const;
|
||||
int32 IndexOfCategoryByCode(
|
||||
const BString& code) const;
|
||||
const PackageList& fPackages;
|
||||
const CategoryList& fCategories;
|
||||
BLocker& fLock;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
PackageFillingPkgListener::PackageFillingPkgListener(
|
||||
const PackageList& packages, const CategoryList& categories,
|
||||
BLocker& lock)
|
||||
:
|
||||
fPackages(packages),
|
||||
fCategories(categories),
|
||||
fLock(lock)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PackageFillingPkgListener::~PackageFillingPkgListener()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// TODO; performance could be improved by not needing the linear search
|
||||
|
||||
int32
|
||||
PackageFillingPkgListener::IndexOfPackageByName(
|
||||
const BString& name) const
|
||||
{
|
||||
int32 i;
|
||||
|
||||
for (i = 0; i < fPackages.CountItems(); i++) {
|
||||
const PackageInfoRef& packageInfo = fPackages.ItemAt(i);
|
||||
|
||||
if (packageInfo->Name() == name)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// TODO; performance could be improved by not needing the linear search
|
||||
|
||||
int32
|
||||
PackageFillingPkgListener::IndexOfCategoryByName(
|
||||
const BString& name) const
|
||||
{
|
||||
int32 i;
|
||||
|
||||
for (i = 0; i < fCategories.CountItems(); i++) {
|
||||
const CategoryRef categoryRef = fCategories.ItemAtFast(i);
|
||||
|
||||
if (categoryRef->Name() == name)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PackageFillingPkgListener::Handle(DumpExportPkg* pkg)
|
||||
{
|
||||
BAutolock locker(fLock); // lock from the model.
|
||||
int32 packageIndex = IndexOfPackageByName(*(pkg->Name()));
|
||||
|
||||
if (packageIndex == -1) {
|
||||
printf("unable to find package data for pkg name [%s]\n",
|
||||
pkg->Name()->String());
|
||||
} else {
|
||||
int32 i;
|
||||
const PackageInfoRef& packageInfo = fPackages.ItemAt(packageIndex);
|
||||
|
||||
if (0 != pkg->CountPkgVersions()) {
|
||||
|
||||
// this makes the assumption that the only version will be the
|
||||
// latest one.
|
||||
|
||||
DumpExportPkgVersion* pkgVersion = pkg->PkgVersionsItemAt(0);
|
||||
|
||||
if (!pkgVersion->TitleIsNull())
|
||||
packageInfo->SetTitle(*(pkgVersion->Title()));
|
||||
|
||||
if (!pkgVersion->SummaryIsNull())
|
||||
packageInfo->SetShortDescription(*(pkgVersion->Summary()));
|
||||
|
||||
if (!pkgVersion->DescriptionIsNull()) {
|
||||
packageInfo->SetFullDescription(*(pkgVersion->Description()));
|
||||
}
|
||||
|
||||
if (!pkgVersion->PayloadLengthIsNull())
|
||||
packageInfo->SetSize(pkgVersion->PayloadLength());
|
||||
}
|
||||
|
||||
for (i = 0; i < pkg->CountPkgCategories(); i++) {
|
||||
BString* categoryCode = pkg->PkgCategoriesItemAt(i)->Code();
|
||||
int categoryIndex = IndexOfCategoryByName(*(categoryCode));
|
||||
|
||||
if (categoryIndex == -1) {
|
||||
printf("unable to find the category for [%s]\n",
|
||||
categoryCode->String());
|
||||
} else {
|
||||
packageInfo->AddCategory(fCategories.ItemAtFast(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (!pkg->DerivedRatingIsNull()) {
|
||||
RatingSummary summary;
|
||||
summary.averageRating = pkg->DerivedRating();
|
||||
packageInfo->SetRatingSummary(summary);
|
||||
}
|
||||
|
||||
if (!pkg->ProminenceOrderingIsNull()) {
|
||||
packageInfo->SetProminence(pkg->ProminenceOrdering());
|
||||
}
|
||||
|
||||
if (!pkg->PkgChangelogContentIsNull()) {
|
||||
packageInfo->SetChangelog(*(pkg->PkgChangelogContent()));
|
||||
}
|
||||
|
||||
for (i = 0; i < pkg->CountPkgScreenshots(); i++) {
|
||||
DumpExportPkgScreenshot* screenshot = pkg->PkgScreenshotsItemAt(i);
|
||||
packageInfo->AddScreenshotInfo(ScreenshotInfo(
|
||||
*(screenshot->Code()),
|
||||
static_cast<int32>(screenshot->Width()),
|
||||
static_cast<int32>(screenshot->Height()),
|
||||
static_cast<int32>(screenshot->Length())
|
||||
));
|
||||
}
|
||||
|
||||
if (Logger::IsDebugEnabled()) {
|
||||
printf("did populate data for [%s]\n", pkg->Name()->String());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PackageFillingPkgListener::Complete()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PkgDataUpdateProcess::PkgDataUpdateProcess(
|
||||
const BPath& localFilePath,
|
||||
BLocker& lock,
|
||||
BString repositorySourceCode,
|
||||
BString naturalLanguageCode,
|
||||
const PackageList& packages,
|
||||
const CategoryList& categories)
|
||||
:
|
||||
fLocalFilePath(localFilePath),
|
||||
fNaturalLanguageCode(naturalLanguageCode),
|
||||
fRepositorySourceCode(repositorySourceCode),
|
||||
fPackages(packages),
|
||||
fCategories(categories),
|
||||
fLock(lock)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PkgDataUpdateProcess::~PkgDataUpdateProcess()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
PkgDataUpdateProcess::Run()
|
||||
{
|
||||
printf("will fetch packages' data\n");
|
||||
|
||||
BString urlPath;
|
||||
urlPath.SetToFormat("/__pkg/all-%s-%s.json.gz",
|
||||
fRepositorySourceCode.String(),
|
||||
fNaturalLanguageCode.String());
|
||||
|
||||
status_t result = DownloadToLocalFile(fLocalFilePath,
|
||||
ServerSettings::CreateFullUrl(urlPath),
|
||||
0, 0);
|
||||
|
||||
if (result == B_OK || result == APP_ERR_NOT_MODIFIED) {
|
||||
printf("did fetch packages' data\n");
|
||||
|
||||
// now load the data in and process it.
|
||||
|
||||
printf("will process packages' data\n");
|
||||
result = PopulateDataToDepots();
|
||||
printf("did process packages' data\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
PkgDataUpdateProcess::PopulateDataToDepots()
|
||||
{
|
||||
PackageFillingPkgListener* itemListener =
|
||||
new PackageFillingPkgListener(fPackages, fCategories, fLock);
|
||||
|
||||
BJsonEventListener* listener =
|
||||
new BulkContainerDumpExportPkgJsonListener(itemListener);
|
||||
|
||||
return ParseJsonFromFileWithListener(listener, fLocalFilePath);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PkgDataUpdateProcess::GetStandardMetaDataPath(BPath& path) const
|
||||
{
|
||||
path.SetTo(fLocalFilePath.Path());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PkgDataUpdateProcess::GetStandardMetaDataJsonPath(
|
||||
BString& jsonPath) const
|
||||
{
|
||||
jsonPath.SetTo("$.info");
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
PkgDataUpdateProcess::LoggingName() const
|
||||
{
|
||||
return "pkg-data-update";
|
||||
}
|
51
src/apps/haikudepot/server/PkgDataUpdateProcess.h
Normal file
51
src/apps/haikudepot/server/PkgDataUpdateProcess.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef PACKAGE_DATA_UPDATE_PROCESS_H
|
||||
#define PACKAGE_DATA_UPDATE_PROCESS_H
|
||||
|
||||
|
||||
#include "AbstractServerProcess.h"
|
||||
|
||||
#include "PackageInfo.h"
|
||||
|
||||
#include <File.h>
|
||||
#include <Path.h>
|
||||
#include <String.h>
|
||||
#include <Url.h>
|
||||
|
||||
|
||||
class PkgDataUpdateProcess : public AbstractServerProcess {
|
||||
public:
|
||||
PkgDataUpdateProcess(
|
||||
const BPath& localFilePath,
|
||||
BLocker& lock,
|
||||
BString naturalLanguageCode,
|
||||
BString repositorySourceCode,
|
||||
const PackageList& packages,
|
||||
const CategoryList& categories);
|
||||
virtual ~PkgDataUpdateProcess();
|
||||
|
||||
status_t Run();
|
||||
|
||||
protected:
|
||||
void GetStandardMetaDataPath(BPath& path) const;
|
||||
void GetStandardMetaDataJsonPath(
|
||||
BString& jsonPath) const;
|
||||
const char* LoggingName() const;
|
||||
|
||||
private:
|
||||
status_t PopulateDataToDepots();
|
||||
|
||||
BPath fLocalFilePath;
|
||||
BString fNaturalLanguageCode;
|
||||
BString fRepositorySourceCode;
|
||||
const PackageList& fPackages;
|
||||
const CategoryList& fCategories;
|
||||
BLocker& fLock;
|
||||
|
||||
};
|
||||
|
||||
#endif // PACKAGE_DATA_UPDATE_PROCESS_H
|
@ -78,7 +78,7 @@ DepotMatchingRepositoryListener::IsUnassociatedDepotByUrl(
|
||||
const DepotInfo& depotInfo, const BString& urlStr) const
|
||||
{
|
||||
if (depotInfo.BaseURL().Length() > 0
|
||||
&& depotInfo.WebAppRepositoryCode().Length() == 0) {
|
||||
&& depotInfo.WebAppRepositorySourceCode().Length() == 0) {
|
||||
BUrl depotInfoBaseUrl(depotInfo.BaseURL());
|
||||
BUrl url(urlStr);
|
||||
|
||||
@ -129,7 +129,7 @@ DepotMatchingRepositoryListener::Handle(DumpExportRepository* repository)
|
||||
BString(*(repositorySource->Code())));
|
||||
fDepotList->Replace(depotIndex, modifiedDepotInfo);
|
||||
|
||||
printf("associated depot [%s] with haiku depot server"
|
||||
printf("associated depot [%s] with server"
|
||||
" repository source [%s]\n", modifiedDepotInfo.Name().String(),
|
||||
repositorySource->Code()->String());
|
||||
}
|
||||
@ -182,7 +182,7 @@ RepositoryDataUpdateProcess::Run()
|
||||
ServerSettings::CreateFullUrl("/__repository/all-en.json.gz"),
|
||||
0, 0);
|
||||
|
||||
if (result == B_OK) {
|
||||
if (result == B_OK || result == APP_ERR_NOT_MODIFIED) {
|
||||
printf("did fetch repositories data\n");
|
||||
|
||||
// now load the data in and process it.
|
||||
@ -190,6 +190,8 @@ RepositoryDataUpdateProcess::Run()
|
||||
printf("will process repository data and match to depots\n");
|
||||
result = PopulateDataToDepots();
|
||||
printf("did process repository data and match to depots\n");
|
||||
} else {
|
||||
printf("an error has arisen downloading the repositories' data\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -41,4 +41,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // SERVER_ICON_EXPORT_UPDATE_PROCESS_H
|
||||
#endif // REPOSITORY_DATA_UPDATE_PROCESS_H
|
||||
|
345
src/apps/haikudepot/server/dumpexportpkg/DumpExportPkg.cpp
Normal file
345
src/apps/haikudepot/server/dumpexportpkg/DumpExportPkg.cpp
Normal file
@ -0,0 +1,345 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-11-05T22:30:10.254264
|
||||
*/
|
||||
#include "DumpExportPkg.h"
|
||||
|
||||
|
||||
DumpExportPkg::DumpExportPkg()
|
||||
{
|
||||
fPkgChangelogContent = NULL;
|
||||
fName = NULL;
|
||||
fPkgVersions = NULL;
|
||||
fDerivedRating = NULL;
|
||||
fPkgScreenshots = NULL;
|
||||
fProminenceOrdering = NULL;
|
||||
fPkgCategories = NULL;
|
||||
fModifyTimestamp = NULL;
|
||||
}
|
||||
|
||||
|
||||
DumpExportPkg::~DumpExportPkg()
|
||||
{
|
||||
int32 i;
|
||||
|
||||
if (fPkgChangelogContent != NULL) {
|
||||
delete fPkgChangelogContent;
|
||||
}
|
||||
|
||||
if (fName != NULL) {
|
||||
delete fName;
|
||||
}
|
||||
|
||||
if (fPkgVersions != NULL) {
|
||||
int32 count = fPkgVersions->CountItems();
|
||||
for (i = 0; i < count; i++)
|
||||
delete fPkgVersions->ItemAt(i);
|
||||
delete fPkgVersions;
|
||||
}
|
||||
|
||||
if (fDerivedRating != NULL) {
|
||||
delete fDerivedRating;
|
||||
}
|
||||
|
||||
if (fPkgScreenshots != NULL) {
|
||||
int32 count = fPkgScreenshots->CountItems();
|
||||
for (i = 0; i < count; i++)
|
||||
delete fPkgScreenshots->ItemAt(i);
|
||||
delete fPkgScreenshots;
|
||||
}
|
||||
|
||||
if (fProminenceOrdering != NULL) {
|
||||
delete fProminenceOrdering;
|
||||
}
|
||||
|
||||
if (fPkgCategories != NULL) {
|
||||
int32 count = fPkgCategories->CountItems();
|
||||
for (i = 0; i < count; i++)
|
||||
delete fPkgCategories->ItemAt(i);
|
||||
delete fPkgCategories;
|
||||
}
|
||||
|
||||
if (fModifyTimestamp != NULL) {
|
||||
delete fModifyTimestamp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BString*
|
||||
DumpExportPkg::PkgChangelogContent()
|
||||
{
|
||||
return fPkgChangelogContent;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetPkgChangelogContent(BString* value)
|
||||
{
|
||||
fPkgChangelogContent = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetPkgChangelogContentNull()
|
||||
{
|
||||
if (!PkgChangelogContentIsNull()) {
|
||||
delete fPkgChangelogContent;
|
||||
fPkgChangelogContent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkg::PkgChangelogContentIsNull()
|
||||
{
|
||||
return fPkgChangelogContent == NULL;
|
||||
}
|
||||
|
||||
|
||||
BString*
|
||||
DumpExportPkg::Name()
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetName(BString* value)
|
||||
{
|
||||
fName = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetNameNull()
|
||||
{
|
||||
if (!NameIsNull()) {
|
||||
delete fName;
|
||||
fName = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkg::NameIsNull()
|
||||
{
|
||||
return fName == NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::AddToPkgVersions(DumpExportPkgVersion* value)
|
||||
{
|
||||
if (fPkgVersions == NULL)
|
||||
fPkgVersions = new List<DumpExportPkgVersion*, true>();
|
||||
fPkgVersions->Add(value);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetPkgVersions(List<DumpExportPkgVersion*, true>* value)
|
||||
{
|
||||
fPkgVersions = value;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
DumpExportPkg::CountPkgVersions()
|
||||
{
|
||||
if (fPkgVersions == NULL)
|
||||
return 0;
|
||||
return fPkgVersions->CountItems();
|
||||
}
|
||||
|
||||
|
||||
DumpExportPkgVersion*
|
||||
DumpExportPkg::PkgVersionsItemAt(int32 index)
|
||||
{
|
||||
return fPkgVersions->ItemAt(index);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkg::PkgVersionsIsNull()
|
||||
{
|
||||
return fPkgVersions == NULL;
|
||||
}
|
||||
|
||||
|
||||
double
|
||||
DumpExportPkg::DerivedRating()
|
||||
{
|
||||
return *fDerivedRating;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetDerivedRating(double value)
|
||||
{
|
||||
if (DerivedRatingIsNull())
|
||||
fDerivedRating = new double[1];
|
||||
fDerivedRating[0] = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetDerivedRatingNull()
|
||||
{
|
||||
if (!DerivedRatingIsNull()) {
|
||||
delete fDerivedRating;
|
||||
fDerivedRating = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkg::DerivedRatingIsNull()
|
||||
{
|
||||
return fDerivedRating == NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::AddToPkgScreenshots(DumpExportPkgScreenshot* value)
|
||||
{
|
||||
if (fPkgScreenshots == NULL)
|
||||
fPkgScreenshots = new List<DumpExportPkgScreenshot*, true>();
|
||||
fPkgScreenshots->Add(value);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetPkgScreenshots(List<DumpExportPkgScreenshot*, true>* value)
|
||||
{
|
||||
fPkgScreenshots = value;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
DumpExportPkg::CountPkgScreenshots()
|
||||
{
|
||||
if (fPkgScreenshots == NULL)
|
||||
return 0;
|
||||
return fPkgScreenshots->CountItems();
|
||||
}
|
||||
|
||||
|
||||
DumpExportPkgScreenshot*
|
||||
DumpExportPkg::PkgScreenshotsItemAt(int32 index)
|
||||
{
|
||||
return fPkgScreenshots->ItemAt(index);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkg::PkgScreenshotsIsNull()
|
||||
{
|
||||
return fPkgScreenshots == NULL;
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
DumpExportPkg::ProminenceOrdering()
|
||||
{
|
||||
return *fProminenceOrdering;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetProminenceOrdering(int64 value)
|
||||
{
|
||||
if (ProminenceOrderingIsNull())
|
||||
fProminenceOrdering = new int64[1];
|
||||
fProminenceOrdering[0] = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetProminenceOrderingNull()
|
||||
{
|
||||
if (!ProminenceOrderingIsNull()) {
|
||||
delete fProminenceOrdering;
|
||||
fProminenceOrdering = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkg::ProminenceOrderingIsNull()
|
||||
{
|
||||
return fProminenceOrdering == NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::AddToPkgCategories(DumpExportPkgCategory* value)
|
||||
{
|
||||
if (fPkgCategories == NULL)
|
||||
fPkgCategories = new List<DumpExportPkgCategory*, true>();
|
||||
fPkgCategories->Add(value);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetPkgCategories(List<DumpExportPkgCategory*, true>* value)
|
||||
{
|
||||
fPkgCategories = value;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
DumpExportPkg::CountPkgCategories()
|
||||
{
|
||||
if (fPkgCategories == NULL)
|
||||
return 0;
|
||||
return fPkgCategories->CountItems();
|
||||
}
|
||||
|
||||
|
||||
DumpExportPkgCategory*
|
||||
DumpExportPkg::PkgCategoriesItemAt(int32 index)
|
||||
{
|
||||
return fPkgCategories->ItemAt(index);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkg::PkgCategoriesIsNull()
|
||||
{
|
||||
return fPkgCategories == NULL;
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
DumpExportPkg::ModifyTimestamp()
|
||||
{
|
||||
return *fModifyTimestamp;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetModifyTimestamp(int64 value)
|
||||
{
|
||||
if (ModifyTimestampIsNull())
|
||||
fModifyTimestamp = new int64[1];
|
||||
fModifyTimestamp[0] = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkg::SetModifyTimestampNull()
|
||||
{
|
||||
if (!ModifyTimestampIsNull()) {
|
||||
delete fModifyTimestamp;
|
||||
fModifyTimestamp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkg::ModifyTimestampIsNull()
|
||||
{
|
||||
return fModifyTimestamp == NULL;
|
||||
}
|
||||
|
79
src/apps/haikudepot/server/dumpexportpkg/DumpExportPkg.h
Normal file
79
src/apps/haikudepot/server/dumpexportpkg/DumpExportPkg.h
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-11-05T22:30:10.253178
|
||||
*/
|
||||
|
||||
#ifndef GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKG_H
|
||||
#define GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKG_H
|
||||
|
||||
#include "List.h"
|
||||
#include "String.h"
|
||||
|
||||
#include "DumpExportPkgVersion.h"
|
||||
#include "DumpExportPkgScreenshot.h"
|
||||
#include "DumpExportPkgCategory.h"
|
||||
|
||||
class DumpExportPkg {
|
||||
public:
|
||||
DumpExportPkg();
|
||||
virtual ~DumpExportPkg();
|
||||
|
||||
BString* PkgChangelogContent();
|
||||
void SetPkgChangelogContent(BString* value);
|
||||
void SetPkgChangelogContentNull();
|
||||
bool PkgChangelogContentIsNull();
|
||||
|
||||
BString* Name();
|
||||
void SetName(BString* value);
|
||||
void SetNameNull();
|
||||
bool NameIsNull();
|
||||
|
||||
void AddToPkgVersions(DumpExportPkgVersion* value);
|
||||
void SetPkgVersions(List<DumpExportPkgVersion*, true>* value);
|
||||
int32 CountPkgVersions();
|
||||
DumpExportPkgVersion* PkgVersionsItemAt(int32 index);
|
||||
bool PkgVersionsIsNull();
|
||||
|
||||
|
||||
double DerivedRating();
|
||||
void SetDerivedRating(double value);
|
||||
void SetDerivedRatingNull();
|
||||
bool DerivedRatingIsNull();
|
||||
|
||||
void AddToPkgScreenshots(DumpExportPkgScreenshot* value);
|
||||
void SetPkgScreenshots(List<DumpExportPkgScreenshot*, true>* value);
|
||||
int32 CountPkgScreenshots();
|
||||
DumpExportPkgScreenshot* PkgScreenshotsItemAt(int32 index);
|
||||
bool PkgScreenshotsIsNull();
|
||||
|
||||
|
||||
int64 ProminenceOrdering();
|
||||
void SetProminenceOrdering(int64 value);
|
||||
void SetProminenceOrderingNull();
|
||||
bool ProminenceOrderingIsNull();
|
||||
|
||||
void AddToPkgCategories(DumpExportPkgCategory* value);
|
||||
void SetPkgCategories(List<DumpExportPkgCategory*, true>* value);
|
||||
int32 CountPkgCategories();
|
||||
DumpExportPkgCategory* PkgCategoriesItemAt(int32 index);
|
||||
bool PkgCategoriesIsNull();
|
||||
|
||||
|
||||
int64 ModifyTimestamp();
|
||||
void SetModifyTimestamp(int64 value);
|
||||
void SetModifyTimestampNull();
|
||||
bool ModifyTimestampIsNull();
|
||||
|
||||
private:
|
||||
BString* fPkgChangelogContent;
|
||||
BString* fName;
|
||||
List <DumpExportPkgVersion*, true>* fPkgVersions;
|
||||
double* fDerivedRating;
|
||||
List <DumpExportPkgScreenshot*, true>* fPkgScreenshots;
|
||||
int64* fProminenceOrdering;
|
||||
List <DumpExportPkgCategory*, true>* fPkgCategories;
|
||||
int64* fModifyTimestamp;
|
||||
};
|
||||
|
||||
#endif // GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKG_H
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-11-05T22:30:10.260503
|
||||
*/
|
||||
#include "DumpExportPkgCategory.h"
|
||||
|
||||
|
||||
DumpExportPkgCategory::DumpExportPkgCategory()
|
||||
{
|
||||
fCode = NULL;
|
||||
}
|
||||
|
||||
|
||||
DumpExportPkgCategory::~DumpExportPkgCategory()
|
||||
{
|
||||
if (fCode != NULL) {
|
||||
delete fCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BString*
|
||||
DumpExportPkgCategory::Code()
|
||||
{
|
||||
return fCode;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgCategory::SetCode(BString* value)
|
||||
{
|
||||
fCode = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgCategory::SetCodeNull()
|
||||
{
|
||||
if (!CodeIsNull()) {
|
||||
delete fCode;
|
||||
fCode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgCategory::CodeIsNull()
|
||||
{
|
||||
return fCode == NULL;
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-11-05T22:30:10.259170
|
||||
*/
|
||||
|
||||
#ifndef GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKGCATEGORY_H
|
||||
#define GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKGCATEGORY_H
|
||||
|
||||
#include "List.h"
|
||||
#include "String.h"
|
||||
|
||||
|
||||
class DumpExportPkgCategory {
|
||||
public:
|
||||
DumpExportPkgCategory();
|
||||
virtual ~DumpExportPkgCategory();
|
||||
|
||||
BString* Code();
|
||||
void SetCode(BString* value);
|
||||
void SetCodeNull();
|
||||
bool CodeIsNull();
|
||||
|
||||
private:
|
||||
BString* fCode;
|
||||
};
|
||||
|
||||
#endif // GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKGCATEGORY_H
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Generated Listener Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-11-11T14:09:03.498089
|
||||
*/
|
||||
|
||||
#ifndef GEN_JSON_SCHEMA_PARSER__SINGLEDUMPEXPORTPKGJSONLISTENER_H
|
||||
#define GEN_JSON_SCHEMA_PARSER__SINGLEDUMPEXPORTPKGJSONLISTENER_H
|
||||
|
||||
#include <JsonEventListener.h>
|
||||
|
||||
#include "DumpExportPkg.h"
|
||||
|
||||
class AbstractStackedDumpExportPkgJsonListener;
|
||||
|
||||
class AbstractMainDumpExportPkgJsonListener : public BJsonEventListener {
|
||||
friend class AbstractStackedDumpExportPkgJsonListener;
|
||||
public:
|
||||
AbstractMainDumpExportPkgJsonListener();
|
||||
virtual ~AbstractMainDumpExportPkgJsonListener();
|
||||
|
||||
void HandleError(status_t status, int32 line, const char* message);
|
||||
void Complete();
|
||||
status_t ErrorStatus();
|
||||
|
||||
protected:
|
||||
void SetStackedListener(
|
||||
AbstractStackedDumpExportPkgJsonListener* listener);
|
||||
status_t fErrorStatus;
|
||||
AbstractStackedDumpExportPkgJsonListener* fStackedListener;
|
||||
};
|
||||
|
||||
|
||||
/*! Use this listener when you want to parse some JSON data that contains
|
||||
just a single instance of DumpExportPkg.
|
||||
*/
|
||||
class SingleDumpExportPkgJsonListener
|
||||
: public AbstractMainDumpExportPkgJsonListener {
|
||||
friend class AbstractStackedDumpExportPkgJsonListener;
|
||||
public:
|
||||
SingleDumpExportPkgJsonListener();
|
||||
virtual ~SingleDumpExportPkgJsonListener();
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
DumpExportPkg* Target();
|
||||
|
||||
private:
|
||||
DumpExportPkg* fTarget;
|
||||
};
|
||||
|
||||
|
||||
/*! Concrete sub-classes of this class are able to respond to each
|
||||
DumpExportPkg* instance as
|
||||
it is parsed from the bulk container. When the stream is
|
||||
finished, the Complete() method is invoked.
|
||||
|
||||
Note that the item object will be deleted after the Handle method
|
||||
is invoked. The Handle method need not take responsibility
|
||||
for deleting the item itself.
|
||||
*/
|
||||
class DumpExportPkgListener {
|
||||
public:
|
||||
virtual void Handle(DumpExportPkg* item) = 0;
|
||||
virtual void Complete() = 0;
|
||||
};
|
||||
|
||||
|
||||
/*! Use this listener, together with an instance of a concrete
|
||||
subclass of DumpExportPkgListener
|
||||
in order to parse the JSON data in a specific "bulk
|
||||
container" format. Each time that an instance of
|
||||
DumpExportPkg
|
||||
is parsed, the instance item listener will be invoked.
|
||||
*/
|
||||
class BulkContainerDumpExportPkgJsonListener
|
||||
: public AbstractMainDumpExportPkgJsonListener {
|
||||
friend class AbstractStackedDumpExportPkgJsonListener;
|
||||
public:
|
||||
BulkContainerDumpExportPkgJsonListener(
|
||||
DumpExportPkgListener* itemListener);
|
||||
~BulkContainerDumpExportPkgJsonListener();
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
private:
|
||||
DumpExportPkgListener* fItemListener;
|
||||
};
|
||||
|
||||
#endif // GEN_JSON_SCHEMA_PARSER__SINGLEDUMPEXPORTPKGJSONLISTENER_H
|
@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-11-05T22:30:10.257444
|
||||
*/
|
||||
#include "DumpExportPkgScreenshot.h"
|
||||
|
||||
|
||||
DumpExportPkgScreenshot::DumpExportPkgScreenshot()
|
||||
{
|
||||
fOrdering = NULL;
|
||||
fWidth = NULL;
|
||||
fLength = NULL;
|
||||
fCode = NULL;
|
||||
fHeight = NULL;
|
||||
}
|
||||
|
||||
|
||||
DumpExportPkgScreenshot::~DumpExportPkgScreenshot()
|
||||
{
|
||||
if (fOrdering != NULL) {
|
||||
delete fOrdering;
|
||||
}
|
||||
|
||||
if (fWidth != NULL) {
|
||||
delete fWidth;
|
||||
}
|
||||
|
||||
if (fLength != NULL) {
|
||||
delete fLength;
|
||||
}
|
||||
|
||||
if (fCode != NULL) {
|
||||
delete fCode;
|
||||
}
|
||||
|
||||
if (fHeight != NULL) {
|
||||
delete fHeight;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int64
|
||||
DumpExportPkgScreenshot::Ordering()
|
||||
{
|
||||
return *fOrdering;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetOrdering(int64 value)
|
||||
{
|
||||
if (OrderingIsNull())
|
||||
fOrdering = new int64[1];
|
||||
fOrdering[0] = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetOrderingNull()
|
||||
{
|
||||
if (!OrderingIsNull()) {
|
||||
delete fOrdering;
|
||||
fOrdering = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgScreenshot::OrderingIsNull()
|
||||
{
|
||||
return fOrdering == NULL;
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
DumpExportPkgScreenshot::Width()
|
||||
{
|
||||
return *fWidth;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetWidth(int64 value)
|
||||
{
|
||||
if (WidthIsNull())
|
||||
fWidth = new int64[1];
|
||||
fWidth[0] = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetWidthNull()
|
||||
{
|
||||
if (!WidthIsNull()) {
|
||||
delete fWidth;
|
||||
fWidth = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgScreenshot::WidthIsNull()
|
||||
{
|
||||
return fWidth == NULL;
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
DumpExportPkgScreenshot::Length()
|
||||
{
|
||||
return *fLength;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetLength(int64 value)
|
||||
{
|
||||
if (LengthIsNull())
|
||||
fLength = new int64[1];
|
||||
fLength[0] = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetLengthNull()
|
||||
{
|
||||
if (!LengthIsNull()) {
|
||||
delete fLength;
|
||||
fLength = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgScreenshot::LengthIsNull()
|
||||
{
|
||||
return fLength == NULL;
|
||||
}
|
||||
|
||||
|
||||
BString*
|
||||
DumpExportPkgScreenshot::Code()
|
||||
{
|
||||
return fCode;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetCode(BString* value)
|
||||
{
|
||||
fCode = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetCodeNull()
|
||||
{
|
||||
if (!CodeIsNull()) {
|
||||
delete fCode;
|
||||
fCode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgScreenshot::CodeIsNull()
|
||||
{
|
||||
return fCode == NULL;
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
DumpExportPkgScreenshot::Height()
|
||||
{
|
||||
return *fHeight;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetHeight(int64 value)
|
||||
{
|
||||
if (HeightIsNull())
|
||||
fHeight = new int64[1];
|
||||
fHeight[0] = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgScreenshot::SetHeightNull()
|
||||
{
|
||||
if (!HeightIsNull()) {
|
||||
delete fHeight;
|
||||
fHeight = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgScreenshot::HeightIsNull()
|
||||
{
|
||||
return fHeight == NULL;
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-11-05T22:30:10.256842
|
||||
*/
|
||||
|
||||
#ifndef GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKGSCREENSHOT_H
|
||||
#define GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKGSCREENSHOT_H
|
||||
|
||||
#include "List.h"
|
||||
#include "String.h"
|
||||
|
||||
|
||||
class DumpExportPkgScreenshot {
|
||||
public:
|
||||
DumpExportPkgScreenshot();
|
||||
virtual ~DumpExportPkgScreenshot();
|
||||
|
||||
|
||||
int64 Ordering();
|
||||
void SetOrdering(int64 value);
|
||||
void SetOrderingNull();
|
||||
bool OrderingIsNull();
|
||||
|
||||
|
||||
int64 Width();
|
||||
void SetWidth(int64 value);
|
||||
void SetWidthNull();
|
||||
bool WidthIsNull();
|
||||
|
||||
|
||||
int64 Length();
|
||||
void SetLength(int64 value);
|
||||
void SetLengthNull();
|
||||
bool LengthIsNull();
|
||||
|
||||
BString* Code();
|
||||
void SetCode(BString* value);
|
||||
void SetCodeNull();
|
||||
bool CodeIsNull();
|
||||
|
||||
|
||||
int64 Height();
|
||||
void SetHeight(int64 value);
|
||||
void SetHeightNull();
|
||||
bool HeightIsNull();
|
||||
|
||||
private:
|
||||
int64* fOrdering;
|
||||
int64* fWidth;
|
||||
int64* fLength;
|
||||
BString* fCode;
|
||||
int64* fHeight;
|
||||
};
|
||||
|
||||
#endif // GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKGSCREENSHOT_H
|
@ -0,0 +1,380 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-11-05T22:30:10.255929
|
||||
*/
|
||||
#include "DumpExportPkgVersion.h"
|
||||
|
||||
|
||||
DumpExportPkgVersion::DumpExportPkgVersion()
|
||||
{
|
||||
fMajor = NULL;
|
||||
fPayloadLength = NULL;
|
||||
fDescription = NULL;
|
||||
fTitle = NULL;
|
||||
fSummary = NULL;
|
||||
fMicro = NULL;
|
||||
fPreRelease = NULL;
|
||||
fArchitectureCode = NULL;
|
||||
fMinor = NULL;
|
||||
fRevision = NULL;
|
||||
}
|
||||
|
||||
|
||||
DumpExportPkgVersion::~DumpExportPkgVersion()
|
||||
{
|
||||
if (fMajor != NULL) {
|
||||
delete fMajor;
|
||||
}
|
||||
|
||||
if (fPayloadLength != NULL) {
|
||||
delete fPayloadLength;
|
||||
}
|
||||
|
||||
if (fDescription != NULL) {
|
||||
delete fDescription;
|
||||
}
|
||||
|
||||
if (fTitle != NULL) {
|
||||
delete fTitle;
|
||||
}
|
||||
|
||||
if (fSummary != NULL) {
|
||||
delete fSummary;
|
||||
}
|
||||
|
||||
if (fMicro != NULL) {
|
||||
delete fMicro;
|
||||
}
|
||||
|
||||
if (fPreRelease != NULL) {
|
||||
delete fPreRelease;
|
||||
}
|
||||
|
||||
if (fArchitectureCode != NULL) {
|
||||
delete fArchitectureCode;
|
||||
}
|
||||
|
||||
if (fMinor != NULL) {
|
||||
delete fMinor;
|
||||
}
|
||||
|
||||
if (fRevision != NULL) {
|
||||
delete fRevision;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BString*
|
||||
DumpExportPkgVersion::Major()
|
||||
{
|
||||
return fMajor;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetMajor(BString* value)
|
||||
{
|
||||
fMajor = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetMajorNull()
|
||||
{
|
||||
if (!MajorIsNull()) {
|
||||
delete fMajor;
|
||||
fMajor = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::MajorIsNull()
|
||||
{
|
||||
return fMajor == NULL;
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
DumpExportPkgVersion::PayloadLength()
|
||||
{
|
||||
return *fPayloadLength;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetPayloadLength(int64 value)
|
||||
{
|
||||
if (PayloadLengthIsNull())
|
||||
fPayloadLength = new int64[1];
|
||||
fPayloadLength[0] = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetPayloadLengthNull()
|
||||
{
|
||||
if (!PayloadLengthIsNull()) {
|
||||
delete fPayloadLength;
|
||||
fPayloadLength = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::PayloadLengthIsNull()
|
||||
{
|
||||
return fPayloadLength == NULL;
|
||||
}
|
||||
|
||||
|
||||
BString*
|
||||
DumpExportPkgVersion::Description()
|
||||
{
|
||||
return fDescription;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetDescription(BString* value)
|
||||
{
|
||||
fDescription = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetDescriptionNull()
|
||||
{
|
||||
if (!DescriptionIsNull()) {
|
||||
delete fDescription;
|
||||
fDescription = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::DescriptionIsNull()
|
||||
{
|
||||
return fDescription == NULL;
|
||||
}
|
||||
|
||||
|
||||
BString*
|
||||
DumpExportPkgVersion::Title()
|
||||
{
|
||||
return fTitle;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetTitle(BString* value)
|
||||
{
|
||||
fTitle = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetTitleNull()
|
||||
{
|
||||
if (!TitleIsNull()) {
|
||||
delete fTitle;
|
||||
fTitle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::TitleIsNull()
|
||||
{
|
||||
return fTitle == NULL;
|
||||
}
|
||||
|
||||
|
||||
BString*
|
||||
DumpExportPkgVersion::Summary()
|
||||
{
|
||||
return fSummary;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetSummary(BString* value)
|
||||
{
|
||||
fSummary = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetSummaryNull()
|
||||
{
|
||||
if (!SummaryIsNull()) {
|
||||
delete fSummary;
|
||||
fSummary = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::SummaryIsNull()
|
||||
{
|
||||
return fSummary == NULL;
|
||||
}
|
||||
|
||||
|
||||
BString*
|
||||
DumpExportPkgVersion::Micro()
|
||||
{
|
||||
return fMicro;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetMicro(BString* value)
|
||||
{
|
||||
fMicro = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetMicroNull()
|
||||
{
|
||||
if (!MicroIsNull()) {
|
||||
delete fMicro;
|
||||
fMicro = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::MicroIsNull()
|
||||
{
|
||||
return fMicro == NULL;
|
||||
}
|
||||
|
||||
|
||||
BString*
|
||||
DumpExportPkgVersion::PreRelease()
|
||||
{
|
||||
return fPreRelease;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetPreRelease(BString* value)
|
||||
{
|
||||
fPreRelease = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetPreReleaseNull()
|
||||
{
|
||||
if (!PreReleaseIsNull()) {
|
||||
delete fPreRelease;
|
||||
fPreRelease = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::PreReleaseIsNull()
|
||||
{
|
||||
return fPreRelease == NULL;
|
||||
}
|
||||
|
||||
|
||||
BString*
|
||||
DumpExportPkgVersion::ArchitectureCode()
|
||||
{
|
||||
return fArchitectureCode;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetArchitectureCode(BString* value)
|
||||
{
|
||||
fArchitectureCode = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetArchitectureCodeNull()
|
||||
{
|
||||
if (!ArchitectureCodeIsNull()) {
|
||||
delete fArchitectureCode;
|
||||
fArchitectureCode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::ArchitectureCodeIsNull()
|
||||
{
|
||||
return fArchitectureCode == NULL;
|
||||
}
|
||||
|
||||
|
||||
BString*
|
||||
DumpExportPkgVersion::Minor()
|
||||
{
|
||||
return fMinor;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetMinor(BString* value)
|
||||
{
|
||||
fMinor = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetMinorNull()
|
||||
{
|
||||
if (!MinorIsNull()) {
|
||||
delete fMinor;
|
||||
fMinor = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::MinorIsNull()
|
||||
{
|
||||
return fMinor == NULL;
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
DumpExportPkgVersion::Revision()
|
||||
{
|
||||
return *fRevision;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetRevision(int64 value)
|
||||
{
|
||||
if (RevisionIsNull())
|
||||
fRevision = new int64[1];
|
||||
fRevision[0] = value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportPkgVersion::SetRevisionNull()
|
||||
{
|
||||
if (!RevisionIsNull()) {
|
||||
delete fRevision;
|
||||
fRevision = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportPkgVersion::RevisionIsNull()
|
||||
{
|
||||
return fRevision == NULL;
|
||||
}
|
||||
|
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-11-05T22:30:10.255268
|
||||
*/
|
||||
|
||||
#ifndef GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKGVERSION_H
|
||||
#define GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKGVERSION_H
|
||||
|
||||
#include "List.h"
|
||||
#include "String.h"
|
||||
|
||||
|
||||
class DumpExportPkgVersion {
|
||||
public:
|
||||
DumpExportPkgVersion();
|
||||
virtual ~DumpExportPkgVersion();
|
||||
|
||||
BString* Major();
|
||||
void SetMajor(BString* value);
|
||||
void SetMajorNull();
|
||||
bool MajorIsNull();
|
||||
|
||||
|
||||
int64 PayloadLength();
|
||||
void SetPayloadLength(int64 value);
|
||||
void SetPayloadLengthNull();
|
||||
bool PayloadLengthIsNull();
|
||||
|
||||
BString* Description();
|
||||
void SetDescription(BString* value);
|
||||
void SetDescriptionNull();
|
||||
bool DescriptionIsNull();
|
||||
|
||||
BString* Title();
|
||||
void SetTitle(BString* value);
|
||||
void SetTitleNull();
|
||||
bool TitleIsNull();
|
||||
|
||||
BString* Summary();
|
||||
void SetSummary(BString* value);
|
||||
void SetSummaryNull();
|
||||
bool SummaryIsNull();
|
||||
|
||||
BString* Micro();
|
||||
void SetMicro(BString* value);
|
||||
void SetMicroNull();
|
||||
bool MicroIsNull();
|
||||
|
||||
BString* PreRelease();
|
||||
void SetPreRelease(BString* value);
|
||||
void SetPreReleaseNull();
|
||||
bool PreReleaseIsNull();
|
||||
|
||||
BString* ArchitectureCode();
|
||||
void SetArchitectureCode(BString* value);
|
||||
void SetArchitectureCodeNull();
|
||||
bool ArchitectureCodeIsNull();
|
||||
|
||||
BString* Minor();
|
||||
void SetMinor(BString* value);
|
||||
void SetMinorNull();
|
||||
bool MinorIsNull();
|
||||
|
||||
|
||||
int64 Revision();
|
||||
void SetRevision(int64 value);
|
||||
void SetRevisionNull();
|
||||
bool RevisionIsNull();
|
||||
|
||||
private:
|
||||
BString* fMajor;
|
||||
int64* fPayloadLength;
|
||||
BString* fDescription;
|
||||
BString* fTitle;
|
||||
BString* fSummary;
|
||||
BString* fMicro;
|
||||
BString* fPreRelease;
|
||||
BString* fArchitectureCode;
|
||||
BString* fMinor;
|
||||
int64* fRevision;
|
||||
};
|
||||
|
||||
#endif // GEN_JSON_SCHEMA_MODEL__DUMPEXPORTPKGVERSION_H
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-10-12T21:34:32.334310
|
||||
* generated at : 2017-11-11T13:59:22.553529
|
||||
*/
|
||||
#include "DumpExportRepository.h"
|
||||
|
||||
@ -59,6 +59,16 @@ DumpExportRepository::SetInformationUrl(BString* value)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportRepository::SetInformationUrlNull()
|
||||
{
|
||||
if (!InformationUrlIsNull()) {
|
||||
delete fInformationUrl;
|
||||
fInformationUrl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportRepository::InformationUrlIsNull()
|
||||
{
|
||||
@ -80,6 +90,16 @@ DumpExportRepository::SetCode(BString* value)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportRepository::SetCodeNull()
|
||||
{
|
||||
if (!CodeIsNull()) {
|
||||
delete fCode;
|
||||
fCode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportRepository::CodeIsNull()
|
||||
{
|
||||
@ -140,6 +160,16 @@ DumpExportRepository::SetName(BString* value)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportRepository::SetNameNull()
|
||||
{
|
||||
if (!NameIsNull()) {
|
||||
delete fName;
|
||||
fName = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportRepository::NameIsNull()
|
||||
{
|
||||
@ -161,6 +191,16 @@ DumpExportRepository::SetDescription(BString* value)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportRepository::SetDescriptionNull()
|
||||
{
|
||||
if (!DescriptionIsNull()) {
|
||||
delete fDescription;
|
||||
fDescription = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportRepository::DescriptionIsNull()
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-10-12T21:34:32.333203
|
||||
* generated at : 2017-11-11T13:59:22.550365
|
||||
*/
|
||||
|
||||
#ifndef GEN_JSON_SCHEMA_MODEL__DUMPEXPORTREPOSITORY_H
|
||||
@ -19,10 +19,12 @@ public:
|
||||
|
||||
BString* InformationUrl();
|
||||
void SetInformationUrl(BString* value);
|
||||
void SetInformationUrlNull();
|
||||
bool InformationUrlIsNull();
|
||||
|
||||
BString* Code();
|
||||
void SetCode(BString* value);
|
||||
void SetCodeNull();
|
||||
bool CodeIsNull();
|
||||
|
||||
void AddToRepositorySources(DumpExportRepositorySource* value);
|
||||
@ -33,10 +35,12 @@ public:
|
||||
|
||||
BString* Name();
|
||||
void SetName(BString* value);
|
||||
void SetNameNull();
|
||||
bool NameIsNull();
|
||||
|
||||
BString* Description();
|
||||
void SetDescription(BString* value);
|
||||
void SetDescriptionNull();
|
||||
bool DescriptionIsNull();
|
||||
|
||||
private:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Generated Listener Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-10-02T22:02:18.621800
|
||||
* generated at : 2017-11-11T14:08:39.276778
|
||||
*/
|
||||
#include "DumpExportRepositoryJsonListener.h"
|
||||
#include "List.h"
|
||||
@ -386,16 +386,16 @@ DumpExportRepository_StackedDumpExportRepositoryJsonListener::Handle(const BJson
|
||||
{
|
||||
|
||||
if (fNextItemName == "informationUrl")
|
||||
fTarget->SetInformationUrl(NULL);
|
||||
fTarget->SetInformationUrlNull();
|
||||
|
||||
if (fNextItemName == "code")
|
||||
fTarget->SetCode(NULL);
|
||||
fTarget->SetCodeNull();
|
||||
|
||||
if (fNextItemName == "name")
|
||||
fTarget->SetName(NULL);
|
||||
fTarget->SetNameNull();
|
||||
|
||||
if (fNextItemName == "description")
|
||||
fTarget->SetDescription(NULL);
|
||||
fTarget->SetDescriptionNull();
|
||||
fNextItemName.SetTo("");
|
||||
break;
|
||||
}
|
||||
@ -542,10 +542,10 @@ DumpExportRepositorySource_StackedDumpExportRepositoryJsonListener::Handle(const
|
||||
{
|
||||
|
||||
if (fNextItemName == "url")
|
||||
fTarget->SetUrl(NULL);
|
||||
fTarget->SetUrlNull();
|
||||
|
||||
if (fNextItemName == "code")
|
||||
fTarget->SetCode(NULL);
|
||||
fTarget->SetCodeNull();
|
||||
fNextItemName.SetTo("");
|
||||
break;
|
||||
}
|
||||
@ -767,7 +767,11 @@ AbstractMainDumpExportRepositoryJsonListener::~AbstractMainDumpExportRepositoryJ
|
||||
void
|
||||
AbstractMainDumpExportRepositoryJsonListener::HandleError(status_t status, int32 line, const char* message)
|
||||
{
|
||||
printf("an error has arisen processing json for 'DumpExportRepository'; %s", message);
|
||||
if (message != NULL) {
|
||||
fprintf(stderr, "an error has arisen processing json for 'DumpExportRepository'; %s\n", message);
|
||||
} else {
|
||||
fprintf(stderr, "an error has arisen processing json for 'DumpExportRepository'\n");
|
||||
}
|
||||
fErrorStatus = status;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Generated Listener Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-10-02T22:02:18.621102
|
||||
* generated at : 2017-11-11T14:08:39.274913
|
||||
*/
|
||||
|
||||
#ifndef GEN_JSON_SCHEMA_PARSER__SINGLEDUMPEXPORTREPOSITORYJSONLISTENER_H
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-10-12T21:34:32.334783
|
||||
* generated at : 2017-11-11T13:59:22.559632
|
||||
*/
|
||||
#include "DumpExportRepositorySource.h"
|
||||
|
||||
@ -39,6 +39,16 @@ DumpExportRepositorySource::SetUrl(BString* value)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportRepositorySource::SetUrlNull()
|
||||
{
|
||||
if (!UrlIsNull()) {
|
||||
delete fUrl;
|
||||
fUrl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportRepositorySource::UrlIsNull()
|
||||
{
|
||||
@ -60,6 +70,16 @@ DumpExportRepositorySource::SetCode(BString* value)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DumpExportRepositorySource::SetCodeNull()
|
||||
{
|
||||
if (!CodeIsNull()) {
|
||||
delete fCode;
|
||||
fCode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DumpExportRepositorySource::CodeIsNull()
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Generated Model Object
|
||||
* source json-schema : dumpexport.json
|
||||
* generated at : 2017-10-12T21:34:32.334652
|
||||
* generated at : 2017-11-11T13:59:22.559237
|
||||
*/
|
||||
|
||||
#ifndef GEN_JSON_SCHEMA_MODEL__DUMPEXPORTREPOSITORYSOURCE_H
|
||||
@ -18,10 +18,12 @@ public:
|
||||
|
||||
BString* Url();
|
||||
void SetUrl(BString* value);
|
||||
void SetUrlNull();
|
||||
bool UrlIsNull();
|
||||
|
||||
BString* Code();
|
||||
void SetCode(BString* value);
|
||||
void SetCodeNull();
|
||||
bool CodeIsNull();
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user