diff --git a/ucc/ucc.api/pom.xml b/ucc/ucc.api/pom.xml index 60e2c6bb3bf7ae50b750011b2243851382c07ba9..41eb91cb7202bb6edba0c5c726e3361ff490c57d 100644 --- a/ucc/ucc.api/pom.xml +++ b/ucc/ucc.api/pom.xml @@ -17,7 +17,7 @@ <groupId>org.apache.felix</groupId> <artifactId>org.osgi.core</artifactId> </dependency> - <dependency> + <dependency> <groupId>net.sf.qtjambi</groupId> <artifactId>qtjambi</artifactId> <version>4.5.2_01</version> diff --git a/ucc/ucc.core/pom.xml b/ucc/ucc.core/pom.xml index d42ce34c05f44fb75d95d4952c188cfc879f3516..1afe77d49aa9e74f37506d813cb218d5106617dd 100644 --- a/ucc/ucc.core/pom.xml +++ b/ucc/ucc.core/pom.xml @@ -25,7 +25,7 @@ <dependency> <groupId>net.sf.qtjambi</groupId> <artifactId>qtjambi</artifactId> - <version>4.6.3</version> + <version>4.5.2_01</version> </dependency> <!-- <dependency> <groupId>com.hp.hpl.jena</groupId> @@ -52,8 +52,6 @@ <artifactId>mw.managers.api</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> - - </dependencies> <build> <plugins> diff --git a/ucc/ucc.core/src/main/java/org/universAAL/ucc/core/installation/Installer.java b/ucc/ucc.core/src/main/java/org/universAAL/ucc/core/installation/Installer.java index 46037e4c80c747c47eefb3abd560dbe5eed51d69..d1b4dfe4c3f54622913762636e5953b4753ed162 100644 --- a/ucc/ucc.core/src/main/java/org/universAAL/ucc/core/installation/Installer.java +++ b/ucc/ucc.core/src/main/java/org/universAAL/ucc/core/installation/Installer.java @@ -44,7 +44,7 @@ import org.universAAL.ucc.core.Activator; * @version 1.0 * @created 11-Jul-2011 15:57:26 * - * modified 31-05-2012 by Shanshan + * modified 19-09-2012 by Shanshan * */ public class Installer extends ApplicationManager implements IInstaller { @@ -55,6 +55,7 @@ public class Installer extends ApplicationManager implements IInstaller { private boolean initialized = false; private DeployManager deployManager; private AALSpaceManager aalSpaceManager; + private static String MPA_EXTENSION="-mpa"; public Installer(BundleContext con) { context=con; @@ -118,7 +119,7 @@ public class Installer extends ApplicationManager implements IInstaller { if(content[i].endsWith(".jar")) jarok=true; if(content[i].equals("config.owl")) configok=true; if(content[i].equals("EULA.txt")) eulaok=true; - if(content[i].endsWith(".mpa")) mpa=true; + if(content[i].contains(MPA_EXTENSION)) mpa=true; } if(!jarok) throw new Exception("There is no installable jar File in uaal Package!"); if(!configok) throw new Exception("config.owl file not found!"); @@ -278,25 +279,32 @@ static public void extractFolder(String zipFile, String destdir) throws ZipExcep * - get DeployManager */ private boolean initMpaInstallation() { - //System.out.println("[Installer.initMpaInstallation]"); + System.out.println("[Installer.initMpaInstallation]"); ModuleContext moduleContext = uAALBundleContainer.THE_CONTAINER.registerModule(new Object[] { context }); - Object[] aalManagers = (Object[]) moduleContext.getContainer().fetchSharedObject(moduleContext,new Object[]{AALSpaceManager.class.getName().toString()}); + if (moduleContext==null) + System.out.println("[Installer.initMpaInstallation] moduleContext is null!"); + else { + System.out.println("[Installer.initMpaInstallation] moduleContext exists!"); + moduleContext.logDebug("[Installer.initMpaInstallation] moduleContext exists", null, null); + } + //Object[] aalManagers = (Object[]) moduleContext.getContainer().fetchSharedObject(moduleContext,new Object[]{AALSpaceManager.class.getName().toString()}); + Object aalManagers = moduleContext.getContainer().fetchSharedObject(moduleContext,new Object[]{AALSpaceManager.class.getName().toString()}); if(aalManagers != null){ - moduleContext.logDebug("AALSpaceManagers found...", null); - System.out.println("[MpaParser] AALSpaceManagers found..."); - if(aalManagers[0] instanceof AALSpaceManager){ - aalSpaceManager = (AALSpaceManager)aalManagers[0]; + moduleContext.logDebug("[Installer.initMpaInstallation] AALSpaceManagers found...", null, null); + System.out.println("[Installer.initMpaInstallation] AALSpaceManagers found..."); + if(aalManagers instanceof AALSpaceManager){ + aalSpaceManager = (AALSpaceManager)aalManagers; } else{ - moduleContext.logWarn("No AALSpaceManagers found", null); + moduleContext.logWarn("Installer.initMpaInstallation] No AALSpaceManagers found", null, null); System.out.println("[Installer.initMpaInstallation]No AALSpaceManagers found"); initialized = false; return initialized; } }else{ - moduleContext.logWarn("No AALSpaceManagers found", null); + moduleContext.logWarn("Installer.initMpaInstallation] No AALSpaceManagers found", null, null); System.out.println("[MpaParser]No AALSpaceManagers found"); initialized = false; return initialized; @@ -305,29 +313,12 @@ static public void extractFolder(String zipFile, String destdir) throws ZipExcep Object refs = moduleContext.getContainer().fetchSharedObject(moduleContext,new Object[]{DeployManager.class.getName().toString()}); if(refs != null){ - deployManager = (DeployManager)refs; - // -- just for testing - URI mpaUri = null; - try { - mpaUri = new URI("http://aaloa.isti.cnr.it/Ping-Pong-mpa.xml"); - Map layout = new HashMap(); - PeerCard card1= new PeerCard("DeployNode1", PeerRole.PEER); - layout.put(card1, "Part1"); - System.out.println("[Installer] call deploy manager to install " + mpaUri.toString() + " for " - + layout.toString()); - deployManager.requestToInstall(mpaUri, layout); - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - // -- end for testing - + deployManager = (DeployManager)refs; initialized = true; return initialized; }else{ - moduleContext.logWarn("No DeployManager found", null); - System.out.println("No DeployManager found"); + moduleContext.logWarn("Installer.initMpaInstallation] No DeployManager found", null, null); + System.out.println("Installer.initMpaInstallation] No DeployManager found"); initialized = false; return initialized; } diff --git a/ucc/ucc.plugin.information/.classpath b/ucc/ucc.plugin.information/.classpath index 6535c146714c9238233a09a315f02c49fa520ef5..3d7841e35df28680b8f4ca541ae9c2788c872f6d 100644 --- a/ucc/ucc.plugin.information/.classpath +++ b/ucc/ucc.plugin.information/.classpath @@ -3,8 +3,8 @@ <classpathentry kind="src" output="target/classes" path="src/main/java"/> <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/> + <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> <classpathentry kind="src" path="Generated JUIC files"/> <classpathentry kind="output" path="target/classes"/> </classpath> diff --git a/ucc/ucc.pom/pom.xml b/ucc/ucc.pom/pom.xml index 631a00085aca58f3f95f7ef864745ea7c6f20437..13a8ef9e219635226723db0c4b351f0e07edcc92 100644 --- a/ucc/ucc.pom/pom.xml +++ b/ucc/ucc.pom/pom.xml @@ -4,7 +4,7 @@ <groupId>org.universAAL.tools.ucc</groupId> <artifactId>ucc.pom</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.2.1-SNAPSHOT</version> <packaging>pom</packaging> <name>universAAL Control Center</name> @@ -40,20 +40,25 @@ </dependencyManagement> <dependencies> + <dependency> + <groupId>org.universAAL.middleware</groupId> + <artifactId>mw.data.representation.osgi</artifactId> + <version>1.2.1-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.universAAL.middleware</groupId> - <artifactId>mw.data.representation</artifactId> - <version>1.1.1-SNAPSHOT</version> + <artifactId>mw.bus.model.osgi</artifactId> + <version>1.2.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.universAAL.middleware</groupId> - <artifactId>mw.bus.model</artifactId> - <version>1.1.1-SNAPSHOT</version> + <artifactId>mw.bus.ui.osgi</artifactId> + <version>1.2.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.universAAL.middleware</groupId> - <artifactId>mw.bus.ui</artifactId> - <version>1.1.1-SNAPSHOT</version> + <artifactId>mw.acl.interfaces.osgi</artifactId> + <version>1.2.1-SNAPSHOT</version> </dependency> </dependencies> @@ -83,6 +88,15 @@ </roles> <timezone>CEST/CET</timezone> </developer> + <developer> + <id>shanshan</id> + <email>Shanshan.Jiang@sintef.no</email> + <name>Shanshan Jiang</name> + <roles> + <role>developer</role> + </roles> + <timezone>CEST/CET</timezone> + </developer> </developers> <contributors /> diff --git a/ucc/ucc.viewjambi/pom.xml b/ucc/ucc.viewjambi/pom.xml index 6e18d0b2aaae8506709e7c04b2639bbcf2b4f8f7..448ec84713d9a0a31b5aaa48302aff02f1b9d536 100644 --- a/ucc/ucc.viewjambi/pom.xml +++ b/ucc/ucc.viewjambi/pom.xml @@ -51,7 +51,7 @@ <Bundle-Description>${project.description}</Bundle-Description> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> <Private-Package>org.universAAL.ucc.viewjambi.impl,org.universAAL.ucc.viewjambi.information,org.universAAL.ucc.viewjambi.install,org.universAAL.ucc.viewjambi.juic,org.universAAL.ucc.viewjambi.layouts,org.universAAL.ucc.viewjambi.overview,org.universAAL.ucc.viewjambi.store</Private-Package> - <Export-Package>org.universAAL.ucc.viewjambi.common,com.trolltech.qt.*</Export-Package> + <Export-Package>org.universAAL.ucc.viewjambi.common, com.trolltech.qt.*</Export-Package> <Include-Resource> {maven-resources} </Include-Resource> diff --git a/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/DeployConfigView.java b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/DeployConfigView.java index a299a23d55e1b187ba223812ba176b5469678f9d..e523689828bf69116a3c868bf029b9e2a6d39cbd 100644 --- a/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/DeployConfigView.java +++ b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/DeployConfigView.java @@ -109,12 +109,11 @@ public class DeployConfigView extends SubWindow { // check the validity of the configuration layout if (!checkLayout()) { // the selection is not valid - QMessageBox.information(this, "Configure error", "The configuration is not valid. Please try again!"); + QMessageBox.warning(this, "Configure error", "The configuration is not valid. Please try again!"); return; } MainWindow.getInstance().removeSubWindow(this); System.out.println("Start deploying..."); - QMessageBox.information(this, "Deploy", "start deploying the multi-part application..."); //save the deploy configuration for(Part part : layout.keySet()){ PeerCard card = peers.get(layout.get(part)); @@ -122,8 +121,11 @@ public class DeployConfigView extends SubWindow { + ":" + layout.get(part) + "/" + part.getPartId()); mpaLayout.put(card, part); } + ProgressThread progress = new ProgressThread(); + progress.start(); // call MW deploy manager requestToInstall InstallationResults results = Activator.getInstaller().requestToInstall((new File(deployPath)).toURI(), mpaLayout); + progress.finished=true; switch (results) { case SUCCESS: QMessageBox.information(this, "Installation result", "The multi-part application has been successfully installed!"); @@ -131,17 +133,17 @@ public class DeployConfigView extends SubWindow { break; case FAILED: - QMessageBox.information(this, "Installation result", "The installation of the multi-part application has been failed!"); + QMessageBox.warning(this, "Installation result", "The installation of the multi-part application has been failed!"); System.out.println("[DeployConfigView.nextScreen] The installation of the multi-part application has been failed!"); break; case NO_AALSPACE_JOINED: - QMessageBox.information(this, "Installation result", "Error in the installation of the multi-part application: no AALspace joined!"); + QMessageBox.warning(this, "Installation result", "Error in the installation of the multi-part application: no AALspace joined!"); System.out.println("[DeployConfigView.nextScreen] Error in the installation of the multi-part application: no AALspace joined!"); break; case MPA_URI_INVALID: - QMessageBox.information(this, "Installation result", "Error in the installation of the multi-part application: MPA uri is invalid!"); + QMessageBox.warning(this, "Installation result", "Error in the installation of the multi-part application: MPA uri is invalid!"); System.out.println("[DeployConfigView.nextScreen] Error in the installation of the multi-part application: MPA uri is invalid!"); break; @@ -215,15 +217,15 @@ public class DeployConfigView extends SubWindow { } else System.out.println("[DeployConfigView.checkLayout] The part " + part.getPartId() + " can be installed on the peer " + layout.get(part)); } - // check if a peer is associated with more than one part - for (String peerId: layout.values()) { + // check if a peer is associated with more than one part -- no need for such check +/* for (String peerId: layout.values()) { System.out.println("[DeployConfigView.checkLayout] check for peer " + peerId); if (countPeer(peerId)>1) { System.out.println("[DeployConfigView.checkLayout] " + peerId + " has been associated with more than one part!"); QMessageBox.information(this, "Validity check", peerId + " has been associated with more than one part!"); valid = false; } - } + } */ return valid; } diff --git a/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/DeployStrategyView.java b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/DeployStrategyView.java index 4b116aa0fb01910c8850fd2f3bc75ab9d05133f7..7dcbf18be4e6e3a9861dd1f4a4291b862db516d6 100644 --- a/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/DeployStrategyView.java +++ b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/DeployStrategyView.java @@ -16,6 +16,7 @@ import org.universAAL.ucc.viewjambi.impl.Activator; import org.universAAL.ucc.viewjambi.impl.MainWindow; import org.universAAL.ucc.viewjambi.juic.Ui_DeployStrategyView; +import com.trolltech.qt.core.QTimer; import com.trolltech.qt.gui.*; public class DeployStrategyView extends SubWindow { @@ -25,7 +26,7 @@ public class DeployStrategyView extends SubWindow { String deployPath; MpaParser mpaParser; Map<String, PeerCard> peers; - + /** * * @param path deployPath, i.e., path of the extracted files from .uaal @@ -68,7 +69,11 @@ public class DeployStrategyView extends SubWindow { if (defaultStrategy) { Map config = buildDefaultInstallationLayout(); - InstallationResults results = Activator.getInstaller().requestToInstall((new File(deployPath)).toURI(), config); + MainWindow.getInstance().removeSubWindow(this); + ProgressThread progress = new ProgressThread(); + progress.start(); + InstallationResults results = Activator.getInstaller().requestToInstall((new File(deployPath)).toURI(), config); + progress.finished = true; switch (results) { case SUCCESS: QMessageBox.information(this, "Installation result", "The multi-part application has been successfully installed!"); @@ -76,17 +81,17 @@ public class DeployStrategyView extends SubWindow { break; case FAILED: - QMessageBox.information(this, "Installation result", "The installation of the multi-part application has been failed!"); + QMessageBox.warning(this, "Installation result", "The installation of the multi-part application has been failed!"); System.out.println("[DeployStrategyView.ok] The installation of the multi-part application has been failed!"); break; case NO_AALSPACE_JOINED: - QMessageBox.information(this, "Installation result", "Error in the installation of the multi-part application: no AALspace joined!"); + QMessageBox.warning(this, "Installation result", "Error in the installation of the multi-part application: no AALspace joined!"); System.out.println("[DeployStrategyView.ok] Error in the installation of the multi-part application: no AALspace joined!"); - break; + break; case MPA_URI_INVALID: - QMessageBox.information(this, "Installation result", "Error in the installation of the multi-part application: MPA uri is invalid!"); + QMessageBox.warning(this, "Installation result", "Error in the installation of the multi-part application: MPA uri is invalid!"); System.out.println("[DeployStrategyView.ok] Error in the installation of the multi-part application: MPA uri is invalid!"); break; @@ -175,8 +180,6 @@ public class DeployStrategyView extends SubWindow { private void cancel() { MainWindow.getInstance().removeSubWindow(this); - } - - - + } } + diff --git a/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/LicenseView.java b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/LicenseView.java index aa0c61d988d365b5b6ea82137f382641ae1c106c..ebaffb33b76c2d4e1dc6d06039ff6885119296e1 100644 --- a/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/LicenseView.java +++ b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/LicenseView.java @@ -17,6 +17,7 @@ public class LicenseView extends SubWindow { private static Ui_License install_base = new Ui_License(); private static String appDir; private static boolean mpa=false; + private static String MPA_EXTENSION="-mpa"; public LicenseView(String path) throws IOException { super(LicenseView.install_base); @@ -69,7 +70,7 @@ public class LicenseView extends SubWindow { File folder=new File(appDir); String[] content = folder.list(); for(int i=0;i<content.length;i++){ - if(content[i].endsWith(".mpa")) + if(content[i].contains(MPA_EXTENSION)) return true; } return false; diff --git a/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/MpaParser.java b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/MpaParser.java index a29b75f82dc7f2f4940761e459854aa86d3a19e5..09b222f87e0fc82258e9723487668905b0acd07d 100644 --- a/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/MpaParser.java +++ b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/MpaParser.java @@ -12,6 +12,7 @@ import org.universAAL.middleware.connectors.deploy.model.ObjectFactory; public class MpaParser { AalMpa mpa = null; + private static String MPA_EXTENSION="-mpa"; private JAXBContext jc; private Unmarshaller unmarshaller; @@ -29,7 +30,7 @@ public class MpaParser { File appDir=new File(deployPath); String[] filelist=appDir.list(); for(int i=0;i<filelist.length;i++){ - if(filelist[i].endsWith(".mpa")){ + if(filelist[i].contains(MPA_EXTENSION)){ String mpaName = deployPath+File.separator+filelist[i]; System.out.println("[MpaParser] the mpa file is: " + mpaName); // convert"\" to "//" -- this is OS dependent, solve later diff --git a/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/ProgressThread.java b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/ProgressThread.java new file mode 100644 index 0000000000000000000000000000000000000000..5c000c8742ca3ac74b3bb2a650bac5b44fb553a6 --- /dev/null +++ b/ucc/ucc.viewjambi/src/main/java/org/universAAL/ucc/viewjambi/install/ProgressThread.java @@ -0,0 +1,30 @@ +package org.universAAL.ucc.viewjambi.install; + +import com.trolltech.qt.gui.QProgressDialog; + +public class ProgressThread extends Thread { + boolean finished = false; + + public void run() { + QProgressDialog qd = new QProgressDialog("Installing the multi-part application...", null, 0, 100); + qd.setWindowTitle("Installing"); + qd.setAutoClose(true); + int i=1; + qd.setValue(10); + while(!finished) { + try { + sleep(1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (i<10) { + qd.setValue(i*10); + System.out.println("progressing: " + i*10 + "%"); + i++; + } + } + qd.setValue(100); + } + +}