Example usage for java.util.logging Level CONFIG

List of usage examples for java.util.logging Level CONFIG

Introduction

In this page you can find the example usage for java.util.logging Level CONFIG.

Prototype

Level CONFIG

To view the source code for java.util.logging Level CONFIG.

Click Source Link

Document

CONFIG is a message level for static configuration messages.

Usage

From source file:diet.gridr.g5k.gui.GanttChart.java

/**
 * Default constructor of the GanttChart
 *
 * @param title title of the GanttChart/*from   w  w  w .  j a va  2s  .c o m*/
 * @param aSiteName name of the cluster
 * @param aJobsList list of Jobs for the cluster
 * @param connection ssh connection
 */
public GanttChart(String title, String aSiteName, ArrayList<GridJob> aJobsList, Connection connection) {
    super(title);
    this.connection = connection;
    jobsList = new ArrayList<ArrayList<GridJob>>();
    for (int i = 0; i < HistoryUtil.durationsTimesArray.length; i++) {
        jobsList.add(makeACopyOf(aJobsList));
    }
    // numberOfNodes = G5kCluster.getCapacityForIndex(G5kCluster.getIndexForCluster(aClusterName));
    numberOfNodes = G5kSite.getResCount(G5kSite.getIndexForSite(aSiteName));
    siteName = aSiteName;
    getContentPane().setLayout(new BorderLayout());

    getContentPane().add(getSelectionPanel(), BorderLayout.NORTH);
    getContentPane().add(getTablePanel(), BorderLayout.SOUTH);
    getContentPane().add(getCardPanel(), BorderLayout.CENTER);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    LoggingManager.log(Level.CONFIG, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "GanttChart",
            "GanttChart constructed");
}

From source file:io.github.agentsoz.abmjadex.super_central.ABMSimStarter.java

