public class ServiceModelManager extends PlatformObject implements IServiceModelManager
Modifier and Type | Method and Description |
---|---|
void |
addConfiguration(IProject project,
IServiceConfiguration conf)
Associate the service configuration with a project.
|
void |
addConfiguration(IServiceConfiguration conf)
Adds the given service configuration to the model without explicitly
associating it with a particular project.
|
void |
addEventListener(IServiceModelEventListener listener,
int type)
Adds the given listener for service model events.
|
boolean |
exportConfigurations(String filename,
IServiceConfiguration[] configs)
Export a set of service configurations to a file.
|
IServiceConfiguration |
getActiveConfiguration()
Get the global "active" service configuration.
|
IServiceConfiguration |
getActiveConfiguration(IProject project)
Get the configuration that is currently active for the project.
|
Set<IServiceCategory> |
getCategories()
Returns all the service categories that have been registered with
the system.
|
IServiceConfiguration |
getConfiguration(IProject project,
String name)
Get the named configuration for this project.
|
IServiceConfiguration |
getConfiguration(String id)
Get the configuration with the specified ID.
|
Set<IServiceConfiguration> |
getConfigurations()
Get all configurations available in the workspace.
|
Set<IServiceConfiguration> |
getConfigurations(IProject project)
Get all the configurations that are known by the project
|
static ServiceModelManager |
getInstance() |
Set<IProject> |
getProjectsForConfiguration(IServiceConfiguration serviceConfiguration)
Get the set of projects which use the specified service configuration
|
IService |
getService(String id)
Retrieves the service corresponding to a given id.
|
IServiceProvider |
getServiceProvider(IServiceProviderDescriptor desc)
Return a new instance of a service provider based on the descriptor.
|
Set<IService> |
getServices()
Get all the services that have been registered with the system.
|
Set<IService> |
getServices(IProject project)
Get all the services that are used by a particular project.
|
IServiceConfiguration[] |
importConfigurations(String filename)
Import a set of service configurations from a file.
|
boolean |
isConfigured(IProject project)
Returns true if the given project has a configuration.
|
boolean |
isValidConfigurationFile(String filename)
Validate a set of service configurations in a file
|
void |
loadModelConfiguration()
Replaces the current service model configuration with what is specified
in the default save file.
|
void |
loadModelConfiguration(Reader reader)
Replaces the current service model configuration with what is specified
in the given
file . |
IServiceConfiguration |
newServiceConfiguration(String name)
Obtain a new service configuration with name 'name'.
|
void |
notifyListeners(IServiceModelEvent event)
Notify listeners of an event occurrence.
|
void |
printServiceModel()
Prints the current service model to the console, for debugging purposes.
|
void |
remap(IProject removedProject,
IProject addedProject)
Remaps all the configurations and services associated to the removed project to the added project.
|
void |
remove(IProject project)
Removes all the configurations and services associated to the given project.
|
void |
removeConfiguration(IProject project,
IServiceConfiguration conf)
TODO What happens if you try to remove the active configuration?
|
void |
removeEventListener(IServiceModelEventListener listener)
Removes the given listener for service model events.
|
void |
saveModelConfiguration()
Saves the model configuration into the plugin's metadata area using the
default file name.
|
void |
saveModelConfiguration(Writer writer)
Saves the service model configuration to the given
file . |
void |
setActiveConfiguration(IProject project,
IServiceConfiguration configuration)
Set the active configuration for a project.
|
void |
setActiveConfiguration(IServiceConfiguration config)
Set the global "active" service configuration.
|
public static ServiceModelManager getInstance()
public void addConfiguration(IProject project, IServiceConfiguration conf)
IServiceModelManager
addConfiguration
in interface IServiceModelManager
project
- the projectconf
- the configurationpublic void addConfiguration(IServiceConfiguration conf)
IServiceModelManager
addConfiguration
in interface IServiceModelManager
conf
- the configurationpublic void addEventListener(IServiceModelEventListener listener, int type)
IServiceModelManager
Listeners can listen for several types of event as defined in
IServiceModelEvent
. Clients are free to register for
any number of event types. Clients are guaranteed to only receive
event types for which they are registered.
addEventListener
in interface IServiceModelManager
listener
- the listenerIServiceModelEventListener
,
IServiceModelEvent
,
IServiceModelManager.removeEventListener(IServiceModelEventListener)
public boolean exportConfigurations(String filename, IServiceConfiguration[] configs) throws InvocationTargetException
IServiceModelManager
exportConfigurations
in interface IServiceModelManager
InvocationTargetException
- wraps any exceptions thrown during exportpublic IServiceConfiguration getActiveConfiguration()
IServiceModelManager
getActiveConfiguration
in interface IServiceModelManager
public IServiceConfiguration getActiveConfiguration(IProject project)
IServiceModelManager
getActiveConfiguration
in interface IServiceModelManager
project
- project for which the configuration will be obtainedpublic Set<IServiceCategory> getCategories()
IServiceModelManager
getCategories
in interface IServiceModelManager
public IServiceConfiguration getConfiguration(IProject project, String name)
IServiceModelManager
getConfiguration
in interface IServiceModelManager
project
- project for which the configuration will be obtainedname
- name of the configurationpublic IServiceConfiguration getConfiguration(String id)
IServiceModelManager
getConfiguration
in interface IServiceModelManager
id
- ID of the configurationpublic Set<IServiceConfiguration> getConfigurations()
IServiceModelManager
getConfigurations
in interface IServiceModelManager
public Set<IServiceConfiguration> getConfigurations(IProject project)
IServiceModelManager
getConfigurations
in interface IServiceModelManager
project
- project containing the configurationspublic Set<IProject> getProjectsForConfiguration(IServiceConfiguration serviceConfiguration)
getProjectsForConfiguration
in interface IServiceModelManager
serviceConfiguration
- The service configurationpublic IService getService(String id)
IServiceModelManager
getService
in interface IServiceModelManager
id
- The unique id of the service to retrieve.public IServiceProvider getServiceProvider(IServiceProviderDescriptor desc)
IServiceModelManager
getServiceProvider
in interface IServiceModelManager
desc
- extension descriptionpublic Set<IService> getServices()
IServiceModelManager
getServices
in interface IServiceModelManager
public Set<IService> getServices(IProject project)
IServiceModelManager
getServices
in interface IServiceModelManager
project
- project using the servicespublic IServiceConfiguration[] importConfigurations(String filename) throws InvocationTargetException
IServiceModelManager
IServiceModelManager.addConfiguration(IServiceConfiguration)
before they can be used. No model events will be generated while loading
the configurations.importConfigurations
in interface IServiceModelManager
InvocationTargetException
- wraps any exceptions thrown during importpublic boolean isConfigured(IProject project)
IServiceModelManager
isConfigured
in interface IServiceModelManager
public boolean isValidConfigurationFile(String filename)
IServiceModelManager
isValidConfigurationFile
in interface IServiceModelManager
public void loadModelConfiguration() throws IOException, CoreException
org.eclipse.ptp.services.core plugin.
IOException
CoreException
public void loadModelConfiguration(Reader reader) throws IOException, CoreException
file
.
This method is not meant to be called outside of the
org.eclipse.ptp.services.core plugin.
IOException
CoreException
public IServiceConfiguration newServiceConfiguration(String name)
IServiceModelManager
newServiceConfiguration
in interface IServiceModelManager
name
- name of service configurationpublic void notifyListeners(IServiceModelEvent event)
org.eclipse.ptp.services.core plugin.
event
- event to notifypublic void printServiceModel()
public void remap(IProject removedProject, IProject addedProject)
IServiceModelManager
remap
in interface IServiceModelManager
removedProject
- project removed from workspaceaddedProject
- project added to workspacepublic void remove(IProject project)
IServiceModelManager
remove
in interface IServiceModelManager
public void removeConfiguration(IProject project, IServiceConfiguration conf)
IServiceModelManager
removeConfiguration
in interface IServiceModelManager
project
- the projectconf
- the configurationpublic void removeEventListener(IServiceModelEventListener listener)
IServiceModelManager
removeEventListener
in interface IServiceModelManager
listener
- the listenerIServiceModelEventListener
,
IServiceModelEvent
,
#addEventListener(IServiceModelEventListener)
public void saveModelConfiguration() throws IOException
org.eclipse.ptp.services.core plugin.
IOException
public void saveModelConfiguration(Writer writer) throws IOException
file
.
Will not save data for projects that do not exist.
This method is not meant to be called outside of the
org.eclipse.ptp.services.core plugin.
file
- IOException
NullPointerException
- if file is nullpublic void setActiveConfiguration(IProject project, IServiceConfiguration configuration)
IServiceModelManager
setActiveConfiguration
in interface IServiceModelManager
project
- project for which the configuration will be obtainedconfiguration
- configuration to set as active for this projectpublic void setActiveConfiguration(IServiceConfiguration config)
IServiceModelManager
setActiveConfiguration
in interface IServiceModelManager
config
- the service configuration to select as activeCopyright (c) 2011 IBM Corporation and others. All Rights Reserved.