com.izforge.izpack.util.os
Class Unix_Shortcut

java.lang.Object
  extended bycom.izforge.izpack.util.os.Shortcut
      extended bycom.izforge.izpack.util.os.Unix_Shortcut
All Implemented Interfaces:
Unix_ShortcutConstants

public class Unix_Shortcut
extends Shortcut
implements Unix_ShortcutConstants

Author:
marc.eppelmann This is the Implementaion of the RFC-Based Desktop-Link. Used in KDE and GNOME.

Field Summary
private static java.lang.String C
          C = Comment = H+S = "# "
private  java.lang.String createdDirectory
           
private static java.lang.String DESKTOP_EXT
          DESKTOP_EXT = ".desktop"
private static java.lang.String H
          H = "#"
private  java.lang.String itsApplnkFolder
           
private  java.lang.String itsArguments
           
private  java.lang.String itsDescription
           
private  java.lang.String itsFileName
           
private  java.lang.String itsGroupName
           
private  int itsIconIndex
           
private  java.lang.String itsIconPath
           
private  java.lang.String itsName
           
private  int itsShow
           
private  java.lang.String itsTargetPath
           
private  int itsType
           
private  int itsUserType
           
private  java.lang.String itsWorkingDirectory
           
private static java.lang.String N
          N = "\n"
private  java.util.Properties props
           
private static java.lang.String rev
           
private static java.lang.String S
          S = " "
private static java.lang.String template
           
private static java.lang.String version
           
 
Fields inherited from class com.izforge.izpack.util.os.Shortcut
ALL_USERS, APPLICATIONS, CURRENT_USER, DESKTOP, HIDE, MAXIMIZED, MINIMIZED, NORMAL, START_MENU, START_UP
 
Fields inherited from interface com.izforge.izpack.util.os.Unix_ShortcutConstants
$$LANG_Comment, $$LANG_GenericName, $$LANG_Name, $Arguments, $Comment, $Encoding, $Exec, $GenericName, $Icon, $MimeType, $Name, $Options_For_Terminal, $Path, $ServiceTypes, $SwallowExec, $SwallowTitle, $Terminal, $Type, $URL, $X_KDE_SubstituteUID, $X_KDE_Username
 
Constructor Summary
Unix_Shortcut()
           
 
Method Summary
 java.lang.String getDirectoryCreated()
          Dummy
 java.lang.String getFileName()
          Dummy
 java.util.Vector getProgramGroups(int userType)
          Overridden Compatibility Method.
 void initialize(int aType, java.lang.String aName)
          Overridden Method
private  void initProps()
          This initialisizes all Properties Values with null.
static void main(java.lang.String[] args)
          Test Method
 boolean multipleUsers()
          overridden method
 java.lang.String replace()
          Creates the Shortcut String which will be stored as File.
 void save()
          Creates and stores the shortcut-files.
 void setArguments(java.lang.String args)
          Set the Commandline Arguments
 void setDescription(java.lang.String description)
          Sets the Description
 void setEncoding(java.lang.String aEncoding)
          Sets The Encoding
 void setIconLocation(java.lang.String path, int index)
          Sets The Icon Path
 void setKdeSubstUID(java.lang.String aKDESubstUID)
          Sets The KDE Specific subst UID property
 void setLinkName(java.lang.String aName)
          Sets the Name of this Shortcut
 void setLinkType(int aType)
          Sets the type of this Shortcut
 void setMimetype(java.lang.String aMimetype)
          Sets the MimeType
 void setProgramGroup(java.lang.String aGroupName)
          Sets the ProgramGroup
 void setShowCommand(int show)
          Sets the ShowMode
 void setTargetPath(java.lang.String aPath)
          Sets The TargetPath
 void setTerminal(java.lang.String trueFalseOrNothing)
          Sets the terminal
 void setTerminalOptions(java.lang.String someTerminalOptions)
          Sets the terminal options
 void setType(java.lang.String aType)
          Sets the Shortcut type (one of Application, Link or Device)
 void setURL(java.lang.String anUrl)
          Sets the Url for type Link.
 void setUserType(int aUserType)
          Sets the usertype.
 void setWorkingDirectory(java.lang.String aDirectory)
          Sets the working-directory
 boolean supported()
          This indicates that Unix will be supported.
 java.lang.String toString()
          Dumps the Name to console.
 
Methods inherited from class com.izforge.izpack.util.os.Shortcut
getBasePath, getHotkey, getIconLocation, getLinkType, getShowCommand, getUserType, getWorkingDirectory, setHotkey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

version

private static java.lang.String version

rev

private static java.lang.String rev

createdDirectory

private java.lang.String createdDirectory

DESKTOP_EXT

private static java.lang.String DESKTOP_EXT
DESKTOP_EXT = ".desktop"


itsShow

private int itsShow

itsUserType

private int itsUserType

itsType

private int itsType

itsIconIndex

private int itsIconIndex

itsWorkingDirectory

private java.lang.String itsWorkingDirectory

itsGroupName

private java.lang.String itsGroupName

itsTargetPath

private java.lang.String itsTargetPath

itsIconPath

private java.lang.String itsIconPath

itsDescription

private java.lang.String itsDescription

itsArguments

private java.lang.String itsArguments

itsName

private java.lang.String itsName

itsFileName

private java.lang.String itsFileName

itsApplnkFolder

private java.lang.String itsApplnkFolder

template

private static java.lang.String template

props

private java.util.Properties props

N

private static final java.lang.String N
N = "\n"

See Also:
Constant Field Values

H

private static final java.lang.String H
H = "#"

See Also:
Constant Field Values

S

private static final java.lang.String S
S = " "

See Also:
Constant Field Values

C

private static final java.lang.String C
C = Comment = H+S = "# "

See Also:
Constant Field Values
Constructor Detail

Unix_Shortcut

public Unix_Shortcut()
Method Detail

initProps

private void initProps()
This initialisizes all Properties Values with null.


initialize

public void initialize(int aType,
                       java.lang.String aName)
                throws java.lang.Exception
Overridden Method

Overrides:
initialize in class Shortcut
Parameters:
aType - the type or classification of the program group in which the link should exist.
aName - the name of the shortcut.
Throws:
java.lang.Exception
See Also:
Shortcut.initialize(int, java.lang.String)

supported

public boolean supported()
This indicates that Unix will be supported.

Overrides:
supported in class Shortcut
Returns:
true if the creation of shortcuts is supported, flase if this is not supported.
See Also:
Shortcut.supported()

getDirectoryCreated

public java.lang.String getDirectoryCreated()
Dummy

Overrides:
getDirectoryCreated in class Shortcut
Returns:
this implementation returns always null.
See Also:
Shortcut.getDirectoryCreated()

getFileName

public java.lang.String getFileName()
Dummy

Overrides:
getFileName in class Shortcut
Returns:
an empty String
See Also:
Shortcut.getFileName()

getProgramGroups

public java.util.Vector getProgramGroups(int userType)
Overridden Compatibility Method. returns all directories in $USER/.kde/share/applink

Overrides:
getProgramGroups in class Shortcut
Parameters:
userType - the type of user for the program group set.
Returns:
a Vector of String objects that represent the names of the existing program groups. It is theoretically possible that this list is empty.
See Also:
Shortcut.getProgramGroups(int)

multipleUsers

public boolean multipleUsers()
overridden method

Overrides:
multipleUsers in class Shortcut
Returns:
true
See Also:
Shortcut.multipleUsers()

save

public void save()
          throws java.lang.Exception
Creates and stores the shortcut-files.

Overrides:
save in class Shortcut
Throws:
java.lang.Exception - if problems are encountered
See Also:
Shortcut.save()

setArguments

public void setArguments(java.lang.String args)
Set the Commandline Arguments

Overrides:
setArguments in class Shortcut
Parameters:
args - the command line arguments
See Also:
Shortcut.setArguments(java.lang.String)

setDescription

public void setDescription(java.lang.String description)
Sets the Description

Overrides:
setDescription in class Shortcut
Parameters:
description - the descriptiojn string
See Also:
Shortcut.setDescription(java.lang.String)

setIconLocation

public void setIconLocation(java.lang.String path,
                            int index)
Sets The Icon Path

