提交 ccd6eb69 编写于 作者: J jurgen

Dependencies model

Former-commit-id: 18e66b72
上级 c1fc2055
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.registry.driver;
import org.jkiss.dbeaver.model.connection.DBPDriverDependencies;
import org.jkiss.dbeaver.model.connection.DBPDriverLibrary;
import java.util.Collection;
import java.util.List;
/**
* DriverDependencies
*/
public class DriverDependencies implements DBPDriverDependencies
{
public DriverDependencies(Collection<? extends DBPDriverLibrary> rootLibraries) {
}
@Override
public List<DBPDriverLibrary> getLibraryList() {
return null;
}
@Override
public List<DependencyNode> getLibraryMap() {
return null;
}
}
......@@ -27,14 +27,12 @@ import org.jkiss.dbeaver.core.DBeaverActivator;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.core.DBeaverUI;
import org.jkiss.dbeaver.model.*;
import org.jkiss.dbeaver.model.connection.DBPClientHome;
import org.jkiss.dbeaver.model.connection.DBPClientManager;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.connection.DBPDriverLibrary;
import org.jkiss.dbeaver.model.connection.*;
import org.jkiss.dbeaver.model.impl.AbstractDescriptor;
import org.jkiss.dbeaver.model.impl.PropertyDescriptor;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.navigator.meta.DBXTreeNode;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.runtime.DBRRunnableContext;
import org.jkiss.dbeaver.model.runtime.OSDescriptor;
import org.jkiss.dbeaver.registry.DataSourceDescriptor;
......@@ -100,21 +98,21 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
private boolean custom;
private boolean modified;
private boolean disabled;
private final List<String> clientHomeIds = new ArrayList<String>();
private final List<DriverFileSource> fileSources = new ArrayList<DriverFileSource>();
private final List<DBPDriverLibrary> libraries = new ArrayList<DBPDriverLibrary>();
private final List<DBPDriverLibrary> origFiles = new ArrayList<DBPDriverLibrary>();
private final List<DBPPropertyDescriptor> connectionPropertyDescriptors = new ArrayList<DBPPropertyDescriptor>();
private final List<OSDescriptor> supportedSystems = new ArrayList<OSDescriptor>();
private final List<ReplaceInfo> driverReplacements = new ArrayList<ReplaceInfo>();
private final List<String> clientHomeIds = new ArrayList<>();
private final List<DriverFileSource> fileSources = new ArrayList<>();
private final List<DBPDriverLibrary> libraries = new ArrayList<>();
private final List<DBPDriverLibrary> origFiles = new ArrayList<>();
private final List<DBPPropertyDescriptor> connectionPropertyDescriptors = new ArrayList<>();
private final List<OSDescriptor> supportedSystems = new ArrayList<>();
private final List<ReplaceInfo> driverReplacements = new ArrayList<>();
private DriverDescriptor replacedBy;
private final Map<Object, Object> defaultParameters = new HashMap<Object, Object>();
private final Map<Object, Object> customParameters = new HashMap<Object, Object>();
private final Map<Object, Object> defaultParameters = new HashMap<>();
private final Map<Object, Object> customParameters = new HashMap<>();
private final Map<Object, Object> defaultConnectionProperties = new HashMap<Object, Object>();
private final Map<Object, Object> customConnectionProperties = new HashMap<Object, Object>();
private final Map<Object, Object> defaultConnectionProperties = new HashMap<>();
private final Map<Object, Object> customConnectionProperties = new HashMap<>();
private Class driverClass;
private boolean isLoaded;
......@@ -296,7 +294,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
public List<DataSourceDescriptor> getUsedBy()
{
List<DataSourceDescriptor> usedBy = new ArrayList<DataSourceDescriptor>();
List<DataSourceDescriptor> usedBy = new ArrayList<>();
for (DataSourceDescriptor ds : DataSourceDescriptor.getAllDataSources()) {
if (ds.getDriver() == this) {
usedBy.add(ds);
......@@ -623,6 +621,12 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
return libraries;
}
@NotNull
@Override
public DBPDriverDependencies resolveDependencies(@NotNull DBRProgressMonitor monitor) {
return new DriverDependencies(getDriverLibraries());
}
public DBPDriverLibrary getDriverLibrary(String path)
{
for (DBPDriverLibrary lib : libraries) {
......@@ -831,7 +835,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
validateFilesPresence(runnableContext);
}
List<URL> libraryURLs = new ArrayList<URL>();
List<URL> libraryURLs = new ArrayList<>();
// Load libraries
for (DBPDriverLibrary file : libraries) {
if (file.isDisabled() || file.getType() != DBPDriverLibrary.FileType.jar) {
......@@ -870,7 +874,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
}
}
final List<DBPDriverLibrary> downloadCandidates = new ArrayList<DBPDriverLibrary>();
final List<DBPDriverLibrary> downloadCandidates = new ArrayList<>();
for (DBPDriverLibrary file : libraries) {
if (file.isDisabled() || !file.isDownloadable()) {
// Nothing we can do about it
......@@ -1126,9 +1130,9 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
public static class MetaURL {
private List<String> urlComponents = new ArrayList<String>();
private Set<String> availableProperties = new HashSet<String>();
private Set<String> requiredProperties = new HashSet<String>();
private List<String> urlComponents = new ArrayList<>();
private Set<String> availableProperties = new HashSet<>();
private Set<String> requiredProperties = new HashSet<>();
public List<String> getUrlComponents()
{
......
......@@ -25,6 +25,7 @@ import org.jkiss.dbeaver.model.DBPImage;
import org.jkiss.dbeaver.model.DBPObject;
import org.jkiss.dbeaver.model.DBPPropertyDescriptor;
import org.jkiss.dbeaver.model.navigator.meta.DBXTreeNode;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.runtime.DBRRunnableContext;
import java.util.Collection;
......@@ -92,6 +93,9 @@ public interface DBPDriver extends DBPObject
@NotNull
Collection<? extends DBPDriverLibrary> getDriverLibraries();
@NotNull
DBPDriverDependencies resolveDependencies(@NotNull DBRProgressMonitor monitor);
Object getDriverInstance(DBRRunnableContext runnableContext) throws DBException;
void validateFilesPresence(DBRRunnableContext runnableContext);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册