PTP
Release 7.0

org.eclipse.ptp.services.core
Interface IServiceModelManager

All Superinterfaces:
org.eclipse.core.runtime.IAdaptable
All Known Implementing Classes:
ServiceModelManager

public interface IServiceModelManager
extends org.eclipse.core.runtime.IAdaptable


Method Summary
 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
 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
 IServiceConfiguration newServiceConfiguration(java.lang.String name)
          Obtain a new service configuration with name 'name'.
 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 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.
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Method Detail

addConfiguration

void addConfiguration(org.eclipse.core.resources.IProject project,
                      IServiceConfiguration conf)
Associate the service configuration with a project. A project can have multiple service configurations. The service configuration will become the active configuration for the project.

Parameters:
project - the project
conf - the configuration
Throws:
java.lang.NullPointerException - if project or conf is null

addConfiguration

void addConfiguration(IServiceConfiguration conf)
Adds the given service configuration to the model without explicitly associating it with a particular project. It may be associated with a project later using the addConfiguration(IProject, IServiceConfiguration) method.

Parameters:
project - the project
conf - the configuration
Throws:
java.lang.NullPointerException - if conf is null

addEventListener

void addEventListener(IServiceModelEventListener listener,
                      int type)
Adds the given listener for service model events. Has no effect if an identical listener is already registered.

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.

Parameters:
listener - the listener
eventMask - the bit-wise OR of all event types of interest to the listener
See Also:
IServiceModelEventListener, IServiceModelEvent, removeEventListener(IServiceModelEventListener)

exportConfigurations

boolean exportConfigurations(java.lang.String filename,
                             IServiceConfiguration[] configs)
                             throws java.lang.reflect.InvocationTargetException
Export a set of service configurations to a file.

Parameters:
file - file name used to save the configuration
Returns:
service configurations to export
Throws:
java.lang.reflect.InvocationTargetException - wraps any exceptions thrown during export

getActiveConfiguration

IServiceConfiguration getActiveConfiguration()
Get the global "active" service configuration. The "active" configuration is an arbitrary configuration can be used by tools that do not operate on a project basis.

Returns:
active service configuration, or null if no active configuration has been set

getActiveConfiguration

IServiceConfiguration getActiveConfiguration(org.eclipse.core.resources.IProject project)
Get the configuration that is currently active for the project. Each project has exactly one active configuration, which describes the mapping from services to service providers. By default, the first configuration created for a project will be the active configuration for that project.

Parameters:
project - project for which the configuration will be obtained
Returns:
the service configuration for this project
Throws:
java.lang.NullPointerException - if project is null
ProjectNotConfiguredException - if the project has not been configured

getCategories

java.util.Set<IServiceCategory> getCategories()
Returns all the service categories that have been registered with the system.

Returns:

getConfiguration

IServiceConfiguration getConfiguration(org.eclipse.core.resources.IProject project,
                                       java.lang.String name)
Get the named configuration for this project.

Parameters:
project - project for which the configuration will be obtained
name - name of the configuration
Returns:
the service configuration or null if no configurations with the supplied name exist
Throws:
java.lang.NullPointerException - if project is null
ProjectNotConfiguredException - if the project has not been configured

getConfiguration

IServiceConfiguration getConfiguration(java.lang.String id)
Get the configuration with the specified ID.

Parameters:
id - ID of the configuration
Returns:
the service configuration or null if no configurations with the supplied ID exist

getConfigurations

java.util.Set<IServiceConfiguration> getConfigurations()
Get all configurations available in the workspace.

Returns:
all configurations that could be found, or an empty set

getConfigurations

java.util.Set<IServiceConfiguration> getConfigurations(org.eclipse.core.resources.IProject project)
Get all the configurations that are known by the project

Parameters:
project - project containing the configurations
Returns:
set of configurations known by the project
Throws:
java.lang.NullPointerException - if project is null
ProjectNotConfiguredException - if the project has not been configured

getProjectsForConfiguration

java.util.Set<org.eclipse.core.resources.IProject> getProjectsForConfiguration(IServiceConfiguration serviceConfiguration)
Get the set of projects which use the specified service configuration

