## org.eclipse.wst.ws.service.policy
Class ServicePolicyPlatform

    java.lang.Object
      org.eclipse.wst.ws.service.policy.ServicePolicyPlatform

    public class ServicePolicyPlatform

extends java.lang.Object

This class is used to access and add service policies to the platform.

Method Summary
`void` `addChildChangeListener(IPolicyChildChangeListener listener, boolean onCommit)` This method allows calls to listener to any child change that is made in the service policy platform regardless of where it is located in the tree of service policies.
`void` `addProjectLoadListener(IPolicyPlatformProjectLoadListener listener)` Add a project platform listener.
`void` `commitChanges()` Calling this method will commit all the state changes that were made to all the service policies.
`void` `commitChanges(org.eclipse.core.resources.IProject project)` Calling this method will commit all the state changes that were made to all the service policies for a particular project.
`IServicePolicy` `createServicePolicy(IServicePolicy parent, java.lang.String id, java.lang.String enumListId, java.lang.String defaultEnumId)` This method creates an IServicePolicy object.
`void` `discardChanges()` Calling this method will discard all the state changes that were made to all the service policies.
`void` `discardChanges(org.eclipse.core.resources.IProject project)` Calling this method will discard all the state changes that were made to all the service policies for a particular project.
`java.util.Set<java.lang.String>` `getAllPolicyIds()` Returns all service policy IDs that are defined.
`static ServicePolicyPlatform` `getInstance()` Returns a singleton instance of this service policy platform.
`java.util.List<IServicePolicy>` `getRootServicePolicies(IFilter filter)` Returns the list of root policies for the platform given a filter.
`IServicePolicy` `getServicePolicy(java.lang.String id)` Returns a service policy given it's unique ID.
`java.util.List<IStateEnumerationItem>` `getStateEnumeration(java.lang.String enumId)`
`IStateEnumerationItem` `getStateItemEnumeration(java.lang.String stateItemId)`
`boolean` `isEnabled(java.lang.Object object)` Indicates if the property page for a project should be displayed in a popup menu or not.
`boolean` `isProjectPreferencesEnabled(org.eclipse.core.resources.IProject project)` Returns if the particular project has been enabled or not on it's service policy property page.
`void` `queueChildChangeListeners(boolean queue)` Indicates whether child change listeners should be queued or not.
`void` `removeChildChangeListener(IPolicyChildChangeListener listener, boolean onCommit)` Removes a child change listener from the service policy platform.
`void` `removeProjectLoadListener(IPolicyPlatformProjectLoadListener listener)` Removes a project platform listener.
`void` `removeServicePolicy(IServicePolicy policy)` Removes a service policy from the service policy platform.
`void` `restoreDefaults()` Restores the workspace level defaults.
`void` `restoreDefaults(org.eclipse.core.resources.IProject project)` Restores the project level defaults.
`void` `setProjectPreferencesEnabled(org.eclipse.core.resources.IProject project, boolean value)` Sets whether a project specific service policy preferences is enabled or not.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static ServicePolicyPlatform getInstance()

  Returns a singleton instance of this service policy platform.

  Returns:
    returns a singleton instance of this service policy platform.

### isEnabled

    public boolean isEnabled(java.lang.Object object)

  Indicates if the property page for a project should be displayed in a popup menu or not.

  Parameters:
    `object` -
  Returns:
    returns true if this platform is enabled for specified object. In most cases the specified object will be an IProject. This method is usually called to determine if a the service policy entry should appear for a particular project.

### commitChanges

    public void commitChanges()

  Calling this method will commit all the state changes that were made to all the service policies. The method only applies to state changes at the workspace level.

### discardChanges

    public void discardChanges()

  Calling this method will discard all the state changes that were made to all the service policies. The method only applies to state changes at the workspace level.

### commitChanges

    public void commitChanges(org.eclipse.core.resources.IProject project)

  Calling this method will commit all the state changes that were made to all the service policies for a particular project. The method only applies to state changes at the project level.

### discardChanges

    public void discardChanges(org.eclipse.core.resources.IProject project)

  Calling this method will discard all the state changes that were made to all the service policies for a particular project. The method only applies to state changes at the project level.

### getAllPolicyIds

    public java.util.Set<java.lang.String> getAllPolicyIds()

  Returns all service policy IDs that are defined.

  Returns:
    returns all service policy IDs that are defined.

