1 11 package org.eclipse.core.internal.boot; 12 13 import java.io.IOException ; 14 import java.net.URL ; 15 import org.eclipse.core.boot.IPlatformConfiguration; 16 17 public class PlatformConfiguration implements IPlatformConfiguration { 18 private org.eclipse.update.configurator.IPlatformConfiguration newConfig; 19 20 public PlatformConfiguration(org.eclipse.update.configurator.IPlatformConfiguration config) { 21 newConfig = config; 22 } 23 24 public ISiteEntry createSiteEntry(URL url, ISitePolicy policy) { 25 return new SiteEntry(newConfig.createSiteEntry(url, ((SitePolicy) policy).getNewPolicy())); 26 } 27 28 public ISitePolicy createSitePolicy(int type, String [] list) { 29 return new SitePolicy(newConfig.createSitePolicy(type, list)); 30 } 31 32 public IFeatureEntry createFeatureEntry(String id, String version, String pluginVersion, boolean primary, String application, URL [] root) { 33 return new FeatureEntry(newConfig.createFeatureEntry(id, version, pluginVersion, primary, application, root)); 34 } 35 36 public IFeatureEntry createFeatureEntry(String id, String version, String pluginIdentifier, String pluginVersion, boolean primary, String application, URL [] root) { 37 return new FeatureEntry(newConfig.createFeatureEntry(id, version, pluginIdentifier, pluginVersion, primary, application, root)); 38 } 39 40 public void configureSite(ISiteEntry entry) { 41 newConfig.configureSite(((SiteEntry) entry).getNewSiteEntry()); 42 } 43 44 public void configureSite(ISiteEntry entry, boolean replace) { 45 newConfig.configureSite(((SiteEntry) entry).getNewSiteEntry(), replace); 46 } 47 48 public void unconfigureSite(ISiteEntry entry) { 49 newConfig.unconfigureSite(((SiteEntry) entry).getNewSiteEntry()); 50 } 51 52 public ISiteEntry[] getConfiguredSites() { 53 org.eclipse.update.configurator.IPlatformConfiguration.ISiteEntry[] sites = newConfig.getConfiguredSites(); 54 SiteEntry[] oldSites = new SiteEntry[sites.length]; 55 for (int i = 0; i < sites.length; i++) 56 oldSites[i] = new SiteEntry(sites[i]); 57 return oldSites; 58 } 59 60 public ISiteEntry findConfiguredSite(URL url) { 61 org.eclipse.update.configurator.IPlatformConfiguration.ISiteEntry siteEntry = newConfig.findConfiguredSite(url); 62 if (siteEntry == null) 63 return null; 64 return new SiteEntry(siteEntry); 65 } 66 67 public void configureFeatureEntry(IFeatureEntry entry) { 68 newConfig.configureFeatureEntry(((FeatureEntry) entry).getNewFeatureEntry()); 69 } 70 71 public void unconfigureFeatureEntry(IFeatureEntry entry) { 72 newConfig.unconfigureFeatureEntry(((FeatureEntry) entry).getNewFeatureEntry()); 73 } 74 75 public IFeatureEntry[] getConfiguredFeatureEntries() { 76 org.eclipse.update.configurator.IPlatformConfiguration.IFeatureEntry[] entries = newConfig.getConfiguredFeatureEntries(); 77 FeatureEntry[] oldEntries = new FeatureEntry[entries.length]; 78 for (int i = 0; i < entries.length; i++) 79 oldEntries[i] = new FeatureEntry(entries[i]); 80 return oldEntries; 81 } 82 83 public IFeatureEntry findConfiguredFeatureEntry(String id) { 84 return new FeatureEntry(newConfig.findConfiguredFeatureEntry(id)); 85 } 86 87 public URL getConfigurationLocation() { 88 return newConfig.getConfigurationLocation(); 89 } 90 91 public long getChangeStamp() { 92 return newConfig.getChangeStamp(); 93 } 94 95 public long getFeaturesChangeStamp() { 96 return newConfig.getFeaturesChangeStamp(); 97 } 98 99 public long getPluginsChangeStamp() { 100 return newConfig.getPluginsChangeStamp(); 101 } 102 103 public String getPrimaryFeatureIdentifier() { 104 return newConfig.getPrimaryFeatureIdentifier(); 105 } 106 107 public URL [] getPluginPath() { 108 return newConfig.getPluginPath(); 109 } 110 111 public String [] getBootstrapPluginIdentifiers() { 112 return newConfig.getBootstrapPluginIdentifiers(); 113 } 114 115 public void setBootstrapPluginLocation(String id, URL location) { 116 newConfig.setBootstrapPluginLocation(id, location); 117 } 118 119 public boolean isUpdateable() { 120 return newConfig.isUpdateable(); 121 } 122 123 public boolean isTransient() { 124 return newConfig.isTransient(); 125 } 126 127 public void isTransient(boolean value) { 128 newConfig.isTransient(value); 129 } 130 131 public void refresh() { 132 newConfig.refresh(); 133 } 134 135 public void save() throws IOException { 136 newConfig.save(); 137 } 138 139 public void save(URL url) throws IOException { 140 newConfig.save(url); 141 } 142 143 public boolean equals(Object o) { 144 if (o instanceof PlatformConfiguration) 145 return newConfig.equals(((PlatformConfiguration) o).newConfig); 146 return false; 147 } 148 149 public int hashCode() { 150 return newConfig.hashCode(); 151 } 152 } 153 | Popular Tags |