org.eclipse.update.core/Scrapbook.jpage
Parent Directory
|
Revision Log
Revision 1.17 -
(download)
(annotate)
Fri Jan 3 21:42:25 2003 UTC (6 years, 10 months ago) by celek
Branch: MAIN
CVS Tags: v20070416a, v20041012, v20070413patches, v01062006, v20060816, R2_1_3, R2_1_2, R2_1_1, v20050412, v20050411, v20051115, v20051114, v20050418, v20041129, v20040607a, v20081003, v20030129H1200, v20041120, v20040528, v20040520, v20040527, v20030305H1715, R3_2, v20040209, v20060329, v20060326, v20060321, v20031215, v20031217, v20050623a, R32x_v20061220, v20051205, v20030701, v20030709, v20030708, v20030617, v20030107H0700, v20090223, v20030221H1615, v20070328, v20040512b, v20040119, v20020205H2030, R32x_v20070109, R2_1, v20060601, v20060602, v20060605, v20051215a, v20090316, v20041119, v20030114H1300, v20050317, v20051031, v20050526, v20050525, v20030715b, v20060829, v20041122a, R34x_v20080714, v20040419, v20060504, v20060505, v20040413, v20040410, v20060823, v20040930_R3_0_1_1, v20040219, v20080515, v20031201, v20040325_patched, v20031209, v20031208, v20030624, r311_v20050915, v20081127, v20030310-precopyrightupdate, R3_3_1_1, v20092006, v20070615, v20030121H0630, v20070321b, v20070321a, v20040505a, v20030221H0700, v20090213, v20041002, v20041003, v20050317a, v20020205H2100, v20050317c, v20050211, v20070517a, v20040826a, v20050403, v20050130, R33x_v20070911, v20040320, v20040321, v20040322, R3_4, R3_5, R3_0, R3_1, v20040519, R3_3, v20040517, v20040516, v20040512, v20040510, v20030624a, v20040517a, v20040809, v20050125_R3_0_2, v20040608, v20092006-1400, v20030211H1130, pre_R3_3, v20040923, v20020311H1415_RC2_copyright, v20070322b, v20070322a, v20080428, v20090427, v20080421, R32x_v20061214, v20051214, v20051215, v20030220H1300, v20030715, v20030710, r311_v20050823, v20102006-1507, v20030310-postcopyrightupdate, R33x_v20070828a, v20050609a, v20050609c, R34x_v20081202, v20050621, v20050623, R32x_v20070111, v20031021, R32x_v20070118, v20040623c, v20040623b, v20040623a, v20071113, v20070424, v20070426, v20030127H1100_pre_progressmonitor_refactoring, v20030506, v20030916a, v20030327H1145, v20040315, v20040317, v20040316, v20030820a, v20040318, v20040426, v20030218H0630, v20040504a, v20070514, v20070515, v20070517, v20070510, v20040316b, v20031212, v20030611, v20030610, v20050412b, v20050412c, v20050412a, v20040223, v20040224, v20030715a, v20030916, r312_v20051215, R34x_v20081128, v20030820, v20030825, v20030827, v20030218H1300, v20040325_patched_63120, R33x_v20070828, v20070606a, v20031110_rcp, v20092006-patch1, v20050610, v20090209, v20050616, v20050207, v20080714, v20041109a, v20050805, v20040720, v20060329-a, v20041109, v20070411, v20070413, v20070415, v20041101, v20070416, v20040503, v20040504, v20040505, v20040923a_R3_0_maintenance, v20040720_R3_0_maintenance, v20050506, v20040610, v20030812, v20071113a, I20060605-1430, v20041212, v20030729, v20041215, v20030722, v20070522, v20030121H0800, v20050610a, v20090302, v20030923, v20030922, v20050125a_R3_0_2, R3_4_2, R3_4_1, v20060329a, v20080222, v20041103, v20070828, v20040625, v20040624, v20040623, v20040316c, v20020312H1745, v20050420, v20050425, R3_0_2, R3_0_1, v20060809, v20040307, v20061124, v20040301, R3_2_1, v20040308, R3_2_2, v20040430, v20030603, v20061220, v20020128H0700, v203_20030325, v20060412, v20060413, r312_v20060109, v20081107, v20090525, Root_R3_2_maintenance, v20030327H1825, v20050110, v20070606_copyright, v20040923a, v20040610a, v20080318, v20081215, v20050609, v20050602, v20041027, v20041021, v20080317, v20070316, v20031006, v20070321, v20030306H1200, v20030317H1640, v20051129, v20030327H1040, v20090306, v20070403, v20070404, v20030114H1100, v20060504a, R3_5_1, v20050301, v20040923_R3_0_maintenance, v20040824, v20050512, v20050511, v20030527, v20030528, v20060403b, v20040603a, v20040603b, v20060511, v20060510, v20040405, v20040406, v20030317H0845, R3_1_2, v20041206, R3_1_1, v20030819, v20030325, R3_3_1, R3_3_2, v20061211, v20061214, v20090429-1625, v20060424, v20060426, v20060428, v20040412a, v20031124, v20040325, HEAD
Branch point for: R3_0_maintenance, R3_4_1_maintenance_patches, M8_3_0, R3_1_maintenance, R3_3_maintenance, v20031021_update_refactoring, R3_4_maintenance, R3_5_maintenance, R3_2_maintenance, New-Simple-Configurator
Changes since 1.16: +5 -1 lines
Fri Jan 3 21:42:25 2003 UTC (6 years, 10 months ago) by celek
Branch: MAIN
CVS Tags: v20070416a, v20041012, v20070413patches, v01062006, v20060816, R2_1_3, R2_1_2, R2_1_1, v20050412, v20050411, v20051115, v20051114, v20050418, v20041129, v20040607a, v20081003, v20030129H1200, v20041120, v20040528, v20040520, v20040527, v20030305H1715, R3_2, v20040209, v20060329, v20060326, v20060321, v20031215, v20031217, v20050623a, R32x_v20061220, v20051205, v20030701, v20030709, v20030708, v20030617, v20030107H0700, v20090223, v20030221H1615, v20070328, v20040512b, v20040119, v20020205H2030, R32x_v20070109, R2_1, v20060601, v20060602, v20060605, v20051215a, v20090316, v20041119, v20030114H1300, v20050317, v20051031, v20050526, v20050525, v20030715b, v20060829, v20041122a, R34x_v20080714, v20040419, v20060504, v20060505, v20040413, v20040410, v20060823, v20040930_R3_0_1_1, v20040219, v20080515, v20031201, v20040325_patched, v20031209, v20031208, v20030624, r311_v20050915, v20081127, v20030310-precopyrightupdate, R3_3_1_1, v20092006, v20070615, v20030121H0630, v20070321b, v20070321a, v20040505a, v20030221H0700, v20090213, v20041002, v20041003, v20050317a, v20020205H2100, v20050317c, v20050211, v20070517a, v20040826a, v20050403, v20050130, R33x_v20070911, v20040320, v20040321, v20040322, R3_4, R3_5, R3_0, R3_1, v20040519, R3_3, v20040517, v20040516, v20040512, v20040510, v20030624a, v20040517a, v20040809, v20050125_R3_0_2, v20040608, v20092006-1400, v20030211H1130, pre_R3_3, v20040923, v20020311H1415_RC2_copyright, v20070322b, v20070322a, v20080428, v20090427, v20080421, R32x_v20061214, v20051214, v20051215, v20030220H1300, v20030715, v20030710, r311_v20050823, v20102006-1507, v20030310-postcopyrightupdate, R33x_v20070828a, v20050609a, v20050609c, R34x_v20081202, v20050621, v20050623, R32x_v20070111, v20031021, R32x_v20070118, v20040623c, v20040623b, v20040623a, v20071113, v20070424, v20070426, v20030127H1100_pre_progressmonitor_refactoring, v20030506, v20030916a, v20030327H1145, v20040315, v20040317, v20040316, v20030820a, v20040318, v20040426, v20030218H0630, v20040504a, v20070514, v20070515, v20070517, v20070510, v20040316b, v20031212, v20030611, v20030610, v20050412b, v20050412c, v20050412a, v20040223, v20040224, v20030715a, v20030916, r312_v20051215, R34x_v20081128, v20030820, v20030825, v20030827, v20030218H1300, v20040325_patched_63120, R33x_v20070828, v20070606a, v20031110_rcp, v20092006-patch1, v20050610, v20090209, v20050616, v20050207, v20080714, v20041109a, v20050805, v20040720, v20060329-a, v20041109, v20070411, v20070413, v20070415, v20041101, v20070416, v20040503, v20040504, v20040505, v20040923a_R3_0_maintenance, v20040720_R3_0_maintenance, v20050506, v20040610, v20030812, v20071113a, I20060605-1430, v20041212, v20030729, v20041215, v20030722, v20070522, v20030121H0800, v20050610a, v20090302, v20030923, v20030922, v20050125a_R3_0_2, R3_4_2, R3_4_1, v20060329a, v20080222, v20041103, v20070828, v20040625, v20040624, v20040623, v20040316c, v20020312H1745, v20050420, v20050425, R3_0_2, R3_0_1, v20060809, v20040307, v20061124, v20040301, R3_2_1, v20040308, R3_2_2, v20040430, v20030603, v20061220, v20020128H0700, v203_20030325, v20060412, v20060413, r312_v20060109, v20081107, v20090525, Root_R3_2_maintenance, v20030327H1825, v20050110, v20070606_copyright, v20040923a, v20040610a, v20080318, v20081215, v20050609, v20050602, v20041027, v20041021, v20080317, v20070316, v20031006, v20070321, v20030306H1200, v20030317H1640, v20051129, v20030327H1040, v20090306, v20070403, v20070404, v20030114H1100, v20060504a, R3_5_1, v20050301, v20040923_R3_0_maintenance, v20040824, v20050512, v20050511, v20030527, v20030528, v20060403b, v20040603a, v20040603b, v20060511, v20060510, v20040405, v20040406, v20030317H0845, R3_1_2, v20041206, R3_1_1, v20030819, v20030325, R3_3_1, R3_3_2, v20061211, v20061214, v20090429-1625, v20060424, v20060426, v20060428, v20040412a, v20031124, v20040325, HEAD
Branch point for: R3_0_maintenance, R3_4_1_maintenance_patches, M8_3_0, R3_1_maintenance, R3_3_maintenance, v20031021_update_refactoring, R3_4_maintenance, R3_5_maintenance, R3_2_maintenance, New-Simple-Configurator
Changes since 1.16: +5 -1 lines
*** empty log message ***
java.util.Enumeration enum = System.getProperties().keys();
String key = null;
while (enum.hasMoreElements()){
key = (String)enum.nextElement();
System.out.print(key);
for (int i =0;i<(30-key.length());i++)System.out.print(" ");
System.out.println("->"+System.getProperty(key));
}
new java.net.URL("file://C:/temp/org.eclipse.update.core.feature1_1.0.0/org.eclipse.update.core.feature1.plugin1_1.1.1.jar").openStream()
(new java.io.File("C:\\chris chris\hello\\")).mkdirs();
java.net.URL a = new java.net.URL("http","www.oti.com","/feature/blah.jar");
java.net.URL b = new java.net.URL("jar",null,a.toExternalForm()+"!/hello.txt");
b
new java.net.URL("file",null,System.getProperty("java.io.tmpdir"));
new java.net.URL("file",null,System.getProperty("user.home"));
String tempDir = "c:\\TEMP\\features2.jar";
java.net.URL TEMP_SITE = new java.net.URL("file",null,tempDir);
java.net.URL file = new java.net.URL("jar",null,TEMP_SITE.toExternalForm()+"!/feature.xml");
file.openStream();
file
java.io.File f = new java.io.File("c:\\temp\\xtf\\file.jar");
f.mkdirs()
java.util.Locale.getDefault()
java.util.ResourceBundle
java.net.URL url = new java.net.URL("file",null,"C:\\path"+java.io.File.separator);
url.getPath().endsWith("/");
url
java.net.URL url = new java.net.URL("http://machine:8080/path space/file.abc#hello");
java.net.URL url2 = new java.net.URL(url,"/ ");
url2.getPath()
java.lang.ClassLoader l = new java.net.URLClassLoader(new java.net.URL[] {new java.net.URL("file",null,"c:\\oti\\wsw205\\eclipse\\install\\features\\org.eclipse.help.feature_1.0.4/") }, null);
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("feature", java.util.Locale.getDefault(), l);
bundle
String[] ss = {"a", "b"};
java.util.List list = new java.util.ArrayList(0);
list.addAll(java.util.Arrays.asList(ss));
list.add("c");
list.size();
java.util.List list = new java.util.ArrayList(0);
list.add("1");
list.add("2");
list.add("3");
list.add("4");
list.add("5");
list.add("6");
list.add("7");
while (list.size()>5){
list.remove(0);
}
list.get(0)
org.eclipse.update.internal.security.KeyStores k = new org.eclipse.update.internal.security.KeyStores();
while (k.hasNext()){
org.eclipse.update.internal.security.KeystoreHandle handle = (org.eclipse.update.internal.security.KeystoreHandle) k.next();
System.out.println("KeyStore:"+handle.getLocation()+":"+handle.getType());
}
int i = (13/3);
i
*****************************************
OLD Feature Code
/**
*/
private void downloadArchivesLocally(ISite tempSite, String[] archiveIDToInstall, IProgressMonitor monitor) throws CoreException, IOException {
URL sourceURL;
String newFile;
URL newURL;
if (monitor != null) {
monitor.beginTask("Download archives bundles to Temporary Space", archiveIDToInstall.length);
}
for (int i = 0; i < archiveIDToInstall.length; i++) {
// transform the id by asking the site to map them to real URL inside the SITE
if (getSite() != null) {
sourceURL = getSite().getSiteContentProvider().getArchivesReferences(archiveIDToInstall[i]);
if (monitor != null) {
monitor.subTask("..." + archiveIDToInstall[i]);
}
// the name of the file in the temp directory
// should be the regular plugins/pluginID_ver as the Temp site is OUR site
newFile = Site.DEFAULT_PLUGIN_PATH + archiveIDToInstall[i];
newURL = UpdateManagerUtils.resolveAsLocal(sourceURL, newFile, monitor);
// transfer the possible mapping to the temp site
((Site) tempSite).addArchive(new URLEntry(archiveIDToInstall[i], newURL));
if (monitor != null) {
monitor.worked(1);
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
}
}
// the site of this feature now becomes the TEMP directory
// FIXME: make sure there is no other issue
// like asking for stuff that hasn't been copied
// or reusing this feature
// of having an un-manageable temp site
this.setSite(tempSite);
}
/**
*/
private void downloadDataLocally(IFeature targetFeature, INonPluginEntry[] dataToInstall, IProgressMonitor monitor) throws CoreException, IOException {
URL sourceURL;
// any other data
INonPluginEntry[] entries = getNonPluginEntries();
if (entries != null) {
if (monitor != null) {
monitor.beginTask("Installing Other Data information", dataToInstall.length);
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
for (int j = 0; j < entries.length; j++) {
String name = dataToInstall[j].getIdentifier();
if (monitor != null) {
monitor.subTask("..." + name);
}
// the id is URL format with "/"
String dataEntryId = Site.DEFAULT_FEATURE_PATH + getIdentifier().toString() + "/" + name;
// transform the id by asking the site to map them to real URL inside the SITE
if (getSite() != null) {
sourceURL = getSite().getSiteContentProvider().getArchivesReferences(dataEntryId);
((Site) targetFeature.getSite()).storeFeatureInfo(getIdentifier(), name, sourceURL.openStream());
if (monitor != null) {
monitor.worked(1);
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
}// getSite==null
}
}
}
/**
* Method install.
* @param targetFeature
* @param monitor
* @throws CoreException
*/
public void old_install(IFeature targetFeature, IProgressMonitor monitor) throws CoreException {
IPluginEntry[] sourceFeaturePluginEntries = getPluginEntries();
IPluginEntry[] targetSitePluginEntries = targetFeature.getSite().getPluginEntries();
Site tempSite = (Site) SiteManager.getTempSite();
// determine list of plugins to install
// find the intersection between the two arrays of IPluginEntry...
// The one teh site contains and teh one the feature contains
IPluginEntry[] pluginsToInstall = intersection(sourceFeaturePluginEntries, targetSitePluginEntries);
// private abstract - Determine list of content references id /archives id /bundles id that
// map the list of plugins to install
String[] archiveIDToInstall = getContentReferenceToInstall(pluginsToInstall);
try {
// download and install data bundles
// before we set the site of teh feature to the TEMP site
INonPluginEntry[] dataEntries = getNonPluginEntries();
if (dataEntries.length > 0) {
downloadDataLocally(targetFeature, dataEntries, monitor);
}
// optmization, may be private to implementation
// copy *blobs/content references/archives/bundles* in TEMP space
if (((Site) getSite()).optimize()) {
if (archiveIDToInstall != null) {
downloadArchivesLocally(tempSite, archiveIDToInstall, monitor);
}
}
// obtain the list of *Streamable Storage Unit*
// from the archive
if (monitor != null) {
int total = pluginsToInstall == null ? 1 : pluginsToInstall.length + 1;
monitor.beginTask("Install feature " + getLabel(), total);
}
if (pluginsToInstall != null) {
InputStream inStream = null;
for (int i = 0; i < pluginsToInstall.length; i++) {
if (monitor != null) {
monitor.subTask("Installing plug-in: " + pluginsToInstall[i]);
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
open(pluginsToInstall[i]);
String[] names = getStorageUnitNames(pluginsToInstall[i]);
if (names != null) {
for (int j = 0; j < names.length; j++) {
if ((inStream = getInputStreamFor(pluginsToInstall[i], names[j])) != null)
targetFeature.store(pluginsToInstall[i], names[j], inStream);
}
}
close(pluginsToInstall[i]);
if (monitor != null) {
monitor.worked(1);
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
}
}
// install the Feature info
InputStream inStream = null;
String[] names = getStorageUnitNames(this);
if (names != null) {
openFeature();
if (monitor != null) {
monitor.subTask("Installing Feature information");
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
for (int j = 0; j < names.length; j++) {
if ((inStream = getInputStreamFor(this, names[j])) != null)
((Site) targetFeature.getSite()).storeFeatureInfo(getIdentifier(), names[j], inStream);
}
closeFeature();
if (monitor != null) {
monitor.worked(1);
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
}
} catch (IOException e) {
String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Error during Install", e);
throw new CoreException(status);
} finally {
//do not clean up TEMP drive
// as other feature may be there... clean up when exiting the plugin
}
}
/**
* @see IPluginContainer#store(IPluginEntry, String, InputStream)
*/
public void store(IPluginEntry pluginEntry, String contentKey, InputStream inStream) throws CoreException {
// check if pluginEntry already exists before passing to the site
// anything else ?
boolean found = false;
int i = 0;
IPluginEntry[] entries = getPluginEntries();
while (i < entries.length && !found) {
if (entries[i].equals(pluginEntry)) {
found = true;
}
i++;
}
if (!found) {
String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "The plugin:" + pluginEntry.getIdentifier().toString() + " is not part of the plugins of the feature:" + this.getIdentifier().toString(), null);
throw new CoreException(status);
}
getSite().store(pluginEntry, contentKey, inStream);
}
/**
* perform pre processing before opening a plugin archive
* @param entry the plugin about to be opened
*/
protected void open(IPluginEntry entry) {
};
/**
* perform post processing to close a plugin archive
* @param entry the plugin about to be closed
*/
protected void close(IPluginEntry entry) throws IOException {
};
/**
* perform pre processing before opening the feature archive
*/
protected void openFeature() {
};
/**
* perform post processing to close a feature archive
*/
public void closeFeature() throws IOException {
};
/**
* return the list of FILE to be transfered for a Plugin
*/
protected abstract String[] getStorageUnitNames(IPluginEntry pluginEntry) throws CoreException;
/**
* return the list of FILE to be transfered from within the Feature
*/
protected abstract String[] getStorageUnitNames(IFeature feature) throws CoreException;
/**
* return the Stream of the FILE to be transfered for a Plugin
*/
protected abstract InputStream getInputStreamFor(IPluginEntry pluginEntry, String name) throws CoreException;
/**
* return the Stream of FILE to be transfered from within the Feature
*/
protected abstract InputStream getInputStreamFor(IFeature feature, String name) throws IOException, CoreException;
/**
* returns the list of archive to transfer/install
* in order to install the list of plugins
*
* @param pluginsToInstall list of plugin to install
*/
protected abstract String[] getContentReferenceToInstall(IPluginEntry[] pluginsToInstall);
/**
* remove myself...
*/
public void old_remove(IProgressMonitor monitor) throws CoreException {
// remove the feature and the plugins if they are not used and not activated
// get the plugins from the feature
IPluginEntry[] pluginsToRemove = ((SiteLocal) SiteManager.getLocalSite()).getDeltaPluginEntries(this);
try {
// obtain the list of *Streamable Storage Unit*
// from the archive
if (monitor != null) {
int total = pluginsToRemove == null ? 1 : pluginsToRemove.length + 1;
monitor.beginTask("Uninstall feature " + getLabel(), total);
}
if (pluginsToRemove != null) {
for (int i = 0; i < pluginsToRemove.length; i++) {
if (monitor != null) {
monitor.subTask("Removing plug-in: " + pluginsToRemove[i]);
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
remove(pluginsToRemove[i]);
if (monitor != null) {
monitor.worked(1);
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
}
}
// remove the Feature info
String[] names = getStorageUnitNames(this);
if (names != null) {
if (monitor != null) {
monitor.subTask("Removing Feature information");
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
((Site) this.getSite()).removeFeatureInfo(getIdentifier());
closeFeature();
if (monitor != null) {
monitor.worked(1);
if (monitor.isCanceled()) {
throw CANCEL_EXCEPTION;
}
}
}
} catch (IOException e) {
String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Error during Uninstall", e);
throw new CoreException(status);
}
}
System.getProperty("java.io.tmpdir")(java.lang.String) /tmp
true^false
true^true
org.eclipse.core.runtime.IPath p1= (new org.eclipse.core.runtime.Path("/path1/path2/*.txt"));
org.eclipse.core.runtime.IPath p2= (new org.eclipse.core.runtime.Path("/path1/path2/a.txt"));
p1.equals(p2);
org.eclipse.update.internal.core.URLEncoder.encode(new java.net.URL("http://www.ourwebsite.com/servlet/update?jar=somefeaturejarfile"));(java.net.URL) http://www.ourwebsite.com/servlet/update?jar=somefeaturejarfile
| help@eclipse.org | ViewVC Help |
| Powered by ViewVC 1.0.3 |