Overrides:
setIconLocation in class Shortcut
Parameters:
path - a fully qualified file name of a file that contains the icon.
index - the index of the specific icon to use in the file. If there is only one icon in the file, use an index of 0.
See Also:
Shortcut.setIconLocation(java.lang.String, int)

setLinkName

public void setLinkName(java.lang.String aName)
Sets the Name of this Shortcut

Overrides:
setLinkName in class Shortcut
Parameters:
aName - The name that the link should display on a menu or on the desktop. Do not include a file extension.
See Also:
Shortcut.setLinkName(java.lang.String)

setLinkType

public void setLinkType(int aType)
                 throws java.lang.IllegalArgumentException
Sets the type of this Shortcut

Overrides:
setLinkType in class Shortcut
Parameters:
aType - The type of link desired. The following values can be set:
Throws:
java.lang.IllegalArgumentException - if an an invalid type is passed
See Also:
Shortcut.setLinkType(int)

setProgramGroup

public void setProgramGroup(java.lang.String aGroupName)
Sets the ProgramGroup

Overrides:
setProgramGroup in class Shortcut
Parameters:
aGroupName - the name of the program group
See Also:
Shortcut.setProgramGroup(java.lang.String)

setShowCommand

public void setShowCommand(int show)
Sets the ShowMode

Overrides:
setShowCommand in class Shortcut
Parameters:
show - the show command. Valid settings are:
See Also:
Shortcut.setShowCommand(int)

setTargetPath

public void setTargetPath(java.lang.String aPath)
Sets The TargetPath

Overrides:
setTargetPath in class Shortcut
Parameters:
aPath - the fully qualified file name of the target
See Also:
Shortcut.setTargetPath(java.lang.String)

setUserType

public void setUserType(int aUserType)
Sets the usertype.

Overrides:
setUserType in class Shortcut
Parameters:
aUserType - the type of user for the link.
See Also:
Shortcut.setUserType(int)

setWorkingDirectory

public void setWorkingDirectory(java.lang.String aDirectory)
Sets the working-directory

Overrides:
setWorkingDirectory in class Shortcut
Parameters:
aDirectory - the working directory
See Also:
Shortcut.setWorkingDirectory(java.lang.String)

toString

public java.lang.String toString()
Dumps the Name to console.

See Also:
Object.toString()

replace

public java.lang.String replace()
Creates the Shortcut String which will be stored as File.

Returns:

main

public static void main(java.lang.String[] args)
Test Method


setEncoding

public void setEncoding(java.lang.String aEncoding)
Sets The Encoding

Overrides:
setEncoding in class Shortcut
Parameters:
aEncoding -
See Also:
Shortcut.setEncoding(java.lang.String)

setKdeSubstUID

public void setKdeSubstUID(java.lang.String aKDESubstUID)
Sets The KDE Specific subst UID property

Overrides:
setKdeSubstUID in class Shortcut
Parameters:
aKDESubstUID -
See Also:
Shortcut.setKdeSubstUID(java.lang.String)

setMimetype

public void setMimetype(java.lang.String aMimetype)
Sets the MimeType

Overrides:
setMimetype in class Shortcut
Parameters:
aMimetype -
See Also:
Shortcut.setMimetype(java.lang.String)

setTerminal

public void setTerminal(java.lang.String trueFalseOrNothing)
Sets the terminal

Overrides:
setTerminal in class Shortcut
Parameters:
trueFalseOrNothing -
See Also:
Shortcut.setTerminal(java.lang.String)

setTerminalOptions

public void setTerminalOptions(java.lang.String someTerminalOptions)
Sets the terminal options

Overrides:
setTerminalOptions in class Shortcut
Parameters:
someTerminalOptions -
See Also:
Shortcut.setTerminalOptions(java.lang.String)

setType

public void setType(java.lang.String aType)
Sets the Shortcut type (one of Application, Link or Device)

Overrides:
setType in class Shortcut
Parameters:
aType -
See Also:
Shortcut.setType(java.lang.String)

setURL

public void setURL(java.lang.String anUrl)
Sets the Url for type Link. Can be also a apsolute file/path

Overrides:
setURL in class Shortcut
Parameters:
anUrl -
See Also:
Shortcut.setURL(java.lang.String)