org.jclouds.karaf.commands.compute
Class ComputeCommandBase

java.lang.Object
  extended by org.apache.karaf.shell.console.AbstractAction
      extended by org.jclouds.karaf.commands.compute.ComputeCommandBase
All Implemented Interfaces:
org.apache.felix.gogo.commands.Action
Direct Known Subclasses:
ComputeCommandWithOptions, ComputeServiceDestroyCommand, ComputeServiceListCommand

public abstract class ComputeCommandBase
extends org.apache.karaf.shell.console.AbstractAction

Author:
Guillaume Nodet (gnodet)

Field Summary
protected  CacheProvider cacheProvider
           
protected  List<org.jclouds.compute.ComputeService> computeServices
           
protected  org.osgi.service.cm.ConfigurationAdmin configAdmin
           
static String FACTORY_FILTER
           
static String NODE_DETAILS_FORMAT
           
static String PROVIDERFORMAT
           
protected  ShellTableFactory shellTableFactory
           
 
Fields inherited from class org.apache.karaf.shell.console.AbstractAction
log, session
 
Constructor Summary
ComputeCommandBase()
           
 
Method Summary
 Object execute(org.apache.felix.service.command.CommandSession session)
           
protected  org.osgi.service.cm.Configuration findOrCreateFactoryConfiguration(org.osgi.service.cm.ConfigurationAdmin configurationAdmin, String factoryPid, String id, String provider, String api)
          Finds a Configuration if exists, or creates a new one.
protected  Set<? extends org.jclouds.domain.Location> getAllLocations(org.jclouds.compute.ComputeService computeService)
           
 CacheProvider getCacheProvider()
           
 List<org.jclouds.compute.ComputeService> getComputeServices()
           
 org.osgi.service.cm.ConfigurationAdmin getConfigAdmin()
           
protected  double getCpuCores(org.jclouds.compute.domain.Hardware hardware)
           
protected  double getCpuUnits(org.jclouds.compute.domain.Hardware hardware)
           
protected  double getMemory(org.jclouds.compute.domain.Hardware hardware)
           
protected  String getOperatingSystemDetails(org.jclouds.compute.domain.NodeMetadata node)
          Returns a String that displays the OperatingSystem details.
protected  String getPrivateAddresses(org.jclouds.compute.domain.NodeMetadata node)
          Returns a comma separated list of the private addresses.
protected  String getPublicAddresses(org.jclouds.compute.domain.NodeMetadata node)
          Returns a comma separated list of the public addresses.
 ShellTableFactory getShellTableFactory()
           
protected  void printComputeApis(Iterable<org.jclouds.apis.ApiMetadata> apis, List<org.jclouds.compute.ComputeService> computeServices, String indent, PrintStream out)
           
protected  void printComputeProviders(Iterable<org.jclouds.providers.ProviderMetadata> providers, List<org.jclouds.compute.ComputeService> computeServices, String indent, PrintStream out)
           
protected  void printHardwares(org.jclouds.compute.ComputeService service, Set<? extends org.jclouds.compute.domain.Hardware> hardwares, PrintStream out)
           
protected  void printImages(org.jclouds.compute.ComputeService service, Set<? extends org.jclouds.compute.domain.Image> images, PrintStream out)
           
protected  void printLocations(org.jclouds.compute.ComputeService computeService, PrintStream out)
           
protected  void printNodeInfo(org.jclouds.compute.ComputeService service, Set<? extends org.jclouds.compute.domain.NodeMetadata> nodes, boolean details, PrintStream out)
           
protected  void printNodes(org.jclouds.compute.ComputeService service, Set<? extends org.jclouds.compute.domain.ComputeMetadata> nodes, PrintStream out)
           
 void setCacheProvider(CacheProvider cacheProvider)
           
 void setComputeServices(List<org.jclouds.compute.ComputeService> computeServices)
           
 void setConfigAdmin(org.osgi.service.cm.ConfigurationAdmin configAdmin)
           
 void setShellTableFactory(ShellTableFactory shellTableFactory)
           
 
Methods inherited from class org.apache.karaf.shell.console.AbstractAction
doExecute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_DETAILS_FORMAT

public static final String NODE_DETAILS_FORMAT
See Also:
Constant Field Values

PROVIDERFORMAT

public static final String PROVIDERFORMAT
See Also:
Constant Field Values