private static void parsingArguments(String[] args, Options options) {
    //flags//from  w  w w. ja  va  2 s.co  m
    boolean isRunningCO = true;
    boolean isForced = false; //Overwrite any existing CO xml file
    boolean isRunningSC = true;
    boolean isLogToConsole = false;
    Level logLevel = Level.INFO;

    Properties prop = null;
    CommandLine line = null;
    BasicParser parser = new BasicParser();
    ArrayList<String> argsList = new ArrayList<String>();

    //Initialize argsList with args
    for (int i = 0; i < args.length; i++) {
        argsList.add(args[i]);
    }

    //Update 04/17/2013
    String[] specificArgs = packageOptionSpecific(args);

    try {
        // parse the command line arguments
        //line = parser.parse(options, args );
        //Update 04/17/2013
        line = parser.parse(options, specificArgs);

        //Commandline required -prop argument to be filled with valid properties file location
        if (line.hasOption(HELP)) {
            //Remove app specific arguments from total arguments
            int helpIndex = argsList.indexOf("-" + HELP);
            if (helpIndex == -1)
                helpIndex = argsList.indexOf("-" + HELP_LONG);
            argsList.remove(helpIndex);

            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("Jadex-ABMS", options);
        }

        if (line.hasOption(PROP)) {
            //Remove app specific arguments from total arguments
            int propIndex = argsList.indexOf("-" + PROP);
            if (propIndex == -1)
                propIndex = argsList.indexOf("-" + PROP_LONG);
            argsList.remove(propIndex + 1);
            argsList.remove(propIndex);

            String propertiesLoc = line.getOptionValue(PROP).replace("\\", "/").replace("\\\\", "/");
            prop = new Properties();

            try {
                prop.load(new FileInputStream(propertiesLoc));
                //Parsing options value into local flags------------------------
                if (line.hasOption(MODE)) {
                    String mode = line.getOptionValue(MODE);
                    if (mode.equalsIgnoreCase(CO_ONLY)) {
                        isRunningSC = false;
                    } else if (mode.equalsIgnoreCase(SC_CO)) {
                        //Default value is to run an SC and a CO
                    } else if (mode.equalsIgnoreCase(SC_ONLY)) {
                        isRunningCO = false;
                    } else {
                        throw new ParseException("Wrong argument for -mode.");
                    }

                    //Remove app specific arguments from total arguments
                    int modeIndex = argsList.indexOf("-" + MODE);
                    argsList.remove(modeIndex + 1);
                    argsList.remove(modeIndex);
                }

                if (line.hasOption(FORCED)) {
                    isForced = true;
                    //Remove app specific arguments from total arguments
                    int modeIndex = argsList.indexOf("-" + FORCED);
                    if (modeIndex == -1)
                        modeIndex = argsList.indexOf("-" + FORCED_LONG);
                    argsList.remove(modeIndex);
                }

                if (line.hasOption(GUI)) {
                    String guiMode = line.getOptionValue(GUI);
                    if (!guiMode.equalsIgnoreCase("true") && !guiMode.equalsIgnoreCase("false"))
                        throw new ParseException("Wrong argument for -gui.");
                } else {
                    argsList.add("-" + GUI);
                    int guiIndex = argsList.indexOf("-" + GUI);
                    argsList.add(guiIndex + 1, "false");
                }

                if (line.hasOption(LOG_CONSOLE)) {
                    isLogToConsole = true;
                    //Remove app specific arguments from total arguments
                    int logCIndex = argsList.indexOf("-" + LOG_CONSOLE);
                    argsList.remove(logCIndex);
                }

                if (line.hasOption(LOG_LVL)) {
                    String level = line.getOptionValue(LOG_LVL);
                    if (level.equalsIgnoreCase("INFO")) {
                        logLevel = Level.INFO;
                    } else if (level.equalsIgnoreCase("ALL")) {
                        logLevel = Level.ALL;
                    } else if (level.equalsIgnoreCase("CONFIG")) {
                        logLevel = Level.CONFIG;
                    } else if (level.equalsIgnoreCase("FINE")) {
                        logLevel = Level.FINE;
                    } else if (level.equalsIgnoreCase("FINER")) {
                        logLevel = Level.FINER;
                    } else if (level.equalsIgnoreCase("FINEST")) {
                        logLevel = Level.FINEST;
                    } else if (level.equalsIgnoreCase("OFF")) {
                        logLevel = Level.OFF;
                    } else if (level.equalsIgnoreCase("SEVERE")) {
                        logLevel = Level.SEVERE;
                    } else if (level.equalsIgnoreCase("WARNING")) {
                        logLevel = Level.WARNING;
                    } else {
                        throw new ParseException("argument for loglvl unknown");
                    }
                    //Remove app specific arguments from total arguments
                    int logLvlIndex = argsList.indexOf("-" + LOG_LVL);
                    argsList.remove(logLvlIndex + 1);
                    argsList.remove(logLvlIndex);
                }

                //Setup logger
                try {
                    ABMBDILoggerSetter.initialized(prop, isLogToConsole, logLevel);
                    ABMBDILoggerSetter.setup(LOGGER);
                } catch (IOException e) {
                    e.printStackTrace();
                    LOGGER.severe(e.getMessage());
                    throw new RuntimeException("Problems with creating logfile");
                }

                //Translate argsList into array------------------------------
                String[] newargs = new String[argsList.size()];
                for (int i = 0; i < argsList.size(); i++) {
                    newargs[i] = argsList.get(i);
                }

                //Running the system----------------------------------------
                if (isRunningSC == true) {
                    runSC(prop);
                }

                if (isRunningCO == true) {
                    runCO(prop, newargs, isForced);
                }

            } catch (IOException e) {
                e.printStackTrace();
                LOGGER.severe(e.getMessage());
            }
        } else {
            throw new ParseException("-prop <properties_location> is a required option");
        }

    } catch (ParseException exp) {
        LOGGER.severe("Unexpected exception:" + exp.getMessage());

        //If its not working print out help info
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("Jadex-ABMS", options);
    }
}

From source file:de.mendelson.comm.as2.client.AS2Gui.java

/**
 * Creates new form NewJFrame//from w w w.  ja  va  2s.c  o m
 */
