private static void printMetaBundle(final ElementMetaData data, Map globalAttributes) {
    System.out.println("-----------------------------------------------------");
    final AbstractMetaData amd = (AbstractMetaData) data;
    final String keyPrefix = amd.getKeyPrefix();
    final String ename = amd.getName();
    final String ebundle = amd.getBundleLocation();

    System.out.println(keyPrefix + ename + ".display-name=" + ename);
    System.out.println(
        keyPrefix + ename + ".grouping=" + filter(amd.getGrouping(Locale.ENGLISH), "Group"));
    System.out.println(
        keyPrefix + ename + ".description=" + filter(amd.getDescription(Locale.ENGLISH), ""));
    System.out.println(
        keyPrefix + ename + ".deprecated=" + filter(amd.getDeprecationMessage(Locale.ENGLISH), ""));

    final AttributeMetaData[] attributes = data.getAttributeDescriptions();

    for (int j = 0; j < attributes.length; j++) {
      final AttributeMetaData attribute = attributes[j];
      final AbstractMetaData aamd = (AbstractMetaData) attribute;
      final String akeyPrefix = aamd.getKeyPrefix();
      final String abundle = aamd.getBundleLocation();
      final String aname = attribute.getName();
      if (abundle.equals(GLOBAL_BUNDLE) && akeyPrefix.startsWith("attribute.")) {
        globalAttributes.put(aname, attribute);
        continue;
      }
      System.out.println(akeyPrefix + aname + ".display-name=" + aname);
      System.out.println(
          akeyPrefix + aname + ".grouping=" + filter(aamd.getGrouping(Locale.ENGLISH), "Group"));
      System.out.println(
          akeyPrefix + aname + ".description=" + filter(aamd.getDescription(Locale.ENGLISH), ""));
      System.out.println(
          akeyPrefix
              + aname
              + ".deprecated="
              + filter(aamd.getDeprecationMessage(Locale.ENGLISH), ""));
    }

    System.out.println("-----------------------------------------------------");
  }
  private static void validateAttributeMetaData(
      final ElementMetaData metaData, final ArrayList<String> missingProperties) {
    final Locale locale = Locale.getDefault();
    final String typeName = metaData.getName();

    final AttributeMetaData[] attributeMetaDatas = metaData.getAttributeDescriptions();
    for (int j = 0; j < attributeMetaDatas.length; j++) {
      final AttributeMetaData propertyMetaData = attributeMetaDatas[j];
      final String propertyDisplayName = propertyMetaData.getDisplayName(locale);
      if (isValid(propertyDisplayName, propertyMetaData.getName(), missingProperties) == false) {
        logger.warn(
            "ElementType '"
                + typeName
                + ": Attr "
                + propertyMetaData.getName()
                + ": No DisplayName");
      }

      final String propertyGrouping = propertyMetaData.getGrouping(locale);
      if (isValid(propertyGrouping, "common", missingProperties) == false) {
        logger.warn(
            "ElementType '"
                + typeName
                + ": Attr "
                + propertyMetaData.getName()
                + ": Grouping is not valid");
      }
      if (propertyMetaData.isDeprecated()) {
        final String deprecateMessage = propertyMetaData.getDeprecationMessage(locale);
        if (isValid(deprecateMessage, "Deprecated", missingProperties) == false) {
          logger.warn(
              "ElementType '"
                  + typeName
                  + ": Attr "
                  + propertyMetaData.getName()
                  + ": No valid deprecate message");
        }
      }
    }
  }
