public class SessionLoader extends SessionLoaderInternal
Modifier and Type | Field and Description |
---|---|
static String |
copyright |
DBG_Out, HOST_3270, HOST_5250, HOST_ALC, HOST_T27, HOST_UTS, HOST_VT, initial_reserve, internalUse, ManagerInstance, reserve_increment, SLInstance, strMCSPassword, strMCSServerName, strMCSUser, termType
Constructor and Description |
---|
SessionLoader() |
Modifier and Type | Method and Description |
---|---|
String |
getConfigurationIPAddress()
Deprecated.
As of Version 4.0, XML configurations should be passed in by
application using
requestScreenEx(String, String, String, int) |
int |
getTerminalType()
Gets the default Screen Type to be used for retrieving Screen Objects.
|
IScreenUPG |
requestScreen(String User,
String Password,
String WebView)
Deprecated.
As of Version 4.0, XML configurations should be passed in by
application using
requestScreenEx(String, String, String, int) |
IScreenUPG |
requestScreenEx(String User,
String Password,
String ScreenData,
int intUse)
Gets a Screen object, instantiated with the specified user and password,
as well as the configuration specified by the XML Data.
|
void |
setConfigurationIPAddress(String Server)
Deprecated.
As of Version 4.0, XML configurations should be passed in by
application using
requestScreenEx(String, String, String, int) |
void |
setResourceManagerOptions(int ir,
int ri,
String rsa)
Deprecated.
As of Version 4.0, session ID management should be handled by application.
|
void |
setTerminalType(int Type)
Sets a default Screen Type to be used for retrieving Screen Objects.
|
void |
Shutdown()
Deprecated.
As of Version 4.0, session ID management should be handled by application.
|
getConfig, getMCSConfiguration, getMCSPassword, getMCSUser, loadTerminalSession, onCOMRegister, requestScreenFile, setMCSPassword, setMCSUser
public static final String copyright
public IScreenUPG requestScreen(String User, String Password, String WebView) throws SessionException
requestScreenEx(String, String, String, int)
User
- A valid user name defined in the Management and Control Server.
The user must have Management console access permission.Password
- The password assigned to the user specified with
the User parameter.WebView
- A valid WebView defined in HAS.SessionException
- Returned if the requested session
could not be loaded.
SessionLoader sl = new SessionLoader();
//The following is only applicable if you are using ID Manager to obtain IDs.
sl.setResourceManagerOptions(75,25,"");
//End of ID Manager-specific code.
ScreenUts m_ScreenObj;
try {
m_ScreenObj = (ScreenUts) sl.requestScreen("User","Password","WebView");
}
catch (SessionException se){
System.out.println(se.getMessage());
}
if(m_screenObj.Open())
System.out.println("Connected!");
else
System.out.println("Host Connection Failed!");
m_screenObj.Closed();
dim loaderObj
'The following is only applicable if you are using ID Manager to obtain IDs.
loaderObj.setResourceManagerOptions(75,25,"")
'End of ID Manager-specific code.
On error resume next
set loaderObj = Server.CreateObject("SessionLoader.SessionLoader")
set Session("screenObj") = loaderObj.requestScreen("User","Password","WebView")
If Session("screenObj").Open = True Then
Session("Session("sreenObj")").waitHostQuiet 1000,5000
Response.write (Session("screenObj").gettext)
Session("screenObj").Close
else
Response.write("Open of WebView failed!")
End if
…
void Screen::start(void)
{
TRY
{
//The following is only applicable if you are using ID Manager to obtain IDs.
m_SessLoader.setResourceManagerOptions(75,25,"");
//End of ID Manager-specific code.
CLSID clsid;
HRESULT hr = ::CLSIDFromProgID(L"SessionLoader.SessionLoader", &clsid);
if (FAILED(hr))
{
AfxThrowOleException(hr);
}
if (m_sessLoader.CreateDispatch(clsid))
{
TRY
{
IDispatch *lpScreenDisp = m_sessLoader.requestScreen("User","Password","WebView");
if (lpScreenDisp)
{
this->m_screenObj.AttachDispatch(lpScreenDisp);
if (!this->m_screenObj.Open())
{
AfxMessageBox("open failed");
return ;
}
…
//Start programming here.
//Be sure to close the connection when you are done.
this->m_screenObj.Close();
}
}
CATCH_ALL(e)
{
char buff[1024];
e->GetErrorMessage(buff,1024,NULL);
AfxMessageBox(buff);
this->m_screenObj.Close();
}
END_CATCH_ALL
}
}
CATCH_ALL(e)
{
AfxMessageBox("Error: Failed to create 'SessionLoader.SessionLoader' object");
return;
}
END_CATCH_ALL
}
public IScreenUPG requestScreenEx(String User, String Password, String ScreenData, int intUse) throws SessionException
User.
- Password.
- XMLData
- A valid WebView defined in HAS.reserved.
- Set to zero.SessionException
- Returned if the requested session
could not be loaded.
SessionLoader sl = new SessionLoader();
//The following is only applicable if you are using ID Manager to obtain IDs.
sl.setResourceManagerOptions(75,25,"");
//End of ID Manager-specific code.
ScreenUts m_ScreenObj;
String XMLData = "Specific to terminal Type";
try {
m_ScreenObj = (ScreenUts) sl.requestScreenEx("User","Password","XMLData","Reserved");
}
catch (SessionException se){
System.out.println(se.getMessage());
}
if(m_screenObj.Open())
System.out.println("Connected!");
else
System.out.println("Host Connection Failed!");
m_screenObj.Closed();
dim loaderObj
'The following is only applicable if you are using ID Manager to obtain IDs.
loaderObj.setResourceManagerOptions(75,25,"")
'End of ID Manager-specific code.
set XMLData = "Specific to terminal Type"
On error resume next
set loaderObj = Server.CreateObject("SessionLoader.SessionLoader")
set Session("screenObj") = loaderObj.requestScreenEx("User","Password","XMLData","Reserved")
If Session("screenObj").Open = True Then
Session("Session("sreenObj")").waitHostQuiet 1000,5000
Response.write (Session("screenObj").gettext)
Session("screenObj").Close
else
Response.write("Open of WebView failed!")
End if
…
void Screen::start(void)
{
TRY
{
//The following is only applicable if you are using ID Manager to obtain IDs.
m_SessLoader.setResourceManagerOptions(75,25,"");
//End of ID Manager-specific code.
CLSID clsid;
HRESULT hr = ::CLSIDFromProgID(L"SessionLoader.SessionLoader", &clsid);
if (FAILED(hr))
{
AfxThrowOleException(hr);
}
if (m_sessLoader.CreateDispatch(clsid))
{
TRY
{
char XMLData[256];
memset(XMLData,0,sizeof(XMLData));
memcpy(XMLData,"Specific to terminal Type");
IDispatch *lpScreenDisp = m_sessLoader.requestScreenEx("User","Password","XMLData","Reserved");
if (lpScreenDisp)
{
this->m_screenObj.AttachDispatch(lpScreenDisp);
if (!this->m_screenObj.Open())
{
AfxMessageBox("open failed");
return ;
}
…
//Start programming here.
//Be sure to close the connection when you are done.
this->m_screenObj.Close();
}
}
CATCH_ALL(e)
{
char buff[1024];
e->GetErrorMessage(buff,1024,NULL);
AfxMessageBox(buff);
this->m_screenObj.Close();
}
END_CATCH_ALL
}
}
CATCH_ALL(e)
{
AfxMessageBox("Error: Failed to create 'SessionLoader.SessionLoader' object");
return;
}
END_CATCH_ALL
}
public void setConfigurationIPAddress(String Server)
requestScreenEx(String, String, String, int)
Server
- either a DNS name or IP address followed by a colon and then
the TCP port of the server (e.g. “yourhost:8015”). All subsequent configuration
requests will be sent to this server address and TCP port.
The getConfigurationIPAddress method will return either the default
MCS server (“localhost”) or the last server address/hostname set by the developer.
Server (HAS).getConfigurationIPAddress,requestScreen,setTerminalType
public String getConfigurationIPAddress()
requestScreenEx(String, String, String, int)
setConfigurationIPAddress,requestScreen,setTerminalType
public void setTerminalType(int Type)
Type
- A valid Screen Type.
Valid Types: T27 = 100
UTS = 105
3270 = 110
5250 = 115
VT = 120
ALC = 125public int getTerminalType()
Type
- A valid Screen Type.
Valid Types: T27 = 100
UTS = 105
3270 = 110
5250 = 115
VT = 120
ALC = 125public void setResourceManagerOptions(int ir, int ri, String rsa)
ir
- The initial number of IDs that the application will
request from e-Vantage ID Manager.ri
- The increment in which additional IDs will be requested
from e-Vantage ID Manager when all allocated IDs are already
in use.rsa
- The ID Manager Address, if a remote ID Manager is used.
sl.setResourceManagerOptions(75,25,"");
loaderObj.setResourceManagerOptions(75,25,"")
m_sessLoader.setResourceManagerOptions(75,25,"");
public void Shutdown()
sl.Shutdown();
loaderObj.Shutdown
m_sessLoader.Shutdown();