packages.
[Desc.] * InstallManager can support to cache extra information.
* InstallManager can maintain the newest extra package list always.
* User can remove extra packages each repository.
Change-Id: Id790d976b0893da6dbf77adf1012c159cfeaf676
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import org.tizen.installmanager.lib.Downloader;
+import org.tizen.installmanager.lib.ErrorController;
+import org.tizen.installmanager.lib.IIMProgressMonitor;
import org.tizen.installmanager.lib.Log;
import org.tizen.installmanager.pkg.lib.PackageManager;
-import org.tizen.installmanager.pkg.model.ConfigFile;
+import org.tizen.installmanager.pkg.model.Package;
import org.tizen.installmanager.pkg.model.PackageSet;
+import org.tizen.installmanager.ui.InstallManagerWindow;
import org.tizen.installmanager.util.PathUtil;
/**
private static SDKExtensionInfo sdkExtensionInfo = null;
//member variable
+ LinkedHashMap<String, String> extensionRepositories = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> userExtensionRepositories = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> builtInExtensionRepositories = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> cacheRepositories = new LinkedHashMap<String, String>();
private final String CACHING_FILE_NAME = "CacheInformation.txt";
private final String CACHING_DIRECTORY_PATH = PathUtil.get(Config.getConfigHome(), CACHING_DIR_NAME); // tizen-sdk-data/extra
private String CACHING_FULL_PATH = null;
- private List<String> CACHING_PACKAGE_LIST_PATH = null;
- //member func
private SDKExtensionInfo() {
- load();
+
}
+ /**
+ * Add extra repository information from add extra dialog.
+ * @param name Extra repository name.
+ * @param packageRepo Extra repository address.
+ * @return If true, success to add. false, fail to add.
+ */
public boolean add(String name, String packageRepo) {
if (name == null || !checkPackageRepo(packageRepo)) {
return false;
setCachePath(name);
save(name, true);
- downloadExtraPkgList(packageRepo);
+ downloadExtraPkgList(packageRepo, name);
return true;
}
+ /**
+ * Check to be duplicated user extra package address.
+ * @param packageRepo
+ * @return If true, duplicated repository exists, false not.
+ */
public boolean contains(String packageRepo) {
return userExtensionRepositories.containsKey(packageRepo);
}
+ /**
+ * Check to be duplicated built-in extra package address.
+ * @param packageRepo
+ * @return If true, duplicated repository exists, false not.
+ */
public boolean containsBuiltIn(String packageRepo) {
return builtInExtensionRepositories.containsKey(packageRepo);
}
+ /**
+ * Remove extra repository information from saved user extension repositories.
+ * @param name Extra repository name.
+ * @param packageRepo Extra repository address.
+ */
public void remove(String name, String packageRepo) {
+ uninstallExtraPackages(packageRepo);
if (contains(packageRepo)) {
userExtensionRepositories.remove(packageRepo);
}
+
save(name, false);
}
/**
+ * Uninstall extra packages which belong to selected extra repository.
+ * @param repo Selected extra repository for removing.
+ */
+ private void uninstallExtraPackages(String repo) {
+ boolean result = false;
+
+ PackageSet pkgs = PackageManager.getInstance().getExtensionPackages();
+
+ List<String> installedExtraList = new ArrayList<String>();
+ for (Package pkg : pkgs) {
+ if (pkg.getExtensionServer().equalsIgnoreCase(repo)) {
+ installedExtraList.add(pkg.getPackageName());
+ }
+ }
+
+ if (installedExtraList.size() <= 0) {
+ return;
+ } else {
+ result = InstallManagerWindow.getInstallManagerWindow().
+ getViewController().uninstall(installedExtraList, null);
+ }
+
+ ErrorController.setInstallationSuccess(result);
+ }
+
+ /**
* Save extra repository information to config file and cache directory.
* otherwise remove extra information form cache.
* @param name extra repository name
* @param isAdd true is saving, false is removing.
*/
public void save(String name, boolean isAdd) {
- saveToConfFile();
if (isAdd) {
saveCache();
} else {
}
/**
- * Save extesion information(name(key), repository(value)) to config file.
- */
- private void saveToConfFile() {
- ConfigFile confFile = Config.getInstance().getConfigFile();
-
- confFile.setExtensionServer(userExtensionRepositories.toString());
-
- Config.getInstance().saveConfig();
- }
-
- /**
* Save extra repository information to cache.
* @param name Repository name
* @param packageRepo Repository URL
File cacheDir = new File(CACHING_FULL_PATH);
if (!cacheDir.exists()) {
cacheDir.mkdirs();
- } else {
- //to do nothing(already existing directory).
}
}
* @param packageRepo Remote extra repository address.
* @return Caching package list file path.
*/
- private String downloadExtraPkgList(String packageRepo) {
+ private String downloadExtraPkgList(String packageRepo, String name) {
URL serverUrl = null;
try {
serverUrl = new URL(PathUtil.addURLPath(packageRepo, PackageManager.getInstance().getPackageListFileName()));
}
Downloader dl = InstallManager.getDownloader();
- String extraPkgListPath = PathUtil.get(CACHING_FULL_PATH,
+
+ String extraPkgListPath = PathUtil.get(CACHING_DIRECTORY_PATH, name,
PackageManager.getInstance().getPackageListFileName());
File extraPkgList = new File(extraPkgListPath);
+ if (extraPkgList.exists()) {
+ extraPkgList.delete();
+ }
long size = dl.download(serverUrl, extraPkgList.getAbsolutePath(), null);
} else {
return null;
}
-
}
/**
* Remove cache information.
* @param name
*/
- private void removeCache(String name) {
- File cacheDir = new File(PathUtil.get(CACHING_DIRECTORY_PATH, name));
+ public void removeCache(String name) {
+ File cacheDir = null;
+ if (name != null) {
+ cacheDir = new File(PathUtil.get(CACHING_DIRECTORY_PATH, name));
+ } else {
+ cacheDir = new File(CACHING_DIRECTORY_PATH);
+ }
+
if (cacheDir.exists()) {
if (PathUtil.remove(cacheDir)) {
Log.log("Success to extra cache dir. => " + cacheDir);
}
}
writeExtraRepoToCache();
- String tmp = PathUtil.readAllTextFromFile(PathUtil.get(CACHING_DIRECTORY_PATH, CACHING_FILE_NAME), false);
- if (tmp.equalsIgnoreCase("{}")) {
- // 'CacheInformation.txt' file is empty. so it could be removed.
- if (PathUtil.remove(CACHING_DIRECTORY_PATH)) {
- Log.log("Success to remove cache file. => " + CACHING_DIRECTORY_PATH);
- } else {
- Log.err("Fail to remove cache file. => " + CACHING_DIRECTORY_PATH);
- }
- } else {
- // 'CacheInformation.txt' file is empty.
+ File cacheInfo = new File(PathUtil.get(CACHING_DIRECTORY_PATH, CACHING_FILE_NAME));
+ if (cacheInfo.exists()) {
+ String tmp = PathUtil.readAllTextFromFile(cacheInfo.getAbsolutePath(), false);
+ if (tmp.equalsIgnoreCase("{}")) {
+ // 'CacheInformation.txt' file is empty. so it could be removed.
+ if (PathUtil.remove(CACHING_DIRECTORY_PATH)) {
+ Log.log("Success to remove cache file. => " + CACHING_DIRECTORY_PATH);
+ } else {
+ Log.err("Fail to remove cache file. => " + CACHING_DIRECTORY_PATH);
+ }
+ }
}
}
+ /**
+ * Load extension packages from cache.
+ */
public void load() {
- String extensionInfo = "";
+ String userExtensionInfo = "";
String extraCachePath = PathUtil.get(CACHING_DIRECTORY_PATH, CACHING_FILE_NAME); // tizen-sdk-data/extra/CacheInformation.txt
File extraCache = new File(extraCachePath);
if (extraCache.exists()) { // If cache file exists, installmanager loads extension information from cache.
- extensionInfo = PathUtil.readAllTextFromFile(PathUtil.get(CACHING_DIRECTORY_PATH, CACHING_FILE_NAME), false);
+ userExtensionInfo = PathUtil.readAllTextFromFile(extraCachePath, false);
}
- String builtInExtensionInfo = Config.getInstance().getConfigFile().getBuiltInExtensionServer();
+ String builtInExtensionInfo = Config.getInstance().getConfigFile().getBuiltInExtensionServer();
builtInExtensionRepositories = parseLocationInformationToMap(builtInExtensionInfo);
- userExtensionRepositories = parseLocationInformationToMap(extensionInfo);
+ userExtensionRepositories = parseLocationInformationToMap(userExtensionInfo);
+
+ setExtensionRepositories();
+
+ PackageManager pm = PackageManager.getInstance();
+ try {
+ pm.loadExtensionPackages();
+ } catch (IOException e) {
+ Log.ExceptionLog(e);
+ }
+ }
+
+ /**
+ * Set absolute path of cache.
+ */
+ private void setCacheExtensionInfo() {
+ String extensionInfo = PathUtil.readAllTextFromFile(PathUtil.get(CACHING_DIRECTORY_PATH, CACHING_FILE_NAME), false);
+ LinkedHashMap<String, String> extensionCache = parseLocationInformationToMap(extensionInfo);
+ File tmp = new File(PathUtil.get(CACHING_DIRECTORY_PATH));
+ for (String key : extensionCache.keySet()) {
+ String name = extensionCache.get(key);
+ try {
+ String cacheKey = PathUtil.get(tmp.toURI().toURL().toString(), name);
+ cacheRepositories.put(cacheKey, name);
+ } catch (MalformedURLException e) {
+ // Thrown to indicate that a malformed URL has occurred.
+ Log.ExceptionLog(e);
+ }
+ }
+ }
+
+ /**
+ * Refresh cache from extra server.
+ */
+ public void refreshCache() {
+ final refreshCacheThread refreshThread = new refreshCacheThread(null);
+ refreshThread.start();
+ try {
+ refreshThread.join();
+ } catch (InterruptedException e) {
+ Log.ExceptionLog(e);
+ }
+ }
+
+ class refreshCacheThread extends Thread {
+ public refreshCacheThread(IIMProgressMonitor monitor) {
+
+ }
+
+ /**
+ * refreshCacheThread thread run
+ */
+ @Override
+ public void run() {
+ String userExtensionInfo = "";
+ String extraCachePath = PathUtil.get(CACHING_DIRECTORY_PATH, CACHING_FILE_NAME); // tizen-sdk-data/extra/CacheInformation.txt
+ File extraCache = new File(extraCachePath);
+ if (extraCache.exists()) { // If cache file exists, installmanager loads extension information from cache.
+ userExtensionInfo = PathUtil.readAllTextFromFile(extraCachePath, false);
+ }
+
+ LinkedHashMap<String, String> remoteRepositories = parseLocationInformationToMap(userExtensionInfo);
+ Collection<String> keys = remoteRepositories.keySet();
+ if (!keys.isEmpty()) {
+ for (String key : keys) {
+ downloadExtraPkgList(key, remoteRepositories.get(key));
+ }
+ }
+ }
}
public boolean checkPackageRepo(String packageRepo) {
return extensionInformation;
}
- /**
- * Get extension packages.
- * @return Extension package set.
- */
- public PackageSet getExtensionPackages() {
- PackageManager pm = PackageManager.getInstance();
-
- if (pm == null) {
- return PackageSet.EMPTY;
- } else {
- try {
- //Get all extension repositories.
- LinkedHashMap<String, String> extensionRepositories = new LinkedHashMap<String, String>();
- extensionRepositories.putAll(builtInExtensionRepositories);
- extensionRepositories.putAll(userExtensionRepositories);
-
- pm.loadExtensionPackages(extensionRepositories.keySet());
- if (pm.getExtensionPackages().isEmpty()) {
- if(getExtensionPkgsFromCache(pm) == null) {
- Log.err("Cannot load extension packages from cache.");
- }
- }
- return pm.getRootMetaPackagesOfExtensionServer();
-
- } catch (IOException e) {
- Log.ExceptionLog(e);
- return PackageSet.EMPTY;
- }
- }
+ private void setExtensionRepositories() {
+ extensionRepositories.clear();
+ extensionRepositories.putAll(userExtensionRepositories);
+ extensionRepositories.putAll(builtInExtensionRepositories);
}
- /**
- * Get extension packages from cache.
- * @param pm PackageManager object.
- * @return PackageManager object which has extension packages.
- */
- private PackageManager getExtensionPkgsFromCache(PackageManager pm) {
- Collection<String> keys = userExtensionRepositories.keySet();
-
- for (String key : keys) {
- CACHING_PACKAGE_LIST_PATH.add(PathUtil.get(CACHING_FULL_PATH, userExtensionRepositories.get(key)
- , PackageManager.getInstance().getPackageListFileName()));
- }
-
- if (CACHING_PACKAGE_LIST_PATH != null) {
- LinkedHashMap<String, String> extensionRepositories = new LinkedHashMap<String, String>();
- extensionRepositories.putAll(builtInExtensionRepositories);
- try {
- pm.loadExtensionPackages(CACHING_PACKAGE_LIST_PATH);
- } catch (IOException e) {
- //Cannot read extension packages from package list cache file.
- Log.ExceptionLog(e);
- }
- }
- return pm;
+ public LinkedHashMap<String, String> getExtensionRepositories() {
+ return extensionRepositories;
}
- public LinkedHashMap<String, String> getExtensionRepositories() {
+ public LinkedHashMap<String, String> getUserExtensionRepositories() {
return userExtensionRepositories;
}
UNINSTALL;
}
+ /**
+ * It is a position where can installmanager get the package list file
+ */
+ private enum Style {
+ NETWORK,
+ IMAGE,
+ EXTRA;
+ }
+
//abstract method
/**
* Get package list file name.
public void loadRepositoryPackageList(Collection<String> repoPackagesUrls) throws IOException {
HashMap<String,List<PropertySection>> r2sMap = null;
if (Config.fromWhere == Config.ConfDialog.LOCAL_IMAGE) { // Using SDK Image
- r2sMap = getRepositoryAndPackageList(repoPackagesUrls, false);
+ r2sMap = getRepositoryAndPackageList(repoPackagesUrls, Style.IMAGE);
} else {
- r2sMap = getRepositoryAndPackageList(repoPackagesUrls, true);
+ r2sMap = getRepositoryAndPackageList(repoPackagesUrls, Style.NETWORK);
}
setRepoPackages(r2sMap);
* @param repoPackagesUrls Packgae server list.
* @throws IOException
*/
- public void loadExtensionPackages(Collection<String> repoPackagesUrls) throws IOException {
- HashMap<String,List<PropertySection>> repoToSectionsMap = getRepositoryAndPackageList(repoPackagesUrls, false);
+ public void loadExtensionPackages() throws IOException {
+ HashMap<String,List<PropertySection>> repoToSectionsMap =
+ getRepositoryAndPackageList(SDKExtensionInfo.getInstance().getExtensionRepositories().keySet(),
+ Style.EXTRA);
setExtensionPackages(repoToSectionsMap);
setExtensionPackagesToRecentPackages();
}
private HashMap<String,List<PropertySection>> getRepositoryAndPackageList
- (Collection<String> repoPackagesUrls, boolean isSnapshotServer) throws IOException {
+ (Collection<String> repoPackagesUrls, Style style) throws IOException {
PropertyParser parser = new PropertyParser();
HashMap<String,List<PropertySection>> r2sMap = new HashMap<String,List<PropertySection>>();
if(repoPackagesUrls != null) {
for(String repo : repoPackagesUrls) {
- URL packageListURL = getPackageListPath(repo, isSnapshotServer);
+ URL packageListURL = getPackageListPath(repo, style);
+ File packageListFile = null;
- File packageListFile = downloadPackageListFile(packageListURL);
-
- if(packageListFile != null) {
- r2sMap.put(repo, parser.readFromFile(packageListFile));
- } else {
- packageListURL = getPackageListPath(SDKExtensionInfo.getInstance().getExtraPackageListPath(repo), isSnapshotServer);
+ if (style != Style.EXTRA) { // Snapshot, Image case
packageListFile = downloadPackageListFile(packageListURL);
- if (packageListFile != null) {
+ if(packageListFile != null) {
+ r2sMap.put(repo, parser.readFromFile(packageListFile));
+ }
+ } else { // Extra extension case
+ // Get package list file from cache.
+ URL extraPackageListURL = getPackageListPath(SDKExtensionInfo.getInstance().getExtraPackageListPath(repo), style);
+ packageListFile = downloadPackageListFile(extraPackageListURL);
+ if (packageListFile != null) { // If cache does not exist, install manager get it from remote repository.
r2sMap.put(repo, parser.readFromFile(packageListFile));
} else {
- Log.err("Ignore invalid repository: "+repo);
+ // InstallManager can get package list file from remote repository.
+ packageListFile = downloadPackageListFile(packageListURL);
+ if (packageListFile != null) {
+ r2sMap.put(repo, parser.readFromFile(packageListFile));
+ }
}
}
-
-
-// if(packageListFile != null) {
-// r2sMap.put(repo, parser.readFromFile(packageListFile));
-// } else {
-// Log.err("Ignore invalid repository: "+repo);
-// }
}
} else {
Log.log("Cannot find repository. This is local installer.");
public PackageSet getInstalledExtensionPackages() {
PackageSet extensionPackages = new PackageSet();
+ PackageSet pkgs = this.getInstalledPackages();
- for (Package pkg : extensionPackages) {
+
+ for (Package pkg : pkgs) {
if (pkg.isExtensionPackage()) {
extensionPackages.add(pkg);
}
* @param url
* @return Full url path
*/
- private URL getPackageListPath(String url, boolean isSnapshotServer) {
+ private URL getPackageListPath(String url, Style style) {
if (url == null || url.isEmpty()) {
return null;
} else {
String packageListURL = "";
- if (isSnapshotServer) {
+ if (style == Style.NETWORK) {
String snapshotPath = Config.getInstance().getSnapshotPath();
if (snapshotPath == null || snapshotPath.isEmpty()) {
public static PackageManager getInstance() {
return pm;
}
+
+ public SDKExtensionInfo getSdkExtensionInfo() {
+ return SDKExtensionInfo.getInstance();
+ }
}
private SetInstallDirectoryPage compositeSetInstallDirectoryPage;
public UpdatableListPage compositeUpdatableListPage;
- private static ViewController controller;
+ protected static ViewController controller;
private SelectionAdapter cancelBtnSelectionAdapter = null;
private SelectionAdapter closeBtnSelectionAdapter = null;
protected boolean cancelButtonClicked;
addExtraButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- extraDialog = new AddExtraRepositoryDialog(composite.getShell());
+ extraDialog = new AddExtraRepositoryDialog(composite.getShell(), controller);
int ret = extraDialog.open();
if (ret != 0) {
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.tizen.installmanager.core.SDKExtensionInfo;
import org.tizen.installmanager.lib.Downloader;
import org.tizen.installmanager.lib.ErrorController;
import org.tizen.installmanager.lib.ErrorController.ErrorCode;
import org.tizen.installmanager.pkg.lib.PackageManager;
+import org.tizen.installmanager.ui.page.ViewController;
import org.tizen.installmanager.util.PathUtil;
/**
*/
public class AddExtraDialog extends Dialog {
private String DIALOG_TITLE = "Add Repository";
- private AddExtraRepositoryDialog rDialog = null;
+ private ViewController controller;
private Text nameText = null;
private Text repositoryText = null;
private String thirdPartyName = "";
private String thirdPartyRepository = "";
- public AddExtraDialog(Shell parentShell) {
+ public AddExtraDialog(Shell parentShell, ViewController viewController) {
super(parentShell);
setShellStyle(SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL);
+ controller = viewController;
}
/**
/**
* Create contents of the dialog.
- *
* @param parent
*/
@Override
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(null);
container.getShell().setImage(PathUtil.getImageFromResource("/res/icons/SDK_icon.png"));
- rDialog = new AddExtraRepositoryDialog(getParentShell());
setTitle();
}
private boolean isDuplicatedName() {
- SDKExtensionInfo extensionInfo = rDialog.getSdkExtensionInfo();
- if (extensionInfo.contains(thirdPartyName)) {
+ if (controller.getSdkExtensionInfo().contains(thirdPartyName)) {
ErrorController.setError(ErrorCode.DUPLICATED_EXTENSION_REPOSITORY_NAME);
return false;
- } else if (extensionInfo.containsBuiltIn(thirdPartyName)) {
+ } else if (controller.getSdkExtensionInfo().containsBuiltIn(thirdPartyName)) {
ErrorController.setError(ErrorCode.DUPLICATED_BUILT_IN_EXTENSION_REPOSITORY_NAME);
return false;
} else {
private boolean isDuplicatedRepository() {
removeSeperator();
- SDKExtensionInfo extensionInfo = rDialog.getSdkExtensionInfo();
- if (extensionInfo.contains(thirdPartyRepository)) {
+
+ if (controller.getSdkExtensionInfo().contains(thirdPartyRepository)) {
ErrorController.setError(ErrorCode.DUPLICATED_EXTENSION_REPOSITORY);
return false;
- } else if (extensionInfo.containsBuiltIn(thirdPartyRepository)) {
+ } else if (controller.getSdkExtensionInfo().containsBuiltIn(thirdPartyRepository)) {
ErrorController.setError(ErrorCode.DUPLICATED_BUILT_IN_EXTENSION_REPOSITORY);
return false;
} else {
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
-import org.tizen.installmanager.core.SDKExtensionInfo;
import org.tizen.installmanager.lib.Log;
import org.tizen.installmanager.pkg.model.PackageSet;
+import org.tizen.installmanager.ui.page.ViewController;
import org.tizen.installmanager.util.PathUtil;
/**
public class AddExtraRepositoryDialog extends Dialog {
private final String STRING_TITLE = "Add Extra Repository";
+ private ViewController controller;
+
private AddExtraDialog addDialog = null;
private String thirdPartyName = "";
private String thirdPartyRepository = "";
// Set of removable item list.
private Set<TableItem> removeRepositorySet;
- private SDKExtensionInfo sdkExtensionInfo = SDKExtensionInfo.getInstance();
-
- public AddExtraRepositoryDialog(Shell parentShell) {
+ public AddExtraRepositoryDialog(Shell parentShell, ViewController viewController) {
super(parentShell);
setShellStyle(SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL);
+ controller = viewController;
}
/**
container.setLayout(null);
container.getShell().setImage(PathUtil.getImageFromResource("/res/icons/SDK_icon.png"));
- sdkExtensionInfo.load();
+ controller.getSdkExtensionInfo().load();
removeRepositorySet = new HashSet<TableItem>();
setTitle();
setRepositoryTable(container);
- addItemToRepositoryTable(sdkExtensionInfo.getExtensionRepositories());
+ addItemToRepositoryTable(controller.getSdkExtensionInfo().getExtensionRepositories());
setSeparator(container);
/**
* Show 3rd party information on table.
- * @param type
+ * @param isAdd If true, extra repository is added. false is removed.
*/
private void showRepositoryTable() {
repositoryTable.removeAll();
removeRepositorySet.clear();
- addItemToRepositoryTable(sdkExtensionInfo.getExtensionRepositories());
+ controller.getSdkExtensionInfo().load();
+ addItemToRepositoryTable(controller.getSdkExtensionInfo().getExtensionRepositories());
}
/**
Set<String> keys = repositoryInfo.keySet();
for (String key : keys) {
TableItem item = new TableItem(repositoryTable, SWT.NONE);
- item.setText(TABLE_COLUMN_NAME, repositoryInfo.get(key));
+ item.setText(TABLE_COLUMN_NAME, controller.getSdkExtensionInfo().getExtensionRepositories().get(key));
item.setText(TABLE_COLUMN_REPOSITORY, key);
}
}
addButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- addDialog = new AddExtraDialog(getShell());
+ addDialog = new AddExtraDialog(getShell(), controller);
int ret = addDialog.open();
* Write 3rd party information of adding to installmanager.conf
*/
private void addRepositoryInformation() {
- sdkExtensionInfo.add(thirdPartyName, thirdPartyRepository);
+ controller.getSdkExtensionInfo().add(thirdPartyName, thirdPartyRepository);
}
/**
*/
private void removeRepositoryInformation() {
for (TableItem removeItem : removeRepositorySet) {
- sdkExtensionInfo.remove(removeItem.getText(0), removeItem.getText(1));
+ controller.getSdkExtensionInfo().remove(removeItem.getText(0), removeItem.getText(1));
}
}
public PackageSet getPackagesFromExtraRepository() {
- return sdkExtensionInfo.getExtensionPackages();
+ return controller.getRootMetaPackageListOfExtension();
}
/**
* Set to enable OK button.
okButton = getButton(Window.OK);
okButton.setEnabled(isAvailable);
}
-
- public SDKExtensionInfo getSdkExtensionInfo() {
- return sdkExtensionInfo;
- }
}
import org.eclipse.swt.widgets.Label;
import org.tizen.installmanager.core.IMFatalException;
import org.tizen.installmanager.core.InstallManager;
-import org.tizen.installmanager.core.SDKExtensionInfo;
import org.tizen.installmanager.lib.ErrorController;
import org.tizen.installmanager.lib.IMError;
import org.tizen.installmanager.lib.Log;
try {
loadPackagesToTreeViewer(viewController.getRootMetaPackageListOfRepository());
-
- SDKExtensionInfo sdkExtensionInfo = SDKExtensionInfo.getInstance();
- addExtensionPackagesToExtra(sdkExtensionInfo.getExtensionPackages());
+ viewController.loadSdkExtension();
+ addExtensionPackagesToExtra(viewController.getRootMetaPackageListOfExtension());
+
} catch (IMFatalException fatalException) {
Log.err(ErrorController.getErrorMessage());
IMError.fatalError(ErrorController.getErrorMessage());
return retItem;
}
}
-
-
-
try {
loadPackagesToTreeViewer(viewController.getRootMetaPackageListOfRepository());
-
- SDKExtensionInfo sdkExtensionInfo = SDKExtensionInfo.getInstance();
- addExtensionPackagesToExtra(sdkExtensionInfo.getExtensionPackages());
+ viewController.loadSdkExtension();
+ addExtensionPackagesToExtra(viewController.getRootMetaPackageListOfExtension());
} catch (IMFatalException fatalException) {
Log.err(ErrorController.getErrorMessage());
import org.tizen.installmanager.core.IMFatalException;
import org.tizen.installmanager.core.InstallManager;
import org.tizen.installmanager.core.Options;
+import org.tizen.installmanager.core.SDKExtensionInfo;
import org.tizen.installmanager.core.Config.ServerType;
import org.tizen.installmanager.lib.ErrorController;
import org.tizen.installmanager.lib.IIMProgressMonitor;
private InstallManager installManager;
private PackageManager packageManager;
+ private SDKExtensionInfo sdkExtensionInfo;
/**
* Initialize objects which need to install.
installManager = InstallManager.getInstance();
installManager.init();
packageManager = installManager.getPackageManager();
+ sdkExtensionInfo = packageManager.getSdkExtensionInfo();
+
+ // InstallManager maintains the newest extension package list always.
+ sdkExtensionInfo.refreshCache();
if (packageManager == null) {
throw new IMFatalException("Cannot read package information.");
return packageManager.getRootMetaPackagesOfRepository();
}
}
+
+ public PackageSet getRootMetaPackageListOfExtension() {
+ if (packageManager == null) {
+ return null;
+ } else {
+ return packageManager.getRootMetaPackagesOfExtensionServer();
+ }
+ }
/**
* Get meta packages that are available to update.
return true;
} else {
PackageSet removablePackages = packageManager.getInstalledPackagesByName(uninstallList);
-
+
return uninstallPackages(removablePackages, monitor);
}
}
public void saveSnapshotSettings(String repository, String distribution, ServerType packageType, String snapshotPath) {
Config.getInstance().saveSnapshotSettings(repository, distribution, packageType, snapshotPath);
}
+
+ public SDKExtensionInfo getSdkExtensionInfo() {
+ return sdkExtensionInfo;
+ }
+
+ public void loadSdkExtension() {
+ sdkExtensionInfo.load();
+ }
}