Class DtProjectDataSource
java.lang.Object
com._1c.g5.v8.dt.internal.compare.datasource.DtProjectDataSource
- All Implemented Interfaces:
IComparisonDataSource
- Direct Known Subclasses:
ActiveDtProjectDataSource
,LibraryComparisonDataSource
,OverlayComparisonDataSource
A comparison data source for any supported type of the project
-
Field Summary
FieldsFields inherited from interface com._1c.g5.v8.dt.compare.datasource.IComparisonDataSource
PROJECT_FILE, PROJECT_SOURCE_FOLDER
-
Constructor Summary
ConstructorsConstructorDescriptionDtProjectDataSource
(DataSourceType dataSourceType, IExtendedProjectSourceProvider sourceProvider, ISymbolicNameService symbolicNameService, IQualifiedNameFilePathConverter qualifiedNameFilePathConverter, IBmModelManager bmModelManager, IWorkspaceOrchestrator workspaceOrchestrator, IVirtualProjectResourceImportService resourceImportService, IDerivedDataManagerProvider derivedDataManagerProvider, ILibraryRepository libraryRepository) Constructs a new data source for the specified V8 project. -
Method Summary
Modifier and TypeMethodDescriptionBegins the data source operation transaction.boolean
boolean
fileExists
(Path path) Checks whether a file for the specified path exists.Gets the BM model associated with the sourcegetCollectionSymlinks
(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference collectionReference, org.eclipse.xtext.scoping.IScopeProvider scopeProvider) Returns a list of symbolic links for objects owned by this data source and referenced by the specified multi-reference from the specified context object.Returns the distribution support information for this data source.Gets theIDtProject
instance associated with this data source and related to the project being represented by this sourcegetFileListRecursively
(Path path) Returns the file list for given folder path and all its subfolders.getFileStream
(Path path) Returns a file stream for the specified path.Returns the model editing support provider for this data source.org.eclipse.emf.ecore.EObject
getObjectById
(long id) Returns an object by the specified Id.Returns the file path for the specified top-level MD objectReturns project name for this data source.Returns the stored project nature.Gets the associated source providergetSymlink
(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject eObject, org.eclipse.xtext.scoping.IScopeProvider scopeProvider) Returns a symbolic link for an object owned by this data source.getSymlink
(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, org.eclipse.xtext.scoping.IScopeProvider scopeProvider) Returns a symbolic link for an object owned by this data source, as defined by a single reference from a context object.getSymlinksOfTopObjects
(org.eclipse.xtext.scoping.IScopeProvider scopeProvider, List<org.eclipse.emf.ecore.EClass> eClasses) Gets all top level object symlinks for a given set ofEClass
'es.Gets the target runtime version for the project behind this sourceorg.eclipse.emf.ecore.EObject
getTopLevelObject
(String symlink, org.eclipse.emf.ecore.EClass eClass) Returns a top-level MD object by the specified symbolic link.long
Gets top-level object Id by FQN.getType()
Gets the type of the data source.int
hashCode()
boolean
isOverlayOf
(IComparisonDataSource comparisonDataSource) Checks if this data source overlays the provided source.protected void
onStart
(org.eclipse.core.runtime.IProgressMonitor progressMonitor) Prepares the data of the source (like import, etc)protected void
onStop()
Clears all the data for the source (like internal model, etc)void
prepareTopObjectInfos
(List<TopObjectInfo> topObjectInfos) Prepares information for the specified top objects.protected final void
setBmModel
(IBmModel bmModel) Sets the BM model associated with the data source.final void
startIfNecessary
(org.eclipse.core.runtime.IProgressMonitor progressMonitor) Starts the data source in the flow of the comparison session creation.final void
stop()
Stops the data source in the flow of the comprison session closure.void
synchronize
(org.eclipse.core.runtime.IProgressMonitor progressMonitor) Synchronizes the data source with external changes being made to this source.boolean
topObjectExists
(String symlink, org.eclipse.emf.ecore.EClass eClass) Checks if the referenced top object exists in the data source.toString()
-
Field Details
-
symbolicNameService
the symbolic name service
-
-
Constructor Details
-
DtProjectDataSource
public DtProjectDataSource(DataSourceType dataSourceType, IExtendedProjectSourceProvider sourceProvider, ISymbolicNameService symbolicNameService, IQualifiedNameFilePathConverter qualifiedNameFilePathConverter, IBmModelManager bmModelManager, IWorkspaceOrchestrator workspaceOrchestrator, IVirtualProjectResourceImportService resourceImportService, IDerivedDataManagerProvider derivedDataManagerProvider, ILibraryRepository libraryRepository) Constructs a new data source for the specified V8 project.- Parameters:
dataSourceType
- the type of the data source according to the description. May not benull
sourceProvider
- theIExtendedProjectSourceProvider
abstraction of project sources file access. May not benull
symbolicNameService
- the symbolic name service, notnull
qualifiedNameFilePathConverter
- the qualified name file path provider, notnull
bmModelManager
- the BM model manager, notnull
workspaceOrchestrator
- the link to theIWorkspaceOrchestrator
service. May not benull
resourceImportService
- the link to theIVirtualProjectResourceImportService
service. May not benull
derivedDataManagerProvider
- the link to theIDerivedDataManagerProvider
service. May not benull
libraryRepository
- the library repository. May not benull
-
-
Method Details
-
beginTransaction
Description copied from interface:IComparisonDataSource
Begins the data source operation transaction.- Specified by:
beginTransaction
in interfaceIComparisonDataSource
- Returns:
- The newly started transaction. Cannot be
null
-
equals
-
fileExists
Description copied from interface:IComparisonDataSource
Checks whether a file for the specified path exists.- Specified by:
fileExists
in interfaceIComparisonDataSource
- Parameters:
path
- the specified path to check the existence for, cannot benull
- Returns:
true
if the file exists,false
otherwise
-
getBmModel
Description copied from interface:IComparisonDataSource
Gets the BM model associated with the source- Specified by:
getBmModel
in interfaceIComparisonDataSource
- Returns:
- The BM model instance. May not be
null
-
getCollectionSymlinks
public List<String> getCollectionSymlinks(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference collectionReference, org.eclipse.xtext.scoping.IScopeProvider scopeProvider) Description copied from interface:IComparisonDataSource
Returns a list of symbolic links for objects owned by this data source and referenced by the specified multi-reference from the specified context object.- Specified by:
getCollectionSymlinks
in interfaceIComparisonDataSource
- Parameters:
context
- the referencing object, notnull
collectionReference
- the referencing feature, notnull
, must be multi-referencescopeProvider
- the scope provider- Returns:
- a list of symbolic links, never
null
-
getDistributionDescription
Description copied from interface:IComparisonDataSource
Returns the distribution support information for this data source.- Specified by:
getDistributionDescription
in interfaceIComparisonDataSource
- Returns:
- the distribution support information or
null
if no information for this data source was specified
-
getDtProject
Description copied from interface:IComparisonDataSource
Gets theIDtProject
instance associated with this data source and related to the project being represented by this source- Specified by:
getDtProject
in interfaceIComparisonDataSource
- Returns:
- The
IDtProject
instance. May not benull
-
getFileListRecursively
Description copied from interface:IComparisonDataSource
Returns the file list for given folder path and all its subfolders.- Specified by:
getFileListRecursively
in interfaceIComparisonDataSource
- Parameters:
path
- the relative folder path to get the file list for, can not benull
- Returns:
- the list of relative file paths, never
null
-
getFileStream
Description copied from interface:IComparisonDataSource
Returns a file stream for the specified path.- Specified by:
getFileStream
in interfaceIComparisonDataSource
- Parameters:
path
- the string with the path- Returns:
- the input stream
-
getModelEditingSupport
Description copied from interface:IComparisonDataSource
Returns the model editing support provider for this data source.- Specified by:
getModelEditingSupport
in interfaceIComparisonDataSource
- Returns:
- the model editing support provider or
null
if no provider for this data source was specified
-
getPath
Returns the file path for the specified top-level MD object- Specified by:
getPath
in interfaceIComparisonDataSource
- Parameters:
symlink
- the symlink of the top-level MD objecteClass
- TODO- Returns:
- a string with the relative path of the MD object, may be
null
-
getProjectName
Description copied from interface:IComparisonDataSource
Returns project name for this data source.- Specified by:
getProjectName
in interfaceIComparisonDataSource
- Returns:
- the project name, never
null
-
getProjectNature
Description copied from interface:IComparisonDataSource
Returns the stored project nature.- Specified by:
getProjectNature
in interfaceIComparisonDataSource
- Returns:
- the stored project nature, may be
ICoreConstants.V8_CONFIGURATION_NATURE
orICoreConstants.V8_EXTENSION_NATURE
orICoreConstants.V8_EXTERNAL_OBJECTS_NATURE
ornull
if the data source does not store V8 project
-
getSymlink
public String getSymlink(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject eObject, org.eclipse.xtext.scoping.IScopeProvider scopeProvider) Description copied from interface:IComparisonDataSource
Returns a symbolic link for an object owned by this data source.- Specified by:
getSymlink
in interfaceIComparisonDataSource
- Parameters:
context
- the referencing object, notnull
reference
- the reference feature, notnull
eObject
- the referenced object, notnull
scopeProvider
- the scope provider- Returns:
- the symbolic link, never
null
-
getSymlink
public String getSymlink(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, org.eclipse.xtext.scoping.IScopeProvider scopeProvider) Description copied from interface:IComparisonDataSource
Returns a symbolic link for an object owned by this data source, as defined by a single reference from a context object.- Specified by:
getSymlink
in interfaceIComparisonDataSource
- Parameters:
context
- the referencing object, notnull
reference
- the referencing feature, notnull
, must be single referencescopeProvider
- the scope provider- Returns:
- the symbolic link, never
null
-
getSymlinksOfTopObjects
public Map<org.eclipse.emf.ecore.EClass,List<String>> getSymlinksOfTopObjects(org.eclipse.xtext.scoping.IScopeProvider scopeProvider, List<org.eclipse.emf.ecore.EClass> eClasses) Description copied from interface:IComparisonDataSource
Gets all top level object symlinks for a given set ofEClass
'es. If this data source is associated with Configuration-aware project, the order of the returned instances will be the same as in the corresponding collection of the Configuration.- Specified by:
getSymlinksOfTopObjects
in interfaceIComparisonDataSource
- Parameters:
scopeProvider
- the scope provider for symbolic links, cannot benull
eClasses
- the given set ofEClass
'es, may benull
- Returns:
- all top level object symlinks for a given set of
EClass
'es, nevernull
-
getTargetRuntimeVersion
Description copied from interface:IComparisonDataSource
Gets the target runtime version for the project behind this source- Specified by:
getTargetRuntimeVersion
in interfaceIComparisonDataSource
- Returns:
- The version of the target 1C runtime. Cannot be
null
-
getTopLevelObject
public org.eclipse.emf.ecore.EObject getTopLevelObject(String symlink, org.eclipse.emf.ecore.EClass eClass) Description copied from interface:IComparisonDataSource
Returns a top-level MD object by the specified symbolic link.- Specified by:
getTopLevelObject
in interfaceIComparisonDataSource
- Parameters:
symlink
- the symbolic link (FQN) of the MD object, notnull
; an exception will be thrown for an invalid or a non-top object argumenteClass
- TheEClass
that defines the context of the symlink resolution, may benull
- Returns:
- the object, never
null
-
getType
Description copied from interface:IComparisonDataSource
Gets the type of the data source.- Specified by:
getType
in interfaceIComparisonDataSource
- Returns:
- The type of the data source. May not be
null
-
hashCode
public int hashCode() -
isOverlayOf
Description copied from interface:IComparisonDataSource
Checks if this data source overlays the provided source. Used to syncrhonize the data in case of underlying data source data changes- Specified by:
isOverlayOf
in interfaceIComparisonDataSource
- Returns:
-
prepareTopObjectInfos
Description copied from interface:IComparisonDataSource
Prepares information for the specified top objects. Deletes top object info if the referenced top object doesn't exist in the data source.- Specified by:
prepareTopObjectInfos
in interfaceIComparisonDataSource
- Parameters:
topObjectInfos
- the list of top object information containers, cannot benull
-
startIfNecessary
public final void startIfNecessary(org.eclipse.core.runtime.IProgressMonitor progressMonitor) Description copied from interface:IComparisonDataSource
Starts the data source in the flow of the comparison session creation. Implementation should take care about multiple attempts of start request being submitted to the data source- Specified by:
startIfNecessary
in interfaceIComparisonDataSource
- Parameters:
progressMonitor
- Progress monitor of a start sequence. May not benull
-
stop
public final void stop()Description copied from interface:IComparisonDataSource
Stops the data source in the flow of the comprison session closure. Should be failure-proof to not hinder othe sources sequential stops- Specified by:
stop
in interfaceIComparisonDataSource
-
synchronize
public void synchronize(org.eclipse.core.runtime.IProgressMonitor progressMonitor) Description copied from interface:IComparisonDataSource
Synchronizes the data source with external changes being made to this source. Until this method call the data source should store any change tasks without applying- Specified by:
synchronize
in interfaceIComparisonDataSource
- Parameters:
progressMonitor
- Progress monitor of a update/synchronization sequence. May not benull
-
topObjectExists
Description copied from interface:IComparisonDataSource
Checks if the referenced top object exists in the data source. The implementation of this method should be as quick as possible.- Specified by:
topObjectExists
in interfaceIComparisonDataSource
- Parameters:
symlink
- The symlink to check existence for.eClass
- The eClass of expected object.- Returns:
- True if the data source is able to retrieve referenced object; false otherwise.
-
toString
-
getObjectById
public org.eclipse.emf.ecore.EObject getObjectById(long id) Description copied from interface:IComparisonDataSource
Returns an object by the specified Id.- Specified by:
getObjectById
in interfaceIComparisonDataSource
- Parameters:
id
- the Id- Returns:
- the object found or
null
-
getTopObjectIdByFqn
Description copied from interface:IComparisonDataSource
Gets top-level object Id by FQN.- Specified by:
getTopObjectIdByFqn
in interfaceIComparisonDataSource
- Parameters:
fqn
- the FQN to get Id by, may not benull
- Returns:
- the Id or
-1L
if there is no object with the specified FQN
-
getSourceProvider
Gets the associated source provider- Returns:
IExtendedProjectSourceProvider
provider. May not benull
-
onStart
protected void onStart(org.eclipse.core.runtime.IProgressMonitor progressMonitor) Prepares the data of the source (like import, etc)- Parameters:
progressMonitor
- The progress monitor to control the process. May not benull
-
onStop
protected void onStop()Clears all the data for the source (like internal model, etc)- Parameters:
progressMonitor
- The progress monitor to control the process. May not benull
-
setBmModel
Sets the BM model associated with the data source. Should be called during the start sequence of the data source
-