{
err(getLocalizationManager().getLocalizedTextString("sessionInProgress")); //$NON-NLS-1$
return;
}
SessionManager mgr = Bootstrap.sessionManager();
if (hasMoreTokens())
{
if (!setLaunchURI(restOfLine()))
return;
}
if (m_connectPort == null)
mgr.startListening();
try
{
if (m_connectPort != null) {
out(getLocalizationManager().getLocalizedTextString("waitingToConnectToPlayer")); //$NON-NLS-1$
m_session = mgr.connect(Integer.valueOf(m_connectPort), null);
}
else if (m_launchURI == null)
{
out(getLocalizationManager().getLocalizedTextString("waitingForPlayerToConnect")); //$NON-NLS-1$
m_session = mgr.accept(null);
}
else
{
out(getLocalizationManager().getLocalizedTextString("launchingWithUrl") + m_newline + m_launchURI); //$NON-NLS-1$
m_session = mgr.launch(m_launchURI, null, true, null, null);
}
// now see what happened
if (m_session == null)
{
// shouldn't have gotten here
throw new SocketTimeoutException();
}
else
{
out(getLocalizationManager().getLocalizedTextString("playerConnectedSessionStarting")); //$NON-NLS-1$
initSession(m_session);
// pause for a while during startup, don't let exceptions ripple outwards
try { waitTilHalted(); } catch(Exception e) {}
// pause for a while during startup, don't let exceptions ripple outwards
try { waitForMetaData(); } catch(Exception e) {}
setInitialSourceFile();
out(getLocalizationManager().getLocalizedTextString("setBreakpointsThenResume")); //$NON-NLS-1$
// now poke to see if the player is good enough
try
{
if (m_session.getPreference(SessionManager.PLAYER_SUPPORTS_GET) == 0 )
err(m_newline + getLocalizationManager().getLocalizedTextString("warningNotAllCommandsSupported")); //$NON-NLS-1$
}
catch(Exception npe) {}
}
}
catch (FileNotFoundException fnf)
{
Map<String, Object> args = new HashMap<String, Object>();
args.put("uri", fnf.getLocalizedMessage()); //$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("fileDoesNotExist", args)); //$NON-NLS-1$
}
catch (SocketTimeoutException ste)
{
err(getLocalizationManager().getLocalizedTextString("failedToConnect")); //$NON-NLS-1$
}
catch (IOException io)
{
err(io.getLocalizedMessage());
}
finally
{
// turn off listening, to allow other session to connect
if (m_connectPort == null)
mgr.stopListening();
}
}