public AS2Gui(Splash splash, String host) {
    this.host = host;
    //Set System default look and feel
    try {
        //support the command line option -Dswing.defaultlaf=...
        if (System.getProperty("swing.defaultlaf") == null) {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
    } catch (Exception e) {
        this.logger.warning(this.getClass().getName() + ":" + e.getMessage());
    }
    //load resource bundle
    try {
        this.rb = (MecResourceBundle) ResourceBundle.getBundle(ResourceBundleAS2Gui.class.getName());
    } catch (MissingResourceException e) {
        throw new RuntimeException("Oops..resource bundle " + e.getClassName() + " not found.");
    }
    initComponents();
    this.jButtonNewVersion.setVisible(false);
    this.jPanelRefreshWarning.setVisible(false);
    //set preference values to the GUI
    this.setBounds(this.clientPreferences.getInt(PreferencesAS2.FRAME_X),
            this.clientPreferences.getInt(PreferencesAS2.FRAME_Y),
            this.clientPreferences.getInt(PreferencesAS2.FRAME_WIDTH),
            this.clientPreferences.getInt(PreferencesAS2.FRAME_HEIGHT));
    //ensure to display all messages
    this.getLogger().setLevel(Level.ALL);
    LogConsolePanel consolePanel = new LogConsolePanel(this.getLogger());
    //define the colors for the log levels
    consolePanel.setColor(Level.SEVERE, LogConsolePanel.COLOR_BROWN);
    consolePanel.setColor(Level.WARNING, LogConsolePanel.COLOR_BLUE);
    consolePanel.setColor(Level.INFO, LogConsolePanel.COLOR_BLACK);
    consolePanel.setColor(Level.CONFIG, LogConsolePanel.COLOR_DARK_GREEN);
    consolePanel.setColor(Level.FINE, LogConsolePanel.COLOR_DARK_GREEN);
    consolePanel.setColor(Level.FINER, LogConsolePanel.COLOR_DARK_GREEN);
    consolePanel.setColor(Level.FINEST, LogConsolePanel.COLOR_DARK_GREEN);
    this.jPanelServerLog.add(consolePanel);
    this.setTitle(AS2ServerVersion.getProductName() + " " + AS2ServerVersion.getVersion());
    //initialize the help system if available
    this.initializeJavaHelp();
    this.jTableMessageOverview.getSelectionModel().addListSelectionListener(this);
    this.jTableMessageOverview.getTableHeader().setReorderingAllowed(false);
    //icon columns
    TableColumn column = this.jTableMessageOverview.getColumnModel().getColumn(0);
    column.setMaxWidth(20);
    column.setResizable(false);
    column = this.jTableMessageOverview.getColumnModel().getColumn(1);
    column.setMaxWidth(20);
    column.setResizable(false);
    this.jTableMessageOverview.setDefaultRenderer(Date.class,
            new TableCellRendererDate(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)));
    //add row sorter
    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(this.jTableMessageOverview.getModel());
    jTableMessageOverview.setRowSorter(sorter);
    sorter.addRowSorterListener(this);
    this.jPanelFilterOverview.setVisible(this.showFilterPanel);
    this.jMenuItemHelpForum.setEnabled(Desktop.isDesktopSupported());
    //destroy splash, possible login screen for the client should come up
    if (splash != null) {
        splash.destroy();
    }
    this.setButtonState();
    this.jTableMessageOverview.addMouseListener(this);
    //popup menu issues
    this.jPopupMenu.setInvoker(this.jScrollPaneMessageOverview);
    this.jPopupMenu.addPopupMenuListener(this);
    super.addMessageProcessor(this);
    //perform the connection to the server
    //warning! this works for localhost only so far
    int clientServerCommPort = this.clientPreferences.getInt(PreferencesAS2.CLIENTSERVER_COMM_PORT);
    if (splash != null) {
        splash.destroy();
    }
    this.browserLinkedPanel.cyleText(new String[] {
            "For additional EDI software to convert and process your data please contact <a href='http://www.mendelson-e-c.com'>mendelson-e-commerce GmbH</a>",
            "To buy a commercial license please visit the <a href='http://shop.mendelson-e-c.com/'>mendelson online shop</a>",
            "Most trading partners demand a trusted certificate - Order yours at the <a href='http://ca.mendelson-e-c.com'>mendelson CA</a> now!",
            "Looking for additional secure data transmission software? Try the <a href='http://oftp2.mendelson-e-c.com'>mendelson OFTP2</a> solution!",
            "You want to send EDIFACT data from your SAP system? Ask <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20SAP%20integration%20solutions'>mendelson-e-commerce GmbH</a> for a solution.",
            "You need a secure FTP solution? <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20SFTP%20solution'>Ask us</a> for the mendelson SFTP software.",
            "Convert flat files, EDIFACT, SAP IDos, VDA, inhouse formats? <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20converter%20solution'>Ask us</a> for the mendelson EDI converter.",
            "For commercial support of this software please buy a license at <a href='http://as2.mendelson-e-c.com'>the mendelson AS2</a> website.",
            "Have a look at the <a href='http://www.mendelson-e-c.com/products_mbi.php'>mendelson business integration</a> for a powerful EDI solution.",
            "The <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20RosettaNet%20solution'>mendelson RosettaNet solution</a> supports RNIF 1.1 and RNIF 2.0.",
            "The <a href='http://www.mendelson-e-c.com/products_ide.php'>mendelson converter IDE</a> is the graphical mapper for the mendelson converter.",
            "To process any XML data and convert it to EDIFACT, VDA, flat files, IDocs and inhouse formats use <a href='http://www.mendelson-e-c.com/products_converter.php'>the mendelson converter</a>.",
            "To transmit your EDI data via HTTP/S please <a href='mailto:info@mendelson.de?subject=Please%20inform%20me%20about%20your%20HTTPS%20solution'>ask us</a> for the mendelson HTTPS solution.",
            "If you have questions regarding this product please refer to the <a href='http://community.mendelson-e-c.com/'>mendelson community</a>.", });
    this.connect(new InetSocketAddress(host, clientServerCommPort), 5000);
    Runnable dailyNewsThread = new Runnable() {

        @Override
        public void run() {
            while (true) {
                long lastUpdateCheck = Long.valueOf(clientPreferences.get(PreferencesAS2.LAST_UPDATE_CHECK));
                //check only once a day even if the system is started n times a day
                if (lastUpdateCheck < (System.currentTimeMillis() - TimeUnit.HOURS.toMillis(23))) {
                    clientPreferences.put(PreferencesAS2.LAST_UPDATE_CHECK,
                            String.valueOf(System.currentTimeMillis()));
                    jButtonNewVersion.setVisible(false);
                    String version = (AS2ServerVersion.getVersion() + " " + AS2ServerVersion.getBuild())
                            .replace(' ', '+');
                    Header[] header = htmlPanel.setURL(
                            "http://www.mendelson.de/en/mecas2/client_welcome.php?version=" + version,
                            AS2ServerVersion.getProductName() + " " + AS2ServerVersion.getVersion(),
                            new File("start/client_welcome.html"));
                    if (header != null) {
                        String downloadURL = null;
                        String actualBuild = null;
                        for (Header singleHeader : header) {
                            if (singleHeader.getName().equals("x-actual-build")) {
                                actualBuild = singleHeader.getValue().trim();
                            }
                            if (singleHeader.getName().equals("x-download-url")) {
                                downloadURL = singleHeader.getValue().trim();
                            }
                        }
                        if (downloadURL != null && actualBuild != null) {
                            try {
                                int thisBuild = AS2ServerVersion.getBuildNo();
                                int availableBuild = Integer.valueOf(actualBuild);
                                if (thisBuild < availableBuild) {
                                    jButtonNewVersion.setVisible(true);
                                }
                                downloadURLNewVersion = downloadURL;
                            } catch (Exception e) {
                                //nop
                            }
                        }
                    }
                } else {
                    htmlPanel.setPage(new File("start/client_welcome.html"));
                }
                try {
                    //check once a day for new update
                    Thread.sleep(TimeUnit.DAYS.toMillis(1));
                } catch (InterruptedException e) {
                    //nop
                }
            }
        }
    };
    Executors.newSingleThreadExecutor().submit(dailyNewsThread);
    this.as2StatusBar.setConnectedHost(this.host);
}

