Package com.vmware.vim.binding.vmodl

Examples of com.vmware.vim.binding.vmodl.ManagedObjectReference


         if (comps[i] != null &&
             (comps[i].equals("null") || comps[i].equals(""))) {
            comps[i] = null;
         }
      }
      ManagedObjectReference ref = new ManagedObjectReference();
      if (comps.length == 2) {
         ref.setServerGuid(null);
         ref.setType(comps[0]);
         ref.setValue(comps[1]);
      } else {
         ref.setServerGuid(comps[0]);
         ref.setType(comps[1]);
         ref.setValue(comps[2]);
      }
      // make sure the reference object is valid
      if (ref.getType() == null || ref.getValue() == null ||
          (ref.getServerGuid() != null &&
           !ref.getServerGuid().equals(VcContext.getServerGuid()))) {
         return null;
      }
      return ref;
   }
View Full Code Here


   }

   public static Folder getRootFolder() throws Exception {
      AuAssert.check(VcContext.isInSession());
      VcService svc = VcContext.getService();
      ManagedObjectReference rootFolderRef =
         svc.getServiceInstanceContent().getRootFolder();
      return svc.getManagedObject(rootFolderRef);
   }
View Full Code Here

    * Get a VC task callback to refresh a VcObject asynchronously
    * and wait for refresh in the VC task caller.
    */
   static private IVcTaskCallback getRefreshVcTaskCB(final VcObject obj,
         final EnumSet<UpdateType> updates) {
      final ManagedObjectReference moref = obj.getMoRef();
      return new IVcTaskCallback() {
         @Override
         public final void completeCB(VcTask task) {
            refresh(moref, updates);
         }
View Full Code Here

   static protected IVcTaskCallback getRefreshAllVcTaskCB(final VcObject obj) {
      return getRefreshVcTaskCB(obj, EnumSet.allOf(UpdateType.class));
   }

   static private ManagedObjectReference getMoRef(String id) {
      ManagedObjectReference moRef = MoUtil.stringToMoref(id);
      if (moRef == null) {
         throw VcException.INVALID_MOREF(id);
      }
      return moRef;
   }
View Full Code Here

      HttpClientConfiguration clientConfig = HttpClientConfiguration.Factory.newInstance();
      clientConfig.setHttpConfiguration(httpConfig);
      Client client = Client.Factory.createClient(sdkUri, version, clientConfig);
      SessionManager sm = null;
      try {
         ManagedObjectReference svcRef = new ManagedObjectReference();
         svcRef.setType("ServiceInstance");
         svcRef.setValue("ServiceInstance");
         ServiceInstance si = client.createStub(ServiceInstance.class, svcRef);
         sm = client.createStub(SessionManager.class,
               si.getContent().getSessionManager());
         sm.loginExtensionByCertificate(extKey, "en");
         String ticket = sm.acquireSessionTicket(null);
View Full Code Here

    *
    * @throws Exception
    */
   public static void dumpRecentTasks() throws Exception {
      TaskManager taskManager = VcContext.getService().getTaskManager();
      ManagedObjectReference taskMoRefs[] = taskManager.getRecentTask();
      for (ManagedObjectReference moRef : taskMoRefs) {
         Task task = MoUtil.getManagedObject(moRef);
         dumpTask(task);
      }
   }
View Full Code Here

         }
      }
   }

   public void enumAllExtensions() throws Exception {
      ManagedObjectReference emRef = vcService.getServiceInstanceContent().getExtensionManager();
      ExtensionManager em = (ExtensionManager) MoUtil.getManagedObject(emRef);
      Extension[] extensions = em.getExtensionList();
      int extensionCount = 0;
      int auroraCount = 0;
View Full Code Here

      private ServiceContents(long genCount) throws Exception
      {
         this.genCount = genCount;
         long startNanos = System.nanoTime();
         String sessionTicket = loginAndGetSessionTicket();
         ManagedObjectReference svcRef = new ManagedObjectReference();
         boolean done = false;
         svcRef.setType("ServiceInstance");
         svcRef.setValue("ServiceInstance");
         try {
            initVmomiClient();
            instance = vmomiClient.createStub(ServiceInstance.class, svcRef);

            /*
 
View Full Code Here

         public boolean eventHandler(VcEventType type, Event e)
               throws Exception {
            // Event can be either VmEvent or EventEx (TODO: Explicitly check for
            // VM specific EventEx class usage? e.g. VcEventType.VmAppHealthChanged?)
            AuAssert.check(e instanceof VmEvent || e instanceof EventEx);
            ManagedObjectReference moRef = e.getVm().getVm();
            switch (type) {
            case VmRemoved: {
               VcCache.purge(moRef);
               ManagedObjectReference rpMoRef = VcCache.removeVmRpPair(moRef);
               if (rpMoRef != null) {
                  VcCache.refresh(rpMoRef);
               }
               return false;
            }
            case VmDisconnected:
            case VmConnected: {
               VcVirtualMachine vm = VcCache.getIgnoreMissing(moRef);
               if (vm == null) {
                  return false;
               }
               vm.update();
               break;
            }
            case VmResourcePoolMoved: {
               VmResourcePoolMovedEvent event = (VmResourcePoolMovedEvent) e;
               VcCache.refresh(event.getOldParent().getResourcePool());
               VcCache.refresh(event.getNewParent().getResourcePool());
               break;
            }
            case VmCreated: {
               VmCreatedEvent event = (VmCreatedEvent) e;
               VcVirtualMachine vm = VcCache.get(event.getVm().getVm());
               vm.refreshRP();
               break;
            }
            case HostRemoved: {
               logger.info("Host removed event received" + e);
            }
            }
            VcCache.refreshAll(moRef);
            return false;
         }
      });

      /* High level handler for external rp events. */
      VcEventListener.installExtEventHandler(rpEvents, new IVcEventHandler() {
         @Override
         public boolean eventHandler(VcEventType type, Event e)
               throws Exception {
            ManagedObjectReference moRef =
                  ((ResourcePoolEvent) e).getResourcePool().getResourcePool();
            if (type == VcEventType.ResourcePoolDestroyed) {
               VcCache.purge(moRef);
            } else {
               VcCache.refreshAll(moRef);
View Full Code Here

    * @return Realtime sampling interval (aka refresh rate) for target entity.
    */
   public Integer getRealtimeInterval(final String targetId) {
      return VcContext.inVcSessionDo(new VcSession<Integer>() {
         public Integer body() {
            ManagedObjectReference target = MoUtil.stringToMoref(targetId);
            ProviderSummary summary = getCachedPerfMgr().queryProviderSummary(target);
            Integer refresh = summary.getRefreshRate();
            if (summary.isCurrentSupported()) {
               return refresh;
            }
View Full Code Here

TOP

Related Classes of com.vmware.vim.binding.vmodl.ManagedObjectReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.