### getRootServicePolicies

    public java.util.List<IServicePolicy> getRootServicePolicies(IFilter filter)

  Returns the list of root policies for the platform given a filter.

  Parameters:
    `filter` - a filter a the service policies. This method may be null if no filter is required.
  Returns:
    returns all root level service policies. If a filter is specified some service policies may be removed from the returned list. A root level service policy is defined to be a service policy with no parent.

### getServicePolicy

    public IServicePolicy getServicePolicy(java.lang.String id)

  Returns a service policy given it's unique ID.

  Parameters:
    `id` -
  Returns:
    returns a service policy given it's unique ID.

### isProjectPreferencesEnabled

    public boolean isProjectPreferencesEnabled(org.eclipse.core.resources.IProject project)

  Returns if the particular project has been enabled or not on it's service policy property page.

  Parameters:
    `project` -
  Returns:
    returns true if the specified project has been enabled for project specific policy preferences.

### setProjectPreferencesEnabled

    public void setProjectPreferencesEnabled(org.eclipse.core.resources.IProject project,
                                             boolean value)

  Sets whether a project specific service policy preferences is enabled or not.

  Parameters:
    `project` -
    `value` -

### restoreDefaults

    public void restoreDefaults()

  Restores the workspace level defaults. Note: the state changes made by calling this method need to be committed or discarded by the platform.

### restoreDefaults

    public void restoreDefaults(org.eclipse.core.resources.IProject project)

  Restores the project level defaults. Note: the state changes made by calling this method need to be committed or discarded by the platform.

  Parameters:
    `project` -

### createServicePolicy

    public IServicePolicy createServicePolicy(IServicePolicy parent,
                                              java.lang.String id,
                                              java.lang.String enumListId,
                                              java.lang.String defaultEnumId)

  This method creates an IServicePolicy object.

  Parameters:
    `parent` - the parent policy for this policy. If this policy has no parent null may be specified.
    `id` - This is a unique id for this service policy. If the id specified is not unique trailing numerical digits in the id will be stripped off. Numerical digits will then be added to end of the id to make it unique. If the id is empty or null the framework will assign a unique id.
    `enumListId` - If this policy's state is defined by an enumeration the enumeration id should be specified here. Otherwise null should be specified.
    `defaultEnumId` - If this policy's state is defined by an enumeration this parameter specifies the default value. This value may be null if not using an enumeration or if the default value of the enumeration should be used.
  Returns:
    returns a service policy object.

### removeServicePolicy

    public void removeServicePolicy(IServicePolicy policy)

  Removes a service policy from the service policy platform.

  Parameters:
    `policy` - the service policy

### addChildChangeListener

    public void addChildChangeListener(IPolicyChildChangeListener listener,
                                       boolean onCommit)

  This method allows calls to listener to any child change that is made in the service policy platform regardless of where it is located in the tree of service policies.

  Parameters:
    `listener` -
    `onCommit` - indicates whether this listener should be invoked when the the platform changes are committed.

### queueChildChangeListeners

    public void queueChildChangeListeners(boolean queue)

  Indicates whether child change listeners should be queued or not. If they are queued then child change events will be queue up until this method is called with a false parameter. When this happens the child change event listeners are noticed of add the events that have occurred.

  Parameters:
    `queue` -

### removeChildChangeListener

    public void removeChildChangeListener(IPolicyChildChangeListener listener,
                                          boolean onCommit)

  Removes a child change listener from the service policy platform.

  Parameters:
    `listener` -
    `onCommit` - indicates whether this change listener should be removed from the onCommit list.

### addProjectLoadListener

    public void addProjectLoadListener(IPolicyPlatformProjectLoadListener listener)

  Add a project platform listener. When a particular project is referenced by in the service policy platform this listener will be called the first time the project is loaded into the system.

  Parameters:
    `listener` - the listener

### removeProjectLoadListener

    public void removeProjectLoadListener(IPolicyPlatformProjectLoadListener listener)

  Removes a project platform listener.

  Parameters:
    `listener` - the listener

### getStateEnumeration

    public java.util.List<IStateEnumerationItem> getStateEnumeration(java.lang.String enumId)

  Parameters:
    `enumId` -
  Returns:
    returns a list of state enumeration items given the unique enumeration ID for this enumeration.

### getStateItemEnumeration

    public IStateEnumerationItem getStateItemEnumeration(java.lang.String stateItemId)

  Parameters:
    `stateItemId` -
  Returns:
    returns a state enumeration item given this ID for this enumeration item.