Class ConnectedServiceBase

  • Direct Known Subclasses:
    AboutInfo, CheckCompliance, CreateProfile, CreateVSANProfile, DeleteProfile, EditProfile, FcdAssociateProfile, ListProfiles, ViewProfile, VMClone, VMCreate, VMRelocate

    public abstract class ConnectedServiceBase
    extends java.lang.Object
    An abstract base class, extend this class if your common needs to open a connection to the virtual center server before it can do anything useful.

    Example: The simplest possible extension class merely forms a connection and specifies it's own common action.

     @Sample(name = "connect")
     public class Connect extends ConnectedServiceBase {
        @Action
        public void action() {
           System.out.println("currently connected: " + this.isConnected());
        }
     }
     

    This is provided as an alternative to extending the Connection class directly.

    For a very simple connected sample:

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setConnection​(Connection connect)
      A method for dependency injection of the connection object.
      boolean start()
      connects this object, returns true on successful connect
      boolean stop()
      disconnects this object and returns true on successful disconnect
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConnectedServiceBase

        public ConnectedServiceBase()
    • Method Detail

      • setConnection

        @Option(name="connection",
                type=BasicConnection.class)
        public void setConnection​(Connection connect)
        A method for dependency injection of the connection object.

        Parameters:
        connect - the connection object to use for this POJO
        See Also:
        Connection
      • start

        @Before
        public boolean start()
        connects this object, returns true on successful connect
        Returns:
        true on successful connect
        Throws:
        ConnectionException
      • stop

        @After
        public boolean stop()
        disconnects this object and returns true on successful disconnect
        Returns:
        a disconnected reference to itself
        Throws:
        ConnectionException