Java 类com.vmware.vim25.LicenseManagerLicenseInfo 实例源码

项目:vijava    文件:SwapLicenseV4.java   
public static void main(String[] args) throws Exception
{
  ServiceInstance si = new ServiceInstance(new URL("https://8.8.8.8/sdk"), 
      "administrator", "vmware", true);
  LicenseManager lm = si.getLicenseManager();
  LicenseAssignmentManager lam = lm.getLicenseAssignmentManager();

  LicenseAssignmentManagerLicenseAssignment[] las = lam.queryAssignedLicenses(null);

  String newLic = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX";
  String oldLic = "YYYYY-YYYYY-YYYYY-YYYYY-YYYYY";

  List<LicEntity> entities = new ArrayList<LicEntity>();

  for(LicenseAssignmentManagerLicenseAssignment la : las)
  {
    LicenseManagerLicenseInfo licInfo = la.getAssignedLicense();
    if(oldLic.equals(licInfo.getLicenseKey()))
    {
      entities.add(new LicEntity(la.getEntityId(), la.getEntityDisplayName()));
      System.out.println("entityId:" + la.getEntityId());

    }
  }

  lm.addLicense(newLic, null);

  for(LicEntity e : entities)
  {
    lam.updateAssignedLicense(e.entityId, newLic, e.displayName);
  }
  lm.removeLicense(oldLic);
}
项目:vijava    文件:PrintLicExpirationDateV4.java   
public static void main(String[] args) throws Exception
{
  ServiceInstance si = new ServiceInstance(new URL("https://8.8.8.8/sdk"), 
      "administrator", "vmware", true);
  LicenseManager lm = si.getLicenseManager();
  LicenseManagerLicenseInfo[] lics = lm.getLicenses();

  DateFormat df = DateFormat.getInstance();
  for(LicenseManagerLicenseInfo lic : lics)
  {
    Date expDate = null;

    if("eval".equalsIgnoreCase(lic.getEditionKey()))
    {
      LicenseManagerEvaluationInfo evalInfo = lm.getEvaluation();
      expDate = getExpirationDate(evalInfo.getProperties());
    }
    else
    {
      expDate = getExpirationDate(lic.getProperties());
    }

    if(expDate!=null)
    {
      System.out.println(lic.getLicenseKey() + " expires on " + df.format(expDate));
    }
    else
    {
      System.out.println(lic.getLicenseKey() + " expires on NEVER");
    }
  }
}
项目:vijava    文件:LicenseAssignmentManager.java   
public LicenseManagerLicenseInfo updateAssignedLicense( String entity, String licenseKey, String entityDisplayName) throws RuntimeFault, RemoteException
{
    return getVimService().updateAssignedLicense(getMOR(), entity, licenseKey, entityDisplayName);
}
项目:cloudstack    文件:LicenseAssignmentManagerMO.java   
public LicenseManagerLicenseInfo getHostLicenseInfo(ManagedObjectReference hostMor) throws Exception {
    // Retrieve license assigned to specified host
    LicenseAssignmentManagerLicenseAssignment license = getAssignedLicenseToHost(hostMor);
    return license.getAssignedLicense();
}
项目:jcloud-vsphere    文件:LicenseManagerApi.java   
/**
 * @since SDK4.0
 */
LicenseManagerLicenseInfo addLicense(String licenseKey, KeyValue[] labels) throws RuntimeFault, RemoteException;
项目:jcloud-vsphere    文件:LicenseManagerApi.java   
/**
 * @since SDK4.0
 */
LicenseManagerLicenseInfo decodeLicense(String licenseKey) throws RuntimeFault, RemoteException;
项目:jcloud-vsphere    文件:LicenseManagerApi.java   
LicenseManagerLicenseInfo[] getLicenses();