Package devplugin

Examples of devplugin.Version


    // Create a plugin instance
    try {
      Class pluginClass = classLoader.loadClass(pluginName.toLowerCase() + "." + pluginName);
      Method getVersion = pluginClass.getMethod("getVersion",new Class[0]);
      Version version1 = null;
      try {
        version1 = (Version)getVersion.invoke(pluginClass, new Object[0]);
      } catch (Exception e) {
      }
      if (version1 == null || version1.toString().equals("0.0.0.0")) {
        mLog.warning("Did not load plugin " + pluginName + ", version is too old.");
        return null;
      }

      if(pluginClass.getSuperclass().equals(devplugin.AbstractTvDataService.class) || classLoader2 != null) {
        getVersion = pluginClass.getMethod("getVersion",new Class[0]);
        version1 = (Version)getVersion.invoke(pluginClass, new Object[0]);

        if(pluginClass.getSuperclass().equals(devplugin.AbstractTvDataService.class)) {
          isBlockedDataService = Settings.propBlockedPluginArray.isBlocked(pluginName.toLowerCase() + "." + pluginName, version1);
        }
      }

      if(classLoader2 != null) {
        try {
          Class pluginClass2 = classLoader2.loadClass(pluginName.toLowerCase() + "." + pluginName);
          Method getVersion2 = pluginClass2.getMethod("getVersion",new Class[0]);

          Version version2 = (Version)getVersion2.invoke(pluginClass2, new Object[0]);

          if(version2.compareTo(version1) > 0) {
            return null;
          }
        }catch(Throwable t) {}
      }
View Full Code Here


                       
        pluginClass = classLoader.loadClass(pluginName.toLowerCase() + "." + pluginName);
        Method getVersion = pluginClass.getMethod("getVersion",new Class[0]);
       
        try {
          Version version = (Version)getVersion.invoke(pluginClass, new Object[0]);
         
          PluginBaseInfo baseInfo = new PluginBaseInfo("java." + pluginClass.getName(),version);
         
          if(!availablePlugins.contains(baseInfo)) {
            availablePlugins.add(baseInfo);
          }
        } catch (Exception e) {
        }
       
       
      } catch (Throwable t) {
        urls = null;
        pluginClass = null;
        System.gc();
       
        PluginBaseInfo baseInfo = new PluginBaseInfo("java." + pluginName.toLowerCase() + "." + pluginName, new Version(0,0));
       
        if(!availablePlugins.contains(baseInfo)) {
          availablePlugins.add(baseInfo);
        }
       
View Full Code Here

    updateProxySettings();

    // Set the String to use for indicating the user agent in http requests
    System.setProperty("http.agent", MAINWINDOW_TITLE);

    Version tmpVer = Settings.propTVBrowserVersion.getVersion();
    final Version currentVersion = tmpVer != null ? new Version(tmpVer.getMajor(),tmpVer.getMinor(),Settings.propTVBrowserVersionIsStable.getBoolean()) : tmpVer;

    /*TODO Create an update service for installed TV data services that doesn't
     *     work with TV-Browser 3.0 and updates for them are known.
     */
    if(!isTransportable() && Launch.isOsWindowsNtBranch() && currentVersion != null && currentVersion.compareTo(new Version(3,0,true)) < 0) {
      String tvDataDir = Settings.propTVDataDirectory.getString().replace("/",File.separator);

      if(!tvDataDir.startsWith(System.getenv("appdata"))) {
        StringBuilder oldDefaultTvDataDir = new StringBuilder(System.getProperty("user.home")).append(File.separator).append("TV-Browser").append(File.separator).append("tvdata");

        if(oldDefaultTvDataDir.toString().equals(tvDataDir)) {
          Settings.propTVDataDirectory.setString(Settings.propTVDataDirectory.getDefault());
        }
      }
    }


    Settings.propTVBrowserVersion.setVersion(VERSION);
    Settings.propTVBrowserVersionIsStable.setBoolean(VERSION.isStable());

    final Splash splash;

    if (mShowSplashScreen && Settings.propSplashShow.getBoolean()) {
      splash = new SplashScreen(
          Settings.propSplashImage.getString(),
          Settings.propSplashTextPosX.getInt(),
          Settings.propSplashTextPosY.getInt(),
          Settings.propSplashForegroundColor.getColor());
    }
    else {
      splash = new DummySplash();
    }
    splash.showSplash();

    /* Initialize the MarkedProgramsList */
    MarkedProgramsList.getInstance();

    /*Maybe there are tvdataservices to install (.jar.inst files)*/
    PluginLoader.getInstance().installPendingPlugins();

    PluginLoader.getInstance().loadAllPlugins();

    mLog.info("Loading TV listings service...");
    splash.setMessage(mLocalizer.msg("splash.dataService", "Loading TV listings service..."));
    TvDataServiceProxyManager.getInstance().init();
    ChannelList.createForTvBrowserStart();

    ChannelList.initSubscribedChannels();

    if (!lookAndFeelInitialized) {
      mLog.info("Loading Look&Feel...");
      splash.setMessage(mLocalizer.msg("splash.laf", "Loading look and feel..."));

      updateLookAndFeel();
    }

    mLog.info("Loading plugins...");
    splash.setMessage(mLocalizer.msg("splash.plugins", "Loading plugins..."));
    try {
      PluginProxyManager.getInstance().init();
    } catch(TvBrowserException exc) {
      ErrorHandler.handle(exc);
    }

    splash.setMessage(mLocalizer.msg("splash.tvData", "Checking TV database..."));

    mLog.info("Checking TV listings inventory...");
    TvDataBase.getInstance().checkTvDataInventory();

    mLog.info("Starting up...");
    splash.setMessage(mLocalizer.msg("splash.ui", "Starting up..."));

    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new TextComponentPopupEventQueue());

    // Init the UI
    final boolean fStartMinimized = Settings.propMinimizeAfterStartup.getBoolean() || mMinimized;
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        initUi(splash, fStartMinimized);

        new Thread("Start finished callbacks") {
          public void run() {
            setPriority(Thread.MIN_PRIORITY);

            mLog.info("Deleting expired TV listings...");
            TvDataBase.getInstance().deleteExpiredFiles(1, false);

            // first reset "starting" flag of mainframe
            mainFrame.handleTvBrowserStartFinished();

            // initialize program info for fast reaction to program table click
            ProgramInfo.getInstance().handleTvBrowserStartFinished();

            // load reminders and favorites
            ReminderPlugin.getInstance().handleTvBrowserStartFinished();
            FavoritesPlugin.getInstance().handleTvBrowserStartFinished();

            // now handle all plugins and services
            GlobalPluginProgramFormatingManager.getInstance();
            PluginProxyManager.getInstance().fireTvBrowserStartFinished();
            TvDataServiceProxyManager.getInstance()
                .fireTvBrowserStartFinished();

            // finally submit plugin caused updates to database
            TvDataBase.getInstance().handleTvBrowserStartFinished();

            startPeriodicSaveSettings();

          }
        }.start();
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            ChannelList.completeChannelLoading();
            initializeAutomaticDownload();
            if (Launch.isOsWindowsNtBranch()) {
              try {
                RegistryKey desktopSettings = new RegistryKey(
                    RootKey.HKEY_CURRENT_USER, "Control Panel\\Desktop");
                RegistryValue autoEnd = desktopSettings
                    .getValue("AutoEndTasks");

                if (autoEnd.getData().equals("1")) {
                  RegistryValue killWait = desktopSettings
                      .getValue("WaitToKillAppTimeout");

                  int i = Integer.parseInt(killWait.getData().toString());

                  if (i < 5000) {
                    JOptionPane pane = new JOptionPane();

                    String cancel = mLocalizer.msg("registryCancel",
                        "Close TV-Browser");
                    String dontDoIt = mLocalizer.msg("registryJumpOver",
                        "Not this time");

                    pane.setOptions(new String[] {
                        Localizer.getLocalization(Localizer.I18N_OK), dontDoIt,
                        cancel });
                    pane.setOptionType(JOptionPane.YES_NO_CANCEL_OPTION);
                    pane.setMessageType(JOptionPane.WARNING_MESSAGE);
                    pane
                        .setMessage(mLocalizer
                            .msg(
                                "registryWarning",
                                "The fast shutdown of Windows is activated.\nThe timeout to wait for before Windows is closing an application is too short,\nto give TV-Browser enough time to save all settings.\n\nThe setting hasn't the default value. It was changed by a tool or by you.\nTV-Browser will now try to change the timeout.\n\nIf you don't want to change this timeout select 'Not this time' or 'Close TV-Browser'."));

                    pane.setInitialValue(mLocalizer.msg("registryCancel",
                        "Close TV-Browser"));

                    JDialog d = pane.createDialog(UiUtilities
                        .getLastModalChildOf(mainFrame), UIManager
                        .getString("OptionPane.messageDialogTitle"));
                    d.setModal(true);
                    UiUtilities.centerAndShow(d);

                    if (pane.getValue() == null
                        || pane.getValue().equals(cancel)) {
                      mainFrame.quit();
                    } else if (!pane.getValue().equals(dontDoIt)) {
                      try {
                        killWait.setData("5000");
                        desktopSettings.setValue(killWait);
                        JOptionPane
                            .showMessageDialog(
                                UiUtilities.getLastModalChildOf(mainFrame),
                                mLocalizer
                                    .msg("registryChanged",
                                        "The timeout was changed successfully.\nPlease reboot Windows!"));
                      } catch (Exception registySetting) {
                        JOptionPane
                            .showMessageDialog(
                                UiUtilities.getLastModalChildOf(mainFrame),
                                mLocalizer
                                    .msg(
                                        "registryNotChanged",
                                        "<html>The Registry value couldn't be changed. Maybe you haven't the right to do it.<br>If it is so contact you Administrator and let him do it for you.<br><br><b><Attention:/b> The following description is for experts. If you change or delete the wrong value in the Registry you could destroy your Windows installation.<br><br>To get no warning on TV-Browser start the Registry value <b>WaitToKillAppTimeout</b> in the Registry path<br><b>HKEY_CURRENT_USER\\Control Panel\\Desktop</b> have to be at least <b>5000</b> or the value for <b>AutoEndTasks</b> in the same path have to be <b>0</b>.</html>"),
                                Localizer.getLocalization(Localizer.I18N_ERROR),
                                JOptionPane.ERROR_MESSAGE);
                      }
                    }
                  }
                }
              } catch (Throwable registry) {
              }
            }

            if (currentVersion != null
                && currentVersion.compareTo(new Version(2, 71, false)) < 0) {
              if (Settings.propProgramPanelMarkedMinPriorityColor.getColor()
                  .equals(
                      Settings.propProgramPanelMarkedMinPriorityColor
                          .getDefaultColor())) {
                Settings.propProgramPanelMarkedMinPriorityColor
                    .setColor(new Color(255, 0, 0, 30));
              }
              if (Settings.propProgramPanelMarkedMediumPriorityColor.getColor()
                  .equals(
                      Settings.propProgramPanelMarkedMediumPriorityColor
                          .getDefaultColor())) {
                Settings.propProgramPanelMarkedMediumPriorityColor
                    .setColor(new Color(140, 255, 0, 60));
              }
              if (Settings.propProgramPanelMarkedHigherMediumPriorityColor
                  .getColor().equals(
                      Settings.propProgramPanelMarkedHigherMediumPriorityColor
                          .getDefaultColor())) {
                Settings.propProgramPanelMarkedHigherMediumPriorityColor
                    .setColor(new Color(255, 255, 0, 60));
              }
              if (Settings.propProgramPanelMarkedMaxPriorityColor.getColor()
                  .equals(
                      Settings.propProgramPanelMarkedMaxPriorityColor
                          .getDefaultColor())) {
                Settings.propProgramPanelMarkedMaxPriorityColor
                    .setColor(new Color(255, 180, 0, 110));
              }
            }

            // check if user should select picture settings
            if (currentVersion != null
                && currentVersion.compareTo(new Version(2, 22)) < 0) {
              TvBrowserPictureSettingsUpdateDialog.createAndShow(mainFrame);
            } else if (currentVersion != null
                && currentVersion.compareTo(new Version(2, 51, true)) < 0) {
              Settings.propAcceptedLicenseArrForServiceIds
                  .setStringArray(new String[0]);
            }

            if (currentVersion != null
                && currentVersion.compareTo(new Version(2, 60, true)) < 0) {
              int startOfDay = Settings.propProgramTableStartOfDay.getInt();
              int endOfDay = Settings.propProgramTableEndOfDay.getInt();

              if (endOfDay - startOfDay < -1) {
                Settings.propProgramTableEndOfDay.setInt(startOfDay);
View Full Code Here

  @Override
  public PluginInfo getInfo() {
    return new PluginInfo(
        Messages.getString("Plugin.name"), Messages.getString("Plugin.desc"), Messages.getString("Plugin.author"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        new Version(0, 3, false), Messages.getString("Plugin.license")); //$NON-NLS-1$
  }
View Full Code Here

TOP

Related Classes of devplugin.Version

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.