本文整理汇总了Java中org.pentaho.packageManagement.Package类的典型用法代码示例。如果您正苦于以下问题:Java Package类的具体用法?Java Package怎么用?Java Package使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Package类属于org.pentaho.packageManagement包,在下文中一共展示了Package类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compare
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
@Override
public int compare(Package o1, Package o2) {
String meta1 = "";
String meta2 = "";
if (m_sortColumn == 0) {
meta1 = o1.getName();
meta2 = o2.getName();
} else {
if (o1.getPackageMetaDataElement("Category") != null) {
meta1 = o1.getPackageMetaDataElement("Category").toString();
}
if (o2.getPackageMetaDataElement("Category") != null) {
meta2 = o2.getPackageMetaDataElement("Category").toString();
}
}
int result = meta1.compareTo(meta2);
if (m_reverseSort) {
result = -result;
}
return result;
}
示例2: installPackages
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
public static void installPackages(List<Package> toInstall,
PrintStream... progress) throws Exception {
useCacheOrOnlineRepository();
PACKAGE_MANAGER.installPackages(toInstall, progress);
for (Package p : toInstall) {
String packageName = p.getName();
File packageDir = new File(PACKAGE_MANAGER.getPackageHome().toString()
+ File.separator + packageName);
boolean loadIt = loadCheck(p, packageDir, progress);
if (loadIt) {
loadPackageDirectory(packageDir, false);
}
}
}
示例3: getAvailableCompatiblePackages
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
/**
* Get a list of the most recent version of all available packages (i.e. those
* not yet installed) that are compatible with the version of Weka that is
* installed.
*
* @return a list of packages that are compatible with the installed version
* of Weka
* @throws Exception if a problem occurs
*/
public static List<Package> getAvailableCompatiblePackages() throws Exception {
List<Package> allAvail = getAvailablePackages();
List<Package> compatible = new ArrayList<Package>();
for (Package p : allAvail) {
List<Object> availableVersions =
PACKAGE_MANAGER.getRepositoryPackageVersions(p.getName());
// version numbers will be in descending sorted order from the repository
// we want the most recent version that is compatible with the base weka
// version
for (Object version : availableVersions) {
Package versionedPackage =
getRepositoryPackageInfo(p.getName(), version.toString());
if (versionedPackage.isCompatibleBaseSystem()) {
compatible.add(p);
break;
}
}
}
return compatible;
}
示例4: done
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
@Override
public void done() {
m_progress.setValue(m_progress.getMinimum());
if (m_unsuccessfulInstalls.size() == 0) {
// if (m_successfulInstall) {
m_detailLabel.setText("Package(s) installed successfully.");
} else {
StringBuffer failedPackageNames = new StringBuffer();
for (Package p : m_unsuccessfulInstalls) {
failedPackageNames.append(p.getName() + "\n");
}
displayErrorDialog(
"The following package(s) could not be installed\n"
+ "for some reason (check the log)\n"
+ failedPackageNames.toString(), "");
m_detailLabel.setText("Install complete.");
}
m_unofficialBut.setEnabled(true);
m_refreshCacheBut.setEnabled(true && !WekaPackageManager.m_offline);
m_availableBut.setEnabled(true);
m_allBut.setEnabled(true);
m_installedBut.setEnabled(true);
// force refresh of installed and available packages
m_installedPackages = null;
m_availablePackages = null;
// m_installBut.setEnabled(true);
m_installing = false;
updateTable();
if (m_table.getSelectedRow() >= 0) {
// mainly to update the install/uninstall button status
// displayPackageInfo(m_table.getSelectedRow());
updateInstallUninstallButtonEnablement();
}
}
示例5: getPackagesAndEstablishLookup
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
private void getPackagesAndEstablishLookup() throws Exception {
m_allPackages = WekaPackageManager.getAllPackages();
// now fill the lookup map
m_packageLookupInfo = new TreeMap<String, List<Object>>();
// Iterator<Package> i = allP.iterator();
for (Package p : m_allPackages) {
// Package p = i.next();
String packageName = p.getName();
String category = "";
if (p.getPackageMetaDataElement("Category") != null) {
category = p.getPackageMetaDataElement("Category").toString();
}
// check the load status of this package (if installed)
String loadStatus = "";
if (p.isInstalled()) {
File packageRoot =
new File(WekaPackageManager.getPackageHome().toString());
boolean loaded = WekaPackageManager.loadCheck(p, packageRoot);
loadStatus = (loaded) ? "Yes" : "No - check log";
}
List<Object> versions =
WekaPackageManager.getRepositoryPackageVersions(packageName);
List<Object> catAndVers = new ArrayList<Object>();
catAndVers.add(category);
catAndVers.add(versions);
catAndVers.add(loadStatus);
m_packageLookupInfo.put(packageName, catAndVers);
}
}
示例6: mostRecentVersionWithRespectToConstraint
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
/**
* Find the most recent version of the package encapsulated in the supplied
* PackageConstraint argument that satisfies the constraint
*
* @param toCheck the PackageConstraint containing the package in question
* @return the most recent version of the package satisfying the constraint
* @throws Exception if a version can't be found that satisfies the constraint
* or an error occurs while communicating with the respository
*/
public static Package mostRecentVersionWithRespectToConstraint(
PackageConstraint toCheck) throws Exception {
Package target = toCheck.getPackage();
Package result = null;
List<Object> availableVersions =
PACKAGE_MANAGER.getRepositoryPackageVersions(target.getName());
// version numbers will be in descending sorted order from the repository
// we want the most recent version that meets the target constraint
for (Object version : availableVersions) {
Package candidate =
PACKAGE_MANAGER.getRepositoryPackageInfo(target.getName(), version);
if (toCheck.checkConstraint(candidate) && candidate.isCompatibleBaseSystem()) {
result = candidate;
break;
}
}
if (result == null) {
throw new Exception("[WekaPackageManager] unable to find a version of "
+ "package " + target.getName() + " that meets constraint "
+ toCheck.toString());
}
return result;
}
示例7: installPackageFromArchive
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
/**
* Install a package from an archive
*
* @param packageArchivePath the path to the package archive file to install
* @param progress for reporting progress
* @return true if the package was installed successfully
* @throws Exception if a problem occurs
*/
public static String installPackageFromArchive(String packageArchivePath,
PrintStream... progress) throws Exception {
useCacheOrOnlineRepository();
Package toInstall =
PACKAGE_MANAGER.getPackageArchiveInfo(packageArchivePath);
Object specialInstallMessage =
toInstall.getPackageMetaDataElement("MessageToDisplayOnInstallation");
if (specialInstallMessage != null
&& specialInstallMessage.toString().length() > 0) {
String siM = specialInstallMessage.toString();
try {
siM = Environment.getSystemWide().substitute(siM);
} catch (Exception ex) {
// quietly ignore
}
String message =
"**** Special installation message ****\n" + siM
+ "\n**** Special installation message ****";
for (PrintStream p : progress) {
p.println(message);
}
}
PACKAGE_MANAGER.installPackageFromArchive(packageArchivePath, progress);
boolean loadIt = checkForMissingClasses(toInstall, progress);
if (loadIt) {
File packageRoot =
new File(PACKAGE_MANAGER.getPackageHome() + File.separator
+ toInstall.getName());
loadIt = checkForMissingFiles(toInstall, packageRoot, progress);
if (loadIt) {
loadPackageDirectory(packageRoot, false, null, false);
}
}
return toInstall.getName();
}
示例8: installPackageFromURL
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
/**
* Insstall a package from the supplied URL
*
* @param packageURL the URL to the package archive to install
* @param progress for reporting progress
* @return true if the package was installed successfully
* @throws Exception if a problem occurs
*/
public static String installPackageFromURL(URL packageURL,
PrintStream... progress) throws Exception {
useCacheOrOnlineRepository();
String packageName =
PACKAGE_MANAGER.installPackageFromURL(packageURL, progress);
Package installed = PACKAGE_MANAGER.getInstalledPackageInfo(packageName);
Object specialInstallMessage =
installed.getPackageMetaDataElement("MessageToDisplayOnInstallation");
if (specialInstallMessage != null
&& specialInstallMessage.toString().length() > 0) {
String message =
"**** Special installation message ****\n"
+ specialInstallMessage.toString()
+ "\n**** Special installation message ****";
for (PrintStream p : progress) {
p.println(message);
}
}
boolean loadIt = checkForMissingClasses(installed, progress);
if (loadIt) {
File packageRoot =
new File(PACKAGE_MANAGER.getPackageHome() + File.separator
+ installed.getName());
loadIt = checkForMissingFiles(installed, packageRoot, progress);
if (loadIt) {
loadPackageDirectory(packageRoot, false, null, false);
}
}
return packageName;
}
示例9: done
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
@Override
public void done() {
m_progress.setValue(m_progress.getMinimum());
if (m_unsuccessfulInstalls.size() == 0) {
// if (m_successfulInstall) {
m_detailLabel.setText("Package(s) installed successfully.");
} else {
StringBuffer failedPackageNames = new StringBuffer();
for (Package p : m_unsuccessfulInstalls) {
failedPackageNames.append(p.getName() + "\n");
}
displayErrorDialog(
"The following package(s) could not be installed\n"
+ "for some reason (check the log)\n"
+ failedPackageNames.toString(), "");
m_detailLabel.setText("Install complete.");
}
m_unofficialBut.setEnabled(true);
m_refreshCacheBut.setEnabled(true);
m_availableBut.setEnabled(true);
m_allBut.setEnabled(true);
m_installedBut.setEnabled(true);
// force refresh of installed and available packages
m_installedPackages = null;
m_availablePackages = null;
// m_installBut.setEnabled(true);
m_installing = false;
updateTable();
if (m_table.getSelectedRow() >= 0) {
// mainly to update the install/uninstall button status
// displayPackageInfo(m_table.getSelectedRow());
updateInstallUninstallButtonEnablement();
}
}
示例10: getPackagesAndEstablishLookup
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
private void getPackagesAndEstablishLookup() throws Exception {
m_allPackages = WekaPackageManager.getAllPackages();
// now fill the lookup map
m_packageLookupInfo = new TreeMap<String, List<Object>>();
// Iterator<Package> i = allP.iterator();
for (Package p : m_allPackages) {
// Package p = i.next();
String packageName = p.getName();
String category = "";
if (p.getPackageMetaDataElement("Category") != null) {
category = p.getPackageMetaDataElement("Category").toString();
}
// check the load status of this package (if installed)
String loadStatus = "";
if (p.isInstalled()) {
File packageRoot = new File(WekaPackageManager.getPackageHome()
.toString());
boolean loaded = WekaPackageManager.loadCheck(p, packageRoot);
loadStatus = (loaded) ? "Yes" : "No - check log";
}
List<Object> versions = WekaPackageManager
.getRepositoryPackageVersions(packageName);
List<Object> catAndVers = new ArrayList<Object>();
catAndVers.add(category);
catAndVers.add(versions);
catAndVers.add(loadStatus);
m_packageLookupInfo.put(packageName, catAndVers);
}
}
示例11: mostRecentVersionWithRespectToConstraint
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
/**
* Find the most recent version of the package encapsulated in the supplied
* PackageConstraint argument that satisfies the constraint
*
* @param toCheck the PackageConstraint containing the package in question
* @return the most recent version of the package satisfying the constraint
* @throws Exception if a version can't be found that satisfies the constraint
* or an error occurs while communicating with the respository
*/
public static Package mostRecentVersionWithRespectToConstraint(
PackageConstraint toCheck) throws Exception {
Package target = toCheck.getPackage();
Package result = null;
List<Object> availableVersions = PACKAGE_MANAGER
.getRepositoryPackageVersions(target.getName());
// version numbers will be in descending sorted order from the repository
// we want the most recent version that meets the target constraint
for (Object version : availableVersions) {
Package candidate = PACKAGE_MANAGER.getRepositoryPackageInfo(
target.getName(), version);
if (toCheck.checkConstraint(candidate)) {
result = candidate;
break;
}
}
if (result == null) {
throw new Exception("[WekaPackageManager] unable to find a version of "
+ "package " + target.getName() + " that meets constraint "
+ toCheck.toString());
}
return result;
}
示例12: installPackageFromRepository
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
public static void installPackageFromRepository(String packageName,
String version, PrintStream... progress) throws Exception {
useCacheOrOnlineRepository();
Package toLoad = getRepositoryPackageInfo(packageName);
Object specialInstallMessage = toLoad
.getPackageMetaDataElement("MessageToDisplayOnInstallation");
if (specialInstallMessage != null
&& specialInstallMessage.toString().length() > 0) {
String siM = specialInstallMessage.toString();
try {
siM = Environment.getSystemWide().substitute(siM);
} catch (Exception ex) {
// quietly ignore
}
String message = "**** Special installation message ****\n" + siM
+ "\n**** Special installation message ****";
for (PrintStream p : progress) {
p.println(message);
}
}
PACKAGE_MANAGER
.installPackageFromRepository(packageName, version, progress);
File packageDir = new File(PACKAGE_MANAGER.getPackageHome().toString()
+ File.separator + packageName);
boolean loadIt = checkForMissingClasses(toLoad, progress);
if (loadIt) {
File packageRoot = new File(PACKAGE_MANAGER.getPackageHome()
+ File.separator + packageName);
loadIt = checkForMissingFiles(toLoad, packageRoot, progress);
if (loadIt) {
loadPackageDirectory(packageDir, false);
}
}
}
示例13: installPackageFromArchive
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
public static String installPackageFromArchive(String packageArchivePath,
PrintStream... progress) throws Exception {
useCacheOrOnlineRepository();
Package toInstall = PACKAGE_MANAGER
.getPackageArchiveInfo(packageArchivePath);
Object specialInstallMessage = toInstall
.getPackageMetaDataElement("MessageToDisplayOnInstallation");
if (specialInstallMessage != null
&& specialInstallMessage.toString().length() > 0) {
String siM = specialInstallMessage.toString();
try {
siM = Environment.getSystemWide().substitute(siM);
} catch (Exception ex) {
// quietly ignore
}
String message = "**** Special installation message ****\n" + siM
+ "\n**** Special installation message ****";
for (PrintStream p : progress) {
p.println(message);
}
}
PACKAGE_MANAGER.installPackageFromArchive(packageArchivePath, progress);
boolean loadIt = checkForMissingClasses(toInstall, progress);
if (loadIt) {
File packageRoot = new File(PACKAGE_MANAGER.getPackageHome()
+ File.separator + toInstall.getName());
loadIt = checkForMissingFiles(toInstall, packageRoot, progress);
if (loadIt) {
loadPackageDirectory(packageRoot, false);
}
}
return toInstall.getName();
}
示例14: installPackageFromURL
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
public static String installPackageFromURL(URL packageURL,
PrintStream... progress) throws Exception {
useCacheOrOnlineRepository();
String packageName = PACKAGE_MANAGER.installPackageFromURL(packageURL,
progress);
Package installed = PACKAGE_MANAGER.getInstalledPackageInfo(packageName);
Object specialInstallMessage = installed
.getPackageMetaDataElement("MessageToDisplayOnInstallation");
if (specialInstallMessage != null
&& specialInstallMessage.toString().length() > 0) {
String message = "**** Special installation message ****\n"
+ specialInstallMessage.toString()
+ "\n**** Special installation message ****";
for (PrintStream p : progress) {
p.println(message);
}
}
boolean loadIt = checkForMissingClasses(installed, progress);
if (loadIt) {
File packageRoot = new File(PACKAGE_MANAGER.getPackageHome()
+ File.separator + installed.getName());
loadIt = checkForMissingFiles(installed, packageRoot, progress);
if (loadIt) {
loadPackageDirectory(packageRoot, false);
}
}
return packageName;
}
示例15: mostRecentVersionWithRespectToConstraint
import org.pentaho.packageManagement.Package; //导入依赖的package包/类
/**
* Find the most recent version of the package encapsulated in the supplied
* PackageConstraint argument that satisfies the constraint
*
* @param toCheck the PackageConstraint containing the package in question
* @return the most recent version of the package satisfying the constraint
* @throws Exception if a version can't be found that satisfies the constraint
* or an error occurs while communicating with the respository
*/
public static Package mostRecentVersionWithRespectToConstraint(
PackageConstraint toCheck) throws Exception {
Package target = toCheck.getPackage();
Package result = null;
List<Object> availableVersions =
PACKAGE_MANAGER.getRepositoryPackageVersions(target.getName());
// version numbers will be in descending sorted order from the repository
// we want the most recent version that meets the target constraint
for (Object version : availableVersions) {
Package candidate =
PACKAGE_MANAGER.getRepositoryPackageInfo(target.getName(), version);
if (toCheck.checkConstraint(candidate)) {
result = candidate;
break;
}
}
if (result == null) {
throw new Exception("[WekaPackageManager] unable to find a version of "
+ "package " + target.getName() + " that meets constraint "
+ toCheck.toString());
}
return result;
}