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

项目:vijava    文件:ExtensionManager.java   
private void encodeUrl(Extension extension)
{
  // replace all the & in the url with &
  for (int i = 0; extension.client != null && i < extension.client.length; i++)
  {
    ExtensionClientInfo eci = extension.client[i];
    if (eci.url.indexOf("&") != -1)
    {
      eci.url = eci.url.replaceAll("&", "&amp;");
    }
  }
  for (int i = 0; extension.server != null && i < extension.server.length; i++)
  {
    ExtensionServerInfo esi = extension.server[i];
    if (esi.url.indexOf("&") != -1)
    {
      esi.url = esi.url.replaceAll("&", "&amp;");
    }
  }
}
项目:vijava    文件:ExtensionManager.java   
/**
 * Print out information of all the plugins to stdout
 * 
 * @throws RemoteException
 *           if something is wrong with web service call, either because of
 *           the web service itself, or because of the service provider unable
 *           to handle the request.
 * @deprecated
 */
public void printAllExtensions()
{
  Extension[] exts = getExtensionList();

  System.out.println("There are totally " + exts.length + " plugin(s) registered.");

  for (int i = 0; exts != null && i < exts.length; i++)
  {
    System.out.println("\n ---- Plugin # " + (i + 1) + " ---- ");
    System.out.println("Key: " + exts[i].getKey());
    System.out.println("Version: " + exts[i].getVersion());
    System.out.println("Registration Time: " + exts[i].getLastHeartbeatTime().getTime());
    System.out.println("Configuration URL: " + exts[i].getServer()[0].getUrl());
  }
}
项目:vijava    文件:ExtMgrUtil.java   
static void printAllExtensions(Extension[] exts) 
{
  System.out.println("There are totally " + 
      exts.length + " plugin(s) registered.");

  for(int i=0; exts!=null && i<exts.length; i++)
  {
    System.out.println("\n --- Plugin # " + (i+1) + " --- ");
    System.out.println("Key: " + exts[i].getKey());
    System.out.println("Version: " + exts[i].getVersion());
    System.out.println("Registration Time: " + 
        exts[i].getLastHeartbeatTime().getTime());
    System.out.println("Configuration URL: " + 
        exts[i].getServer()[0].getUrl());
  }
}
项目:vijava    文件:ExtMgrUtil.java   
static Extension createExtensionObject(Properties props)
{
  String companyStr = props.getProperty("companyStr");
  String descStr = props.getProperty("descStr"); 
  String keyStr = props.getProperty("keyStr");
  String extUrl = props.getProperty("extUrl");
  String adminEmail = props.getProperty("adminEmail");
  String version = props.getProperty("version");

  Description description = new Description();
  description.setLabel(keyStr);
  description.setSummary(descStr);

  ExtensionServerInfo esi = new ExtensionServerInfo();
  esi.setDescription(description);
  esi.setUrl(extUrl);
  esi.setCompany(companyStr);
  // the following type must NOT be changed
  esi.setType("com.vmware.vim.viClientScripts");
  esi.setAdminEmail( new String[] { adminEmail } );

  ExtensionClientInfo eci = new ExtensionClientInfo();
  eci.setCompany(companyStr);
  eci.setUrl(extUrl);
  eci.setType("com.vmware.vim.viClientScripts");
  eci.setVersion(version);
  eci.setDescription(description);

  Extension ext = new Extension();
  ext.setServer(new ExtensionServerInfo[]{esi});
  ext.setClient(new ExtensionClientInfo[] {eci});
  ext.setDescription(description);
  ext.setKey(keyStr);
  ext.setVersion(version);
  ext.setLastHeartbeatTime(Calendar.getInstance());

  return ext;
}
项目:vijava    文件:ExtensionManager.java   
/**
 * Update an existing plugin with modified information If
 * <code>extension</code> is null then a <code>NullPointerException</code> is
 * thrown.
 * 
 * @param extension
 *          The extension object with updated information
 * @throws RemoteException
 * @throws RuntimeFault
 * @throws NotFound
 *           either because of the web service itself, or because of the
 *           service provider unable to handle the request.
 */
