EMMA Coverage Report (generated Thu Nov 26 15:54:18 CST 2009)
[all classes][org.eclipse.pde.api.tools.internal.model]

COVERAGE SUMMARY FOR SOURCE FILE [SystemLibraryApiComponent.java]

nameclass, %method, %block, %line, %
SystemLibraryApiComponent.java100% (1/1)45%  (9/20)85%  (145/171)74%  (31/42)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SystemLibraryApiComponent100% (1/1)45%  (9/20)85%  (145/171)74%  (31/42)
createApiFilterStore (): IApiFilterStore 0%   (0/1)0%   (0/2)0%   (0/1)
getExecutionEnvironments (): String [] 0%   (0/1)0%   (0/3)0%   (0/1)
getLocation (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getLowestEEs (): String [] 0%   (0/1)0%   (0/2)0%   (0/1)
getOrigin (): String 0%   (0/1)0%   (0/2)0%   (0/1)
getRequiredComponents (): IRequiredComponentDescription [] 0%   (0/1)0%   (0/3)0%   (0/1)
getSystemApiDescription (int): IApiDescription 0%   (0/1)0%   (0/2)0%   (0/1)
getVersion (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hasApiDescription (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
hasFragments (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
isFragment (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
SystemLibraryApiComponent (IApiBaseline): void 100% (1/1)100% (4/4)100% (2/2)
SystemLibraryApiComponent (IApiBaseline, ExecutionEnvironmentDescription, Str... 100% (1/1)100% (10/10)100% (4/4)
createApiDescription (): IApiDescription 100% (1/1)100% (55/55)100% (10/10)
createApiTypeContainers (): List 100% (1/1)100% (33/33)100% (5/5)
getErrors (): ResolverError [] 100% (1/1)100% (2/2)100% (1/1)
getId (): String 100% (1/1)100% (5/5)100% (1/1)
init (ExecutionEnvironmentDescription): void 100% (1/1)100% (32/32)100% (6/6)
isSourceComponent (): boolean 100% (1/1)100% (2/2)100% (1/1)
isSystemComponent (): boolean 100% (1/1)100% (2/2)100% (1/1)

1/*******************************************************************************
2 * Copyright (c) 2007, 2009 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 *******************************************************************************/
11package org.eclipse.pde.api.tools.internal.model;
12 
13import java.util.ArrayList;
14import java.util.List;
15 
16import org.eclipse.core.runtime.CoreException;
17import org.eclipse.jdt.launching.LibraryLocation;
18import org.eclipse.jdt.launching.environments.ExecutionEnvironmentDescription;
19import org.eclipse.osgi.service.resolver.ResolverError;
20import org.eclipse.pde.api.tools.internal.ApiDescription;
21import org.eclipse.pde.api.tools.internal.provisional.Factory;
22import org.eclipse.pde.api.tools.internal.provisional.IApiDescription;
23import org.eclipse.pde.api.tools.internal.provisional.IApiFilterStore;
24import org.eclipse.pde.api.tools.internal.provisional.IRequiredComponentDescription;
25import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers;
26import org.eclipse.pde.api.tools.internal.provisional.descriptors.IPackageDescriptor;
27import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
28 
29/**
30 * An API component for a system library.
31 * 
32 * @since 1.0.0
33 */
34public class SystemLibraryApiComponent extends AbstractApiComponent {
35        
36        /**
37         * Execution environment profile symbolic name.
38         */
39        protected String[] fExecEnv;
40        
41        /**
42         * Associated library locations.
43         */
44        protected LibraryLocation[] fLibraries;
45        
46        /**
47         * Home directory
48         */
49        protected String fLocation;
50        
51        /**
52         * List of exported system packages
53         */
54        protected String[] fSystemPackages;
55        
56        /**
57         * Language level - i.e. 1.4, 1.5, etc.
58         */
59        protected String fVersion;
60        
61        /**
62         * Constructs a system library.
63         * 
64         * @param profile owning profile
65         */
66        protected SystemLibraryApiComponent(IApiBaseline profile){
67                super(profile);
68        }
69        /**
70         * Constructs a system library from the given execution environment description file.
71         * 
72         * @param profile owning profile
73         * @param description EE file
74         * @param systemPackages exported system packages
75         * @exception CoreException if unable to read the execution environment description file
76         */
77        public SystemLibraryApiComponent(IApiBaseline profile, ExecutionEnvironmentDescription description, String[] systemPackages) throws CoreException {
78                super(profile);
79                init(description);
80                fSystemPackages = systemPackages;
81        }
82 
83        /* (non-Javadoc)
84         * @see org.eclipse.pde.api.tools.internal.descriptors.AbstractApiComponent#createApiDescription()
85         */
86        protected IApiDescription createApiDescription() throws CoreException {
87                IApiDescription api = new ApiDescription(getId());
88                for (int i = 0; i < fSystemPackages.length; i++) {
89                        IPackageDescriptor pkg  = Factory.packageDescriptor(fSystemPackages[i]);
90                        api.setVisibility(pkg, VisibilityModifiers.API);
91                }
92                // have to fill in java.* as well
93                String[] packageNames = getPackageNames();
94                for (int i = 0; i < packageNames.length; i++) {
95                        if (packageNames[i].startsWith("java.")) { //$NON-NLS-1$
96                                IPackageDescriptor pkg  = Factory.packageDescriptor(packageNames[i]);
97                                api.setVisibility(pkg, VisibilityModifiers.API);
98                        }
99                }
100                return api;
101        }
102 
103        /* (non-Javadoc)
104         * @see org.eclipse.pde.api.tools.internal.AbstractApiComponent#createApiFilterStore()
105         */
106        protected IApiFilterStore createApiFilterStore() {
107                //TODO
108                return null;
109        }
110 
111        /* (non-Javadoc)
112         * @see org.eclipse.pde.api.tools.internal.descriptors.AbstractApiComponent#createClassFileContainers()
113         */
114        protected List createApiTypeContainers() throws CoreException {
115                List libs = new ArrayList(fLibraries.length);
116                for (int i = 0; i < fLibraries.length; i++) {
117                        LibraryLocation lib = fLibraries[i];
118                        libs.add(new ArchiveApiTypeContainer(this, lib.getSystemLibraryPath().toOSString()));
119                }
120                return libs;
121        }
122 
123        /* (non-Javadoc)
124         * @see org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent#getExecutionEnvironments()
125         */
126        public String[] getExecutionEnvironments() {
127                return fExecEnv;
128        }
129 
130        /* (non-Javadoc)
131         * @see org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent#getId()
132         */
133        public String getId() {
134                return fExecEnv[0];
135        }
136        
137        /* (non-Javadoc)
138         * @see org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent#getLocation()
139         */
140        public String getLocation() {
141                return fLocation;
142        }
143 
144        /* (non-Javadoc)
145         * @see org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent#getRequiredComponents()
146         */
147        public IRequiredComponentDescription[] getRequiredComponents() {
148                return new IRequiredComponentDescription[0];
149        }
150 
151        /* (non-Javadoc)
152         * @see org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent#getVersion()
153         */
154        public String getVersion() {
155                return fVersion;
156        }
157        
158        /**
159         * Initializes properties from the EE file.
160         * 
161         * @param description EE file
162         */
163        private void init(ExecutionEnvironmentDescription description) throws CoreException {
164                fLibraries = description.getLibraryLocations();
165                fExecEnv = new String[]{description.getProperty(ExecutionEnvironmentDescription.CLASS_LIB_LEVEL)};
166                fVersion = fExecEnv[0];
167                setName(fExecEnv[0]);
168                fLocation = description.getProperty(ExecutionEnvironmentDescription.JAVA_HOME);
169        }
170 
171        /* (non-Javadoc)
172         * @see IApiComponent#isSourceComponent()
173         */
174        public boolean isSourceComponent() {
175                return false;
176        }
177        
178        /* (non-Javadoc)
179         * @see org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent#isSystemComponent()
180         */
181        public boolean isSystemComponent() {
182                return true;
183        }
184 
185        /* (non-Javadoc)
186         * @see org.eclipse.pde.api.tools.IApiComponent#isFragment()
187         */
188        public boolean isFragment() {
189                return false;
190        }
191        
192        /* (non-Javadoc)
193         * @see org.eclipse.pde.api.tools.IApiComponent#hasFragments()
194         */
195        public boolean hasFragments() {
196                return false;
197        }
198 
199        public String getOrigin() {
200                return null;
201        }
202        
203        /* (non-Javadoc)
204         * @see org.eclipse.pde.api.tools.internal.provisional.IApiComponent#hasApiDescription()
205         */
206        public boolean hasApiDescription() {
207                return false;
208        }
209        
210        /* (non-Javadoc)
211         * @see org.eclipse.pde.api.tools.internal.provisional.IApiComponent#getSystemApiDescription(int)
212         */
213        public IApiDescription getSystemApiDescription(int eeValue) throws CoreException {
214                return null;
215        }
216        
217        /* (non-Javadoc)
218         * @see org.eclipse.pde.api.tools.internal.provisional.IApiComponent#getLowestEEs()
219         */
220        public String[] getLowestEEs() {
221                return null;
222        }
223        /* (non-Javadoc)
224         * @see org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent#getErrors()
225         */
226        public ResolverError[] getErrors() throws CoreException {
227                return null;
228        }
229}

[all classes][org.eclipse.pde.api.tools.internal.model]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov