Skip to content
Snippets Groups Projects
Commit e4711184 authored by Alvaro Fides's avatar Alvaro Fides
Browse files

Increased version, added compatibility with MW 3.2.0 and 3.3.0

parent 039d28fb
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: universAAL New Project Wizard
Bundle-SymbolicName: org.universaal.tools.newwizard.plugin;singleton:=true
Bundle-Version: 1.2.1
Bundle-Version: 1.2.2
Bundle-Activator: org.universaal.tools.newwizard.plugin.Activator
Bundle-Vendor: universAAL ITACA-TSB UPV
Require-Bundle: org.eclipse.ui,
......
......@@ -72,6 +72,14 @@ public interface IMWVersion {
* Identifies MW version 3.1.0.
*/
public static final int VER_310=7;
/**
* Identifies MW version 3.2.0.
*/
public static final int VER_320=8;
/**
* Identifies MW version 3.3.0.
*/
public static final int VER_330=9;
/**
* Identifies a sample AAL App that makes full use of uAAL wrappers.
......
/*
Copyright 2012-2014 ITACA-TSB, http://www.tsb.upv.es
Instituto Tecnologico de Aplicaciones de Comunicacion
Avanzadas - Grupo Tecnologias para la Salud y el
Bienestar (TSB)
See the NOTICE file distributed with this work for additional
information regarding copyright ownership
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.universaal.tools.newwizard.plugin.versions;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* Implements IMWVersion for the 3.2.0 release of the MW. It extends 310 version
* in order to reuse similar methods, but overrides everything in which it
* differs from it.
*
* @author alfiva
*/
public class MWVersion320 extends MWVersion310{
@Override
public int getMWVersionNumber() {
return IMWVersion.VER_320;
}
//________CONSTANTS________
protected static final String BASIC_DEPS =
" <dependency>\n"
+ " <groupId>org.osgi</groupId>\n"
+ " <artifactId>org.osgi.core</artifactId>\n"
+ " <version>4.1.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.data.representation.osgi</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.bus.model.osgi</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.container.xfaces.osgi</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.container.osgi</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n";
protected static final String SERVICE_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.bus.service.osgi</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n";
protected static final String CONTEXT_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.bus.context.osgi</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n";
protected static final String UI_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.bus.ui.osgi</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n";
protected static final String PHWORLD_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.ontology</groupId>\n"
+ " <artifactId>ont.phWorld</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.ontology</groupId>\n"
+ " <artifactId>ont.device</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n";
protected static final String PROFILE_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.ontology</groupId>\n"
+ " <artifactId>ont.profile</artifactId>\n"
+ " <version>3.2.0</version>\n"
+ " </dependency>\n";
/**
* Common project build section in POM.
*/
protected static final String BUILD =
" <build>\n"
+ " <plugins>\n"
+ " <plugin>\n"
+ " <groupId>org.apache.felix</groupId>\n"
+ " <artifactId>maven-bundle-plugin</artifactId>\n"
+ " <version>2.3.7</version>\n"
+ " <extensions>true</extensions>\n"
+ " <configuration>\n"
+ " <instructions>\n"
+ " <Bundle-Name>${project.name}</Bundle-Name>\n"
+ " <Bundle-Activator>" + TAG_PACKAGE + ".Activator</Bundle-Activator>\n"
+ " <Bundle-Description>${project.description}</Bundle-Description>\n"
+ " <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>\n"
+ " <Import-Package>org.osgi.framework;version=\"[1,2)\",*</Import-Package>\n"
+ " </instructions>\n"
+ " </configuration>\n"
+ " </plugin>\n"
+ " </plugins>\n"
+ " </build>\n";
//________FILE MANIPULATION METHODS________
/* (non-Javadoc)
* @see org.universaal.tools.newwizard.plugin.versions.MWVersion300#customizePom(java.lang.String, java.io.InputStream, boolean[], boolean, boolean)
*/
@Override
public InputStream customizePom(String pack, InputStream input,
boolean[] checks, boolean phworld, boolean profile) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
StringBuilder output = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("</project>")) {
output.append(" <packaging>bundle</packaging>\n");
output.append(" <dependencies>\n");
output.append(BASIC_DEPS);
if (checks[0] || checks[1]) {
output.append(SERVICE_DEPS);
}
if (checks[3] || checks[4]) {
output.append(CONTEXT_DEPS);
}
if (checks[6] || checks[7]) {
output.append(UI_DEPS);
}
if (phworld) {
output.append(PHWORLD_DEPS);
}
if (profile) {
output.append(PROFILE_DEPS);
}
output.append(" </dependencies>\n");
output.append(BUILD.replace(TAG_PACKAGE, pack));
output.append(REPOS);
output.append("</project>\n");
} else {
output.append(line + "\n");
}
}
return new ByteArrayInputStream(output.toString().getBytes());
}
/* (non-Javadoc)
* @see org.universaal.tools.newwizard.plugin.versions.MWVersion300#updatePom(java.io.InputStream, int)
*/
@Override
protected InputStream updatePom(InputStream input, int clstype) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(
input));
StringBuilder output = new StringBuilder();
String line;
boolean context = false;
boolean service = false;
boolean ui = false;
while ((line = reader.readLine()) != null) {
if (line.contains("mw.bus.context")) { //$NON-NLS-1$
context = true;
}
if (line.contains("mw.bus.service")) { //$NON-NLS-1$
service = true;
}
if (line.contains("mw.bus.ui")) { //$NON-NLS-1$
ui = true;
}
if (line.contains("</dependencies>")) { //$NON-NLS-1$
StringBuilder outputnew = new StringBuilder();
if (!context && (clstype == 0 || clstype == 1 || clstype == 2)) {
outputnew
.append(SERVICE_DEPS); //$NON-NLS-1$
}
if (!service
&& (clstype == 3 || clstype == 4 )) {
outputnew
.append(CONTEXT_DEPS); //$NON-NLS-1$
}
if (!ui
&& (clstype > 4)) {
outputnew
.append(UI_DEPS); //$NON-NLS-1$
}
outputnew.append("</dependencies>"); //$NON-NLS-1$
line = line.replace("</dependencies>", outputnew.toString()); //$NON-NLS-1$
}
output.append(line + "\n"); //$NON-NLS-1$
}
return new ByteArrayInputStream(output.toString().getBytes());
}
//________HELPER METHODS________
/* (non-Javadoc)
* @see org.universaal.tools.newwizard.plugin.versions.MWVersion300#getMainFolder()
*/
@Override
public String getMainFolder() {
return "files/3.0.0/";
}
}
/*
Copyright 2012-2014 ITACA-TSB, http://www.tsb.upv.es
Instituto Tecnologico de Aplicaciones de Comunicacion
Avanzadas - Grupo Tecnologias para la Salud y el
Bienestar (TSB)
See the NOTICE file distributed with this work for additional
information regarding copyright ownership
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.universaal.tools.newwizard.plugin.versions;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* Implements IMWVersion for the 3.3.0 release of the MW. It extends 320 version
* in order to reuse similar methods, but overrides everything in which it
* differs from it.
*
* @author alfiva
*/
public class MWVersion330 extends MWVersion320{
@Override
public int getMWVersionNumber() {
return IMWVersion.VER_330;
}
//________CONSTANTS________
protected static final String BASIC_DEPS =
" <dependency>\n"
+ " <groupId>org.osgi</groupId>\n"
+ " <artifactId>org.osgi.core</artifactId>\n"
+ " <version>4.1.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.data.representation.osgi</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.bus.model.osgi</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.container.xfaces.osgi</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.container.osgi</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n";
protected static final String SERVICE_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.bus.service.osgi</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n";
protected static final String CONTEXT_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.bus.context.osgi</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n";
protected static final String UI_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.middleware</groupId>\n"
+ " <artifactId>mw.bus.ui.osgi</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n";
protected static final String PHWORLD_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.ontology</groupId>\n"
+ " <artifactId>ont.phWorld</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n"
+ " <dependency>\n"
+ " <groupId>org.universAAL.ontology</groupId>\n"
+ " <artifactId>ont.device</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n";
protected static final String PROFILE_DEPS =
" <dependency>\n"
+ " <groupId>org.universAAL.ontology</groupId>\n"
+ " <artifactId>ont.profile</artifactId>\n"
+ " <version>3.3.0</version>\n"
+ " </dependency>\n";
/**
* Common project build section in POM.
*/
protected static final String BUILD =
" <build>\n"
+ " <plugins>\n"
+ " <plugin>\n"
+ " <groupId>org.apache.felix</groupId>\n"
+ " <artifactId>maven-bundle-plugin</artifactId>\n"
+ " <version>2.3.7</version>\n"
+ " <extensions>true</extensions>\n"
+ " <configuration>\n"
+ " <instructions>\n"
+ " <Bundle-Name>${project.name}</Bundle-Name>\n"
+ " <Bundle-Activator>" + TAG_PACKAGE + ".Activator</Bundle-Activator>\n"
+ " <Bundle-Description>${project.description}</Bundle-Description>\n"
+ " <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>\n"
+ " <Import-Package>org.osgi.framework;version=\"[1,2)\",*</Import-Package>\n"
+ " </instructions>\n"
+ " </configuration>\n"
+ " </plugin>\n"
+ " </plugins>\n"
+ " </build>\n";
//________FILE MANIPULATION METHODS________
/* (non-Javadoc)
* @see org.universaal.tools.newwizard.plugin.versions.MWVersion300#customizePom(java.lang.String, java.io.InputStream, boolean[], boolean, boolean)
*/
@Override
public InputStream customizePom(String pack, InputStream input,
boolean[] checks, boolean phworld, boolean profile) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
StringBuilder output = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("</project>")) {
output.append(" <packaging>bundle</packaging>\n");
output.append(" <dependencies>\n");
output.append(BASIC_DEPS);
if (checks[0] || checks[1]) {
output.append(SERVICE_DEPS);
}
if (checks[3] || checks[4]) {
output.append(CONTEXT_DEPS);
}
if (checks[6] || checks[7]) {
output.append(UI_DEPS);
}
if (phworld) {
output.append(PHWORLD_DEPS);
}
if (profile) {
output.append(PROFILE_DEPS);
}
output.append(" </dependencies>\n");
output.append(BUILD.replace(TAG_PACKAGE, pack));
output.append(REPOS);
output.append("</project>\n");
} else {
output.append(line + "\n");
}
}
return new ByteArrayInputStream(output.toString().getBytes());
}
/* (non-Javadoc)
* @see org.universaal.tools.newwizard.plugin.versions.MWVersion300#updatePom(java.io.InputStream, int)
*/
@Override
protected InputStream updatePom(InputStream input, int clstype) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(
input));
StringBuilder output = new StringBuilder();
String line;
boolean context = false;
boolean service = false;
boolean ui = false;
while ((line = reader.readLine()) != null) {
if (line.contains("mw.bus.context")) { //$NON-NLS-1$
context = true;
}
if (line.contains("mw.bus.service")) { //$NON-NLS-1$
service = true;
}
if (line.contains("mw.bus.ui")) { //$NON-NLS-1$
ui = true;
}
if (line.contains("</dependencies>")) { //$NON-NLS-1$
StringBuilder outputnew = new StringBuilder();
if (!context && (clstype == 0 || clstype == 1 || clstype == 2)) {
outputnew
.append(SERVICE_DEPS); //$NON-NLS-1$
}
if (!service
&& (clstype == 3 || clstype == 4 )) {
outputnew
.append(CONTEXT_DEPS); //$NON-NLS-1$
}
if (!ui
&& (clstype > 4)) {
outputnew
.append(UI_DEPS); //$NON-NLS-1$
}
outputnew.append("</dependencies>"); //$NON-NLS-1$
line = line.replace("</dependencies>", outputnew.toString()); //$NON-NLS-1$
}
output.append(line + "\n"); //$NON-NLS-1$
}
return new ByteArrayInputStream(output.toString().getBytes());
}
//________HELPER METHODS________
/* (non-Javadoc)
* @see org.universaal.tools.newwizard.plugin.versions.MWVersion300#getMainFolder()
*/
@Override
public String getMainFolder() {
return "files/3.0.0/";
}
}
......@@ -49,8 +49,12 @@ public class MWVersionFactory {
return new MWVersion300();
case IMWVersion.VER_310:
return new MWVersion310();
case IMWVersion.VER_320:
return new MWVersion320();
case IMWVersion.VER_330:
return new MWVersion330();
default:
return new MWVersion310();
return new MWVersion330();
}
}
......@@ -79,8 +83,12 @@ public class MWVersionFactory {
return "3.0.0";
case IMWVersion.VER_310:
return "3.1.0";
case IMWVersion.VER_320:
return "3.2.0";
case IMWVersion.VER_330:
return "3.3.0";
default:
return "3.1.0";
return "3.3.0";
}
}
......@@ -100,6 +108,8 @@ public class MWVersionFactory {
getVERname(IMWVersion.VER_200),
getVERname(IMWVersion.VER_300),
getVERname(IMWVersion.VER_310),
getVERname(IMWVersion.VER_320),
getVERname(IMWVersion.VER_330),
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment