public class ServiceModelManager extends org.eclipse.core.runtime.PlatformObject implements IServiceModelManager
| Modifier and Type | Method and Description |
|---|---|
void |
addConfiguration(org.eclipse.core.resources.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(java.lang.String filename,
IServiceConfiguration[] configs)
Export a set of service configurations to a file.
|
IServiceConfiguration |
getActiveConfiguration()
Get the global "active" service configuration.
|
IServiceConfiguration |
getActiveConfiguration(org.eclipse.core.resources.IProject project)
Get the configuration that is currently active for the project.
|
java.util.Set<IServiceCategory> |
getCategories()
Returns all the service categories that have been registered with
the system.
|
IServiceConfiguration |
getConfiguration(org.eclipse.core.resources.IProject project,
java.lang.String name)
Get the named configuration for this project.
|
IServiceConfiguration |
getConfiguration(java.lang.String id)
Get the configuration with the specified ID.
|
java.util.Set<IServiceConfiguration> |
getConfigurations()
Get all configurations available in the workspace.
|
java.util.Set<IServiceConfiguration> |
getConfigurations(org.eclipse.core.resources.IProject project)
Get all the configurations that are known by the project
|
static ServiceModelManager |
getInstance() |
java.util.Set<org.eclipse.core.resources.IProject> |
getProjectsForConfiguration(IServiceConfiguration serviceConfiguration)
Get the set of projects which use the specified service configuration
|
IService |
getService(java.lang.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.
|
java.util.Set<IService> |
getServices()
Get all the services that have been registered with the system.
|
java.util.Set<IService> |
getServices(org.eclipse.core.resources.IProject project)
Get all the services that are used by a particular project.
|
java.util.Set<IService> |
getServices(java.lang.String natureId)
Get all the services that are associated with a project nature.
|
IServiceConfiguration[] |
importConfigurations(java.lang.String filename)
Import a set of service configurations from a file.
|
boolean |
isConfigured(org.eclipse.core.resources.IProject project)
Returns true if the given project has a configuration.
|
boolean |
isValidConfigurationFile(java.lang.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(java.io.Reader reader)
Replaces the current service model configuration with what is specified
in the given
file. |
IServiceConfiguration |
newServiceConfiguration(java.lang.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(org.eclipse.core.resources.IProject removedProject,
org.eclipse.core.resources.IProject addedProject)
Remaps all the configurations and services associated to the removed project to the added project.
|
void |
remove(org.eclipse.core.resources.IProject project)
Removes all the configurations and services associated to the given project.
|
void |
remove(IServiceConfiguration conf)
Removes the service configuration.
|
void |
removeConfiguration(org.eclipse.core.resources.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(java.io.Writer writer)
Saves the service model configuration to the given
file. |
void |
setActiveConfiguration(org.eclipse.core.resources.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(org.eclipse.core.resources.IProject project,
IServiceConfiguration conf)
IServiceModelManageraddConfiguration in interface IServiceModelManagerproject - the projectconf - the configurationpublic void addConfiguration(IServiceConfiguration conf)
IServiceModelManageraddConfiguration in interface IServiceModelManagerconf - 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 IServiceModelManagerlistener - the listenerIServiceModelEventListener,
IServiceModelEvent,
IServiceModelManager.removeEventListener(IServiceModelEventListener)public boolean exportConfigurations(java.lang.String filename,
IServiceConfiguration[] configs)
throws java.lang.reflect.InvocationTargetException
IServiceModelManagerexportConfigurations in interface IServiceModelManagerjava.lang.reflect.InvocationTargetException - wraps any exceptions thrown during exportpublic IServiceConfiguration getActiveConfiguration()
IServiceModelManagergetActiveConfiguration in interface IServiceModelManagerpublic IServiceConfiguration getActiveConfiguration(org.eclipse.core.resources.IProject project)
IServiceModelManagergetActiveConfiguration in interface IServiceModelManagerproject - project for which the configuration will be obtainedpublic java.util.Set<IServiceCategory> getCategories()
IServiceModelManagergetCategories in interface IServiceModelManagerpublic IServiceConfiguration getConfiguration(org.eclipse.core.resources.IProject project, java.lang.String name)
IServiceModelManagergetConfiguration in interface IServiceModelManagerproject - project for which the configuration will be obtainedname - name of the configurationpublic IServiceConfiguration getConfiguration(java.lang.String id)
IServiceModelManagergetConfiguration in interface IServiceModelManagerid - ID of the configurationpublic java.util.Set<IServiceConfiguration> getConfigurations()
IServiceModelManagergetConfigurations in interface IServiceModelManagerpublic java.util.Set<IServiceConfiguration> getConfigurations(org.eclipse.core.resources.IProject project)
IServiceModelManagergetConfigurations in interface IServiceModelManagerproject - project containing the configurationspublic java.util.Set<org.eclipse.core.resources.IProject> getProjectsForConfiguration(IServiceConfiguration serviceConfiguration)
getProjectsForConfiguration in interface IServiceModelManagerserviceConfiguration - The service configurationpublic IService getService(java.lang.String id)
IServiceModelManagergetService in interface IServiceModelManagerid - The unique id of the service to retrieve.public IServiceProvider getServiceProvider(IServiceProviderDescriptor desc)
IServiceModelManagergetServiceProvider in interface IServiceModelManagerdesc - extension descriptionpublic java.util.Set<IService> getServices()
IServiceModelManagergetServices in interface IServiceModelManagerpublic java.util.Set<IService> getServices(org.eclipse.core.resources.IProject project)
IServiceModelManagergetServices in interface IServiceModelManagerproject - project using the servicespublic java.util.Set<IService> getServices(java.lang.String natureId)
IServiceModelManagergetServices in interface IServiceModelManagerpublic IServiceConfiguration[] importConfigurations(java.lang.String filename) throws java.lang.reflect.InvocationTargetException
IServiceModelManagerIServiceModelManager.addConfiguration(IServiceConfiguration)
before they can be used. No model events will be generated while loading
the configurations.importConfigurations in interface IServiceModelManagerjava.lang.reflect.InvocationTargetException - wraps any exceptions thrown during importpublic boolean isConfigured(org.eclipse.core.resources.IProject project)
IServiceModelManagerisConfigured in interface IServiceModelManagerpublic boolean isValidConfigurationFile(java.lang.String filename)
IServiceModelManagerisValidConfigurationFile in interface IServiceModelManagerpublic void loadModelConfiguration()
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
org.eclipse.ptp.services.core plugin.java.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionpublic void loadModelConfiguration(java.io.Reader reader)
throws java.io.IOException,
org.eclipse.core.runtime.CoreException
file.
This method is not meant to be called outside of the
org.eclipse.ptp.services.core plugin.java.io.IOExceptionorg.eclipse.core.runtime.CoreExceptionpublic IServiceConfiguration newServiceConfiguration(java.lang.String name)
IServiceModelManagernewServiceConfiguration in interface IServiceModelManagername - name of service configurationpublic void notifyListeners(IServiceModelEvent event)
org.eclipse.ptp.services.core plugin.event - event to notifypublic void printServiceModel()
public void remap(org.eclipse.core.resources.IProject removedProject,
org.eclipse.core.resources.IProject addedProject)
IServiceModelManagerremap in interface IServiceModelManagerremovedProject - project removed from workspaceaddedProject - project added to workspacepublic void remove(org.eclipse.core.resources.IProject project)
IServiceModelManagerremove in interface IServiceModelManagerpublic void remove(IServiceConfiguration conf)
IServiceModelManagerremove in interface IServiceModelManagerconf - the configurationpublic void removeConfiguration(org.eclipse.core.resources.IProject project,
IServiceConfiguration conf)
IServiceModelManagerremoveConfiguration in interface IServiceModelManagerproject - the projectconf - the configurationpublic void removeEventListener(IServiceModelEventListener listener)
IServiceModelManagerremoveEventListener in interface IServiceModelManagerlistener - the listenerIServiceModelEventListener,
IServiceModelEvent,
#addEventListener(IServiceModelEventListener)public void saveModelConfiguration()
throws java.io.IOException
org.eclipse.ptp.services.core plugin.java.io.IOExceptionpublic void saveModelConfiguration(java.io.Writer writer)
throws java.io.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 - java.io.IOExceptionjava.lang.NullPointerException - if file is nullpublic void setActiveConfiguration(org.eclipse.core.resources.IProject project,
IServiceConfiguration configuration)
IServiceModelManagersetActiveConfiguration in interface IServiceModelManagerproject - project for which the configuration will be obtainedconfiguration - configuration to set as active for this projectpublic void setActiveConfiguration(IServiceConfiguration config)
IServiceModelManagersetActiveConfiguration in interface IServiceModelManagerconfig - the service configuration to select as activeCopyright (c) 2011 IBM Corporation and others. All Rights Reserved.