From source file:jenkins.util.SystemProperties.java

/**
 * Determines the integer value of the system property with the
 * specified name, or a default value./*from   w ww. ja  v  a 2s.  c om*/
 *
 * This behaves just like <code>Integer.getInteger(String,Integer)</code>, except that it
 * also consults the <code>ServletContext</code>'s "init" parameters. If neither exist,
 * return the default value.
 *
 * @param   name property name.
 * @param   def   a default value.
 * @return  the {@code Integer} value of the property.
 *          If the property is missing, return the default value.
 *          Result may be {@code null} only if the default value is {@code null}.
 */
public static Integer getInteger(String name, Integer def) {
    return getInteger(name, def, Level.CONFIG);
}

From source file:org.b3log.latke.repository.Repositories.java

/**
 * Loads repository description./*from   ww  w.j a  va  2 s  .c om*/
 */
private static void loadRepositoryDescription() {
    LOGGER.log(Level.INFO, "Loading repository description....");

    final InputStream inputStream = AbstractRepository.class.getClassLoader()
            .getResourceAsStream("repository.json");

    if (null == inputStream) {
        LOGGER.log(Level.INFO, "Not found repository description[repository.json] file under classpath");
        return;
    }

    LOGGER.log(Level.INFO, "Parsing repository description....");

    try {
        final String description = IOUtils.toString(inputStream);

        LOGGER.log(Level.CONFIG, "{0}{1}", new Object[] { Strings.LINE_SEPARATOR, description });

        repositoriesDescription = new JSONObject(description);

        // Repository name prefix
        final String tableNamePrefix = StringUtils.isNotBlank(Latkes.getLocalProperty("jdbc.tablePrefix"))
                ? Latkes.getLocalProperty("jdbc.tablePrefix") + "_"
                : "";

        final JSONArray repositories = repositoriesDescription.optJSONArray("repositories");

        for (int i = 0; i < repositories.length(); i++) {
            final JSONObject repository = repositories.optJSONObject(i);

            repository.put("name", tableNamePrefix + repository.optString("name"));
        }
    } catch (final Exception e) {
        LOGGER.log(Level.SEVERE, "Parses repository description failed", e);
    } finally {
        try {
            inputStream.close();
        } catch (final IOException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            throw new RuntimeException(e);
        }
    }
}

