org.apache.karaf.shell.config
Class ConfigCommandSupport

java.lang.Object
  extended by org.apache.karaf.shell.console.AbstractAction
      extended by org.apache.karaf.shell.console.OsgiCommandSupport
          extended by org.apache.karaf.shell.config.ConfigCommandSupport
All Implemented Interfaces:
org.apache.felix.gogo.commands.Action, org.apache.karaf.shell.console.BundleContextAware
Direct Known Subclasses:
CancelCommand, ConfigPropertyCommandSupport, DeleteCommand, EditCommand, ListCommand, UpdateCommand

public abstract class ConfigCommandSupport
extends org.apache.karaf.shell.console.OsgiCommandSupport

Abstract class from which all commands related to the ConfigurationAdmin service should derive. This command retrieves a reference to the ConfigurationAdmin service before calling another method to actually process the command.


Field Summary
static String PROPERTY_CONFIG_PID
           
static String PROPERTY_CONFIG_PROPS
           
protected  File storage
           
 
Fields inherited from class org.apache.karaf.shell.console.OsgiCommandSupport
bundleContext, usedReferences
 
Fields inherited from class org.apache.karaf.shell.console.AbstractAction
log, session
 
Constructor Summary
ConfigCommandSupport()
           
 
Method Summary
protected  void deleteStorage(String pid)
           
protected  Object doExecute()
           
protected abstract  void doExecute(org.osgi.service.cm.ConfigurationAdmin admin)
           
 org.osgi.service.cm.Configuration findConfigurationByFileName(org.osgi.service.cm.ConfigurationAdmin admin, String fileName)
           Returns the Configuration object of the given (felix fileinstall) file name.
protected  org.osgi.service.cm.ConfigurationAdmin getConfigurationAdmin()
           
protected  Dictionary getEditedProps()
           
 File getStorage()
           
protected  String[] parsePid(String pid)
           
protected  void persistConfiguration(org.osgi.service.cm.ConfigurationAdmin admin, String pid, Dictionary props)
          Persists configuration to storage.
 void setArtifactInstallers(List<org.apache.felix.fileinstall.ArtifactInstaller> artifactInstallers)
           
 void setStorage(File storage)
           
protected  void update(org.osgi.service.cm.ConfigurationAdmin admin, String pid, Dictionary props, boolean bypassStorage)
          Saves config to storage or ConfigurationAdmin.
 void updateConfiguration(org.osgi.service.cm.ConfigurationAdmin admin, String pid, Dictionary props)
          Updates the configuration to the ConfigurationAdmin service.
 
Methods inherited from class org.apache.karaf.shell.console.OsgiCommandSupport
execute, getAllServices, getBundleContext, getService, setBundleContext, ungetServices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CONFIG_PID

public static final String PROPERTY_CONFIG_PID
See Also:
Constant Field Values

PROPERTY_CONFIG_PROPS

public static final String PROPERTY_CONFIG_PROPS
See Also:
Constant Field Values

storage

protected File storage
Constructor Detail

ConfigCommandSupport

public ConfigCommandSupport()
Method Detail

doExecute

protected Object doExecute()
                    throws Exception
Specified by:
doExecute in class org.apache.karaf.shell.console.AbstractAction
Throws:
Exception

getEditedProps

protected Dictionary getEditedProps()
                             throws Exception
Throws:
Exception

getConfigurationAdmin

protected org.osgi.service.cm.ConfigurationAdmin getConfigurationAdmin()

doExecute

protected abstract void doExecute(org.osgi.service.cm.ConfigurationAdmin admin)
                           throws Exception
Throws:
Exception

findConfigurationByFileName

public org.osgi.service.cm.Configuration findConfigurationByFileName(org.osgi.service.cm.ConfigurationAdmin admin,
                                                                     String fileName)
                                                              throws IOException,
                                                                     org.osgi.framework.InvalidSyntaxException

Returns the Configuration object of the given (felix fileinstall) file name.

Parameters:
fileName -
Returns:
Throws:
IOException
org.osgi.framework.InvalidSyntaxException

update

protected void update(org.osgi.service.cm.ConfigurationAdmin admin,
                      String pid,
                      Dictionary props,
                      boolean bypassStorage)
               throws IOException
Saves config to storage or ConfigurationAdmin.

Parameters:
admin -
pid -
props -
bypassStorage -
Throws:
IOException

persistConfiguration

protected void persistConfiguration(org.osgi.service.cm.ConfigurationAdmin admin,
                                    String pid,
                                    Dictionary props)
                             throws IOException
Persists configuration to storage.

Parameters:
admin -
pid -
props -
Throws:
IOException

updateConfiguration

public void updateConfiguration(org.osgi.service.cm.ConfigurationAdmin admin,
                                String pid,
                                Dictionary props)
                         throws IOException
Updates the configuration to the ConfigurationAdmin service.

Parameters:
admin -
pid -
props -
Throws:
IOException

parsePid

protected String[] parsePid(String pid)

deleteStorage

protected void deleteStorage(String pid)
                      throws Exception
Throws:
Exception

getStorage

public File getStorage()

setStorage

public void setStorage(File storage)

setArtifactInstallers

public void setArtifactInstallers(List<org.apache.felix.fileinstall.ArtifactInstaller> artifactInstallers)


Copyright © 2007-2012 FuseSource, Corp.. All Rights Reserved.