Example usage for org.apache.commons.lang3 SystemUtils USER_NAME

List of usage examples for org.apache.commons.lang3 SystemUtils USER_NAME

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SystemUtils USER_NAME.

Prototype

String USER_NAME

To view the source code for org.apache.commons.lang3 SystemUtils USER_NAME.

Click Source Link

Document

The user.name System Property.

Usage

From source file:com.gs.obevo.util.LogUtil.java

public static FileLogger getLogAppender(String commandName) {
    // append the user name to the temp directory to 1) avoid conflicts in user folder  2) make it clearer who owned the directory
    String userNameSuffix = SystemUtils.USER_NAME != null ? "-" + SystemUtils.USER_NAME : "";
    File workDir;/*from ww  w .  j a  va2  s  . c om*/
    try {
        workDir = Files.createTempDirectory("obevo" + userNameSuffix).toFile();
    } catch (IOException e) {
        // fall back to old logic just in case the above fails (as of v6.1.0)
        workDir = new File(FileUtils.getTempDirectory(), ".obevo" + userNameSuffix);
    }
    final String logFileName = "obevo-" + commandName + "-" + LOG_NAME_TIME_FORMAT.print(new DateTime())
            + ".log";

    return LogUtil.configureLogging(workDir, logFileName);
}

From source file:org.kalypso.model.hydrology.binding.control.NAControl.java

public NAControl(final Object parent, final IRelationType parentRelation, final IFeatureType ft,
        final String id, final Object[] propValues) {
    super(parent, parentRelation, ft, id, propValues);

    /* Initialize with some default values */
    setCreationTime(new Date());
    setEditor(SystemUtils.USER_NAME);
    adjustDescription();/*from   ww w  . j  a  va  2  s.co m*/
}

From source file:org.kalypso.model.wspm.pdb.ui.internal.tin.exports.PdbExportConnectionChooserData.java

private IStatus updateData(final IPdbConnection connection) {
    setDbCoordinateSystem(null);/*  ww w . j a v  a2 s .c o  m*/
    setDemServerPath(null);
    setDhmIndex(null);

    if (connection == null)
        return Status.OK_STATUS;

    Session session = null;
    try {
        session = connection.openSession();

        final PdbInfo info = new PdbInfo(session);
        final int srid = info.getSRID();
        final IPath demServerPath = info.getDemServerPath();
        final DhmIndex dhmIndex = findDhmIndex(GetPdbList.getList(session, DhmIndex.class));

        session.close();

        final String sourceSRS = m_data.getSourceSRS();
        dhmIndex.setMimeType(findMimeType());
        dhmIndex.setEditingDate(new Date());
        dhmIndex.setEditingUser(SystemUtils.USER_NAME);
        dhmIndex.setSrid(String.format("%d", JTSAdapter.toSrid(sourceSRS))); //$NON-NLS-1$
        dhmIndex.setLocation(findLocation(srid));

        setDbCoordinateSystem(JTSAdapter.toSrs(srid));
        setDemServerPath(demServerPath);
        setDhmIndex(dhmIndex);

        return Status.OK_STATUS;
    } catch (final CoreException e) {
        return e.getStatus();
    } catch (final PdbConnectException ex) {
        return new Status(IStatus.ERROR, WspmPdbUiPlugin.PLUGIN_ID,
                Messages.getString("PdbExportConnectionChooserData_1"), ex); //$NON-NLS-1$
    } finally {
        PdbUtils.closeSessionQuietly(session);
    }
}