Class RuntimeInstallationManager
- java.lang.Object
-
- com._1c.g5.v8.dt.platform.services.core.runtimes.RuntimeInstallationManager
-
- All Implemented Interfaces:
IRuntimeInstallationDiscriminator
,IRuntimeInstallationManager
,IRuntimeInstallationNameGenerator
public class RuntimeInstallationManager extends Object implements IRuntimeInstallationManager, IRuntimeInstallationNameGenerator
Implementation ofIRuntimeInstallationManager
. Stores and loads 1C:Enterprise runtime installations in workspace metadata preferences for the provided type of 1C:Enterprise runtim. Manager will use 1C:Enterprise runtime installation lookups and discriminators that is registered for this type of 1C:Enterprise runtime.
-
-
Constructor Summary
Constructors Constructor Description RuntimeInstallationManager(String runtimeTypeId)
Creates an instance ofRuntimeInstallationManager
for the provided 1C:Enterprise runtime type id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(RuntimeInstallation installation)
Adds and saves the provided 1C:Enterprise runtime installation.void
addRuntimeInstallationChangeListener(IRuntimeInstallationChangeListener listener)
Adds the 1C:Enterprise runtime installation change listener to the manager.Optional<RuntimeInstallationDescription>
discriminate(URI location)
Tries to discriminate the 1C:Enterprise runtime installation by the provided location.String
generateUniqueName(Version version, int build, boolean training, Arch arch)
Generates an unique name for the 1C:Enterprise runtime installation based on the provided version, build number and installation architecture.String
generateUniqueName(Version version, int build, boolean training, Arch arch, Collection<String> existingNames)
Generates an unique name for the 1C:Enterprise runtime installation based on the provided version, build number and installation architecture.RuntimeInstallation
get(UUID uuid)
Returns the 1C:Enterprise runtime installation by the providedUUID
.List<RuntimeInstallation>
getAllRegistered()
Returns all registered 1C:Enterprise runtime installations.List<RuntimeInstallation>
getAllSupported()
Returns all registered and supported 1C:Enterprise runtime installations.boolean
isSearchAvailable()
Returns whether search for local installations of 1C:Enterprise runtime is available for the installation manager.boolean
isSupportedByOs()
Returns whether manager supports current running operation system.void
refresh()
Refreshes current collection of 1C:Enterprise runtime installations.void
removeRuntimeInstallationChangeListener(IRuntimeInstallationChangeListener listener)
Removes the registered listener from the manager.void
save(List<RuntimeInstallation> installations)
Saves the entire list of the provided 1C:Enterprise runtime installations.void
save(List<RuntimeInstallation> installations, List<RuntimeInstallation> current)
List<RuntimeInstallation>
search(Path directory, Collection<String> existingNames, org.eclipse.core.runtime.IProgressMonitor monitor)
Searches for local installations of 1C:Enterprise runtime in the target directory.List<RuntimeInstallation>
search(Collection<String> existingNames, org.eclipse.core.runtime.IProgressMonitor monitor)
Searches for local installations of 1C:Enterprise runtime in default locations.
-
-
-
Constructor Detail
-
RuntimeInstallationManager
@Inject public RuntimeInstallationManager(String runtimeTypeId)
Creates an instance ofRuntimeInstallationManager
for the provided 1C:Enterprise runtime type id.- Parameters:
runtimeTypeId
- the 1C:Enterprise runtime type id, cannot benull
-
-
Method Detail
-
isSupportedByOs
public boolean isSupportedByOs()
Description copied from interface:IRuntimeInstallationManager
Returns whether manager supports current running operation system. Result is based on registered 1C:Enterprise runtime component resolvers and version resolvers.- Specified by:
isSupportedByOs
in interfaceIRuntimeInstallationManager
- Returns:
- whether service supports current running operations system
-
isSearchAvailable
public boolean isSearchAvailable()
Description copied from interface:IRuntimeInstallationManager
Returns whether search for local installations of 1C:Enterprise runtime is available for the installation manager. Iffalse
, then search attempts will always return empty results.- Specified by:
isSearchAvailable
in interfaceIRuntimeInstallationManager
- Returns:
- whether search for local installations of 1C:Enterprise runtime is available for the installation manager
-
getAllSupported
public List<RuntimeInstallation> getAllSupported()
Description copied from interface:IRuntimeInstallationManager
Returns all registered and supported 1C:Enterprise runtime installations.- Specified by:
getAllSupported
in interfaceIRuntimeInstallationManager
- Returns:
- a list of all registered and supported 1C:Enterprise runtime installations, never
null
-
getAllRegistered
public List<RuntimeInstallation> getAllRegistered()
Description copied from interface:IRuntimeInstallationManager
Returns all registered 1C:Enterprise runtime installations.- Specified by:
getAllRegistered
in interfaceIRuntimeInstallationManager
- Returns:
- a list of all found and registered 1C:Enterprise runtime installations, never
null
-
get
public RuntimeInstallation get(UUID uuid)
Description copied from interface:IRuntimeInstallationManager
Returns the 1C:Enterprise runtime installation by the providedUUID
.- Specified by:
get
in interfaceIRuntimeInstallationManager
- Parameters:
uuid
- theUUID
to get 1C:Enterprise runtime installation with, cannot benull
- Returns:
- the 1C:Enterprise runtime installation by provided
UUID
, ornull
if not found
-
save
public void save(List<RuntimeInstallation> installations)
Description copied from interface:IRuntimeInstallationManager
Saves the entire list of the provided 1C:Enterprise runtime installations. All registered installations will be replaced.- Specified by:
save
in interfaceIRuntimeInstallationManager
- Parameters:
installations
- a list of 1C:Enterprise runtime installations to save, cannot benull
-
add
public void add(RuntimeInstallation installation)
Description copied from interface:IRuntimeInstallationManager
Adds and saves the provided 1C:Enterprise runtime installation.- Specified by:
add
in interfaceIRuntimeInstallationManager
- Parameters:
installation
- the 1C:Enterprise runtime installation to add, cannot benull
-
search
public List<RuntimeInstallation> search(Collection<String> existingNames, org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface:IRuntimeInstallationManager
Searches for local installations of 1C:Enterprise runtime in default locations. Default location depends on the current OS. Returns a list of found 1C:Enterprise runtime installations.- Specified by:
search
in interfaceIRuntimeInstallationManager
- Parameters:
existingNames
- a collection of already existing names, manager will not use any of it for newly found 1C:Enterprise runtime installations, cannot benull
, can be emptymonitor
- the progress monitor to report progress to and check cancellation status, cannot benull
- Returns:
- a list of found 1C:Enterprise runtime installations, never
null
-
search
public List<RuntimeInstallation> search(Path directory, Collection<String> existingNames, org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface:IRuntimeInstallationManager
Searches for local installations of 1C:Enterprise runtime in the target directory. Returns a list of found 1C:Enterprise runtime installations.- Specified by:
search
in interfaceIRuntimeInstallationManager
- Parameters:
directory
- the target directory to search 1C:Enterprise runtime installations in, cannot benull
existingNames
- a collection of already existing names, manager will not use any of it for newly found 1C:Enterprise runtime installations, cannot benull
, can be emptymonitor
- the progress monitor to report progress to and check cancellation status, cannot benull
- Returns:
- a list of found 1C:Enterprise runtime installations, never
null
-
generateUniqueName
public String generateUniqueName(Version version, int build, boolean training, Arch arch)
Description copied from interface:IRuntimeInstallationManager
Generates an unique name for the 1C:Enterprise runtime installation based on the provided version, build number and installation architecture.- Specified by:
generateUniqueName
in interfaceIRuntimeInstallationManager
- Parameters:
version
- the version of the provided 1C:Enterprise runtime installation, cannot benull
build
- the build number of the provided 1C:Enterprise runtime installation, cannot benull
training
- whether to generatean unique name for a training 1C:Enterprise platform installationarch
- the architecture of the provided 1C:Enterprise runtime installation, cannot benull
- Returns:
- a unique 1C:Enterprise runtime installation name, never
null
-
refresh
public void refresh()
Description copied from interface:IRuntimeInstallationManager
Refreshes current collection of 1C:Enterprise runtime installations.- Specified by:
refresh
in interfaceIRuntimeInstallationManager
-
generateUniqueName
public String generateUniqueName(Version version, int build, boolean training, Arch arch, Collection<String> existingNames)
Description copied from interface:IRuntimeInstallationNameGenerator
Generates an unique name for the 1C:Enterprise runtime installation based on the provided version, build number and installation architecture.- Specified by:
generateUniqueName
in interfaceIRuntimeInstallationNameGenerator
- Parameters:
version
- the version of the provided 1C:Enterprise runtime installation, cannot benull
build
- the build number of the provided 1C:Enterprise runtime installation, cannot benull
training
- whether to generatean unique name for a training 1C:Enterprise platform installationarch
- the architecture of the provided 1C:Enterprise runtime installation, cannot benull
existingNames
- a collection of already existed names to guarantee uniqueness for, cannot benull
, may be empty- Returns:
- a unique 1C:Enterprise runtime installation name, never
null
-
addRuntimeInstallationChangeListener
public void addRuntimeInstallationChangeListener(IRuntimeInstallationChangeListener listener)
Description copied from interface:IRuntimeInstallationManager
Adds the 1C:Enterprise runtime installation change listener to the manager. The listener will be notified about runtime installations changes.Causes no effect if the provided listener is already registered.
- Specified by:
addRuntimeInstallationChangeListener
in interfaceIRuntimeInstallationManager
- Parameters:
listener
- the change listener to add, cannot benull
- See Also:
IRuntimeInstallationChangeListener
-
removeRuntimeInstallationChangeListener
public void removeRuntimeInstallationChangeListener(IRuntimeInstallationChangeListener listener)
Description copied from interface:IRuntimeInstallationManager
Removes the registered listener from the manager. The listener will no longer be notified about 1C:Enterprise runtime installations changes.- Specified by:
removeRuntimeInstallationChangeListener
in interfaceIRuntimeInstallationManager
- Parameters:
listener
- the change listener to remove, cannot benull
- See Also:
IRuntimeInstallationChangeListener
-
discriminate
public Optional<RuntimeInstallationDescription> discriminate(URI location) throws org.eclipse.core.runtime.CoreException
Description copied from interface:IRuntimeInstallationDiscriminator
Tries to discriminate the 1C:Enterprise runtime installation by the provided location. Returns an optional description of the 1C:Enterprise runtime installation:- The version of the target 1C:Enterprise runtime installation (e.g.
8.3.8
) - The build number of the target 1C:Enterprise runtime installation (e.g.
1945
) - The architectire of the target 1C:Enterprise runtime installation (e.g.
x86
)
- Specified by:
discriminate
in interfaceIRuntimeInstallationDiscriminator
- Parameters:
location
- the 1C:Enterprise runtime install location to get version from, cannot benull
- Returns:
- an optional description of the 1C:Enterprise runtime installation
- Throws:
org.eclipse.core.runtime.CoreException
- if description resolve failed with some reason- See Also:
RuntimeInstallationDescription
- The version of the target 1C:Enterprise runtime installation (e.g.
-
save
public void save(List<RuntimeInstallation> installations, List<RuntimeInstallation> current)
-
-