PTP
Release 7.0

org.eclipse.ptp.rdt.sync.core
Class SyncConfig

java.lang.Object
  extended by org.eclipse.ptp.rdt.sync.core.SyncConfig
All Implemented Interfaces:
java.lang.Comparable<SyncConfig>

public class SyncConfig
extends java.lang.Object
implements java.lang.Comparable<SyncConfig>

Class to encapsulate information about syncing a project

Since:
3.0

Constructor Summary
SyncConfig(java.lang.String name)
          Create a new sync configuration.
 
Method Summary
 int compareTo(SyncConfig config)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getConnectionName()
           
 java.lang.String[] getKeys()
          Get the keys for all properties set for this configuration.
 java.lang.String getLocation()
          Get the remote fLocation
 java.lang.String getLocation(IProject project)
          Get fLocation (directory), resolved in terms of the passed project
 java.lang.String getName()
          Get the configuration name
 IProject getProject()
          Get the synchronized project
 java.lang.String getProperty(java.lang.String key)
          Get an arbitrary property for the configuration
 IRemoteConnection getRemoteConnection()
          Get remote connection.
 java.lang.String getRemoteServicesId()
          Get the remote services ID
 java.lang.String getSyncProviderId()
          Get sync provider ID
 ISynchronizeService getSyncService()
          Get the synchronize service
 int hashCode()
           
 boolean isSyncOnPostBuild()
          Check if syncs should occur on post-build
 boolean isSyncOnPreBuild()
          Check if syncs should occur on pre-build
 boolean isSyncOnSave()
          Check if syncs should occur on saves
static java.lang.String resolveString(IProject project, java.lang.String path)
          Utility function to resolve a string based on path variables for a certain project.
 void setConfigName(java.lang.String configName)
          Set the configuration name
 void setConnection(IRemoteConnection connection)
          Set the remote connection
 void setConnectionName(java.lang.String connectionName)
          Set the connection name
 void setLocation(java.lang.String location)
          Set the sync location
 void setProject(IProject project)
          Set the synchronized project
 void setProperty(java.lang.String key, java.lang.String value)
          Set an arbitrary property for the configuration
 void setRemoteServicesId(java.lang.String remoteServicesId)
          Set the remote services ID
 void setSyncOnPostBuild(boolean syncOnPostBuild)
          Set the sync on post-build flag
 void setSyncOnPreBuild(boolean syncOnPreBuild)
          Set the sync on pre-build flag
 void setSyncOnSave(boolean syncOnSave)
          Set the sync on save flag
 void setSyncProviderId(java.lang.String syncProviderId)
          Set the sync provider ID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncConfig

public SyncConfig(java.lang.String name)
Create a new sync configuration. Should not be called by clients directly. Use SyncConfigManager.newConfig(String, String, IRemoteConnection, String) instead.

Parameters:
name - Name of this configuration. Must be unique per project.
Method Detail

resolveString

public static java.lang.String resolveString(IProject project,
                                             java.lang.String path)
Utility function to resolve a string based on path variables for a certain project. Unless string is in the form: ${path_variable:/remainder}, where "path_variable" is a path variable defined for the project, the original string is returned unchanged. The Eclipse platform should provide a standard mechanism for doing this, but various combinations of URIUtil and PathVariableManager methods failed.

Parameters:
project -
path -
Returns:
resolved string

compareTo

public int compareTo(SyncConfig config)
Specified by:
compareTo in interface java.lang.Comparable<SyncConfig>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getConnectionName

public java.lang.String getConnectionName()
Returns:
remote services ID

getKeys

public java.lang.String[] getKeys()
Get the keys for all properties set for this configuration.

Returns:
configuration properties keys

getLocation

public java.lang.String getLocation()
Get the remote fLocation

Returns:
fLocation

getLocation

public java.lang.String getLocation(IProject project)
Get fLocation (directory), resolved in terms of the passed project

Parameters:
project -
Returns:
fLocation

getName

public java.lang.String getName()
Get the configuration name

Returns:
config name

getProject

public IProject getProject()
Get the synchronized project

Returns:

getProperty

public java.lang.String getProperty(java.lang.String key)
Get an arbitrary property for the configuration

Parameters:
key -
Returns:
value

getRemoteConnection

public IRemoteConnection getRemoteConnection()
                                      throws MissingConnectionException
Get remote connection. If connection is missing, this function calls the missing-connection handler. Thus, after catching the exception, callers can assume user has already been notified and given an opportunity to define the connection. So callers only need to worry about recovering gracefully.

Returns:
remote connection - never null
Throws:
MissingConnectionException - if no connection with the stored name exist. This can happen for various reasons: 1) The connection was renamed 2) The connection was deleted 3) The connection never existed, such as when a project is imported to a different workspace

getRemoteServicesId

public java.lang.String getRemoteServicesId()
Get the remote services ID

Returns:
remote services ID

getSyncProviderId

public java.lang.String getSyncProviderId()
Get sync provider ID

Returns:
sync provider ID

getSyncService

public ISynchronizeService getSyncService()
Get the synchronize service

Returns:
sync service

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isSyncOnPostBuild

public boolean isSyncOnPostBuild()
Check if syncs should occur on post-build

Returns:

isSyncOnPreBuild

public boolean isSyncOnPreBuild()
Check if syncs should occur on pre-build

Returns:

isSyncOnSave

public boolean isSyncOnSave()
Check if syncs should occur on saves

Returns:

setConfigName

public void setConfigName(java.lang.String configName)
Set the configuration name

Parameters:
configName -

setConnection

public void setConnection(IRemoteConnection connection)
Set the remote connection

Parameters:
connection -

setConnectionName

public void setConnectionName(java.lang.String connectionName)
Set the connection name

Parameters:
connectionName -

setLocation

public void setLocation(java.lang.String location)
Set the sync location

Parameters:
location -

setProject

public void setProject(IProject project)
Set the synchronized project

Parameters:
project -

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Set an arbitrary property for the configuration

Parameters:
key -
value -

setRemoteServicesId

public void setRemoteServicesId(java.lang.String remoteServicesId)
Set the remote services ID

Parameters:
remoteServicesId -

setSyncOnPostBuild

public void setSyncOnPostBuild(boolean syncOnPostBuild)
Set the sync on post-build flag

Parameters:
syncOnPostBuild -

setSyncOnPreBuild

public void setSyncOnPreBuild(boolean syncOnPreBuild)
Set the sync on pre-build flag

Parameters:
syncOnPreBuild -

setSyncOnSave

public void setSyncOnSave(boolean syncOnSave)
Set the sync on save flag

Parameters:
syncOnSave -

setSyncProviderId

public void setSyncProviderId(java.lang.String syncProviderId)
Set the sync provider ID

Parameters:
syncProvider -

PTP
Release 7.0

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