本文整理了Java中org.eclipse.equinox.internal.frameworkadmin.utils.Utils
类的一些代码示例,展示了Utils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils
类的具体详情如下:
包路径:org.eclipse.equinox.internal.frameworkadmin.utils.Utils
类名称:Utils
暂无
代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.simpleconfigurator.manipulator
private static boolean isTargetConfiguratorBundle(URI location) {
final String symbolic = Utils.getPathFromClause(Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME));
return (SimpleConfiguratorManipulator.SERVICE_PROP_VALUE_CONFIGURATOR_SYMBOLICNAME.equals(symbolic));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin
public static String[] getTokens(String msg, String delim) {
return getTokens(msg, delim, false);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.simpleconfigurator.manipulator
private BundleInfo[] orderingInitialConfig(List<BundleInfo> setToInitialConfig) {
List<BundleInfo> notToBeStarted = new LinkedList<BundleInfo>();
List<BundleInfo> toBeStarted = new LinkedList<BundleInfo>();
for (Iterator<BundleInfo> ite2 = setToInitialConfig.iterator(); ite2.hasNext();) {
BundleInfo bInfo = ite2.next();
if (bInfo.isMarkedAsStarted())
toBeStarted.add(bInfo);
else
notToBeStarted.add(bInfo);
}
setToInitialConfig.clear();
setToInitialConfig.addAll(notToBeStarted);
setToInitialConfig.addAll(toBeStarted);
return Utils.getBundleInfosFromList(setToInitialConfig);
}
代码示例来源:origin: org.eclipse.equinox/frameworkadmin
public static String[] getClausesManifestMainAttributes(URI location, String name) {
return getClauses(getManifestMainAttributes(location, name));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin
public static URL getUrlInFull(String path, URL from) throws MalformedURLException {//throws ManipulatorException {
Utils.checkFullUrl(from, "from"); //$NON-NLS-1$
path = Utils.replaceAll(path, File.separator, "/"); //$NON-NLS-1$
//System.out.println("from.toExternalForm()=" + from.toExternalForm());
String fromSt = Utils.removeLastCh(from.toExternalForm(), '/');
//System.out.println("fromSt=" + fromSt);
if (path.startsWith("/")) { //$NON-NLS-1$
String fileSt = from.getFile();
return new URL(fromSt.substring(0, fromSt.lastIndexOf(fileSt) - 1) + path);
}
return new URL(fromSt + "/" + path); //$NON-NLS-1$
}
代码示例来源:origin: org.eclipse.equinox/frameworkadmin
public BundleInfo[] getPrerequisteBundles(BundleInfo bInfo) {
URI location = bInfo.getLocation();
final String requiredBundles = Utils.getManifestMainAttributes(location, Constants.REQUIRE_BUNDLE);
if (requiredBundles == null)
return new BundleInfo[] {this.getSystemBundle()};
String[] clauses = Utils.getClauses(requiredBundles);
List list = new LinkedList();
for (int i = 0; i < clauses.length; i++)
list.add(Utils.getPathFromClause(clauses[i]));
List ret = new LinkedList();
ret.add(this.getSystemBundle());
for (Iterator ite = this.bundleInfosList.iterator(); ite.hasNext();) {
BundleInfo currentBInfo = (BundleInfo) ite.next();
URI currentLocation = currentBInfo.getLocation();
String currentSymbolicName = Utils.getManifestMainAttributes(currentLocation, Constants.BUNDLE_SYMBOLICNAME);
if (currentSymbolicName == null)
continue;
currentSymbolicName = Utils.getPathFromClause(currentSymbolicName);
for (Iterator ite2 = list.iterator(); ite2.hasNext();) {
String symbolicName = (String) ite2.next();
if (symbolicName.equals(currentSymbolicName)) {
ret.add(currentBInfo);
break;
}
}
}
return Utils.getBundleInfosFromList(ret);
}
代码示例来源:origin: org.eclipse.equinox.frameworkadmin/equinox
private BundleInfo convertSystemBundle(BundleDescription toConvert) {
// Converting the System Bundle
boolean markedAsStarted = false;
int sl = BundleInfo.NO_LEVEL;
URI location = null;
String symbolicNameTarget = toConvert.getSymbolicName();
Version versionTarget = toConvert.getVersion();
try {
File fwJar = manipulator.getLauncherData().getFwJar();
if (fwJar != null) {
URI fwJarLocation = fwJar.toURI();
String[] clauses = Utils.getClausesManifestMainAttributes(fwJarLocation, Constants.BUNDLE_SYMBOLICNAME);
String fwJarSymbolicName = Utils.getPathFromClause(clauses[0]);
String fwJarVersionSt = Utils.getManifestMainAttributes(fwJarLocation, Constants.BUNDLE_VERSION);
if (fwJarSymbolicName.equals(symbolicNameTarget) && fwJarVersionSt.equals(versionTarget.toString())) {
location = fwJarLocation;
markedAsStarted = true;
}
}
} catch (FrameworkAdminRuntimeException e1) {
Log.log(LogService.LOG_ERROR, "", e1); //$NON-NLS-1$
}
return createBundleInfo(toConvert, markedAsStarted, sl, location, null);
}
代码示例来源:origin: org.eclipse.equinox.frameworkadmin/equinox
bInfos = Utils.sortBundleInfos(bInfos, initialBSL);
continue;
for (int j = 0; j < references.length; j++)
if (references[j].getProperty(ConfiguratorManipulator.SERVICE_PROP_KEY_CONFIGURATOR_BUNDLESYMBOLICNAME).equals(Utils.getPathFromClause(Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME)))) {
configuratorManipulator = (ConfiguratorManipulator) cmTracker.getService(references[j]);
break;
代码示例来源:origin: org.eclipse.equinox/frameworkadmin
public BundleInfo[] getSystemFragmentedBundles() {
BundleInfo systemBInfo = this.getSystemBundle();
if (systemBInfo == null)
return NULL_BUNDLEINFOS;
List list = new LinkedList();
for (Iterator ite = this.bundleInfosList.iterator(); ite.hasNext();) {
BundleInfo bInfo = (BundleInfo) ite.next();
URI location = bInfo.getLocation();
String manifestVersion = Utils.getManifestMainAttributes(location, Constants.BUNDLE_MANIFESTVERSION);
if (manifestVersion == null)
continue;
if (manifestVersion.equals("1") || manifestVersion.equals("1.0")) //$NON-NLS-1$//$NON-NLS-2$
continue;
String fragmentHost = Utils.getManifestMainAttributes(location, Constants.FRAGMENT_HOST);
if (fragmentHost == null)
continue;
int index = fragmentHost.indexOf(";"); //$NON-NLS-1$
if (index == -1)
continue;
String symbolicName = fragmentHost.substring(0, index).trim();
String parameter = fragmentHost.substring(index + 1).trim();
// TODO What to do ,in case of alias name of system bundle is not used ?
if (symbolicName.equals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME))
if (parameter.equals(Constants.EXTENSION_DIRECTIVE + ":=" + Constants.EXTENSION_FRAMEWORK)) { //$NON-NLS-1$
list.add(location);
break;
}
}
return Utils.getBundleInfosFromList(list);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin
public static String getRelativePath(File target, File from) {
String targetPath = Utils.replaceAll(target.getAbsolutePath(), File.separator, PATH_SEP);
String fromPath = Utils.replaceAll(from.getAbsolutePath(), File.separator, PATH_SEP);
String[] targetTokens = Utils.getTokens(targetPath, PATH_SEP);
String[] fromTokens = Utils.getTokens(fromPath, PATH_SEP);
int index = -1;
for (int i = 0; i < fromTokens.length; i++)
if (fromTokens[i].equals(targetTokens[i]))
index = i;
else
break;
StringBuffer sb = new StringBuffer();
for (int i = index + 1; i < fromTokens.length; i++)
sb.append(".." + PATH_SEP); //$NON-NLS-1$
for (int i = index + 1; i < targetTokens.length; i++)
if (i != targetTokens.length - 1)
sb.append(targetTokens[i] + PATH_SEP);
else
sb.append(targetTokens[i]);
return sb.toString();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin.equinox
return;
if (!Utils.createParentDir(outputFile)) {
throw new IllegalStateException(NLS.bind(Messages.exception_failedToCreateDir, outputFile.getParent()));
Utils.printoutProperties(System.out, "configProps", configProps); //$NON-NLS-1$
File dest = Utils.getSimpleDataFormattedFile(outputFile);
if (!outputFile.renameTo(dest))
throw new IOException(NLS.bind(Messages.exception_failedToRename, outputFile, dest));
代码示例来源:origin: org.eclipse.equinox/frameworkadmin
public static String getManifestMainAttributes(URI location, String name) {
Dictionary manifest = Utils.getOSGiManifest(location);
if (manifest == null)
throw new RuntimeException("Unable to locate bundle manifest: " + location);
return (String) manifest.get(name);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin.equinox
public static File isSystemBundle(BundleInfo bundleInfo) {
if (bundleInfo == null || bundleInfo.getLocation() == null)
return null;
URI bundleLocation = bundleInfo.getLocation();
try {
String[] clauses = Utils.getClausesManifestMainAttributes(bundleLocation, Constants.BUNDLE_SYMBOLICNAME);
if (bundleLocation.getPath().indexOf(EquinoxConstants.FW_SYMBOLIC_NAME) > 0)
if (EquinoxConstants.PERSISTENT_DIR_NAME.equals(Utils.getPathFromClause(clauses[0])))
return new File(bundleLocation);
} catch (RuntimeException e) {
e.printStackTrace();
}
return null;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin.equinox
if (!Utils.createParentDir(launcherConfigFile)) {
throw new IllegalStateException(Messages.exception_failedToCreateDir);
File dest = Utils.getSimpleDataFormattedFile(launcherConfigFile);
if (!launcherConfigFile.renameTo(dest))
throw new IOException(NLS.bind(Messages.exception_failedToRename, launcherConfigFile, dest));
代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.simpleconfigurator.manipulator
public static void writeConfiguration(BundleInfo[] simpleInfos, File outputFile) throws IOException {
if (!Utils.createParentDir(outputFile)) {
throw new IllegalStateException(Messages.exception_failedToCreateDir);
}
IOException caughtException = null;
OutputStream stream = null;
try {
stream = new FileOutputStream(outputFile);
writeConfiguration(simpleInfos, stream);
} catch (IOException e) {
caughtException = e;
} finally {
try {
if (stream != null)
stream.close();
} catch (IOException e) {
// we want to avoid over-writing the original exception
if (caughtException != null)
caughtException = e;
}
}
if (caughtException != null)
throw caughtException;
}
代码示例来源:origin: org.eclipse.equinox/frameworkadmin
return basicLoadManifest(URIUtil.toFile(location));
File file = jarName != null ? new File(jarName) : null;
if (file != null && file.exists()) {
return convertPluginManifest(file, true);
return manifestToProperties(manifest);
} catch (BundleException e) {
return null;
代码示例来源:origin: org.eclipse.equinox.simpleconfigurator/manipulator
private void saveConfiguration(BundleInfo[] configuration, File outputFile, URI installArea, boolean backup) throws IOException {
if (backup && outputFile.exists()) {
File backupFile = Utils.getSimpleDataFormattedFile(outputFile);
if (!outputFile.renameTo(backupFile)) {
throw new IOException("Fail to rename from (" + outputFile + ") to (" + backupFile + ")");
}
}
org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo[] simpleInfos = convertBundleInfos(configuration, installArea);
// if empty remove the configuration file
if (simpleInfos == null || simpleInfos.length == 0) {
if (outputFile.exists()) {
outputFile.delete();
}
File parentDir = outputFile.getParentFile();
if (parentDir.exists()) {
parentDir.delete();
}
return;
}
SimpleConfiguratorManipulatorUtils.writeConfiguration(simpleInfos, outputFile);
if (CONFIG_LIST.equals(outputFile.getName()) && installArea != null && isSharedInstallSetup(URIUtil.toFile(installArea), outputFile))
rememberSharedBundlesInfoTimestamp(installArea, outputFile.getParentFile());
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin
return basicLoadManifest(URIUtil.toFile(location));
return null;
return manifestToProperties(manifest);
} catch (BundleException e) {
return null;
代码示例来源:origin: org.eclipse.equinox.simpleconfigurator/manipulator
Utils.appendProperties(properties, manipulator.getConfigData().getProperties());
boolean exclusiveInstallation = Boolean.valueOf(properties.getProperty(SimpleConfiguratorManipulatorImpl.PROP_KEY_EXCLUSIVE_INSTALLATION)).booleanValue();
File configFile = getConfigFile(manipulator);
代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.frameworkadmin
public BundleInfo[] getPrerequisteBundles(BundleInfo bInfo) {
URI location = bInfo.getLocation();
final String requiredBundles = Utils.getManifestMainAttributes(location, Constants.REQUIRE_BUNDLE);
if (requiredBundles == null)
return new BundleInfo[] {this.getSystemBundle()};
String[] clauses = Utils.getClauses(requiredBundles);
List<String> list = new LinkedList<String>();
for (int i = 0; i < clauses.length; i++)
list.add(Utils.getPathFromClause(clauses[i]));
List<BundleInfo> ret = new LinkedList<BundleInfo>();
ret.add(this.getSystemBundle());
for (Iterator<BundleInfo> ite = this.bundleInfosList.iterator(); ite.hasNext();) {
BundleInfo currentBInfo = ite.next();
URI currentLocation = currentBInfo.getLocation();
String currentSymbolicName = Utils.getManifestMainAttributes(currentLocation, Constants.BUNDLE_SYMBOLICNAME);
if (currentSymbolicName == null)
continue;
currentSymbolicName = Utils.getPathFromClause(currentSymbolicName);
for (Iterator<String> ite2 = list.iterator(); ite2.hasNext();) {
String symbolicName = ite2.next();
if (symbolicName.equals(currentSymbolicName)) {
ret.add(currentBInfo);
break;
}
}
}
return Utils.getBundleInfosFromList(ret);
}
内容来源于网络,如有侵权,请联系作者删除!