From source file:com.willwinder.universalgcodesender.GrblController.java

@Override
protected void rawResponseHandler(String response) {
    String processed = response;//from www.j  a v  a 2  s.  c  om
    try {
        boolean verbose = false;

        if (GrblUtils.isOkResponse(response)) {
            this.commandComplete(processed);
        }

        // Error case.
        else if (GrblUtils.isOkErrorAlarmResponse(response)) {
            if (GrblUtils.isAlarmResponse(response)) {
                //this is not updating the state to Alarm in the GUI, and the alarm is no longer being processed
                // TODO: Find a builder library.
                String stateString = lookupCode(response, true);
                this.controllerStatus = new ControllerStatus(stateString, ControllerState.ALARM,
                        this.controllerStatus.getMachineCoord(), this.controllerStatus.getWorkCoord(),
                        this.controllerStatus.getFeedSpeed(), this.controllerStatus.getFeedSpeedUnits(),
                        this.controllerStatus.getSpindleSpeed(), this.controllerStatus.getOverrides(),
                        this.controllerStatus.getWorkCoordinateOffset(), this.controllerStatus.getEnabledPins(),
                        this.controllerStatus.getAccessoryStates());

                Alarm alarm = GrblUtils.parseAlarmResponse(response);
                dispatchAlarm(alarm);
                dispatchStatusString(this.controllerStatus);
                dispatchStateChange(COMM_IDLE);
            }

            // If there is an active command, mark it as completed with error
            Optional<GcodeCommand> activeCommand = this.getActiveCommand();
            if (activeCommand.isPresent()) {
                processed = String
                        .format(Localization.getString("controller.exception.sendError"),
                                activeCommand.get().getCommandString(), lookupCode(response, false))
                        .replaceAll("\\.\\.", "\\.");
                this.dispatchConsoleMessage(MessageType.ERROR, processed + "\n");
                this.commandComplete(processed);
            } else {
                processed = String.format(Localization.getString("controller.exception.unexpectedError"),
                        lookupCode(response, false)).replaceAll("\\.\\.", "\\.");
                dispatchConsoleMessage(MessageType.INFO, processed + "\n");
            }
            checkStreamFinished();
            processed = "";
        }

        else if (GrblUtils.isGrblVersionString(response)) {
            this.isReady = true;
            resetBuffers();

            // When exiting COMM_CHECK mode a soft reset is done, do not clear the
            // controller status because we need to know the previous state for resetting
            // single step mode
            if (getControlState() != COMM_CHECK) {
                this.controllerStatus = null;
            }

            this.stopPollingPosition();
            positionPollTimer = createPositionPollTimer();
            this.beginPollingPosition();

            // In case a reset occurred while streaming.
            if (this.isStreaming()) {
                checkStreamFinished();
            }

            this.grblVersion = GrblUtils.getVersionDouble(response);
            this.grblVersionLetter = GrblUtils.getVersionLetter(response);

            this.capabilities = GrblUtils.getGrblStatusCapabilities(this.grblVersion, this.grblVersionLetter);
            try {
                this.sendCommandImmediately(createCommand(GrblUtils.GRBL_VIEW_SETTINGS_COMMAND));
                this.sendCommandImmediately(createCommand(GrblUtils.GRBL_VIEW_PARSER_STATE_COMMAND));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }

            Logger.getLogger(GrblController.class.getName()).log(Level.CONFIG, "{0} = {1}{2}",
                    new Object[] { Localization.getString("controller.log.version"), this.grblVersion,
                            this.grblVersionLetter });
            Logger.getLogger(GrblController.class.getName()).log(Level.CONFIG, "{0} = {1}",
                    new Object[] { Localization.getString("controller.log.realtime"),
                            this.capabilities.hasCapability(GrblCapabilitiesConstants.REAL_TIME) });
        }

        else if (GrblUtils.isGrblProbeMessage(response)) {
            Position p = GrblUtils.parseProbePosition(response, getFirmwareSettings().getReportingUnits());
            if (p != null) {
                dispatchProbeCoordinates(p);
            }
        }

        else if (GrblUtils.isGrblStatusString(response)) {
            // Only 1 poll is sent at a time so don't decrement, reset to zero.
            this.outstandingPolls = 0;

            // Status string goes to verbose console
            verbose = true;

            this.handleStatusString(response);
            this.checkStreamFinished();
        }

        else if (GrblUtils.isGrblFeedbackMessage(response, capabilities)) {
            GrblFeedbackMessage grblFeedbackMessage = new GrblFeedbackMessage(response);
            // Convert feedback message to raw commands to update modal state.
            this.updateParserModalState(
                    new GcodeCommand(GrblUtils.parseFeedbackMessage(response, capabilities)));
            this.dispatchConsoleMessage(MessageType.VERBOSE, grblFeedbackMessage.toString() + "\n");
            setDistanceModeCode(grblFeedbackMessage.getDistanceMode());
            setUnitsCode(grblFeedbackMessage.getUnits());
            dispatchStateChange(COMM_IDLE);
        }

        else if (GrblUtils.isGrblSettingMessage(response)) {
            GrblSettingMessage message = new GrblSettingMessage(response);
            processed = message.toString();
        }

        if (StringUtils.isNotBlank(processed)) {
            if (verbose) {
                this.dispatchConsoleMessage(MessageType.VERBOSE, processed + "\n");
            } else {
                this.dispatchConsoleMessage(MessageType.INFO, processed + "\n");
            }
        }
    } catch (Exception e) {
        String message = "";
        if (e.getMessage() != null) {
            message = ": " + e.getMessage();
        }
        message = Localization.getString("controller.error.response") + " <" + processed + ">" + message;

        logger.log(Level.SEVERE, message, e);
        this.dispatchConsoleMessage(MessageType.ERROR, message + "\n");
    }
}

