Package net.laubenberger.tyr.model

Examples of net.laubenberger.tyr.model.ModuleConfig


  static AdvancedPlayer player;

  private boolean isExit = false;

  public static void main(final String[] args) {
    final ModuleConfig cm = new ModuleConfigImpl();
    cm.setName("MusicPlayer"); //$NON-NLS-1$
    cm.setVersion(new BigDecimal("0.87")); //$NON-NLS-1$
    cm.setBuild(247);
    cm.setCreated(HelperTime.getDate(2012, 5, 31, 8, 13, 0));
    cm.setLanguage(Language.ENGLISH);
    cm.setUUID(UUID.fromString("aa9d8103-a786-4a68-8f7c-ff1fdcebe06e")); //$NON-NLS-1$
    cm.addPerson(Constants.BOGATYR.getPersons().get(0)); //hopefully it's me :-)
    cm.setJars(HelperCollection.getList("tyr-module-musicplayer-0.87.jar", "lib/jlayer.jar"))//$NON-NLS-1$//$NON-NLS-2$
    cm.setModuleClass("net.laubenberger.tyr.module.musicplayer.MusicPlayerImpl"); //$NON-NLS-1$
    cm.setLocalizerBase("net/laubenberger/tyr/module/musicplayer/musicplayer"); //$NON-NLS-1$
    cm.setLogo("net/laubenberger/tyr/module/musicplayer/icon/small/logo.png"); //$NON-NLS-1$
    cm.setLogoLarge("net/laubenberger/tyr/module/musicplayer/icon/large/logo.png"); //$NON-NLS-1$
   
    try {
      cm.setUrl(new URL("http://dev.laubenberger.net/")); //$NON-NLS-1$
      // cm.setUpdateLocation(new
      // URL("file://User/slaubenberger/Desktop/musicplayer_update.xml"));
    } catch (MalformedURLException ex) {
      // should never happen!
      log.error("URL invalid", ex); //$NON-NLS-1$
    }

    try {
      HelperXml.serialize(new File(cm.getName() + FileType.CONFIGURATION.getExtension()), cm);
    } catch (JAXBException ex) {
      log.error("Could not write the configration file", ex); //$NON-NLS-1$
    }
  }
View Full Code Here


    final Collection<File> list = HelperIO.getFiles(data.getDirectoryModule(), filter);

    for (final File file : list) {
      try {
        final ModuleConfig cm = HelperXml.deserialize(file, ModuleConfigImpl.class);

        try {
          final URL[] urls = new URL[cm.getJars().size()];
          for (int ii = 0; ii < cm.getJars().size(); ii++) {
            urls[ii] = new URL("file:" + file.getParent() + '/' + cm.getJars().get(ii)); //$NON-NLS-1$
          }

          final JarLoader jl = new JarLoader(urls);

          try {
              if (null != cm.getProperties()) {
//                  cm.setProperty(new PropertyImpl(jl.getResourceAsStream(cm.getProperties())));
                  cm.setProperty(new PropertyImpl(new File(file.getParent(), cm.getProperties())));
              }

              cm.setLocalizer(new LocalizerFile(cm.getLocalizerBase(), jl, new EncodingControl()));
            cm.getLocalizer().setLocale(data.getLanguage().getLocale());

            // read data for the module
            final File tmd = new File(data.getDirectoryData(), cm.getUUID() + FileType.DATA.getExtension());
            try {
              ModuleData md = new ModuleDataImpl();
              if (tmd.exists()) {
                md = HelperXml.deserialize(tmd, ModuleDataImpl.class);
              }
              final ModuleAbstract module = (ModuleAbstract) jl.createInstance(cm.getModuleClass(), HelperArray
                  .getArray(ModuleConfig.class, ModuleData.class, Callback.class, ScalableIcon.class,
                      File.class), HelperArray.getArray(cm, md, controller,
                  new ScalableIconImpl(cm.getLogo(), cm.getLogoLarge(), jl), data.getDirectoryDB())); // TODO
                                                                          // add
                                                                          // large
                                                                          // icon
              modules.add(module);
            } catch (JAXBException ex) {
              log.error("Could not process module data file " + HelperString.quote(tmd.getAbsolutePath()), ex); //$NON-NLS-1$
            }
          } catch (Exception ex) {
            log.error(
                "Could not create instantiate class " + HelperString.quote(cm.getModuleClass()) + " from module configuration file " + HelperString.quote(file.getAbsolutePath()), ex); //$NON-NLS-1$//$NON-NLS-2$
          }
        } catch (MalformedURLException ex) {
          log.error("Invalid JAR destination in module configuration file " + HelperString.quote(file.getAbsolutePath()), ex); //$NON-NLS-1$
        }
      } catch (JAXBException ex) {
View Full Code Here

  final Collection<Dialog> dialogs = new HashSet<Dialog>();

  private boolean isExit = false;

  public static void main(final String[] args) {
    final ModuleConfig cm = new ModuleConfigImpl();
    cm.setName("Test"); //$NON-NLS-1$
    cm.setVersion(new BigDecimal("0.92")); //$NON-NLS-1$
    cm.setBuild(247);
    cm.setCreated(HelperTime.getDate(2012, 5, 31, 8, 37, 0));
    cm.setLanguage(Language.ENGLISH);
    cm.setUUID(UUID.fromString("febb21fe-52e6-4776-bfd4-dcc0fd2cc074")); //$NON-NLS-1$
    cm.addPerson(Constants.BOGATYR.getPersons().get(0)); //hopefully it's me :-)
    cm.setJars(HelperCollection.getList("tyr-module-test-0.92.jar", "lib/jbusycomponent-1.2.2.jar", "lib/jxlayer-3.0.4.jar" /*, "lib/commons-0.2.jar"*/))//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    cm.setModuleClass("net.laubenberger.tyr.module.test.TestImpl"); //$NON-NLS-1$
    cm.setLocalizerBase("net/laubenberger/tyr/module/test/test"); //$NON-NLS-1$
    cm.setLogo("net/laubenberger/tyr/module/test/icon/small/logo.png"); //$NON-NLS-1$
    cm.setLogoLarge("net/laubenberger/tyr/module/test/icon/large/logo.png"); //$NON-NLS-1$

    try {
      cm.setUrl(new URL("http://dev.laubenberger.net/")); //$NON-NLS-1$
      // cm.setUpdateLocation(new
      // URL("file://User/slaubenberger/Desktop/test_update.xml"));
    } catch (MalformedURLException ex) {
      // should never happen!
      log.error("URL invalid", ex); //$NON-NLS-1$
    }

    try {
      HelperXml.serialize(new File(cm.getName() + FileType.CONFIGURATION.getExtension()), cm);
    } catch (JAXBException ex) {
      log.error("Could not write the configration file", ex); //$NON-NLS-1$
    }
  }
View Full Code Here

TOP

Related Classes of net.laubenberger.tyr.model.ModuleConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.