Ejemplo n.º 1
0
  /** @param args */
  public void run(String[] arg0) {
    try {
      boolean chosen = buildUpdateGUI();
      if (!chosen) System.exit(0);

      if (getShotsUsingAssets()) if (confirmShotsToUpdate() == null) System.exit(0);
      processNodes();
      System.err.println("DONE");
      System.exit(0);
    } catch (PipelineException e) {
      e.printStackTrace();
    }
  } // end run(String)
Ejemplo n.º 2
0
  /** @param args */
  public static void main(String[] args) {
    UpdateAssetGUI gui = new UpdateAssetGUI();
    try {
      boolean chosen = gui.buildUpdateGUI();
      if (!chosen) System.exit(0);

      if (gui.getShotsUsingAssets()) if (gui.confirmShotsToUpdate() == null) System.exit(0);
      gui.processNodes();
      System.err.println("DONE");
      System.exit(0);
    } catch (PipelineException e) {
      e.printStackTrace();
    }
  } // end main(args)
Ejemplo n.º 3
0
  public UpdateAssetGUI() {
    try {
      PluginMgrClient.init();
      mclient = new MasterMgrClient();
      queue = new QueueMgrClient();
      plug = PluginMgrClient.getInstance();
      log = LogMgr.getInstance();

      pAssetManager = new TreeMap<String, AssetInfo>();

      project = "lr";
      charList = new TreeMap<String, String>();
      setsList = new TreeMap<String, String>();
      propsList = new TreeMap<String, String>();

      potentialUpdates = new TreeSet<String>();
      pSubstituteFields = new TreeMap<String, LinkedList<JBooleanField>>();

      /* load the look-and-feel */
      {
        try {
          SynthLookAndFeel synth = new SynthLookAndFeel();
          synth.load(
              LookAndFeelLoader.class.getResourceAsStream("synth.xml"), LookAndFeelLoader.class);
          UIManager.setLookAndFeel(synth);
        } catch (java.text.ParseException ex) {
          log.log(
              LogMgr.Kind.Ops,
              LogMgr.Level.Severe,
              "Unable to parse the look-and-feel XML file (synth.xml):\n" + "  " + ex.getMessage());
          System.exit(1);
        } catch (UnsupportedLookAndFeelException ex) {
          log.log(
              LogMgr.Kind.Ops,
              LogMgr.Level.Severe,
              "Unable to load the Pipeline look-and-feel:\n" + "  " + ex.getMessage());
          System.exit(1);
        }
      }

      /* application wide UI settings */
      {
        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
        ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
      }
    } catch (PipelineException ex) {
      ex.printStackTrace();
    } // end try/catch
  } // end constructor
Ejemplo n.º 4
0
    @Override
    public void run() {
      UIMaster master = UIMaster.getInstance();
      MasterMgrClient client = master.acquireMasterMgrClient();
      try {
        MappedSet<String, VersionID> versions = pArchives.get(pIndex);
        String archiveName = null;
        String msg = ("Archiving Volume (" + (pIndex + 1) + " of " + pArchives.size() + ")...");
        long opID = master.beginDialogOp(msg);
        master.setDialogOpCancelClient(opID, client);
        long monitorID = client.addMonitor(new DialogOpMonitor(opID));
        try {
          archiveName = client.archive(pPrefix, versions, pArchiver, pToolset);
        } catch (PipelineException ex) {
          showErrorDialog(
              "Error:",
              ex.getMessage()
                  + "\n\n"
                  + "Archive operation aborted early without creating "
                  + "("
                  + (pArchives.size() - pIndex)
                  + " of "
                  + pArchives.size()
                  + ") archive "
                  + "volumes!");
          return;
        } finally {
          master.endDialogOp(opID, "Archived.");
          client.removeMonitor(monitorID);
        }

        SwingUtilities.invokeLater(new RemoveTask(versions));

        ManualArchiveConfirmTask task =
            new ManualArchiveConfirmTask(
                pParent, archiveName, pIndex + 1, pPrefix, pArchives, pToolset, pArchiver);
        SwingUtilities.invokeLater(task);
      } finally {
        master.releaseMasterMgrClient(client);
      }
    }
Ejemplo n.º 5
0
 public void actionPerformed(ActionEvent e) {
   String com = e.getActionCommand();
   if (com.equals("user")) {
     String user1 = userField.getSelected();
     String view1 = viewField.getSelected();
     viewField.setValues(areas.get(user1));
     if (areas.get(user1).contains(view1)) viewField.setSelected(view1);
     try {
       w = new Wrapper(user1, viewField.getSelected(), toolsetField.getSelected(), mclient);
     } catch (PipelineException e1) {
       e1.printStackTrace();
       System.exit(1);
     }
   } else if (com.equals("wrap")) {
     try {
       w =
           new Wrapper(
               userField.getSelected(),
               viewField.getSelected(),
               toolsetField.getSelected(),
               mclient);
     } catch (PipelineException e1) {
       e1.printStackTrace();
       System.exit(1);
     }
   } else if (com.equals("proj")) {
     project = projectField.getSelected();
   } else if (com.equals("add")) {
     list.add(assetChoiceBox());
     diag.validate();
   } else if (com.equals("type")) {
     JCollectionField eventSrc = (JCollectionField) e.getSource();
     Collection<String> curList = getCorrectList(eventSrc.getSelected());
     Box can = (Box) eventSrc.getParent();
     JCollectionField oldList = ((JCollectionField) can.getComponent(2));
     oldList.setValues(curList);
     JCollectionField newList = (JCollectionField) can.getComponent(4);
     newList.setValues(curList);
   }
 } // end actionPerformed