From source file:diet.gridr.g5k.gui.ClusterInfoPanel.java

/**
 * Method returning the JComboBox for the selection of the chart
 *
 * @return a JComboBox allowing the user to selected the chat he wants
 *//*  w w  w . jav  a 2 s.co m*/
private JComboBox getSelectionComboBox() {
    if (selectionComboBox == null) {
        ArrayList<String> listOfCharts = new ArrayList<String>();
        listOfCharts.add("Pie Chart");
        listOfCharts.add("Spider Chart");
        listOfCharts.add("Pie Chart 3D");
        selectionComboBox = new JComboBox(listOfCharts.toArray(new String[0]));
        selectionComboBox.addActionListener(new ActionListener() {
            /* (non-Javadoc)
             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
             */
            public void actionPerformed(ActionEvent e) {
                String selectionChartType = (String) selectionComboBox.getSelectedItem();
                LoggingManager.log(Level.CONFIG, LoggingManager.RESOURCESTOOL, this.getClass().getName(),
                        "actionPerformed", "Selected Chart is : " + selectionChartType);
                carder.show(cardPanel, selectionChartType);
            }
        });
    }
    return selectionComboBox;
}

From source file:org.adempiere.webui.install.WTranslationDialog.java

private void processUploadMedia(Media media) throws AdempiereException {
    if (media == null)
        return;/*from w  w w  .j  a  v  a 2s . c  o m*/

    InputStream istream;
    if (media.isBinary()) {
        istream = media.getStreamData();
    } else {
        istream = new ReaderInputStream(media.getReaderData());
    }

    if (log.isLoggable(Level.CONFIG))
        log.config(media.getName());

    unZipAndProcess(istream);
}

From source file:com.google.enterprise.connector.sharepoint.client.SiteDataHelper.java

/**
 * Gets the collection of all the lists on the sharepoint server which are of
 * a given type. E.g., DocumentLibrary/*from w w  w . ja v  a2 s.c  om*/
 *
 * @param webstate The web from which the list/libraries are to be discovered
 * @return list of BaseList objects.
 */
