Package com.vmware.vim.binding.vim

Examples of com.vmware.vim.binding.vim.Extension


   }

   private void configureExtensionVService() throws Exception {
      ExtensionManager em = service.extensionManager;

      Extension us = em.findExtension(extKey);
      AuAssert.check(us != null);

      // Describe Aurora itself
      Description desc = new DescriptionImpl();
      desc.setLabel("VMware Serengeti Management Server");
      desc.setSummary("VMware Serengeti Management Server, instance " + Configuration.getCmsInstanceId());
      us.setDescription(desc);
      us.setCompany("VMware, Inc.");
      us.setVersion(Configuration.getNonEmptyString("serengeti.version"));
      us.setShownInSolutionManager(true);
      ExtendedProductInfo extInfo = new ExtendedProductInfoImpl();
      extInfo.setCompanyUrl("http://www.vmware.com");
      us.setExtendedProductInfo(extInfo);
      // XXX: Set health info, any other fields?

      // Describe the entities we manage (DBVM)
      ManagedEntityInfo info = new ManagedEntityInfoImpl();
      info.setType("hadoop node");
      info.setDescription("VMware Serengeti - Node Template");
      //info.setSmallIconUrl("https://*:443/some-16x16.png");
      ManagedEntityInfo[] infos = new ManagedEntityInfo[1];
      infos[0] = info;
      us.setManagedEntityInfo(infos);

      // Generate ResourceInfo
      Extension.ResourceInfo extensionResourceInfo = new ExtensionImpl.ResourceInfoImpl();
      extensionResourceInfo.setLocale("en");
      extensionResourceInfo.setModule("extension");

      KeyValue localizedExt[] = new KeyValue[2];
      localizedExt[0] = new KeyValueImpl();
      localizedExt[0].setKey(us.getKey() + ".label");
      localizedExt[0].setValue(us.getDescription().getLabel());

      localizedExt[1] = new KeyValueImpl();
      localizedExt[1].setKey(us.getKey() + ".summary");
      localizedExt[1].setValue(us.getDescription().getSummary());

      extensionResourceInfo.setData(localizedExt);

      // Generate event type specifications
      Extension.ResourceInfo eventResourceInfo = new ExtensionImpl.ResourceInfoImpl();
      eventResourceInfo.setLocale("en");
      eventResourceInfo.setModule("event");

      class KeyValueList extends ArrayList<KeyValue> {
         public void add(String key, String value) {
            KeyValue pair = new KeyValueImpl();
            pair.setKey(key);
            pair.setValue(value);
            super.add(pair);
         }
      };

      KeyValueList resourceInfo = new KeyValueList();
      ArrayList<Extension.EventTypeInfo> eventTypes = new ArrayList<Extension.EventTypeInfo>();

      for (EventSeverity severity : Event.EventSeverity.values()) {
         resourceInfo.add("com.vmware.vhadoop.vhm.vc.events."+severity.name()+".label", "BDE notification");
         resourceInfo.add("com.vmware.vhadoop.vhm.vc.events."+severity.name()+".summary", "BDE notification");
         resourceInfo.add("com.vmware.vhadoop.vhm.vc.events."+severity.name()+".category", severity.name());
         resourceInfo.add("com.vmware.vhadoop.vhm.vc.events."+severity.name()+".fullFormat", "{message}");
         resourceInfo.add("com.vmware.vhadoop.vhm.vc.events."+severity.name()+".formatOnVm", "BDE notification");

         Extension.EventTypeInfo event = new ExtensionImpl.EventTypeInfoImpl();
         event.setEventID("com.vmware.vhadoop.vhm.vc.events."+severity.name());
         event.setEventTypeSchema("<EventType><eventTypeID>com.vmware.vhadoop.vhm.vc.events."+severity.name()+"</eventTypeID><description>Status update for a Big Data Extensions compute VM</description><arguments/></EventType>");
         eventTypes.add(event);
      }

      eventResourceInfo.setData(resourceInfo.toArray(new KeyValue[0]));

      us.setResourceList(new Extension.ResourceInfo[] {extensionResourceInfo, eventResourceInfo});
      us.setEventList(eventTypes.toArray(new Extension.EventTypeInfo[0]));
      us.setShownInSolutionManager(true);

      SolutionManagerInfo sm = new SolutionManagerInfoImpl();
      sm.setSmallIconUrl("http://www.vmware.com");
      us.setSolutionManagerInfo(sm);
     
      // Push this info into VC
      em.updateExtension(us);
   }
View Full Code Here

TOP

Related Classes of com.vmware.vim.binding.vim.Extension

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.