diff --git a/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/controller/desktop/ToolController.java b/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/controller/desktop/ToolController.java index d65c2a2147824236ffa4cac854fdf2e9e8ba39d7..501d2bf22398b02c0a5e5380ce387fcc98a5ab57 100644 --- a/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/controller/desktop/ToolController.java +++ b/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/controller/desktop/ToolController.java @@ -307,6 +307,7 @@ public class ToolController implements Button.ClickListener, } public void uploadFinished(FinishedEvent event) { + try{ app.getMainWindow().removeWindow(installWindow); String f = event.getFilename(); String file = f.substring(0, f.lastIndexOf(".")); @@ -426,6 +427,10 @@ public class ToolController implements Button.ClickListener, // ToDo: install AAL services with DeployManager and delete temp usrv // file with unziped folders + }catch(Throwable t){ + t.printStackTrace(); + throw new RuntimeException(t); + } } } diff --git a/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/controller/install/DeploymentInfoController.java b/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/controller/install/DeploymentInfoController.java index 1bea6163ae35aacc5fbf0adf124712d50af18c3f..a4788143ae8b5a3cf40f6ea26d7c5216d4a9e018 100644 --- a/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/controller/install/DeploymentInfoController.java +++ b/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/controller/install/DeploymentInfoController.java @@ -191,7 +191,6 @@ public class DeploymentInfoController implements Button.ClickListener, // Get uapp location uri String appLocation = uapp.getUappLocation(); System.err.println("THE UAPP_LOCATION: "+uapp.getUappLocation()); - String p = appLocation.substring(appLocation.indexOf("bin/")); appLocation = FrontendImpl.getUappURI(); System.err.println("LOCATION URI: "+appLocation); File uf = new File(appLocation.trim()); diff --git a/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/frontend/api/IFrontend.java b/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/frontend/api/IFrontend.java index 2810d4b05c4e6457237a7ccc6e98c8780abc7fc2..c57781ac78e06686ec60c95afb1eb2593186bd54 100644 --- a/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/frontend/api/IFrontend.java +++ b/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/frontend/api/IFrontend.java @@ -13,4 +13,6 @@ public interface IFrontend { String serviceId); public String getSessionKey(String username, String password); + + public void startUCC(); } diff --git a/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/frontend/api/impl/FrontendImpl.java b/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/frontend/api/impl/FrontendImpl.java index 8738d80b4cf5d3b76356d7c4fea847274dd73c34..b7f51174dc8b1ddf3c3e2ad56566d546877e81ba 100644 --- a/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/frontend/api/impl/FrontendImpl.java +++ b/uCC/ucc.frontend/src/main/java/org/universAAL/ucc/frontend/api/impl/FrontendImpl.java @@ -10,6 +10,7 @@ import java.io.InputStream; import java.io.Serializable; import java.math.BigInteger; +import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.net.URLConnection; @@ -78,16 +79,7 @@ public class FrontendImpl implements IFrontend { public boolean installService(String sessionkey, String serviceId, String serviceLink) { - if(UccUI.getInstance() == null) { - System.err.println("UCC is null so not running"); - // Opens a browser window and loads the ucc site - Desktop desk = Desktop.getDesktop(); - try { - desk.browse(new URI("http://127.0.0.1:8080/ucc")); - } catch (Exception e) { - e.printStackTrace(); - } - } + startUCC(); // check for sessionkey // if(sessionkey.equals(DesktopController.getSessionKey())) { // downloads a usrv-file from the given download-uri @@ -209,8 +201,12 @@ public class FrontendImpl implements IFrontend { List<Part> parts = uapp .getApplicationPart().getPart(); System.err.println(parts.size()); + + System.err.println("Size of parts: "+parts.size() + " "+ parts.get(0).getBundleId()); + System.err.println("Bundle-Version: "+parts.get(0).getBundleVersion()); for (Part p : parts) { UAPPPart ua = new UAPPPart(); + ua.setUappLocation(uappURI); Part part = new Part(); System.err.println(p.getPartId()); part.setPartId(p.getPartId()); @@ -219,19 +215,25 @@ public class FrontendImpl implements IFrontend { System.err.println(p.getBundleId()); ua.setBundleVersion(p.getBundleVersion()); System.err.println(p.getDeploymentUnit().size()); - + //Here starts the error and breaks the parsing //Getting DeploymentUnit + System.err.println("Deployment-UNIT-Size: "+p.getDeploymentUnit().size()); for(DeploymentUnit du : p.getDeploymentUnit()) { //Getting ContainerUnits if(du.isSetContainerUnit()) { //Karaf features if(du.getContainerUnit().isSetKaraf()) { + if ( du.getContainerUnit().getKaraf().getFeatures() == null ) { + System.err.println("No features for "+du.getId()); + continue; + } for(Serializable so : du.getContainerUnit().getKaraf().getFeatures().getRepositoryOrFeature()) { if(so instanceof Feature) { Feature feat = (Feature)so; for(Serializable dco : feat.getDetailsOrConfigOrConfigfile()) { if(dco instanceof Bundle) { Bundle b = (Bundle)dco; + System.err.println("Bundle-Value: "+b.getValue()); ua.setUappLocation(b.getValue().trim()); System.err.println("Bundle-Value: "+b.getValue()); } @@ -272,6 +274,7 @@ public class FrontendImpl implements IFrontend { if(du.isSetPlatformUnit()) { //TODO: Parse Values for PlatformUnit } + } //Getting UAPPReqAtom for validation @@ -335,13 +338,23 @@ public class FrontendImpl implements IFrontend { slaName = ls.getSla().getName(); System.err.println("SLA-Name: "+slaName); license.setAppName(slaName); - if(ls.getSla().isSetLink()) { + if(ls.getSla().isSetLink() && !ls.getSla().getLink().trim().isEmpty() ) { +// try { +// URL slaContent = new URL(ls.getSla().getLink()); +// slaContent.get +// } catch (MalformedURLException e) { +// e.printStackTrace(); +// } + try{ String link = ls.getSla().getLink(); System.err.println(link); link = link.substring(link.indexOf("./")); System.err.println(link); File file = new File(usrvLocalStore + serviceId+"_temp" + link); license.getSlaList().add(file); + }catch(Throwable t){ + t.printStackTrace(); + } } } @@ -349,13 +362,17 @@ public class FrontendImpl implements IFrontend { for(org.universAAL.middleware.deploymanager.uapp.model.LicenseType lt : ls.getLicense()) { System.err.println("LicenseType is set!!! "+lt.getLink()); - if(lt.isSetLink()) { + if(lt.isSetLink() && !lt.getLink().trim().isEmpty() ) { + try{ txt = lt.getLink(); System.err.println(txt); txt = txt.substring(txt.indexOf("./")); System.err.println(txt); l = new File(usrvLocalStore + serviceId+"_temp" + txt); list.add(l); + }catch(Throwable t){ + t.printStackTrace(); + } } } @@ -600,4 +617,16 @@ public class FrontendImpl implements IFrontend { return userSession; } + public void startUCC() { + if(UccUI.getInstance() == null) { + System.err.println("UCC is null so not running"); + // Opens a browser window and loads the ucc site + Desktop desk = Desktop.getDesktop(); + try { + desk.browse(new URI("http://127.0.0.1:8080/ucc")); + } catch (Exception e) { + e.printStackTrace(); + } + } + } }