Ejemplo n.º 1
0
  /** Lee del config.xml la configuración. */
  public void unmarshalPlugins() {
    HashMap pc = Launcher.getPluginConfig();
    Iterator iter = pc.keySet().iterator();

    while (iter.hasNext()) {
      Object obj = iter.next();
      PluginConfig pconfig = (PluginConfig) pc.get(obj);

      try {
        String fileName =
            Launcher.getAndamiConfig().getPluginsDirectory()
                + File.separator
                + (String) obj
                + File.separator
                + "config.xml";
        FileInputStream is = new FileInputStream(fileName);
        Reader reader = com.iver.utiles.xml.XMLEncodingUtils.getReader(is);
        if (reader == null) {
          // the encoding was not correctly detected, use system default
          reader = new FileReader(fileName);
        } else {
          // use a buffered reader to improve performance
          reader = new BufferedReader(reader);
        }
        pconfig = (PluginConfig) PluginConfig.unmarshal(reader);
        Launcher.getPluginConfig().put(obj, pconfig);
      } catch (Exception e) {
        System.out.println("Exception unmarshalPlugin " + e);
      }
    }

    // hay que refrescar la aplicación
    /// ((App)App.instance).run();
  }
Ejemplo n.º 2
0
 public void initializeDefaults() {
   unmarshalPlugins();
   getChbActivar()
       .setSelected(((Extension) Launcher.getExtension(extension.getClassName())).getActive());
   getJTextField().setText(String.valueOf(extension.getPriority()));
   getJTextArea()
       .setText(
           format(
               ((Extension) Launcher.getExtension(extension.getClassName())).getDescription(),
               40));
 }
Ejemplo n.º 3
0
 public void initializeValues() {
   getChbActivar()
       .setSelected(((Extension) Launcher.getExtension(extension.getClassName())).getActive());
   getJTextField().setText(String.valueOf(extension.getPriority()));
   getJTextArea()
       .setText(
           format(
               ((Extension) Launcher.getExtension(extension.getClassName())).getDescription(),
               40));
   chkSelected = getChbActivar().isSelected();
   txtPriority = extension.getPriority();
 }
Ejemplo n.º 4
0
  /** Escribe sobre el config.xml, la nueva configuración. */
  public void marshalPlugins() {
    HashMap pc = Launcher.getPluginConfig();
    Iterator iter = pc.keySet().iterator();

    while (iter.hasNext()) {
      Object obj = iter.next();
      PluginConfig pconfig = (PluginConfig) pc.get(obj);
      Writer writer;

      try {
        FileOutputStream fos =
            new FileOutputStream(
                Launcher.getAndamiConfig().getPluginsDirectory()
                    + File.separator
                    + (String) obj
                    + File.separator
                    + "config.xml");
        // castor uses xerces, and xerces uses UTF-8 by default, so we should use
        // UTF-8 to create the writer, as long as we continue using castor+xerces
        writer = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));

        try {
          pconfig.marshal(writer);
        } catch (MarshalException e1) {
          e1.printStackTrace();
        } catch (ValidationException e1) {
          e1.printStackTrace();
        }
      } catch (IOException e) {
        e.printStackTrace();
      }

      // hay que refrescar la aplicación
      /// ((App)App.instance).run();
    }
  }