Parameters:
serviceConfiguration - Service configuration to query set of projects using it
Returns:
Set of projects using the service configuration

getService

IService getService(java.lang.String id)
Retrieves the service corresponding to a given id.

Parameters:
id - The unique id of the service to retrieve.
Returns:
IService or null

getServiceProvider

IServiceProvider getServiceProvider(IServiceProviderDescriptor desc)
Return a new instance of a service provider based on the descriptor.

Parameters:
desc - extension description
Returns:
service provider

getServices

java.util.Set<IService> getServices()
Get all the services that have been registered with the system.

Returns:
a set of all the services

getServices

java.util.Set<IService> getServices(org.eclipse.core.resources.IProject project)
Get all the services that are used by a particular project.

Parameters:
project - project using the services
Returns:
set of services
Throws:
java.lang.NullPointerException - if project is null
ProjectNotConfiguredException - if the project has not been configured

getServices

java.util.Set<IService> getServices(java.lang.String natureID)
Get all the services that are associated with a project nature.

Parameters:
nature - project nature
Returns:
set of services or null

importConfigurations

IServiceConfiguration[] importConfigurations(java.lang.String filename)
                                             throws java.lang.reflect.InvocationTargetException
Import a set of service configurations from a file. The configurations must be added to the model using addConfiguration(IServiceConfiguration) before they can be used. No model events will be generated while loading the configurations.

Parameters:
file - file name containing the configuration
Returns:
imported service configurations
Throws:
java.lang.reflect.InvocationTargetException - wraps any exceptions thrown during import

isConfigured

boolean isConfigured(org.eclipse.core.resources.IProject project)
Returns true if the given project has a configuration.


isValidConfigurationFile

boolean isValidConfigurationFile(java.lang.String filename)
Validate a set of service configurations in a file

Parameters:
file - file name of the file containing the configurations
Returns:
true if valid, false otherwise

newServiceConfiguration

IServiceConfiguration newServiceConfiguration(java.lang.String name)
Obtain a new service configuration with name 'name'. The name does not need to be unique. This service configuration will not become part of the service model until it is passed to one of the addConfiguration() methods.

Parameters:
name - name of service configuration
Returns:
new service configuration

remap

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.

Parameters:
removedProject - project removed from workspace
addedProject - project added to workspace
Since:
2.0

remove

void remove(org.eclipse.core.resources.IProject project)
Removes all the configurations and services associated to the given project. If the project has not been configured then this method does nothing.

Throws:
java.lang.NullPointerException - if project is null

remove

void remove(IServiceConfiguration conf)
Removes the service configuration.

Parameters:
conf - the configuration

removeConfiguration

void removeConfiguration(org.eclipse.core.resources.IProject project,
                         IServiceConfiguration conf)
TODO What happens if you try to remove the active configuration? TODO What happens if there are no configurations left after removing the given configuration? Remove the service configuration from a project. If the configuration was not set up on the project then this method does nothing.

Parameters:
project - the project
conf - the configuration
Throws:
java.lang.NullPointerException - if project or conf is null
ProjectNotConfiguredException - if the project has not been configured

removeEventListener

void removeEventListener(IServiceModelEventListener listener)
Removes the given listener for service model events. Has no effect if the listener is not registered.

Parameters:
listener - the listener
See Also:
IServiceModelEventListener, IServiceModelEvent, #addEventListener(IServiceModelEventListener)

setActiveConfiguration

void setActiveConfiguration(org.eclipse.core.resources.IProject project,
                            IServiceConfiguration configuration)
Set the active configuration for a project. By default, the first configuration created for a project will be the active configuration for that project.

Parameters:
project - project for which the configuration will be obtained
configuration - configuration to set as active for this project
Throws:
java.lang.NullPointerException - if project or configuration is null
ProjectNotConfiguredException - if the project has not been configured yet
java.lang.IllegalArgumentException - if the configuration was not part of the project

setActiveConfiguration

void setActiveConfiguration(IServiceConfiguration config)
Set the global "active" service configuration. The "active" configuration is an arbitrary configuration can be used by tools that do not operate on a project basis.

Parameters:
config - the service configuration to select as active

PTP
Release 7.0

Copyright (c) 2011 IBM Corporation and others. All Rights Reserved.