Connect a Solution to
ESX Agent Manager
To connect a
solution to ESX Agent Manager, you must obtain connection information from the
in which you run the solution. You pass a reference to the
EsxAgentManager
instance that is running in
to the solution.
- Verify that you have set up and started the EAM Sample Solution in an application server.
- Openin an editor.eam_work_folder\src\com\vmware\eam\sample\solution\util\VimConnection.java
- Openin an editor.eam_work_folder\src\com\vmware\eam\sample\solution\util\EamConnection.java
- Openin an editor.eam_work_folder\src\com\vmware\eam\sample\solution\Manager.java
- Obtain the following information from the instance on which you run a solution:
- The host ID.
- The HTTPS proxy port for .
- The session cookie for the current user session in which the solution is logged in as an extension.
- The managed object reference (MoRef) of the ESX Agent Manager instance that is running in the instance.
You pass the connection
information to a solution by calling the appropriate methods from the vSphere
API.
If you integrate your
solution with the vCenter Extension vService, the vService obtains the
connection information for you. See
Integrating an Extension with the vCenter Extension vService.
The EAM Sample Solution
defines the connection to
in the
VimConnection.java
class and the connection to ESX Agent Manager in the
EamConnection.java
class.
The
VimConnection
class
defines methods to obtain the
host ID, HTTPS proxy, and the session cookie. The
Manager.java
class
implements
VimConnection
to
connect to the
on which the EAM Sample Solution is running. See
Connect the Extension to.
- Establish a connection to the instance on which the solution runs.The EAM Sample Solution establishes the connection to in theVimConnection.javaclass.
- Create an instance of theManagedObjectReferenceobject of typeEsxAgentManager.TheEamConnection.javaclass defines a constructor that creates a MoRef named_eamRefand a method namedgetEsxAgentManager()that returns the MoRef to the solution.public EamConnection(String vcHost, int vcHttpsProxyPort, String sessionCookie) { [...] _eamRef = new ManagedObjectReference(); _eamRef.setType("EsxAgentManager"); _eamRef.setValue("EsxAgentManager"); } [...] public ManagedObjectReference getEsxAgentManager() { return _eamRef; }
- Connect to the ESX Agent Manager with the URL to the ESX Agent Manager service and the session cookie for the current session in which the solution is logged as an extension.TheEamConnectionclass defines aconnect()method that connects to the ESX Agent Manager service.public void connect() { if (_isConnected) { return; } try { [...] String eamUrl = "https://" + _vcHost + ":" + _vcHttpsProxyPort + "/eam/sdk/"; [...] Map<String, List<String>> map = new HashMap<String, List<String>>(); map.put("Cookie", Collections.singletonList(_sessionCookie)); ((BindingProvider) _stub).getRequestContext() .put(MessageContext.HTTP_REQUEST_HEADERS, map); _isConnected = true; } }
You obtained the connection
details for
and connected a solution to ESX Agent Manager.
Configure ESX agencies and
agents to deploy from the solution.