1 package com.sslexplorer.agent.client.networkplaces; 2 3 import java.io.IOException ; 4 5 import com.maverick.multiplex.Request; 6 import com.maverick.util.ByteArrayReader; 7 import com.maverick.util.ByteArrayWriter; 8 import com.sslexplorer.agent.client.AbstractResourceManager; 9 import com.sslexplorer.agent.client.Agent; 10 11 17 public class NetworkPlaceManager extends AbstractResourceManager { 18 19 20 static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(NetworkPlaceManager.class); 22 24 27 public final static int NETWORK_PLACE_RESOURCE_TYPE_ID = 2; 28 29 32 public static final String SETUP_AND_LAUNCH_NETWORK_PLACE = "setupAndLaunchNetworkPlace@3sp.com"; 34 public NetworkPlaceManager(Agent agent) { 35 super(agent); 36 } 37 38 public void getNetworkPlaceResources() { 39 super.getResources(NETWORK_PLACE_RESOURCE_TYPE_ID, "Network Places"); 40 } 41 42 public void launchResource(int resourceId) { 43 try { 44 ByteArrayWriter baw = new ByteArrayWriter(); 45 baw.writeInt(resourceId); 46 Request request = new Request(SETUP_AND_LAUNCH_NETWORK_PLACE, baw.toByteArray()); 47 if (agent.getConnection().sendRequest(request, true) && request.getRequestData()!=null) { 48 ByteArrayReader bar = new ByteArrayReader(request.getRequestData()); 49 String uri = bar.readString(); 50 agent.getGUI().openBrowser(uri); 51 log.debug("Network place setup"); 53 } else { 56 log.error("Failed to setup and launch network place"); 58 } 60 } catch (IOException e) { 61 log.error("Failed to setup and launch network place", e); 63 } 65 } 66 } 67 | Popular Tags |