KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > core > model > IncludedFeatureReferenceModel


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.update.core.model;
12
13 import org.eclipse.update.core.FeatureReference;
14 import org.eclipse.update.core.IFeatureReference;
15 import org.eclipse.update.core.IImport;
16 import org.eclipse.update.core.IIncludedFeatureReference;
17 import org.eclipse.update.core.IUpdateConstants;
18 import org.eclipse.update.core.Import;
19
20
21 /**
22  * Included Feature reference model object.
23  * <p>
24  * This class may be instantiated or subclassed by clients. However, in most
25  * cases clients should instead instantiate or subclass the provided
26  * concrete implementation of this model.
27  * </p>
28  * <p>
29  * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
30  * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
31  * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
32  * (repeatedly) as the API evolves.
33  * </p>
34  * @see org.eclipse.update.core.IncludedFeatureReference
35  * @since 2.1
36  */

37 public class IncludedFeatureReferenceModel extends FeatureReference {
38
39     // since 2.0.2
40
private boolean isOptional;
41     private int searchLocation;
42     
43     // These are already defined by FeatureReferenceModel, we don't need to duplicate them here
44
// // since 2.1
45
// private String os;
46
// private String ws;
47
// private String arch;
48
// private String nl;
49
//
50
/**
51      * Construct a included feature reference
52      *
53      * @since 2.1
54      */

55     public IncludedFeatureReferenceModel() {
56         super();
57         isOptional(false);
58         setSearchLocation(IUpdateConstants.SEARCH_ROOT);
59     }
60     
61     
62     
63     /**
64      * Construct a included feature reference model
65      *
66      * @param includedFeatureRef the included reference model to copy
67      * @since 2.1
68      */

69     public IncludedFeatureReferenceModel(IncludedFeatureReferenceModel includedFeatureRef) {
70         super((FeatureReferenceModel)includedFeatureRef);
71         isOptional(includedFeatureRef.isOptional());
72         setLabel(includedFeatureRef.getLabel());
73         setSearchLocation(includedFeatureRef.getSearchLocation());
74         setArch(includedFeatureRef.getOSArch());
75         setWS(includedFeatureRef.getWS());
76         setOS(includedFeatureRef.getOS());
77         setNL(includedFeatureRef.getNL());
78         setPatch(includedFeatureRef.getPatch());
79     }
80
81     /**
82      * Constructor IncludedFeatureReferenceModel.
83      * @param featureReference
84      */

85     public IncludedFeatureReferenceModel(IFeatureReference featureReference) {
86         super((FeatureReferenceModel)featureReference);
87         if (featureReference instanceof IIncludedFeatureReference)
88               isOptional( ((IIncludedFeatureReference)featureReference).isOptional() );
89             else
90               isOptional(false);
91         setSearchLocation(IUpdateConstants.SEARCH_ROOT);
92         setLabel(getLabel());
93     }
94
95     /**
96      * Returns the matching rule for this included feature.
97      * The rule will determine the ability of the included feature to move version
98      * without causing the overall feature to appear broken.
99      *
100      * The default is <code>MATCH_PERFECT</code>
101      *
102      * @see IImport#RULE_PERFECT
103      * @see IImport#RULE_EQUIVALENT
104      * @see IImport#RULE_COMPATIBLE
105      * @see IImport#RULE_GREATER_OR_EQUAL
106      * @return int representation of feature matching rule.
107      * @since 2.0.2
108      * @deprecated since 3.0 included feature version is exactly specified
109      */

110     public int getMatch(){
111         return Import.RULE_PERFECT;
112     }
113
114     /**
115      * Returns the search location for this included feature.
116      * The location will be used to search updates for this feature.
117      *
118      * The default is <code>SEARCH_ROOT</code>
119      *
120      * @see IUpdateConstants#SEARCH_ROOT
121      * @see IUpdateConstants#SEARCH_SELF
122      * @return int representation of feature searching rule.
123      * @since 2.0.2
124      */

125
126     public int getSearchLocation(){
127         return searchLocation;
128     }
129     
130
131
132     /**
133      * Returns the isOptional
134      *
135      * @return isOptional
136      * @since 2.0.1
137      */

138     public boolean isOptional() {
139         return isOptional;
140     }
141
142
143     
144
145     /**
146      * Sets the isOptional.
147      * @param isOptional The isOptional to set
148      */

149     public void isOptional(boolean isOptional) {
150         this.isOptional = isOptional;
151     }
152
153     /**
154      * Sets the matchingRule.
155      * @param matchingRule The matchingRule to set
156      * @deprecated since 3.0 included feature version is exactly specified
157      */

158     public void setMatchingRule(int matchingRule) {
159     }
160
161     /**
162      * Sets the searchLocation.
163      * @param searchLocation The searchLocation to set
164      */

165     public void setSearchLocation(int searchLocation) {
166         this.searchLocation = searchLocation;
167     }
168 }
169
Popular Tags