public List<ListState> getNamedLists(final WebState webstate) {
    final ArrayList<ListState> listCollection = new ArrayList<ListState>();
    if (webstate == null) {
        LOGGER.warning("Unable to get the list collection because webstate is null");
        return listCollection;
    }

    final ArrayOf_sListHolder vLists = Util.makeWSRequest(sharepointClientContext, siteDataWS,
            new Util.RequestExecutor<ArrayOf_sListHolder>() {
                public ArrayOf_sListHolder onRequest(final BaseWS ws) throws Throwable {
                    return ((SiteDataWS) ws).getListCollection();
                }

                public void onError(final Throwable e) {
                    LOGGER.log(Level.WARNING, "Call to getListCollection failed.", e);
                }
            });
    if (vLists == null) {
        LOGGER.log(Level.WARNING, "Unable to get the list collection");
        return listCollection;
    }

    final Collator collator = Util.getCollator();

    try {
        final _sList[] sl = vLists.value;

        if (sl != null) {
            webstate.setExisting(true);
            for (_sList element : sl) {
                String url = null;
                String strBaseTemplate = null;

                if (element == null) {
                    continue;
                }

                final String baseType = element.getBaseType();
                LOGGER.log(Level.FINE, "Base Type returned by the Web Service : " + baseType);
                if (!collator.equals(baseType, (SPConstants.DISCUSSION_BOARD))
                        && !collator.equals(baseType, (SPConstants.DOC_LIB))
                        && !collator.equals(baseType, (SPConstants.GENERIC_LIST))
                        && !collator.equals(baseType, (SPConstants.ISSUE))
                        && !collator.equals(baseType, (SPConstants.SURVEYS))) {
                    LOGGER.log(Level.WARNING, "Skipping List [{0}] with unsupported base type [{1}]",
                            new Object[] { element.getTitle(), baseType });
                    continue;
                }
                MessageElement listMetadata = getListMetadata(element.getInternalName());
                if (listMetadata == null) {
                    LOGGER.log(Level.WARNING, "Unable to get metadata for List [{0}]. Skipping List",
                            element.getTitle());
                    continue;
                }
                String rootFolder = getMetadataAttributeForList(listMetadata, "RootFolder");
                if (Strings.isNullOrEmpty(rootFolder)) {
                    LOGGER.log(Level.WARNING, "Unable to get Root Folder for List [{0}]. Skipping List",
                            element.getTitle());
                    continue;
                }
                String defaultViewItemUrl = getMetadataAttributeForList(listMetadata, "DefaultViewItemUrl");
                if (Strings.isNullOrEmpty(defaultViewItemUrl)) {
                    LOGGER.log(Level.WARNING,
                            "Unable to get default View Item Url " + "for List [{0}]. Skipping List",
                            element.getTitle());
                    continue;
                }
                LOGGER.log(Level.FINE, "List [{0}] Root Folder [{1}] Default View Item URL [{2}]",
                        new Object[] { element.getTitle(), rootFolder, defaultViewItemUrl });
                String siteUrl = sharepointClientContext.getSiteURL();
                if (Strings.isNullOrEmpty(element.getDefaultViewUrl())) {
                    LOGGER.log(Level.WARNING,
                            "List [{0}] with empty default view URL." + " Using root folder for List URL.",
                            element.getTitle());
                    StringBuilder listUrl = new StringBuilder(siteUrl);
                    if (!siteUrl.endsWith("/")) {
                        listUrl.append("/");
                    }
                    listUrl.append(rootFolder);
                    url = listUrl.toString();
                } else {
                    url = Util.getWebApp(sharepointClientContext.getSiteURL()) + element.getDefaultViewUrl();
                }

                LOGGER.log(Level.INFO, "List url for List [{0}] is [{1}]",
                        new Object[] { element.getTitle(), url });

                strBaseTemplate = element.getBaseTemplate();
                if (strBaseTemplate == null) {
                    strBaseTemplate = SPConstants.NO_TEMPLATE;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_SLIDELIBRARY)) {// for
                    // SlideLibrary
                    strBaseTemplate = SPConstants.BT_SLIDELIBRARY;
                } else if (collator.equals(strBaseTemplate,
                        SPConstants.ORIGINAL_BT_TRANSLATIONMANAGEMENTLIBRARY)) {// for
                    // TranslationManagementLibrary
                    strBaseTemplate = SPConstants.BT_TRANSLATIONMANAGEMENTLIBRARY;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_TRANSLATOR)) {// for
                    // Translator
                    strBaseTemplate = SPConstants.BT_TRANSLATOR;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_REPORTLIBRARY)) {// for
                    // ReportLibrary
                    strBaseTemplate = SPConstants.BT_REPORTLIBRARY;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_PROJECTTASK)) {// for
                    // ReportLibrary
                    strBaseTemplate = SPConstants.BT_PROJECTTASK;
                } else if (collator.equals(strBaseTemplate, SPConstants.ORIGINAL_BT_SITESLIST)) {// for
                    // ReportLibrary
                    strBaseTemplate = SPConstants.BT_SITESLIST;
                } else {
                    // for FormLibrary
                    for (String formTemplate : sharepointClientContext.getInfoPathBaseTemplate()) {
                        if (collator.equals(strBaseTemplate, formTemplate)) {
                            strBaseTemplate = SPConstants.BT_FORMLIBRARY;
                            break;
                        }
                    }
                }

                LOGGER.config("List URL :" + url);

                // Children of all URLs are discovered
                ListState list = new ListState(element.getInternalName(), element.getTitle(),
                        element.getBaseType(), Util.siteDataStringToCalendar(element.getLastModified()),
                        strBaseTemplate, url, webstate);

                list.setInheritedSecurity(element.isInheritedSecurity());
                list.setApplyReadSecurity(element.getReadSecurity() == 2);

                String myNewListConst = "";
                LOGGER.log(Level.FINE, "getting listConst for list URL [{0}]", defaultViewItemUrl);
                if (defaultViewItemUrl != null) {
                    final StringTokenizer strTokList = new StringTokenizer(defaultViewItemUrl,
                            SPConstants.SLASH);
                    if (null != strTokList) {
                        while ((strTokList.hasMoreTokens()) && (strTokList.countTokens() > 1)) {
                            final String listToken = strTokList.nextToken();
                            if (list.isDocumentLibrary() && listToken.equals(SPConstants.FORMS_LIST_URL_SUFFIX)
                                    && (strTokList.countTokens() == 1)) {
                                break;
                            }
                            if (null != listToken) {
                                myNewListConst += listToken + SPConstants.SLASH;
                            }
                        }
                        list.setListConst(myNewListConst);
                        LOGGER.log(Level.CONFIG, "using listConst [ " + myNewListConst + " ] for list URL [ "
                                + defaultViewItemUrl + " ] ");

                        // Apply the URL filter here

                        // check if the entire list subtree is to excluded
                        // by comparing the prefix of the list URL with the
                        // patterns
                        if (sharepointClientContext
                                .isIncludedUrl(webstate.getWebUrl() + SPConstants.SLASH + myNewListConst)) {
                            // is included check if actual list url itself
                            // is to be excluded
                            if (sharepointClientContext.isIncludedUrl(url, LOGGER)) {
                                // if a List URL is included, it WILL be
                                // sent as a
                                // Document
                                list.setSendListAsDocument(true);
                            } else {
                                // if a List URL is EXCLUDED, it will NOT be
                                // sent as a
                                // Document
                                list.setSendListAsDocument(false);
                            }
                            // add the attribute(Metadata to the list )
                            list = getListWithAllAttributes(list, element);

                            listCollection.add(list);
                        } else {
                            // entire subtree is to be excluded
                            // do not construct list state
                            LOGGER.finest("Excluding " + url + " because entire subtree of " + myNewListConst
                                    + " is excluded");
                        }
                    }
                }

                // Sort the base list
                Collections.sort(listCollection);
            }
        }
    } catch (final Throwable e) {
        LOGGER.log(Level.FINER, e.getMessage(), e);
    }

    if (listCollection.size() > 0) {
        LOGGER.info("Discovered " + listCollection.size() + " lists/libraries under site [ " + webstate
                + " ] for crawling");
    } else {
        LOGGER.config("No lists/libraries to crawl under site [ " + webstate + " ]");
    }
    return listCollection;
}

From source file:jenkins.util.SystemProperties.java

/**
 * Determines the integer value of the system property with the
 * specified name, or a default value.//from   w w w .jav a  2s .c om
 *
 * This behaves just like <code>Long.getLong(String,Long)</code>, except that it
 * also consults the <code>ServletContext</code>'s "init" parameters. If neither exist,
 * return the default value.
 *
 * @param   name property name.
 * @param   def   a default value.
 * @return  the {@code Long} value of the property.
 *          If the property is missing, return the default value.
 *          Result may be {@code null} only if the default value is {@code null}.
 */
public static Long getLong(String name, Long def) {
    return getLong(name, def, Level.CONFIG);
}