Skip to main content
summaryrefslogtreecommitdiffstats
blob: cad96f5a584f32033eb47e6261f88e1299af4802 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*******************************************************************************
 * Copyright (c) 2009, 2010 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 * yyyymmdd bug      Email and other contact information
 * -------- -------- -----------------------------------------------------------
 * 20091021   291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet
 * 20100420   309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries
 *******************************************************************************/
package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig;

import org.eclipse.emf.common.util.EList;
import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary;

/**
 * Attach additional attributes such as selection and deployment to a JAXRS
 * Library when it is referenced by a project.
 * 
 * @deprecated
 * 
 * <p>
 * <b>Provisional API - subject to change - do not use</b>
 * </p>
 */
public class JAXRSLibraryInternalReference {
	final private JAXRSLibrary jaxrsLib;
	private boolean check4Deploy; // Initialized from default in workspace
	private boolean check4SharedLib; // Initialized from default in workspace
	private boolean selected; // selected for project
	private boolean sharedLibSupported = false;

	public boolean isSharedLibSupported() {
		return sharedLibSupported;
	}

	public void setSharedLibSupported(boolean sharedLibSupported) {
		this.sharedLibSupported = sharedLibSupported;
	}

	/**
	 * Constructor
	 * 
	 * @param jaxrsLib
	 *            JAXRSLibrary instance embedded inside.
	 * @param selected
	 *            boolean true if selected, otherwise, not selected.
	 * @param deploy
	 *            boolean true if needs to be deployed, otherwise, won't be
	 *            deployed.
	 */
	public JAXRSLibraryInternalReference(JAXRSLibrary jaxrsLib,
			boolean selected, boolean deploy, boolean sharedLib) {
		this.jaxrsLib = jaxrsLib;
		this.selected = selected;
		this.check4Deploy = deploy;
		this.check4SharedLib = sharedLib;
	}

	/**
	 * Return the embedded JAXRSLibrary instance.
	 * 
	 * @return jaxrsLib JAXRSLibrary
	 */
	public JAXRSLibrary getLibrary() {
		return jaxrsLib;
	}

	/**
	 * Set the to be deployed flag.
	 * 
	 * @param deploy
	 *            boolean
	 */
	public void setToBeDeployed(final boolean deploy) {
		check4Deploy = deploy;
	}

	/**
	 * Set the to be shared library flag.
	 * 
	 * @param deploy
	 *            boolean
	 */
	public void setToBeSharedLibrary(final boolean sharedLib) {
		check4SharedLib = sharedLib;
	}

	/**
	 * Return true if the JAXRS Library needs to be deployed. Otherwise, return
	 * false.
	 * 
	 * @return boolean
	 */
	public boolean isCheckedToBeDeployed() {
		return check4Deploy;
	}
	/**
	 * Return true if the JAXRS Library needs to be added to the project as a shared library.
	 * Otherwise, return false.
	 * 
	 * @return boolean
	 */
	public boolean isCheckedToBeSharedLibrary() {
		return check4SharedLib;
	}

	/**
	 * Set the selected attribute to a JAXRSLibraryLibraryReference object.
	 * 
	 * @param selected
	 *            boolean
	 */
	public void setSelected(final boolean selected) {
		this.selected = selected;
	}

	/**
	 * Return true if the JAXRS Library is referenced by a project. Otherwise,
	 * return false.
	 * 
	 * @return selected boolean
	 */
	public boolean isSelected() {
		return selected;
	}

	/**
	 * To generate a string that represents the JAXRSLibraryLibraryReference
	 * object for persistence.
	 * 
	 * @return String
	 */
	protected String generatePersistString() {
		return (getID() + JAXRSLibraryConfigProjectData.SPTR_TUPLE
				+ String.valueOf(isSelected())
				+ JAXRSLibraryConfigProjectData.SPTR_TUPLE + String
				.valueOf(isCheckedToBeDeployed()));
	}

	/**
	 * Helper method to return the library ID from the embedded JAXRSLibrary
	 * instance.
	 * 
	 * @return id String
	 */
	public String getID() {
		return jaxrsLib.getID();
	}

	/**
	 * Helper method to return the library name from the embedded JAXRSLibrary
	 * instance.
	 * 
	 * @return name String
	 */
	public String getName() {
		return jaxrsLib.getName();
	}

	/**
	 * Helper method to return the label for the library from the embedded
	 * JAXRSLibrary instance.
	 * 
	 * @return name String
	 */
	public String getLabel() {
		return jaxrsLib.getLabel();
	}

	/**
	 * Help method to return a list of Archive files from the embedded
	 * JAXRSLibrary instance.
	 * 
	 * @return boolean
	 */
	@SuppressWarnings("unchecked")
	public EList getArchiveFiles() {
		return jaxrsLib.getArchiveFiles();
	}

}

Back to the top