| Line 17... |
Line 17... |
| 17 |
* License along with this library; if not, write to the Free Software
|
17 |
* License along with this library; if not, write to the Free Software
|
| 18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
| 19 |
* USA
|
19 |
* USA
|
| 20 |
*
|
20 |
*
|
| 21 |
* --------------------------------------------------------------------------
|
21 |
* --------------------------------------------------------------------------
|
| 22 |
* $Id: JonasVersionsServlet.java 20434 2010-10-08 08:50:30Z alitokmen $
|
- |
|
| - |
|
22 |
* $Id: JonasVersionsServlet.java 20438 2010-10-08 15:57:50Z alitokmen $
|
| 23 |
* --------------------------------------------------------------------------
|
23 |
* --------------------------------------------------------------------------
|
| 24 |
*/
|
24 |
*/
|
| 25 |
package org.ow2.jonas.versions.servlet;
|
25 |
package org.ow2.jonas.versions.servlet;
|
| 26 |
|
26 |
|
| 27 |
import java.io.BufferedReader;
|
27 |
import java.io.BufferedReader;
|
| Line 47... |
Line 47... |
| 47 |
import org.apache.felix.ipojo.annotations.Validate;
|
47 |
import org.apache.felix.ipojo.annotations.Validate;
|
| 48 |
import org.osgi.service.http.HttpContext;
|
48 |
import org.osgi.service.http.HttpContext;
|
| 49 |
import org.osgi.service.http.HttpService;
|
49 |
import org.osgi.service.http.HttpService;
|
| 50 |
import org.osgi.service.http.NamespaceException;
|
50 |
import org.osgi.service.http.NamespaceException;
|
| 51 |
import org.ow2.util.archive.api.IArchive;
|
51 |
import org.ow2.util.archive.api.IArchive;
|
| - |
|
52 |
import org.ow2.util.archive.api.IArchiveMetadata;
|
| 52 |
import org.ow2.util.archive.impl.ArchiveManager;
|
53 |
import org.ow2.util.archive.impl.ArchiveManager;
|
| 53 |
import org.ow2.util.ee.deploy.api.deployable.IDeployable;
|
54 |
import org.ow2.util.ee.deploy.api.deployable.IDeployable;
|
| 54 |
import org.ow2.util.ee.deploy.impl.helper.DeployableHelper;
|
55 |
import org.ow2.util.ee.deploy.impl.helper.DeployableHelper;
|
| 55 |
import org.ow2.util.ee.deploy.impl.helper.DeployableHelperException;
|
56 |
import org.ow2.util.ee.deploy.impl.helper.DeployableHelperException;
|
| 56 |
|
57 |
|
| Line 113... |
Line 114... |
| 113 |
response.getWriter().write(JonasVersionsServlet.NEWLINE);
|
114 |
response.getWriter().write(JonasVersionsServlet.NEWLINE);
|
| 114 |
response.getWriter().write(JonasVersionsServlet.NEWLINE);
|
115 |
response.getWriter().write(JonasVersionsServlet.NEWLINE);
|
| 115 |
|
116 |
|
| 116 |
for (File deployableFile : jonasBaseDeployContents) {
|
117 |
for (File deployableFile : jonasBaseDeployContents) {
|
| 117 |
IArchive archive = ArchiveManager.getInstance().getArchive(deployableFile);
|
118 |
IArchive archive = ArchiveManager.getInstance().getArchive(deployableFile);
|
| - |
|
119 |
if (archive == null) {
|
| - |
|
120 |
continue;
|
| - |
|
121 |
}
|
| - |
|
122 |
IArchiveMetadata metadata = archive.getMetadata();
|
| - |
|
123 |
if (metadata == null) {
|
| - |
|
124 |
continue;
|
| - |
|
125 |
}
|
| - |
|
126 |
|
| 118 |
IDeployable<?> deployable;
|
127 |
IDeployable<?> deployable;
|
| 119 |
try {
|
128 |
try {
|
| 120 |
deployable = DeployableHelper.getDeployable(archive);
|
129 |
deployable = DeployableHelper.getDeployable(archive);
|
| 121 |
} catch (DeployableHelperException e) {
|
130 |
} catch (DeployableHelperException e) {
|
| 122 |
IOException exception = new IOException("Failed opening archive: " + e);
|
131 |
IOException exception = new IOException("Failed opening archive: " + e);
|
| 123 |
exception.initCause(e);
|
132 |
exception.initCause(e);
|
| 124 |
throw exception;
|
133 |
throw exception;
|
| - |
|
134 |
}
|
| - |
|
135 |
if (deployable == null) {
|
| - |
|
136 |
continue;
|
| 125 |
}
|
137 |
}
|
| 126 |
|
138 |
|
| 127 |
String versionNumber = deployable.getArchive().getMetadata().get(
|
- |
|
| 128 |
Attributes.Name.IMPLEMENTATION_VERSION.toString());
|
- |
|
| - |
|
139 |
String versionNumber = metadata.get(Attributes.Name.IMPLEMENTATION_VERSION.toString());
|
| 129 |
String name = deployable.getModuleName();
|
140 |
String name = deployable.getModuleName();
|
| 130 |
|
- |
|
| 131 |
if (name != null && versionNumber != null) {
|
141 |
if (name != null && versionNumber != null) {
|
| 132 |
String versionNumberSuffixShort = "-" + versionNumber;
|
142 |
String versionNumberSuffixShort = "-" + versionNumber;
|
| 133 |
String versionNumberSuffixLong = "-version" + versionNumber;
|
143 |
String versionNumberSuffixLong = "-version" + versionNumber;
|
| 134 |
if (name.endsWith(versionNumberSuffixShort)) {
|
144 |
if (name.endsWith(versionNumberSuffixShort)) {
|
| 135 |
name = name.substring(0, name.length() - versionNumberSuffixShort.length());
|
145 |
name = name.substring(0, name.length() - versionNumberSuffixShort.length());
|
| Line 167... |
Line 177... |
| 167 |
}
|
177 |
}
|
| 168 |
|
178 |
|
| 169 |
public void destroy() {
|
179 |
public void destroy() {
|
| 170 |
// Nothing to do
|
180 |
// Nothing to do
|
| 171 |
}
|
181 |
}
|
| 172 |
|
- |
|
| 173 |
}
|
182 |
}
|