Ejemplo n.º 6
0
    @Override
    public void run() {
      UIMaster master = UIMaster.getInstance();
      MasterMgrClient client = master.acquireMasterMgrClient();
      try {
        DoubleMap<String, VersionID, Long> versionSizes = null;
        {
          long opID = master.beginDialogOp("Assigning Versions to Archives...");
          long monitorID = client.addMonitor(new DialogOpMonitor(opID));
          try {
            versionSizes = client.getArchivedSizes(pVersions);
          } catch (PipelineException ex) {
            showErrorDialog(ex);
          } finally {
            master.endDialogOp(opID, "Versions Assigned.");
            client.removeMonitor(monitorID);
          }
        }

        /* assign the maximum number of versions to each archive volume without
        exceeding its capacity */
        TreeMap<Integer, MappedSet<String, VersionID>> archives =
            new TreeMap<Integer, MappedSet<String, VersionID>>();
        if (versionSizes != null) {
          long capacity = pArchiver.getCapacity();
          int idx = 0;
          long total = 0L;
          boolean done = false;
          DoubleMap<String, VersionID, Long> skippedVersionSizes =
              new DoubleMap<String, VersionID, Long>();
          while (!done) {
            for (String name : versionSizes.keySet()) {
              for (VersionID vid : versionSizes.keySet(name)) {
                Long size = versionSizes.get(name, vid);
                if ((total + size) >= capacity) {
                  /* the version is too big to fit by itself in a volume */
                  if (total == 0L) {
                    showErrorDialog(
                        "Error:",
                        "The version ("
                            + vid
                            + ") of node ("
                            + name
                            + ") was larger than "
                            + "the capacity of an entire archive volume!  The capacity of the "
                            + "archive volume must be increased to at least "
                            + "("
                            + formatLong(size)
                            + ") in order to archive this version.");
                    return;
                  }

                  skippedVersionSizes.put(name, vid, size);
                }

                /* the version fits, add it to this volume */
                else {
                  MappedSet<String, VersionID> versions = archives.get(idx);
                  if (versions == null) {
                    versions = new MappedSet<String, VersionID>();
                    archives.put(idx, versions);
                  }

                  versions.put(name, vid);
                  total += size;
                }
              }
            }

            /* some versions wouldn't fit in the current volume,
            create a new volume and try again... */
            if (!skippedVersionSizes.isEmpty()) {
              idx++;
              total = 0L;
              versionSizes = skippedVersionSizes;
              skippedVersionSizes = new DoubleMap<String, VersionID, Long>();
            } else {
              if (total < pMinSize) {
                if (idx == 0) {
                  showErrorDialog(
                      "Error:",
                      "The total size ("
                          + formatLong(total)
                          + ") of all versions selected "
                          + "for archiving was less than the minimum archive volume size "
                          + "("
                          + formatLong(pMinSize)
                          + ")!  Either select enough versions to "
                          + "meet this minimum size or specify a smaller minimum size to create "
                          + "an archive volume.");
                  return;
                } else {
                  archives.remove(idx);
                }
              }

              break;
            }
          }
        }

        /* perform the archive operations */
        if (!archives.isEmpty()) {
          if (pArchiver.isManual()) {
            ManualArchiveConfirmTask task =
                new ManualArchiveConfirmTask(
                    pParent, null, 0, pPrefix, archives, pToolset, pArchiver);
            SwingUtilities.invokeLater(task);
          } else {
            long opID = master.beginDialogOp();
            master.setDialogOpCancelClient(opID, client);
            long monitorID = client.addMonitor(new DialogOpMonitor(opID));
            int lastIdx = 0;
            try {
              for (Integer idx : archives.keySet()) {
                master.updateDialogOp(
                    opID, "Archiving Volume (" + (idx + 1) + " of " + archives.size() + ")...");
                lastIdx = idx;
                client.archive(pPrefix, archives.get(idx), pArchiver, pToolset);
              }
            } catch (PipelineException ex) {
              showErrorDialog(
                  "Error:",
                  ex.getMessage()
                      + "\n\n"
                      + "Archive operation aborted early without creating "
                      + "("
                      + (archives.size() - lastIdx)
                      + " of "
                      + archives.size()
                      + ") archive "
                      + "volumes!");
              return;
            } finally {
              master.endDialogOp(opID, "Archived.");
              client.removeMonitor(monitorID);
            }

            RemoveAllTask task = new RemoveAllTask();
            SwingUtilities.invokeLater(task);
          } // else
        } // if(!archives.isEmpty()) {
      } finally {
        master.releaseMasterMgrClient(client);
      }
    }