Ejemplo n.º 1
0
 private void saveAllSaas(SaasGroup group) {
   for (Saas s : group.getServices()) {
     s.save();
   }
   for (SaasGroup sg : group.getChildrenGroups()) {
     saveAllSaas(sg);
   }
 }
Ejemplo n.º 2
0
 void _removeService(Saas service) {
   try {
     if (service instanceof WsdlSaas) {
       WsdlSaas saas = (WsdlSaas) service;
       WsdlUtil.removeWsdlData(saas.getDelegate().getUrl());
     }
     FileObject saasFolder = service.getSaasFolder();
     if (saasFolder != null) {
       saasFolder.delete();
     }
     service.setState(Saas.State.REMOVED);
   } catch (IOException e) {
     Exceptions.printStackTrace(e);
   }
 }
Ejemplo n.º 3
0
 /**
  * Model mutation: remve service from parent group, delete file, fire event
  *
  * @param service to remove.
  */
 public synchronized void removeService(Saas service) {
   initRootGroup();
   SaasGroup parent = service.getParentGroup();
   parent.removeService(service);
   _removeService(service);
   fireChange(PROP_SERVICES, parent, service, null);
 }
Ejemplo n.º 4
0
  private void loadSaasServiceFile(FileObject saasFile, boolean userDefined) {
    try {
      SaasServices ss = SaasUtil.loadSaasServices(saasFile);
      Group g = ss.getSaasMetadata().getGroup();
      SaasGroup parent = rootGroup;

      Saas service = null;
      if (g == null || g.getName() == null || g.getName().trim().length() == 0) {
        service = createService(parent, ss);
        if (service != null) {
          service.setUserDefined(userDefined);
          parent.addService(service);
        }
      } else {
        while (g != null) {
          SaasGroup child = parent.getChildGroup(g.getName());
          if (child == null) {
            child = new SaasGroup(parent, g);
            parent.addChildGroup(child);
          }

          child.setUserDefined(userDefined);

          if (g.getGroup().size() == 0) {
            service = createService(child, ss);
            if (service != null) {
              service.setUserDefined(userDefined);
              child.addService(service);
            }
            break;
          } else {
            // 'group' element part of straight path, has only single child
            g = g.getGroup().get(0);
            parent = child; // march on towards tip
          }
        }
      }
      if (service != null) service.upgrade();
    } catch (Exception ex) {
      Exceptions.printStackTrace(
          Exceptions.attachMessage(ex, "Error loading saas file: " + saasFile.getPath()));
    }
  }
Ejemplo n.º 5
0
 public synchronized void refreshService(Saas saas) {
   saas.refresh();
 }