public void updateExtension(Extension extension) throws NotFound, RuntimeFault, RemoteException
{
  if (extension == null)
  {
    throw new NullPointerException();
  }

  encodeUrl(extension);

  getVimService().updateExtension(getMOR(), extension);
}
项目:vijava    文件:ExtensionManager.java   
/**
 * Register a new plugin If <code>extension</code> is null then a
 * <code>NullPointerException</code> is thrown.
 * 
 * @param extension
 *          The extension object to be registered
 * @throws RemoteException
 * @throws RuntimeFault
 *           either because of the web service itself, or because of the
 *           service provider unable to handle the request.
 */
public void registerExtension(Extension extension) throws RuntimeFault, RemoteException
{
  if (extension == null)
  {
    throw new NullPointerException();
  }
  encodeUrl(extension);
  getVimService().registerExtension(getMOR(), extension);
}
项目:vijava    文件:ExtensionManager.java   
/**
 * Find the extension based on the unique key of the plugin If
 * <code>keyStr</code> is null then a <code>NullPointerException</code>
 * 
 * @param keyStr
 *          The unique key for the plugin
 * @return The extension object found with the unique key
 * @throws RemoteException
 * @throws RuntimeFault
 * @throws RemoteException
 *           if something is wrong with web service call, either because of
 *           the web service itself, or because of the service provider unable
 *           to handle the request.
 */
public Extension findExtension(String keyStr) throws RuntimeFault, RemoteException
{
  if (keyStr == null)
  {
    throw new NullPointerException();
  }
  return getVimService().findExtension(getMOR(), keyStr);
}
项目:jcloud-vsphere    文件:ExtensionManagerApi.java   
/**
 * Retrieve all the registered plugins objects
 *
 * @return List of extension objects. If no extension found, an empty array is returned.
 */
List<Extension> getExtensionList();
项目:jcloud-vsphere    文件:ExtensionManagerApi.java   
/**
 * Update an existing plugin with modified information
 * If <code>extension</code> is null then a <code>NullPointerException</code> is thrown.
 *
 * @param extension The extension object with updated information
 * @throws RemoteException
 * @throws RuntimeFault
 * @throws NotFound        either because of the web service itself, or because of the service
 *                         provider unable to handle the request.
 */
void updateExtension(Extension extension) throws NotFound, RuntimeFault, RemoteException;
项目:jcloud-vsphere    文件:ExtensionManagerApi.java   
/**
 * Register a new plugin
 * If <code>extension</code> is null then a <code>NullPointerException</code> is thrown.
 *
 * @param extension The extension object to be registered
 * @throws RemoteException
 * @throws RuntimeFault    either because of the web service itself, or because of the service
 *                         provider unable to handle the request.
 */
void registerExtension(Extension extension) throws RuntimeFault, RemoteException;
项目:jcloud-vsphere    文件:ExtensionManagerApi.java   
/**
 * Find the extension based on the unique key of the plugin
 * If <code>keyStr</code> is null then a <code>NullPointerException</code>
 *
 * @param keyStr The unique key for the plugin
 * @return The extension object found with the unique key
 * @throws RemoteException
 * @throws RuntimeFault
 * @throws RemoteException if something is wrong with web service call,
 *                         either because of the web service itself, or because of the service
 *                         provider unable to handle the request.
 */
Extension findExtension(String keyStr) throws RuntimeFault, RemoteException;
项目:vijava    文件:ExtensionManager.java   
/**
 * Retrieve all the registered plugins objects
 * 
 * @return An array of extension objects. If no extension found, an empty
 *         array is returned.
 */

public Extension[] getExtensionList()
{
  return (Extension[]) getCurrentProperty("extensionList");
}