Search in sources :

Example 1 with IServerManagerConnection

use of com.liferay.ide.server.remote.IServerManagerConnection in project liferay-ide by liferay.

the class DebugPortalLaunchParticipant method portalPostLaunch.

public void portalPostLaunch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    final IServer server = org.eclipse.wst.server.core.ServerUtil.getServer(configuration);
    final IServerManagerConnection connection = ServerUtil.getServerManagerConnection(server, monitor);
    if (connection != null) {
        try {
            final String fmDebugPassword = connection.getFMDebugPassword();
            final int fmDebugPort = connection.getFMDebugPort();
            if (fmDebugPassword != null && fmDebugPort != -1) {
                launch.setAttribute(PortalCore.PREF_FM_DEBUG_PASSWORD, fmDebugPassword);
                launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, Integer.toString(fmDebugPort));
                final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
                launch.addDebugTarget(target);
            }
        } catch (APIException e) {
            LiferayServerCore.logError("Unable to determine remote freemarker debugger connection info.", e);
        }
    }
    this.saveLaunchMode = null;
    final String stopServer = configuration.getAttribute(STOP_SERVER, "false");
    if (ILaunchManager.DEBUG_MODE.equals(mode) && "false".equals(stopServer)) {
        if (this.fmDebugPort != null) {
            launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, this.fmDebugPort);
            this.fmDebugPort = null;
            final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
            launch.addDebugTarget(target);
        } else {
            // $NON-NLS-1$
            PortalCore.logError("Launch freemarker port is invalid.");
        }
    }
}
Also used : FMDebugTarget(com.liferay.ide.portal.core.debug.fm.FMDebugTarget) IServer(org.eclipse.wst.server.core.IServer) APIException(com.liferay.ide.core.remote.APIException) IServerManagerConnection(com.liferay.ide.server.remote.IServerManagerConnection) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget)

Example 2 with IServerManagerConnection

use of com.liferay.ide.server.remote.IServerManagerConnection in project liferay-ide by liferay.

the class LiferayServerCore method getRemoteConnection.

public static IServerManagerConnection getRemoteConnection(final IRemoteServer server) {
    IServerManagerConnection retval = null;
    if (connections == null) {
        connections = new HashMap<String, IServerManagerConnection>();
    }
    if (server != null) {
        IServerManagerConnection service = connections.get(server.getId());
        if (service == null) {
            service = new ServerManagerConnection();
            updateConnectionSettings(server, service);
            connections.put(server.getId(), service);
        } else {
            updateConnectionSettings(server, service);
        }
        retval = service;
    }
    return retval;
}
Also used : IServerManagerConnection(com.liferay.ide.server.remote.IServerManagerConnection) ServerManagerConnection(com.liferay.ide.server.remote.ServerManagerConnection) IServerManagerConnection(com.liferay.ide.server.remote.IServerManagerConnection)

Aggregations

IServerManagerConnection (com.liferay.ide.server.remote.IServerManagerConnection)2 APIException (com.liferay.ide.core.remote.APIException)1 FMDebugTarget (com.liferay.ide.portal.core.debug.fm.FMDebugTarget)1 ServerManagerConnection (com.liferay.ide.server.remote.ServerManagerConnection)1 IDebugTarget (org.eclipse.debug.core.model.IDebugTarget)1 IServer (org.eclipse.wst.server.core.IServer)1