public abstract class MXSession
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
adminLogout |
protected java.lang.String |
baseCurrency |
protected java.lang.String |
clientAddr |
protected java.lang.String |
clientHost |
protected boolean |
connected |
protected java.lang.Object |
credential |
protected java.lang.String |
hostname |
protected boolean |
interactive |
protected java.lang.String |
langCode |
protected java.util.Locale |
locale |
protected java.lang.String |
password |
protected MXServerRemote |
remoteServer |
protected java.lang.String |
servername |
protected java.util.TimeZone |
timeZone |
protected java.lang.String |
username
This corresponds to the maxuser.loginid
|
Modifier | Constructor and Description |
---|---|
protected |
MXSession()
Protected so cannot be called.
|
Modifier and Type | Method and Description |
---|---|
void |
addMXSessionListener(MXSessionListener l)
Register to get MXSession events from this object.
|
abstract void |
connect()
Connects to the server using the approprate protocol.
|
void |
connectAsRegUser(java.lang.String forUser)
Connect to server as the user for self-registration.
|
abstract void |
disconnect()
Disconnects from the server.
|
java.lang.String |
getBaseCurrency()
returns the base Currency.
|
abstract int |
getBranding() |
java.lang.String |
getClientAddr()
Returns the client address.
|
java.lang.String |
getClientHost()
Returns the client host.
|
java.lang.Object |
getCredential()
Get the authentication credential.
|
java.util.Date |
getDate()
Gets the current date from the server.
|
java.lang.String |
getForUser()
Get the tenant code set to the session.
|
java.lang.String |
getHost()
Returns the current hostname.
|
abstract java.lang.String[][] |
getLanguageList()
Returns the language ID and name in corresponding language
|
java.util.Locale |
getLocale()
Returns the locale of the current user.
|
abstract MboSetRemote |
getMboSet(java.lang.String name)
Returns an empty MboSetRemote for the specified type of business object.
|
abstract java.lang.String |
getMessage(MXException mxe)
Returns message for the exception
|
abstract java.lang.String |
getMessage(java.lang.String group,
java.lang.String key)
Returns the message for group and key for the mxsession langcode
|
abstract java.lang.String[] |
getMessages(java.lang.String group,
java.lang.String[] key)
Return list of translated strings from the maxmessages table in the order specified by the array of keys passed
for the mxsession langcode
|
abstract MXServerRemote |
getMXServerRemote()
Return the MXServer remote interface.
|
static MXSession |
getNewSession()
Creates a new session and returns it.
|
byte[] |
getPassword(byte[] param)
Returns the password of the current user.
|
abstract ProfileRemote |
getProfile()
Return the user's security profile.
|
abstract java.lang.String |
getProperty(java.lang.String propName)
Returns value of a non-secure property.
|
java.lang.String |
getServer()
Returns the current MXServer name.
|
static MXSession |
getSession()
Returns a reference to the session object.
|
abstract java.lang.String |
getTaggedMessage(MXException mxe)
Returns message with MessageID tagged for the exception
|
java.lang.String |
getTenant()
Get the tenant code set to the session.
|
java.util.TimeZone |
getTimeZone()
Returns the time zone for this user.
|
java.lang.String |
getURLAsString()
Return the URL of the host and server name as a string
|
UserInfo |
getUserInfo()
Returns the userinfo object.
|
java.lang.String |
getUserName()
Returns the current Login ID (not the userid).
|
boolean |
hasAdminLogout()
Sets the adminLogout flag to true if the session is marked for adminlogout in maxsession.
|
boolean |
isConnected()
Specifies whether the session is currently connected to a server.
|
abstract ServiceRemote |
lookup(java.lang.String name)
Returns the specified remote service.
|
void |
removeMXSessionListener(MXSessionListener l)
Unregister a listener for events
|
void |
setClientAddr(java.lang.String cAddr)
Set the client address (servlet request's getRemoteAddr).
|
void |
setClientHost(java.lang.String cHost)
Set the client host (servlet request's getRemoteHost).
|
void |
setCredential(java.lang.Object cert)
Set the credential to authenticate the user.
|
void |
setForUser(java.lang.String username)
Set the tenant code to the session.
|
void |
setHost(java.lang.String url)
Specifies the URL of the MboServer to connect to.
|
void |
setInteractive(boolean value)
Set the interactive flag.
|
void |
setLangCode(java.lang.String lang) |
void |
setLocale(java.util.Locale l)
Sets the user's locale.
|
static void |
setMXSessionImplFactory(MXSessionImplFactory factory)
Set the session factory.
|
void |
setPassword(java.lang.String pwd)
Sets the password for the current user.
|
void |
setTenant(java.lang.String code)
Set the tenant code to the session.
|
void |
setTimeZone(java.util.TimeZone tz)
Sets the time zone for this user.
|
void |
setUserName(java.lang.String user)
Sets the Login ID (
this variable ) to the specified String. |
protected java.util.Locale locale
protected java.util.TimeZone timeZone
protected java.lang.String baseCurrency
protected java.lang.String username
protected java.lang.String password
protected java.lang.String langCode
protected java.lang.String hostname
protected java.lang.String servername
protected boolean connected
protected MXServerRemote remoteServer
protected java.lang.String clientHost
protected java.lang.String clientAddr
protected boolean interactive
protected boolean adminLogout
protected java.lang.Object credential
protected MXSession()
public static MXSession getSession()
MXSession s = MXSession.getSession();
Once a session has been instantiated, a connection to the server can be
established using the methods setHost
, setUserName
,
setPassword
, and connect
.
Generally, there is only one MXSession object per JVM, so it is necessary to connect to the server only once. After a connection has been made, the previously connected MXSession object can be retrieved as follows:
s = MXSession.getSession();
MXSession.setHost(String)
,
MXSession.setUserName(String)
,
MXSession.setPassword(String)
,
MXSession.connect()
public static MXSession getNewSession()
public static void setMXSessionImplFactory(MXSessionImplFactory factory)
public java.lang.String getUserName()
connect()
method has been called. If isConnected()
returns true, this is a valid Login ID.MXSession.isConnected()
,
MXSession.connect()
,
MXSession.setUserName(String)
,
MXSession.username
public byte[] getPassword(byte[] param)
param
- public java.lang.String getBaseCurrency()
public void setLangCode(java.lang.String lang)
Set
- the maximo language code.lang
- public void setUserName(java.lang.String user)
this variable
) to the specified String.user
- The Login ID to be set.MXSession.getUserName()
,
MXSession.username
public void setPassword(java.lang.String pwd)
pwd
- The new password.#getPassword()
public void setTenant(java.lang.String code)
code
- public java.lang.String getTenant()
code
- public void setForUser(java.lang.String username)
code
- public java.lang.String getForUser()
code
- public UserInfo getUserInfo()
public void setHost(java.lang.String url)
url
- The URL of the MboServer, in the form hostname/servername.
MXSession.getHost()
public java.lang.String getHost()
MXSession.setHost(String)
public void setClientHost(java.lang.String cHost)
cHost
- The client hostpublic java.lang.String getClientHost()
public void setClientAddr(java.lang.String cAddr)
cHost
- The client addresspublic java.lang.String getClientAddr()
public java.lang.String getServer()
public java.util.Locale getLocale()
java.util.Locale.getDefault()
),
and can be overridden by setLocale()
.java.util.Locale
.Locale
,
MXSession.setLocale(Locale)
public void setLocale(java.util.Locale l)
java.util.Locale.getDefault()
).l
- The Locale to be set for this user.Locale
,
MXSession.getLocale()
public void setTimeZone(java.util.TimeZone tz)
java.util.TimeZone.getDefault()
,
so setTimeZone()
would be called only if something other than the
initialized value is desired.tz
- The Time Zone to be set.TimeZone
,
MXSession.getTimeZone()
public java.util.TimeZone getTimeZone()
java.util.TimeZone.getDefault()
,
and can be overridden by setTimeZone()
.java.util.TimeZone
.TimeZone
,
MXSession.setTimeZone(TimeZone)
public java.lang.String getURLAsString()
public void addMXSessionListener(MXSessionListener l)
public void removeMXSessionListener(MXSessionListener l)
public java.util.Date getDate()
java.util.Date()
).Date
,
MXFormat
public boolean isConnected()
MXSession.connect()
,
MXSession.disconnect()
public abstract void connect() throws MXException, java.rmi.RemoteException
setHost(String url)
,
setUserName(String user)
,
and setPassword(String pwd)
.MXException
java.rmi.RemoteException
MXSession.isConnected()
,
MXSession.disconnect()
,
MXSession.setHost(String)
,
MXSession.setUserName(String)
,
MXSession.setPassword(String)
public abstract void disconnect() throws MXException, java.rmi.RemoteException
MXException
java.rmi.RemoteException
MXSession.isConnected()
,
MXSession.connect()
public void setInteractive(boolean value)
value
- public abstract MboSetRemote getMboSet(java.lang.String name) throws MXException
setWhere(String)
and the collection assembled
via reset()
.
The following example retrieves a work order set:
MXSession s = MXSession.getSession(); MboSetRemote woSet = s.getMboSet("WORKORDER");
name
- The name of the type of set desired, such as
WORKORDER
, EQUIPMENT
, etc.MXException
MXSession.getSession()
,
MboSet.setWhere(String)
public abstract MXServerRemote getMXServerRemote() throws MXException
MXException
public abstract ProfileRemote getProfile() throws MXException, java.rmi.RemoteException
MXException
java.rmi.RemoteException
public abstract ServiceRemote lookup(java.lang.String name) throws java.rmi.RemoteException, MXException
name
- The name of the desired service.psdi.server.ServiceRemote
).java.rmi.RemoteException
MXException
ServiceRemote
public abstract java.lang.String[][] getLanguageList() throws MXException, java.rmi.RemoteException
MXException
java.rmi.RemoteException
public abstract java.lang.String getMessage(java.lang.String group, java.lang.String key) throws MXException, java.rmi.RemoteException
group
- key
- MXException
java.rmi.RemoteException
public abstract java.lang.String[] getMessages(java.lang.String group, java.lang.String[] key) throws MXException, java.rmi.RemoteException
group
- key
- MXException
java.rmi.RemoteException
public abstract java.lang.String getMessage(MXException mxe) throws MXException, java.rmi.RemoteException
mxe
- MXException
java.rmi.RemoteException
public abstract java.lang.String getTaggedMessage(MXException mxe) throws MXException, java.rmi.RemoteException
mxe
- MXException
java.rmi.RemoteException
public abstract java.lang.String getProperty(java.lang.String propName) throws MXException, java.rmi.RemoteException
propName
- Property nameMXException
java.rmi.RemoteException
public abstract int getBranding() throws MXException, java.rmi.RemoteException
MXException
java.rmi.RemoteException
MXServer.getBranding()
public void connectAsRegUser(java.lang.String forUser) throws MXException, java.rmi.RemoteException
MXException
java.rmi.RemoteException
public void setCredential(java.lang.Object cert)
cert
- public java.lang.Object getCredential()
public boolean hasAdminLogout() throws MXException, java.rmi.RemoteException
MXException
java.rmi.RemoteException