FACTORY_FILTER

public static final String FACTORY_FILTER
See Also:
Constant Field Values

configAdmin

protected org.osgi.service.cm.ConfigurationAdmin configAdmin

cacheProvider

protected CacheProvider cacheProvider

computeServices

protected List<org.jclouds.compute.ComputeService> computeServices

shellTableFactory

protected ShellTableFactory shellTableFactory
Constructor Detail

ComputeCommandBase

public ComputeCommandBase()
Method Detail

execute

public Object execute(org.apache.felix.service.command.CommandSession session)
               throws Exception
Specified by:
execute in interface org.apache.felix.gogo.commands.Action
Overrides:
execute in class org.apache.karaf.shell.console.AbstractAction
Throws:
Exception

printComputeProviders

protected void printComputeProviders(Iterable<org.jclouds.providers.ProviderMetadata> providers,
                                     List<org.jclouds.compute.ComputeService> computeServices,
                                     String indent,
                                     PrintStream out)

printComputeApis

protected void printComputeApis(Iterable<org.jclouds.apis.ApiMetadata> apis,
                                List<org.jclouds.compute.ComputeService> computeServices,
                                String indent,
                                PrintStream out)

printNodes

protected void printNodes(org.jclouds.compute.ComputeService service,
                          Set<? extends org.jclouds.compute.domain.ComputeMetadata> nodes,
                          PrintStream out)

printHardwares

protected void printHardwares(org.jclouds.compute.ComputeService service,
                              Set<? extends org.jclouds.compute.domain.Hardware> hardwares,
                              PrintStream out)

printImages

protected void printImages(org.jclouds.compute.ComputeService service,
                           Set<? extends org.jclouds.compute.domain.Image> images,
                           PrintStream out)

printLocations

protected void printLocations(org.jclouds.compute.ComputeService computeService,
                              PrintStream out)

getAllLocations

protected Set<? extends org.jclouds.domain.Location> getAllLocations(org.jclouds.compute.ComputeService computeService)

getOperatingSystemDetails

protected String getOperatingSystemDetails(org.jclouds.compute.domain.NodeMetadata node)
Returns a String that displays the OperatingSystem details.

Parameters:
node -
Returns:

getPublicAddresses

protected String getPublicAddresses(org.jclouds.compute.domain.NodeMetadata node)
Returns a comma separated list of the public addresses.

Parameters:
node -
Returns:

getPrivateAddresses

protected String getPrivateAddresses(org.jclouds.compute.domain.NodeMetadata node)
Returns a comma separated list of the private addresses.

Parameters:
node -
Returns:

printNodeInfo

protected void printNodeInfo(org.jclouds.compute.ComputeService service,
                             Set<? extends org.jclouds.compute.domain.NodeMetadata> nodes,
                             boolean details,
                             PrintStream out)

findOrCreateFactoryConfiguration

protected org.osgi.service.cm.Configuration findOrCreateFactoryConfiguration(org.osgi.service.cm.ConfigurationAdmin configurationAdmin,
                                                                             String factoryPid,
                                                                             String id,
                                                                             String provider,
                                                                             String api)
                                                                      throws IOException
Finds a Configuration if exists, or creates a new one.

Parameters:
configurationAdmin -
factoryPid -
provider -
api -
Returns:
Throws:
IOException

getMemory

protected double getMemory(org.jclouds.compute.domain.Hardware hardware)

getCpuCores

protected double getCpuCores(org.jclouds.compute.domain.Hardware hardware)

getCpuUnits

protected double getCpuUnits(org.jclouds.compute.domain.Hardware hardware)

getConfigAdmin

public org.osgi.service.cm.ConfigurationAdmin getConfigAdmin()

setConfigAdmin

public void setConfigAdmin(org.osgi.service.cm.ConfigurationAdmin configAdmin)

getCacheProvider

public CacheProvider getCacheProvider()

setCacheProvider

public void setCacheProvider(CacheProvider cacheProvider)

getComputeServices

public List<org.jclouds.compute.ComputeService> getComputeServices()

setComputeServices

public void setComputeServices(List<org.jclouds.compute.ComputeService> computeServices)

getShellTableFactory

public ShellTableFactory getShellTableFactory()

setShellTableFactory

public void setShellTableFactory(ShellTableFactory shellTableFactory)


Copyright © 2013. All Rights Reserved.