Exemplo n.º 3
0
  /** @noinspection ThrowableResultOfMethodCallIgnored */
  public static void main(final String[] args) {
    boolean offlineMode = false;
    boolean offlineModeSecurityManager = false;

    int parsePos;
    for (parsePos = 0; parsePos < args.length; parsePos += 1) {
      final String arg = args[parsePos];
      if ("--offline".equals(arg) || "-o".equals(arg)) // NON-NLS
      {
        offlineMode = true;
        continue;
      }
      if ("--with-offline-mode-security-manager".equals(arg)) // NON-NLS
      {
        offlineModeSecurityManager = true;
        continue;
      }
      break;
    }

    final File[] files = new File[args.length - parsePos];
    for (int i = 0; i < args.length; i++) {
      final String arg = args[i];
      files[i] = new File(arg);
    }

    System.setProperty("sun.awt.exception.handler", ThrowableHandler.class.getName()); // NON-NLS
    Thread.setDefaultUncaughtExceptionHandler(ThrowableHandler.getInstance());

    System.setProperty(
        "java.util.prefs.PreferencesFactory", BinaryPreferencesFactory.class.getName()); // NON-NLS
    System.setProperty("sun.swing.enableImprovedDragGesture", "true"); // NON-NLS

    ProxySelector.setDefault(new FirewallingProxySelector(ProxySelector.getDefault()));
    if (offlineModeSecurityManager) {
      try {
        System.setSecurityManager(new FirewallingSecurityManager());
      } catch (SecurityException se) {
        DebugLog.log(
            "Unable to set security manager. An other security manager prevented us from gaining control."); // NON-NLS
      }
    }
    if (offlineMode) {
      WorkspaceSettings.getInstance().setOfflineMode(true);
    }

    PropertyEditorManager.registerEditor(Color.class, ColorPropertyEditor.class);

    try {
      SwingUtilities.invokeAndWait(new SetLookAndFeelTask());
      SwingUtilities.invokeAndWait(new InstallAWTHandlerRunnable());

      SwingUtilities.invokeAndWait(new InitializeSplashScreenTask());
      // avoid the big cascading boot so that we can update the splashscreen
      // with some meaning full messages

      SwingUtilities.invokeAndWait(new UpdateStatusTask("Booting Base Libraries ..")); // NON-NLS
      LibLoaderBoot.getInstance().start();
      if (LibLoaderBoot.getInstance().isBootFailed()) {
        throw new IllegalStateException(
            "Booting failed", LibLoaderBoot.getInstance().getBootFailureReason());
      }
      SwingUtilities.invokeAndWait(
          new UpdateStatusTask("Booting Font Rendering System ..")); // NON-NLS
      LibFontBoot.getInstance().start();
      if (LibFontBoot.getInstance().isBootFailed()) {
        throw new IllegalStateException(
            "Booting failed", LibFontBoot.getInstance().getBootFailureReason());
      }
      SwingUtilities.invokeAndWait(new UpdateStatusTask("Booting Reporting-Engine ..")); // NON-NLS
      ClassicEngineBoot.getInstance().start();
      if (ClassicEngineBoot.getInstance().isBootFailed()) {
        throw new IllegalStateException(
            "Booting failed", ClassicEngineBoot.getInstance().getBootFailureReason());
      }
      SwingUtilities.invokeAndWait(new UpdateStatusTask("Booting Report-Designer ..")); // NON-NLS
      ReportDesignerBoot.getInstance().start();
      if (ReportDesignerBoot.getInstance().isBootFailed()) {
        throw new IllegalStateException(
            "Booting failed", ReportDesignerBoot.getInstance().getBootFailureReason());
      }

      // initialize some of the more expensive model components.
      SwingUtilities.invokeAndWait(new UpdateStatusTask("Preloading classes ..")); // NON-NLS
      ExpressionRegistry.getInstance();
      ExpressionsTreeModel.getTreeModel();
      ExpressionUtil.getInstance();
      preloadFonts();

      SwingUtilities.invokeAndWait(
          new UpdateStatusTask("Checking initial configuration ..")); // NON-NLS
      SettingsUtil.createInitialConfiguration();

      SwingUtilities.invokeAndWait(new UpdateStatusTask("Collecting Sample Reports ..")); // NON-NLS
      SamplesTreeBuilder.getSampleTreeModel();

      SwingUtilities.invokeAndWait(new UpdateStatusTask("Starting  ..")); // NON-NLS
      SwingUtilities.invokeAndWait(new CreateReportDesignerFrame(files));
      SwingUtilities.invokeAndWait(new VersionCheckerTask());

      final ElementMetaData data =
          ElementTypeRegistry.getInstance().getElementType("page-header"); // NON-NLS
      final AttributeMetaData[] datas = data.getAttributeDescriptions();
      final int x = datas.length; // ensure that there is some metadata.
    } catch (Throwable t) {
      if (splashScreen != null) {
        splashScreen.dispose();
      }
      UncaughtExceptionsModel.getInstance().addException(t);
      final ExceptionDialog dialog = new ExceptionDialog();
      dialog.setModal(true);
      dialog.showDialog();
      System.exit(1);
    }
  }