KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > boot > PlatformConfiguration


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.internal.boot;
12
13 import java.io.IOException JavaDoc;
14 import java.net.URL JavaDoc;
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 JavaDoc url, ISitePolicy policy) {
25         return new SiteEntry(newConfig.createSiteEntry(url, ((SitePolicy) policy).getNewPolicy()));
26     }
27
28     public ISitePolicy createSitePolicy(int type, String JavaDoc[] list) {
29         return new SitePolicy(newConfig.createSitePolicy(type, list));
30     }
31
32     public IFeatureEntry createFeatureEntry(String JavaDoc id, String JavaDoc version, String JavaDoc pluginVersion, boolean primary, String JavaDoc application, URL JavaDoc[] root) {
33         return new FeatureEntry(newConfig.createFeatureEntry(id, version, pluginVersion, primary, application, root));
34     }
35
36     public IFeatureEntry createFeatureEntry(String JavaDoc id, String JavaDoc version, String JavaDoc pluginIdentifier, String JavaDoc pluginVersion, boolean primary, String JavaDoc application, URL JavaDoc[] 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 JavaDoc 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 JavaDoc id) {
84         return new FeatureEntry(newConfig.findConfiguredFeatureEntry(id));
85     }
86
87     public URL JavaDoc 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 JavaDoc getPrimaryFeatureIdentifier() {
104         return newConfig.getPrimaryFeatureIdentifier();
105     }
106
107     public URL JavaDoc[] getPluginPath() {
108         return newConfig.getPluginPath();
109     }
110
111     public String JavaDoc[] getBootstrapPluginIdentifiers() {
112         return newConfig.getBootstrapPluginIdentifiers();
113     }
114
115     public void setBootstrapPluginLocation(String JavaDoc id, URL JavaDoc 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 JavaDoc {
136         newConfig.save();
137     }
138
139     public void save(URL JavaDoc url) throws IOException JavaDoc {
140         newConfig.save(url);
141     }
142
143     public boolean equals(Object JavaDoc 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