Compare commits
36 Commits
release/7.
...
release/7.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c8614b4ac | ||
|
|
baacc284fd | ||
|
|
9d0fdc4532 | ||
|
|
f3ad09604f | ||
|
|
4615ebdb75 | ||
|
|
5616d65272 | ||
|
|
ca85dd4b73 | ||
|
|
11d3c32066 | ||
|
|
a866707aae | ||
|
|
53e052989f | ||
|
|
f52c747409 | ||
|
|
6d36ff79bb | ||
|
|
c362aa776c | ||
|
|
318724d32c | ||
|
|
4b377af1aa | ||
|
|
695dcba405 | ||
|
|
4dc7e4e82f | ||
|
|
4c819add92 | ||
|
|
9c0f5e966d | ||
|
|
da5b7979fd | ||
|
|
8d3832fdfb | ||
|
|
cd8ff90b5b | ||
|
|
d98e5ea43c | ||
|
|
13b57c8823 | ||
|
|
0436bc8dd2 | ||
|
|
091de02e75 | ||
|
|
eb84dfe75d | ||
|
|
a7dd89cc3a | ||
|
|
211abcac09 | ||
|
|
089f43ccd4 | ||
|
|
d008463ef1 | ||
|
|
d7ed643621 | ||
|
|
0972593afd | ||
|
|
c50c5c2e46 | ||
|
|
0b7b156f22 | ||
|
|
30aa2d25a6 |
@@ -12,16 +12,28 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.workbench.extensions;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.IllegalPluginConfigurationException;
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
|
||||
/**
|
||||
* Utilities class uses to get implementation of extension points defined by plug-ins. <br/>
|
||||
@@ -36,6 +48,10 @@ public abstract class ExtensionImplementationProvider<I> {
|
||||
|
||||
private String plugInId;
|
||||
|
||||
public final static String FILE_FEATURES_INDEX = "extra_feature.index";
|
||||
|
||||
public final static String DROP_BUNDLE_INFO = "drop.bundle.info";
|
||||
|
||||
/**
|
||||
* Default Constructor. Must not be used.
|
||||
*/
|
||||
@@ -166,9 +182,17 @@ public abstract class ExtensionImplementationProvider<I> {
|
||||
}
|
||||
|
||||
IExtension[] extensions = pt.getExtensions();
|
||||
|
||||
Map<String, String> dropBundles = null;
|
||||
try {
|
||||
dropBundles = getDropBundleInfo();
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
for (IExtension extension : extensions) {
|
||||
|
||||
if (dropBundles != null && dropBundles.containsKey(extension.getNamespaceIdentifier())
|
||||
&& StringUtils.isEmpty(dropBundles.get(extension.getNamespaceIdentifier()))) {
|
||||
continue;
|
||||
}
|
||||
if (plugInId == null || extension.getNamespaceIdentifier().equals(plugInId)) {
|
||||
String configurationElementName = extensionPointLimiter.getConfigurationElementName();
|
||||
if (configurationElementName != null) {
|
||||
@@ -196,6 +220,32 @@ public abstract class ExtensionImplementationProvider<I> {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* Copied from org.talend.commons.configurator
|
||||
**********************************************************/
|
||||
public Map<String, String> getDropBundleInfo() throws IOException {
|
||||
File indexFile = new File(ConfigurationScope.INSTANCE.getLocation().toFile(), FILE_FEATURES_INDEX);
|
||||
if (!indexFile.exists()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<String, String> dropInfoMap = new HashMap<>();
|
||||
try {
|
||||
String jsonStr = new String(Files.readAllBytes(indexFile.toPath()));
|
||||
if (!jsonStr.isEmpty()) {
|
||||
JSONObject obj = new JSONObject(jsonStr);
|
||||
JSONObject dropInfo = obj.getJSONObject(DROP_BUNDLE_INFO);
|
||||
Iterator<String> iterator = dropInfo.keys();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
dropInfoMap.put(key, dropInfo.getString(key));
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
return dropInfoMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "createAndAddImplementation".
|
||||
*
|
||||
|
||||
@@ -872,25 +872,38 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
@Override
|
||||
public IRepositoryViewObject getLastVersion(Project project, String id, String relativeFolder, ERepositoryObjectType type)
|
||||
throws PersistenceException {
|
||||
List<IRepositoryViewObject> serializableAllVersion = null;
|
||||
Object fullFolder = getFullFolder(project, type, relativeFolder);
|
||||
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, false, true, true);
|
||||
List<IRepositoryViewObject> serializableAllVersion = new ArrayList<>();
|
||||
if (lastFolderForItemMap.containsKey(id)) {
|
||||
ERepositoryObjectType itemType = lastRepositoryTypeForItemMap.get(id);
|
||||
String currentPath = lastFolderForItemMap.get(id);
|
||||
Object fullFolder = getFullFolder(project, itemType, currentPath);
|
||||
try {
|
||||
if (fullFolder != null && (fullFolder instanceof FolderItem || ((IFolder) fullFolder).exists())) {
|
||||
serializableAllVersion.addAll(getSerializableFromFolder(project, fullFolder, id, itemType, false, false, true, true));
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
// do nothing.
|
||||
// if any exception happen or can't find the item, just try to look for it everywhere.
|
||||
}
|
||||
}
|
||||
if (serializableAllVersion.isEmpty()) {
|
||||
// look in all folders for this item type
|
||||
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, true, true, true, true);
|
||||
Object fullFolder = getFullFolder(project, type, relativeFolder);
|
||||
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, false, true, true);
|
||||
if (serializableAllVersion.isEmpty()) {
|
||||
// look in all folders for this item type
|
||||
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, true, true, true, true);
|
||||
}
|
||||
}
|
||||
int size = serializableAllVersion.size();
|
||||
|
||||
if (size > 1) {
|
||||
String message = getItemsMessages(serializableAllVersion, size);
|
||||
|
||||
throw new PersistenceException(Messages.getString(
|
||||
"AbstractEMFRepositoryFactory.presistenceException.OnlyOneOccurenceMustbeFound", message)); //$NON-NLS-1$
|
||||
} else if (size == 1) {
|
||||
return serializableAllVersion.get(0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (size == 1) {
|
||||
return serializableAllVersion.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void computePropertyMaxInformationLevel(Property property) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -154,6 +155,8 @@ public interface ILibraryManagerService extends IService {
|
||||
public boolean contains(String jarName);
|
||||
|
||||
public void clearCache();
|
||||
|
||||
public void deployLibsFromCustomComponents(File componentFolder, List<ModuleNeeded> modulesNeeded);
|
||||
|
||||
@Deprecated
|
||||
public Set<String> list(boolean withComponent, IProgressMonitor... monitorWrap);
|
||||
|
||||
@@ -88,8 +88,8 @@ public enum EDatabaseVersion4Drivers {
|
||||
"Microsoft", "MSSQL_PROP", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "mssql-jdbc.jar", "slf4j-api-1.7.25.jar", "slf4j-log4j12-1.7.25.jar", "adal4j-1.6.7.jar", //$NON-NLS-1$
|
||||
"commons-lang3-3.10.jar", "commons-codec-1.14.jar", "gson-2.8.9.jar", "oauth2-oidc-sdk-9.7.jar",
|
||||
"json-smart-2.4.7.jar", "nimbus-jose-jwt-9.22.jar", "javax.mail-1.6.2.jar", "reload4j-1.2.19.jar",
|
||||
"accessors-smart-2.4.7.jar", "asm-9.1.jar", "content-type-2.1.jar" })),
|
||||
"json-smart-2.4.11.jar", "nimbus-jose-jwt-9.22.jar", "javax.mail-1.6.2.jar", "reload4j-1.2.19.jar",
|
||||
"accessors-smart-2.4.11.jar", "asm-9.5.jar", "content-type-2.1.jar" })),
|
||||
|
||||
VERTICA_9(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 9.X", "VERTICA_9_0", "vertica-jdbc-9.3.1-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
VERTICA_7_1_X(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 7.1.X (Deprecated)", "VERTICA_7_1_X", "vertica-jdbc-7.1.2-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
@@ -495,11 +495,16 @@ public class ContextUtils {
|
||||
}
|
||||
return itemMap;
|
||||
}
|
||||
|
||||
private static Set<String> missingContexts = new HashSet<>();
|
||||
|
||||
public static void clearMissingContextCache() {
|
||||
missingContexts.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* get the repository context item,now contextId can be either joblet node or context node.
|
||||
*/
|
||||
* get the repository context item, now contextId can be either joblet node or context node.
|
||||
*/
|
||||
public static Item getRepositoryContextItemById(String contextId) {
|
||||
if (IContextParameter.BUILT_IN.equals(contextId)) {
|
||||
return null;
|
||||
@@ -507,6 +512,9 @@ public class ContextUtils {
|
||||
if (checkObject(contextId)) {
|
||||
return null;
|
||||
}
|
||||
if (missingContexts.contains(contextId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<ERepositoryObjectType> possibleTypes = new ArrayList<ERepositoryObjectType>();
|
||||
possibleTypes.add(ERepositoryObjectType.CONTEXT);
|
||||
@@ -521,6 +529,8 @@ public class ContextUtils {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
missingContexts.add(contextId);
|
||||
ExceptionHandler.log("Can't find Context item[id=" + contextId + "].");
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
@@ -831,6 +841,7 @@ public class ContextUtils {
|
||||
ItemContextLink itemContextLink) {
|
||||
Map<String, String> renamedMap = new HashMap<String, String>();
|
||||
Map<String, Item> tempItemMap = new HashMap<String, Item>();
|
||||
clearMissingContextCache();
|
||||
for (ContextType contextType : contextTypeList) {
|
||||
for (Object obj : contextType.getContextParameter()) {
|
||||
if (obj instanceof ContextParameterType) {
|
||||
@@ -893,6 +904,7 @@ public class ContextUtils {
|
||||
*/
|
||||
public static Map<String, String> calculateRenamedMapFromLinkFile(String projectLabel, String itemId,
|
||||
List<IContext> contextList) {
|
||||
clearMissingContextCache();
|
||||
Map<String, String> renamedMap = new HashMap<String, String>();
|
||||
Map<String, Item> idToItemMap = new HashMap<String, Item>();
|
||||
try {
|
||||
@@ -951,6 +963,14 @@ public class ContextUtils {
|
||||
params.add(param);
|
||||
}
|
||||
|
||||
public boolean remove(Item item, String param) {
|
||||
Set<String> params = map.get(item);
|
||||
if (params != null && params.contains(param)) {
|
||||
return params.remove(param);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<String> get(Item item) {
|
||||
Set<String> params = map.get(item);
|
||||
|
||||
@@ -299,6 +299,7 @@ public class JobContextManager implements IContextManager {
|
||||
}
|
||||
List<ContextItem> contextItemList = ContextUtils.getAllContextItem();
|
||||
boolean setDefault = false;
|
||||
ContextUtils.clearMissingContextCache();
|
||||
for (int i = 0; i < contextTypeList.size(); i++) {
|
||||
contextType = (ContextType) contextTypeList.get(i);
|
||||
String name = contextType.getName();
|
||||
@@ -526,6 +527,7 @@ public class JobContextManager implements IContextManager {
|
||||
|
||||
EList newcontextTypeList = new BasicEList();
|
||||
Map<String, Item> idToItemMap = new HashMap<String, Item>();
|
||||
ContextUtils.clearMissingContextCache();
|
||||
for (int i = 0; i < listContext.size(); i++) {
|
||||
IContext context = listContext.get(i);
|
||||
String contextGroupName = renameGroupContext.get(context);
|
||||
|
||||
@@ -51,6 +51,7 @@ public abstract class AbstractItemContextLinkService implements IItemContextLink
|
||||
itemContextLink.setItemId(itemId);
|
||||
Map<String, Item> tempCache = new HashMap<String, Item>();
|
||||
if (contextTypeList != null && contextTypeList.size() > 0) {
|
||||
ContextUtils.clearMissingContextCache();
|
||||
for (Object object : contextTypeList) {
|
||||
if (object instanceof ContextType) {
|
||||
ContextType jobContextType = (ContextType) object;
|
||||
|
||||
@@ -206,6 +206,7 @@ public class ContextLinkService {
|
||||
Map<String, Map<String, String>> changedContextParameterId) throws PersistenceException {
|
||||
List<Relation> relationList = RelationshipItemBuilder.getInstance()
|
||||
.getItemsHaveRelationWith(sourceId, RelationshipItemBuilder.LATEST_VERSION, false);
|
||||
ContextUtils.clearMissingContextCache();
|
||||
for (Relation relation : relationList) {
|
||||
String id = relation.getId();
|
||||
IFile linkFile = calContextLinkFile(ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), id);
|
||||
|
||||
@@ -79,4 +79,8 @@ public final class TalendPropertiesUtil {
|
||||
public static String getProductApp() {
|
||||
return System.getProperty(PROD_APP);
|
||||
}
|
||||
|
||||
public static boolean isEnabledUseShortJobletName() {
|
||||
return isEnabled("talend.job.build.useShortJobletName"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,6 +648,7 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
|
||||
helper.initHelper(contextManager);
|
||||
Map<String, Item> items = new HashMap<String, Item>();
|
||||
boolean needRefresh = false;
|
||||
ContextUtils.clearMissingContextCache();
|
||||
for (IContextParameter param : contextManager.getDefaultContext().getContextParameterList()) {
|
||||
if (!param.isBuiltIn()) {
|
||||
String source = param.getSource();
|
||||
|
||||
@@ -522,6 +522,7 @@ public class SelectRepositoryContextDialog extends SelectionDialog {
|
||||
// remove the params which is unchecked
|
||||
Set<String> jobletIds = new HashSet<String>();
|
||||
Set<String> chekedIds = new HashSet<String>();
|
||||
ContextUtils.clearMissingContextCache();
|
||||
for (IContextParameter param : existParas) {
|
||||
if (param.isBuiltIn()) {
|
||||
continue;
|
||||
|
||||
@@ -185,6 +185,7 @@ public class AddRepositoryContextGroupCommand extends Command {
|
||||
// remove the params which is unchecked
|
||||
Set<String> jobletIds = new HashSet<String>();
|
||||
Set<String> chekedIds = new HashSet<String>();
|
||||
ContextUtils.clearMissingContextCache();
|
||||
for (IContextParameter param : existParas) {
|
||||
if (param.isBuiltIn()) {
|
||||
continue;
|
||||
|
||||
@@ -92,6 +92,7 @@ public class ContextNatTableUtils {
|
||||
List<ContextTableTabParentModel> output = new ArrayList<ContextTableTabParentModel>();
|
||||
if (!contextDatas.isEmpty()) {
|
||||
int i = 0;
|
||||
ContextUtils.clearMissingContextCache();
|
||||
for (IContextParameter para : contextDatas) {
|
||||
String sourceId = para.getSource();
|
||||
if (IContextParameter.BUILT_IN.equals(sourceId)) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.core.model.context.ContextUtils;
|
||||
import org.talend.core.ui.branding.IBrandingConfiguration;
|
||||
|
||||
/**
|
||||
@@ -51,6 +52,7 @@ public class Contexts {
|
||||
public void run() {
|
||||
if (cxtView != null) {
|
||||
updateTitle(cxtView);
|
||||
ContextUtils.clearMissingContextCache();
|
||||
cxtView.refresh(part);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public class RoutinesFunctionProposal implements IContentProposal {
|
||||
message += Messages.getString("RoutinesFunctionProposal.CreatedBy");
|
||||
message += Messages.getString("RoutinesFunctionProposal.ReturnType");
|
||||
message += Messages.getString("RoutinesFunctionProposal.VariableName");
|
||||
message = message.replaceAll("\n", System.getProperty("line.separator", "\n")); // for display on Windows platform
|
||||
|
||||
MessageFormat format = new MessageFormat(message);
|
||||
Object[] args = new Object[] { function.getDescription(),
|
||||
|
||||
@@ -134,7 +134,7 @@ public final class TokenInforUtil {
|
||||
targetArray = new JSONArray();
|
||||
Map<String,List<JSONObject>> objectMap = new HashMap<String,List<JSONObject>>();
|
||||
for (Object obj : data) {
|
||||
if((obj instanceof JSONObject) && ((JSONObject)obj).get("component_name")!=null){//$NON-NLS-1$
|
||||
if((obj instanceof JSONObject) && ((JSONObject)obj).has("component_name") && ((JSONObject)obj).get("component_name")!=null){//$NON-NLS-1$
|
||||
List<JSONObject> dataList = new ArrayList<JSONObject>();
|
||||
String componentName = (String) ((JSONObject)obj).get("component_name");//$NON-NLS-1$
|
||||
if(objectMap.containsKey(componentName)){
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.20</version>
|
||||
<version>2.22.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
@@ -139,10 +139,15 @@
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache-extras.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
<version>2.0b6</version>
|
||||
</dependency>
|
||||
<groupId>org.apache-extras.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
<version>2.0b6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.marshalling</groupId>
|
||||
<artifactId>jboss-marshalling</artifactId>
|
||||
<version>2.0.12.Final</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20140107</version>
|
||||
<version>20230227</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<artifactId>studio-tacokit-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<tacokit.components.version>1.27.16</tacokit.components.version>
|
||||
<tacokit.components.version>1.27.24</tacokit.components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<tcomp.version>1.38.6</tcomp.version>
|
||||
<tcomp.version>1.38.9</tcomp.version>
|
||||
<slf4j.version>1.7.32</slf4j.version>
|
||||
<log4j2.version>2.17.1</log4j2.version>
|
||||
<reload4j.version>1.2.19</reload4j.version>
|
||||
|
||||
@@ -6,23 +6,23 @@
|
||||
<classpathentry exported="true" kind="lib" path="lib/wsdl4j-1.6.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/istack-commons-runtime-3.0.12.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jaxb-runtime-2.3.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/woodstox-core-6.2.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-core-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-soap-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-xml-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-databinding-jaxb-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-features-clustering-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxrs-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxws-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-simple-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-rs-client-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-saml-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-transports-http-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-addr-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-wsdl-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-policy-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-security-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/woodstox-core-6.4.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-core-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-soap-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-xml-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-databinding-jaxb-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-features-clustering-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxrs-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxws-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-simple-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-rs-client-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-saml-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-transports-http-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-addr-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-wsdl-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-policy-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-security-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-1.2.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-api-1.2.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta.annotation-api-1.3.5.jar"/>
|
||||
|
||||
@@ -5,22 +5,22 @@ Bundle-SymbolicName: org.talend.libraries.apache.cxf;singleton:=true
|
||||
Bundle-Version: 7.3.1.qualifier
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
lib/cxf-core-3.4.7.jar,
|
||||
lib/cxf-rt-bindings-soap-3.4.7.jar,
|
||||
lib/cxf-rt-bindings-xml-3.4.7.jar,
|
||||
lib/cxf-rt-databinding-jaxb-3.4.7.jar,
|
||||
lib/cxf-rt-features-clustering-3.4.7.jar,
|
||||
lib/cxf-rt-frontend-jaxrs-3.4.7.jar,
|
||||
lib/cxf-rt-frontend-jaxws-3.4.7.jar,
|
||||
lib/cxf-rt-frontend-simple-3.4.7.jar,
|
||||
lib/cxf-rt-rs-client-3.4.7.jar,
|
||||
lib/cxf-rt-security-3.4.7.jar,
|
||||
lib/cxf-rt-security-saml-3.4.7.jar,
|
||||
lib/cxf-rt-transports-http-3.4.7.jar,
|
||||
lib/cxf-rt-ws-addr-3.4.7.jar,
|
||||
lib/cxf-rt-wsdl-3.4.7.jar,
|
||||
lib/cxf-rt-ws-security-3.4.7.jar,
|
||||
lib/cxf-rt-ws-policy-3.4.7.jar,
|
||||
lib/cxf-core-3.5.5.jar,
|
||||
lib/cxf-rt-bindings-soap-3.5.5.jar,
|
||||
lib/cxf-rt-bindings-xml-3.5.5.jar,
|
||||
lib/cxf-rt-databinding-jaxb-3.5.5.jar,
|
||||
lib/cxf-rt-features-clustering-3.5.5.jar,
|
||||
lib/cxf-rt-frontend-jaxrs-3.5.5.jar,
|
||||
lib/cxf-rt-frontend-jaxws-3.5.5.jar,
|
||||
lib/cxf-rt-frontend-simple-3.5.5.jar,
|
||||
lib/cxf-rt-rs-client-3.5.5.jar,
|
||||
lib/cxf-rt-security-3.5.5.jar,
|
||||
lib/cxf-rt-security-saml-3.5.5.jar,
|
||||
lib/cxf-rt-transports-http-3.5.5.jar,
|
||||
lib/cxf-rt-ws-addr-3.5.5.jar,
|
||||
lib/cxf-rt-wsdl-3.5.5.jar,
|
||||
lib/cxf-rt-ws-security-3.5.5.jar,
|
||||
lib/cxf-rt-ws-policy-3.5.5.jar,
|
||||
lib/istack-commons-runtime-3.0.12.jar,
|
||||
lib/jakarta.activation-1.2.2.jar,
|
||||
lib/jakarta.activation-api-1.2.2.jar,
|
||||
@@ -35,7 +35,7 @@ Bundle-ClassPath: .,
|
||||
lib/stax2-api-4.2.1.jar,
|
||||
lib/txw2-2.3.4.jar,
|
||||
lib/xmlschema-core-2.2.5.jar,
|
||||
lib/woodstox-core-6.2.6.jar,
|
||||
lib/woodstox-core-6.4.0.jar,
|
||||
lib/wsdl4j-1.6.3.jar
|
||||
Export-Package: javax.jws,
|
||||
javax.ws.rs,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<cxf.version>3.4.7</cxf.version>
|
||||
<cxf.version>3.5.5</cxf.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@@ -170,7 +170,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>6.2.6</version>
|
||||
<version>6.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ws.xmlschema</groupId>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/advancedPersistentLookupLib-1.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/advancedPersistentLookupLib-1.4.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
||||
@@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Name: org.talend.libraries.persist.lookup
|
||||
Bundle-SymbolicName: org.talend.libraries.persist.lookup
|
||||
Bundle-Version: 7.3.1.qualifier
|
||||
Bundle-ClassPath: lib/advancedPersistentLookupLib-1.2.jar,
|
||||
.
|
||||
Bundle-ClassPath: .,
|
||||
lib/advancedPersistentLookupLib-1.4.jar
|
||||
Export-Package: org.talend.commons.utils.data.map,
|
||||
org.talend.commons.utils.time,
|
||||
org.talend.core.model.process,
|
||||
|
||||
@@ -2,4 +2,6 @@ source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/advancedPersistentLookupLib-1.4.jar,\
|
||||
lib/advancedPersistentLookupLib-1.3.jar,\
|
||||
lib/advancedPersistentLookupLib-1.2.jar
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<jardesc>
|
||||
<jar path="D:/studio_code/tcommon-studio-se/main/plugins/org.talend.libraries.persist.lookup/lib/advancedPersistentLookupLib-1.2.jar"/>
|
||||
<jar path="D:/studio_code/tcommon-studio-se/main/plugins/org.talend.libraries.persist.lookup/lib/advancedPersistentLookupLib-1.4.jar"/>
|
||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/org.talend.libraries.persist.lookup/export_advancedPersistentLookupLib.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="false" storeRefactorings="false" useSourceFolders="false"/>
|
||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||
<selectedProjects/>
|
||||
|
||||
Binary file not shown.
@@ -2,6 +2,7 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="resources/java"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jboss-marshalling-2.0.12.Final.jar"/>
|
||||
<classpathentry kind="lib" path="lib/crypto-utils.jar"/>
|
||||
<classpathentry kind="lib" path="lib/slf4j-api-1.7.25.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
|
||||
@@ -28,7 +28,8 @@ Eclipse-LazyStart: true
|
||||
Bundle-ClassPath: .,
|
||||
lib/crypto-utils.jar,
|
||||
lib/slf4j-api-1.7.25.jar
|
||||
Export-Package: org.talend.librariesmanager.emf.librariesindex,
|
||||
Export-Package: org.jboss.marshalling,
|
||||
org.talend.librariesmanager.emf.librariesindex,
|
||||
org.talend.librariesmanager.librarydata,
|
||||
org.talend.librariesmanager.maven,
|
||||
org.talend.librariesmanager.model,
|
||||
@@ -40,3 +41,5 @@ Export-Package: org.talend.librariesmanager.emf.librariesindex,
|
||||
Import-Package: org.eclipse.emf.ecore.xmi.impl,
|
||||
org.talend.osgi.hook.notification
|
||||
Eclipse-BundleShape: dir
|
||||
Bundle-ClassPath: lib/jboss-marshalling-2.0.12.Final.jar,
|
||||
.
|
||||
|
||||
@@ -69,6 +69,12 @@
|
||||
name="crypto-utils-0.31.12.jar">
|
||||
</library>
|
||||
</systemRoutine>
|
||||
<systemRoutine
|
||||
name="IPersistableLookupRow">
|
||||
<library
|
||||
name="mvn:org.jboss.marshalling/jboss-marshalling/2.0.12.Final">
|
||||
</library>
|
||||
</systemRoutine>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.talend.core.runtime.artifact_handler">
|
||||
|
||||
@@ -51,6 +51,11 @@
|
||||
<version>1.7.25</version>
|
||||
<overWrite>true</overWrite>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.jboss.marshalling</groupId>
|
||||
<artifactId>jboss-marshalling</artifactId>
|
||||
<version>2.0.12.Final</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
@@ -467,13 +467,13 @@ public class TalendDate {
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} String("") string : date represent in string
|
||||
* {param} String("2008/11/24 12:15:25") string : date represent in string
|
||||
*
|
||||
* {param} String("yyyy-MM-dd") pattern : date pattern
|
||||
* {param} String("yyyy/MM/dd HH:mm:ss") pattern : date pattern
|
||||
*
|
||||
* {param} int(addValue) nb : the added value
|
||||
* {param} int(5) nb : the added value
|
||||
*
|
||||
* {param} date("MM") dateType : the part to add
|
||||
* {param} String("dd") dateType : the part to add
|
||||
*
|
||||
* {examples}
|
||||
*
|
||||
@@ -1216,8 +1216,19 @@ public class TalendDate {
|
||||
}
|
||||
|
||||
/**
|
||||
* format date to mssql 2008 type datetimeoffset ISO 8601 string with local time zone format string : yyyy-MM-dd
|
||||
* HH:mm:ss.SSSXXX(JDK7 support it)
|
||||
* Format date to mssql 2008 type datetimeoffset ISO 8601 string with local time zone format string : yyyy-MM-dd
|
||||
* HH:mm:ss.SSSXXX (JDK7 support it)
|
||||
*
|
||||
* @param date the time value to be formatted into a time string.
|
||||
* @return the formatted time string.
|
||||
*
|
||||
* {talendTypes} String
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} date(new Date()) date : the time value to be formatted into a time string
|
||||
*
|
||||
* {example} formatDatetimeoffset(new Date()) #
|
||||
*/
|
||||
public static String formatDatetimeoffset(Date date) {
|
||||
String dateString = formatDate("yyyy-MM-dd HH:mm:ss.SSSZ", date);// keep the max precision in java
|
||||
@@ -1346,14 +1357,28 @@ public class TalendDate {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Convert a formatted string to date
|
||||
*
|
||||
* @param string Must be a string datatype. Passes the values that you want to convert.
|
||||
* @param format Enter a valid TO_DATE format string. The format string must match the parts of the string argument
|
||||
* default formate is "MM/DD/yyyy HH:mm:ss.sss" if not specified.
|
||||
* default format is "MM/DD/yyyy HH:mm:ss.sss" if not specified.
|
||||
*
|
||||
* @return Date
|
||||
* @throws ParseException
|
||||
* {example} TO_DATE("1464576463231", "J") #Mon May 30 10:47:43 CST 2016
|
||||
* {example} TO_DATE("2015-11-21 13:23:45","yyyy-MM-dd HH:mm:ss") #Sat Nov 21 13:23:45 CST 2015
|
||||
*
|
||||
* {talendTypes} Date
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} String("2015-11-21 13:23:45") string : string Must be a string datatype. Passes the values that you want
|
||||
* to convert.
|
||||
*
|
||||
* {param} String("yyyy-MM-dd HH:mm:ss") format : Enter a valid TO_DATE format string. The format string must match
|
||||
* the parts of the string argument default format is "MM/DD/yyyy HH:mm:ss.sss" if not specified.
|
||||
*
|
||||
*
|
||||
* {example} TO_DATE("1464576463231", "J") #Mon May 30 10:47:43 CST 2016 {example} TO_DATE("2015-11-21
|
||||
* 13:23:45","yyyy-MM-dd HH:mm:ss") #Sat Nov 21 13:23:45 CST 2015
|
||||
*
|
||||
*/
|
||||
public static Date TO_DATE(String string, String format) throws ParseException {
|
||||
@@ -1374,6 +1399,24 @@ public class TalendDate {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a formatted string to date with default format as ""MM/DD/yyyy HH:mm:ss.sss"
|
||||
*
|
||||
* @param string Must be a string datatype. Passes the values that you want to convert.
|
||||
* @return Date
|
||||
* @throws ParseException
|
||||
*
|
||||
* {talendTypes} Date
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} String("11/21/2015 13:23:45.111") string : string Must be a string datatype. Passes the values that you
|
||||
* want to convert.
|
||||
*
|
||||
* {example} TO_DATE("11/21/2015 13:23:45.111") #Sat Nov 21 13:23:45.111 CST 2015
|
||||
*
|
||||
*/
|
||||
|
||||
public static Date TO_DATE(String string) throws ParseException {
|
||||
return TO_DATE(string, null);
|
||||
}
|
||||
@@ -1410,13 +1453,25 @@ public class TalendDate {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param date Passes the values you want to change
|
||||
* Add values to the specified portion of the date
|
||||
*
|
||||
* @param date Passes the values you want to change
|
||||
* @param format A format string specifying the portion of the date value you want to change.For example, 'mm'.
|
||||
* @param amount An integer value specifying the amount of years, months, days, hours,
|
||||
* and so on by which you want to change the date value.
|
||||
* @return Date NULL if a null value is passed as an argument to the function.
|
||||
* @param amount An integer value specifying the amount of years, months, days, hours, and so on by which you want
|
||||
* to change the date value.
|
||||
* @return Date NULL if a null value is passed as an argument to the function.
|
||||
* @throws ParseException
|
||||
*
|
||||
* {talendTypes} Date
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} Date(new Date()) date :
|
||||
*
|
||||
* {param} String("HH") format :
|
||||
*
|
||||
* {param} int(2) amount :
|
||||
*
|
||||
* {example} ADD_TO_DATE(new Date(1464576463231l), "HH",2) #Mon May 30 12:47:43 CST 2016
|
||||
*/
|
||||
public static Date ADD_TO_DATE(Date date, String format, int amount) throws ParseException{
|
||||
@@ -1485,10 +1540,21 @@ public class TalendDate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Date to a formatted character string.
|
||||
*
|
||||
* @param date Date/Time datatype. Passes the date values you want to convert to character strings.
|
||||
* @param format Enter a valid TO_CHAR format string. The format string defines the format of the return value,
|
||||
* @return String. NULL if a value passed to the function is NULL.
|
||||
* @param date the date value you want to convert to character strings.
|
||||
* @param format the format of the return value,
|
||||
* @return String. NULL if a value passed to the function is NULL.
|
||||
*
|
||||
* {talendTypes} String
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} Date(new Date()) date : the date value you want to convert to character strings.
|
||||
*
|
||||
* {param} String("MM/DD/YYYY HH24:MI:SS") format : the format of the return value,
|
||||
*
|
||||
* {example} TO_CHAR(new Date(),"MM/DD/YYYY HH24:MI:SS") #
|
||||
*/
|
||||
|
||||
public static String TO_CHAR(Date date, String format) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -14,7 +14,6 @@ package routines.system;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.dom4j.Element;
|
||||
@@ -110,26 +109,31 @@ public class GetJarsToRegister {
|
||||
private String addLibsPath(String line, java.util.Map<String, String> crcMap) {
|
||||
for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) {
|
||||
line = adaptLibPaths(line, entry);
|
||||
if (new java.io.File(line).exists()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) {
|
||||
line = line.replace("\\", "/");
|
||||
String jarName = entry.getValue();
|
||||
String crc = entry.getKey();
|
||||
String libStringFinder = "../lib/" + jarName;
|
||||
String libStringFinder2 = "./" + jarName; // for the job jar itself.
|
||||
String replacement = "../../../cache/lib/" + crc + "/" + jarName;
|
||||
|
||||
if (line.contains(libStringFinder)) {
|
||||
line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName);
|
||||
line = line.replace(libStringFinder, replacement);
|
||||
} else if (line.toLowerCase().contains(libStringFinder2)) {
|
||||
line = line.toLowerCase().replace(libStringFinder2, "../../../cache/lib/" + crc + "/" + jarName);
|
||||
} else if (line.toLowerCase().equals(jarName)) {
|
||||
line = "../../../cache/lib/" + crc + "/" + jarName;
|
||||
line = line.toLowerCase().replace(libStringFinder2, replacement);
|
||||
} else if (line.equalsIgnoreCase(jarName)) {
|
||||
line = replacement;
|
||||
} else if (line.contains(":$ROOT_PATH/" + jarName + ":")) {
|
||||
line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":");
|
||||
line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/" + replacement + ":");
|
||||
} else if (line.contains(";" + jarName + ";")) {
|
||||
line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";");
|
||||
line = line.replace(";" + jarName + ";", ";" + replacement + ";");
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import java.io.DataOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import org.jboss.marshalling.Marshaller;
|
||||
import org.jboss.marshalling.Unmarshaller;
|
||||
|
||||
public interface IPersistableLookupRow<R> {
|
||||
|
||||
public void writeKeysData(ObjectOutputStream out);
|
||||
@@ -19,4 +22,25 @@ public interface IPersistableLookupRow<R> {
|
||||
|
||||
public void copyKeysDataTo(R other);
|
||||
|
||||
default public void writeKeysData(Marshaller marshaller){
|
||||
//sub-class need to override this method
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public void readKeysData(Unmarshaller in){
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public void writeValuesData(DataOutputStream dataOut, Marshaller objectOut){
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public void readValuesData(DataInputStream dataIn, Unmarshaller objectIn){
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public boolean supportMarshaller(){
|
||||
//Override this method to return true after implement the Jboss methods above
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,28 @@ package routines.system;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import org.jboss.marshalling.Marshaller;
|
||||
import org.jboss.marshalling.Unmarshaller;
|
||||
|
||||
public interface IPersistableRow<R> {
|
||||
|
||||
public void writeData(ObjectOutputStream out);
|
||||
|
||||
public void readData(ObjectInputStream in);
|
||||
|
||||
|
||||
default public void writeData(Marshaller marshaller){
|
||||
//sub-class need to override this method
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public void readData(Unmarshaller in){
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public boolean supportJboss(){
|
||||
//Override this method to return true after implement the Jboss methods above
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1319,11 +1319,81 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
saveMavenIndex(mavenURIMap, monitorWrap);
|
||||
savePlatfromURLIndex(platformURLMap, monitorWrap);
|
||||
|
||||
if (service != null) {
|
||||
deployLibsFromCustomComponents(service, platformURLMap);
|
||||
}
|
||||
return mavenURIMap;
|
||||
}
|
||||
|
||||
public void deployLibsFromCustomComponents(File componentFolder, List<ModuleNeeded> modulesNeeded) {
|
||||
if (modulesNeeded == null || modulesNeeded.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<File, Set<MavenArtifact>> needToDeploy = new HashMap<File, Set<MavenArtifact>>();
|
||||
modulesNeeded.forEach(module -> {
|
||||
if (module != null) {
|
||||
boolean needDeploy = false;
|
||||
String mvnUri = module.getMavenUri();
|
||||
String jarPathFromMaven = getJarPathFromMaven(StringUtils.isNotBlank(mvnUri) ? mvnUri : module.getModuleName());
|
||||
if (StringUtils.isBlank(jarPathFromMaven)) {
|
||||
needDeploy = true;
|
||||
} else {
|
||||
File jarFromMaven = new File(jarPathFromMaven);
|
||||
if (!jarFromMaven.exists()) {
|
||||
needDeploy = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needDeploy) {
|
||||
File deployFile = getDeployJarFileByModule(componentFolder, module);
|
||||
if (deployFile != null) {
|
||||
|
||||
install(deployFile, mvnUri, false, true, null);
|
||||
|
||||
if (needToDeploy.get(deployFile) == null) {
|
||||
needToDeploy.put(deployFile, new HashSet<MavenArtifact>());
|
||||
}
|
||||
if (StringUtils.isNotBlank(mvnUri)) {
|
||||
MavenArtifact mavenArtifact = MavenUrlHelper.parseMvnUrl(mvnUri);
|
||||
needToDeploy.get(deployFile).add(mavenArtifact);
|
||||
} else {
|
||||
Map<String, String> sourceAndMavenUri = new HashMap<>();
|
||||
guessMavenRUIFromIndex(deployFile, true, sourceAndMavenUri);
|
||||
Set<MavenArtifact> MavenArtifactSet = new HashSet<MavenArtifact>();
|
||||
sourceAndMavenUri.keySet().forEach(mavenUri -> {
|
||||
if (StringUtils.isNotBlank(mvnUri)) {
|
||||
MavenArtifactSet.add(MavenUrlHelper.parseMvnUrl(mavenUri));
|
||||
}
|
||||
});
|
||||
needToDeploy.get(deployFile).addAll(MavenArtifactSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!needToDeploy.isEmpty()) {
|
||||
ShareComponentsLibsJob shareJob = new ShareComponentsLibsJob(
|
||||
Messages.getString("LocalLibraryManager.shareLibsForCustomponents"), needToDeploy, deployer);
|
||||
shareJob.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
private File getDeployJarFileByModule(File componentFolder, ModuleNeeded module) {
|
||||
String mvnUri = module.getMavenUri();
|
||||
if (StringUtils.isNotBlank(mvnUri)) {
|
||||
MavenArtifact mavenArtifact = MavenUrlHelper.parseMvnUrl(mvnUri);
|
||||
String fileName = mavenArtifact.getFileName();
|
||||
File jarFile = new File(componentFolder, fileName);
|
||||
if (jarFile.exists()) {
|
||||
return jarFile;
|
||||
}
|
||||
|
||||
}
|
||||
// try module name
|
||||
File jarFile = new File(componentFolder, module.getModuleName());
|
||||
if (jarFile.exists()) {
|
||||
return jarFile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -1382,86 +1452,6 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
return false;
|
||||
}
|
||||
|
||||
private void deployLibsFromCustomComponents(IComponentsService service, Map<String, String> platformURLMap) {
|
||||
boolean deployToRemote = true;
|
||||
if (!LibrariesManagerUtils.shareLibsAtStartup()) {
|
||||
log.info("Skip deploying libs from custom components");
|
||||
deployToRemote = false;
|
||||
}
|
||||
|
||||
Map<File, Set<MavenArtifact>> needToDeploy = new HashMap<File, Set<MavenArtifact>>();
|
||||
List<ComponentProviderInfo> componentsFolders = service.getComponentsFactory().getComponentsProvidersInfo();
|
||||
for (ComponentProviderInfo providerInfo : componentsFolders) {
|
||||
String id = providerInfo.getId();
|
||||
try {
|
||||
File file = new File(providerInfo.getLocation());
|
||||
if (isExtComponentProvider(id)) {
|
||||
if (file.isDirectory()) {
|
||||
List<File> jarFiles = FilesUtils.getJarFilesFromFolder(file, null);
|
||||
if (jarFiles.size() > 0) {
|
||||
for (File jarFile : jarFiles) {
|
||||
String name = jarFile.getName();
|
||||
if (!canDeployFromCustomComponentFolder(name) || platformURLMap.get(name) != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
collectLibModules(jarFile, needToDeploy);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!canDeployFromCustomComponentFolder(file.getName()) || platformURLMap.get(file.getName()) != null) {
|
||||
continue;
|
||||
}
|
||||
collectLibModules(file, needToDeploy);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// first install them locally
|
||||
needToDeploy.forEach((k, v) -> {
|
||||
try {
|
||||
// install as release version if can't find mvn url from index
|
||||
install(k, null, false, true);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
});
|
||||
|
||||
if (!deployToRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
ShareComponentsLibsJob shareJob = new ShareComponentsLibsJob(
|
||||
Messages.getString("LocalLibraryManager.shareLibsForCustomponents"), needToDeploy, deployer);
|
||||
shareJob.schedule();
|
||||
}
|
||||
|
||||
private void collectLibModules(File jarFile, Map<File, Set<MavenArtifact>> needToDeploy) {
|
||||
Map<String,String> mavenUris = new HashMap<String,String>();
|
||||
guessMavenRUIFromIndex(jarFile, true, mavenUris);
|
||||
|
||||
Set<MavenArtifact> artifacts = new HashSet<MavenArtifact>();
|
||||
for(String uri: mavenUris.keySet()) {
|
||||
MavenArtifact art = MavenUrlHelper.parseMvnUrl(uri);
|
||||
if(art!=null) {
|
||||
artifacts.add(art);
|
||||
}
|
||||
}
|
||||
|
||||
needToDeploy.put(jarFile, artifacts);
|
||||
}
|
||||
|
||||
private boolean canDeployFromCustomComponentFolder(String fileName) {
|
||||
if (isSystemCacheFile(fileName) || isComponentDefinitionFileType(fileName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void warnDuplicated(List<ModuleNeeded> modules, Set<String> duplicates, String type) {
|
||||
for (String lib : duplicates) {
|
||||
Set<String> components = new HashSet<>();
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
context="plugin:org.talend.metadata.managment"
|
||||
language="java"
|
||||
message="Needed for create snowflake connection"
|
||||
mvn_uri="mvn:net.snowflake/snowflake-jdbc/3.11.0"
|
||||
name="snowflake-jdbc-3.11.0.jar"
|
||||
required="false">
|
||||
mvn_uri="mvn:net.snowflake/snowflake-jdbc/3.13.29"
|
||||
name="snowflake-jdbc-3.13.29.jar"
|
||||
required="true">
|
||||
</libraryNeeded>
|
||||
<libraryNeeded
|
||||
context="plugin:org.talend.metadata.managment"
|
||||
@@ -148,6 +148,33 @@
|
||||
required="true"
|
||||
uripath="platform:/plugin/org.talend.libraries.jdbc.hsql/lib/hsqldb.jar">
|
||||
</libraryNeeded>
|
||||
<libraryNeeded
|
||||
context="plugin:org.talend.metadata.managment"
|
||||
language="java"
|
||||
message="Needed for create Microsoft SQL Server db connection"
|
||||
mvn_uri="mvn:net.minidev/json-smart/2.4.11"
|
||||
name="json-smart-2.4.11.jar"
|
||||
required="true"
|
||||
uripath="platform:/plugin/org.talend.libraries.tis.custom/lib/json-smart-2.4.11.jar">
|
||||
</libraryNeeded>
|
||||
<libraryNeeded
|
||||
context="plugin:org.talend.metadata.managment"
|
||||
language="java"
|
||||
message="Needed for create Microsoft SQL Server db connection"
|
||||
mvn_uri="mvn:net.minidev/accessors-smart/2.4.11"
|
||||
name="accessors-smart-2.4.11.jar"
|
||||
required="true"
|
||||
uripath="platform:/plugin/org.talend.libraries.tis.custom/lib/accessors-smart-2.4.11.jar">
|
||||
</libraryNeeded>
|
||||
<libraryNeeded
|
||||
context="plugin:org.talend.metadata.managment"
|
||||
language="java"
|
||||
message="Needed for create Microsoft SQL Server db connection"
|
||||
mvn_uri="mvn:org.ow2.asm/asm/9.5"
|
||||
name="asm-9.5.jar"
|
||||
required="true"
|
||||
uripath="platform:/plugin/org.talend.libraries.tis.custom/lib/asm-9.5.jar">
|
||||
</libraryNeeded>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.talend.core.migrationTask">
|
||||
|
||||
@@ -19,8 +19,6 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import metadata.managment.i18n.Messages;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.cwm.helper.ColumnSetHelper;
|
||||
@@ -29,6 +27,7 @@ import org.talend.metadata.managment.utils.MetadataConnectionUtils;
|
||||
import org.talend.utils.sql.metadata.constants.GetTable;
|
||||
import org.talend.utils.sql.metadata.constants.TableType;
|
||||
|
||||
import metadata.managment.i18n.Messages;
|
||||
import orgomg.cwm.resource.relational.NamedColumnSet;
|
||||
|
||||
/**
|
||||
@@ -177,9 +176,9 @@ public abstract class AbstractTableBuilder<T extends NamedColumnSet> extends Cwm
|
||||
String tableComment = tablesSet.getString(GetTable.REMARKS.name());
|
||||
if (StringUtils.isBlank(tableComment)) {
|
||||
String dbProductName = getConnectionMetadata(connection).getDatabaseProductName();
|
||||
String selectRemarkOnTable = MetadataConnectionUtils.getCommonQueryStr(dbProductName, tableName);
|
||||
String selectRemarkOnTable = MetadataConnectionUtils.getCommonQueryStr(dbProductName);
|
||||
if (selectRemarkOnTable != null) {
|
||||
tableComment = executeGetCommentStatement(selectRemarkOnTable);
|
||||
tableComment = executeGetCommentStatement(selectRemarkOnTable, tableName);
|
||||
}
|
||||
}
|
||||
return tableComment;
|
||||
|
||||
@@ -14,14 +14,14 @@ package org.talend.core.model.metadata.builder.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import metadata.managment.i18n.Messages;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import metadata.managment.i18n.Messages;
|
||||
|
||||
/**
|
||||
* @author scorreia
|
||||
*
|
||||
@@ -73,14 +73,48 @@ abstract class CwmBuilder {
|
||||
*/
|
||||
protected String executeGetCommentStatement(String queryStmt) {
|
||||
String comment = null;
|
||||
Statement statement = null;
|
||||
PreparedStatement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
statement = connection.createStatement();
|
||||
statement.execute(queryStmt);
|
||||
statement = connection.prepareStatement(queryStmt);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet != null) {
|
||||
while (resultSet.next()) {
|
||||
comment = (String) resultSet.getObject(1);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
// do nothing here
|
||||
} finally {
|
||||
// -- release resources
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
} catch (SQLException e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return comment;
|
||||
}
|
||||
|
||||
protected String executeGetCommentStatement(String queryStmt, String tableName) {
|
||||
String comment = null;
|
||||
PreparedStatement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
statement = connection.prepareStatement(queryStmt);
|
||||
statement.setString(1, tableName);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
// get the results
|
||||
resultSet = statement.getResultSet();
|
||||
if (resultSet != null) {
|
||||
while (resultSet.next()) {
|
||||
comment = (String) resultSet.getObject(1);
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ExtractMetaDataUtils {
|
||||
|
||||
public static final String SNOWFLAKE = "Snowflake"; //$NON-NLS-1$
|
||||
|
||||
public static final String SNOWFLAKE_DRIVER_JAR = "snowflake-jdbc-3.11.0.jar"; //$NON-NLS-1$
|
||||
public static final String SNOWFLAKE_DRIVER_JAR = "snowflake-jdbc-3.13.29.jar"; //$NON-NLS-1$
|
||||
|
||||
private ExtractMetaDataUtils() {
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ import org.talend.metadata.managment.connection.manager.HiveConnectionManager;
|
||||
import org.talend.metadata.managment.hive.EmbeddedHiveDataBaseMetadata;
|
||||
import org.talend.metadata.managment.repository.ManagerConnection;
|
||||
import org.talend.metadata.managment.utils.DatabaseConstant;
|
||||
import org.talend.metadata.managment.utils.EDataBaseType;
|
||||
import org.talend.metadata.managment.utils.ManagementTextUtils;
|
||||
import org.talend.metadata.managment.utils.MetadataConnectionUtils;
|
||||
import org.talend.utils.sql.ConnectionUtils;
|
||||
@@ -1038,8 +1039,12 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
// for CDH4 HIVE2 , the table type are MANAGED_TABLE and EXTERNAL_TABLE ......
|
||||
// tableType = null;
|
||||
}
|
||||
Map<String,String> tableComments = null;
|
||||
if (!isOracle8i) {
|
||||
tableComments = this.getTableComments(dbJDBCMetadata, catalogName, schemaPattern);
|
||||
}
|
||||
ResultSet tables = dbJDBCMetadata.getTables(catalogName, schemaPattern, tablePattern, tableType);
|
||||
|
||||
boolean hasRemarksCol = hasRemarksColumn(tables);
|
||||
while (tables.next()) {
|
||||
String coloumnName = GetTable.TABLE_SCHEM.name();
|
||||
if (schemaPattern != null) {
|
||||
@@ -1064,8 +1069,13 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
// if (!isOracle && !isOracle8i && !isOracleJdbc && tableName.startsWith("/")) { //$NON-NLS-1$
|
||||
// continue;
|
||||
// }
|
||||
if (!isOracle8i) {
|
||||
tableComment = getTableComment(dbJDBCMetadata, tables, tableName, catalogName, schemaPattern);
|
||||
if (hasRemarksCol) {
|
||||
tableComment = getRemarksFromResultSet(tables);
|
||||
}
|
||||
if (tableComments != null) {
|
||||
if (StringUtils.isEmpty(tableComment)) {
|
||||
tableComment = tableComments.get(tableName);
|
||||
}
|
||||
}
|
||||
MetadataTable metadatatable = null;
|
||||
if (TableType.VIEW.toString().equals(temptableType) || ETableTypes.VIRTUAL_VIEW.getName().equals(temptableType)) {
|
||||
@@ -1209,6 +1219,69 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
}
|
||||
return tableComment;
|
||||
}
|
||||
|
||||
private Map<String, String> getTableComments(DatabaseMetaData dbJDBCMetadata, String catalogName, String schemaPattern) {
|
||||
Map<String, String> ret = new HashMap<String, String>();
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
String productName = dbJDBCMetadata.getDatabaseProductName();
|
||||
if (StringUtils.isEmpty(productName)) {
|
||||
return ret;
|
||||
}
|
||||
productName = productName.replaceAll(" ", "_"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
EDataBaseType eDataBaseType = null;
|
||||
try {
|
||||
eDataBaseType = EDataBaseType.valueOf(productName);
|
||||
} catch (Exception e) {
|
||||
eDataBaseType = EDataBaseType.Microsoft_SQL_Server;
|
||||
}
|
||||
|
||||
String sqlStr = ""; //$NON-NLS-1$
|
||||
switch (eDataBaseType) {
|
||||
case Oracle:
|
||||
sqlStr = "SELECT TABLE_NAME,COMMENTS FROM ALL_TAB_COMMENTS WHERE OWNER=?";
|
||||
ps = dbJDBCMetadata.getConnection().prepareStatement(sqlStr);
|
||||
ps.setString(1, schemaPattern.toUpperCase());
|
||||
break;
|
||||
case MySQL:
|
||||
sqlStr = "SELECT TABLE_NAME,TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA=?";
|
||||
ps = dbJDBCMetadata.getConnection().prepareStatement(sqlStr);
|
||||
ps.setString(1, catalogName);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ps != null) {
|
||||
rs = ps.executeQuery();
|
||||
while (rs != null && rs.next()) {
|
||||
String comment = rs.getString(2);
|
||||
if (!StringUtils.isEmpty(comment)) {
|
||||
ret.put(rs.getString(1), comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error(e, e);
|
||||
} finally {
|
||||
if (ps != null) {
|
||||
try {
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
CommonExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (rs != null) {
|
||||
try {
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
CommonExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the Column Comment especially for oracle type.
|
||||
@@ -1295,9 +1368,12 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> tableComments = null;
|
||||
if (!flag) {
|
||||
tableComments = this.getTableComments(dbJDBCMetadata, catalogName, schemaPattern);
|
||||
}
|
||||
ResultSet tables = dbJDBCMetadata.getTables(catalogName, schemaPattern, tablePattern, tableType);
|
||||
|
||||
boolean hasRemarksCol = hasRemarksColumn(tables);
|
||||
while (tables.next()) {
|
||||
String tableName = getStringFromResultSet(tables, GetTable.TABLE_NAME.name());
|
||||
String temptableType = getStringFromResultSet(tables, GetTable.TABLE_TYPE.name());
|
||||
@@ -1316,8 +1392,13 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
if (tableName == null || tablesToFilter.contains(tableName) || tableName.startsWith("/")) { //$NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
if (!flag) {
|
||||
tableComment = getTableComment(dbJDBCMetadata, tables, tableName, catalogName, schemaPattern);
|
||||
if (hasRemarksCol) {
|
||||
tableComment = getRemarksFromResultSet(tables);
|
||||
}
|
||||
if (tableComments != null) {
|
||||
if (StringUtils.isEmpty(tableComment)) {
|
||||
tableComment = tableComments.get(tableName);
|
||||
}
|
||||
}
|
||||
// create table
|
||||
TdTable table = RelationalFactory.eINSTANCE.createTdTable();
|
||||
@@ -1367,8 +1448,17 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
||||
boolean flag = true;
|
||||
if (pack != null) {
|
||||
Connection c = ConnectionHelper.getConnection(pack);
|
||||
flag = MetadataConnectionUtils.isOracle8i(c);
|
||||
}
|
||||
Map<String, String> tableComments = null;
|
||||
if (!flag) {
|
||||
tableComments = this.getTableComments(dbJDBCMetadata, catalogName, schemaPattern);
|
||||
}
|
||||
ResultSet tables = dbJDBCMetadata.getTables(catalogName, schemaPattern, viewPattern, tableType);
|
||||
boolean hasRemarksCol = hasRemarksColumn(tables);
|
||||
while (tables.next()) {
|
||||
|
||||
String tableName = getStringFromResultSet(tables, GetTable.TABLE_NAME.name());
|
||||
@@ -1379,14 +1469,14 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
continue;
|
||||
}
|
||||
// common
|
||||
boolean flag = true;
|
||||
String tableComment = null;
|
||||
if (pack != null) {
|
||||
Connection c = ConnectionHelper.getConnection(pack);
|
||||
flag = MetadataConnectionUtils.isOracle8i(c);
|
||||
if (hasRemarksCol) {
|
||||
tableComment = getRemarksFromResultSet(tables);
|
||||
}
|
||||
if (!flag) {
|
||||
tableComment = getTableComment(dbJDBCMetadata, tables, tableName, catalogName, schemaPattern);
|
||||
if (tableComments != null) {
|
||||
if (StringUtils.isEmpty(tableComment)) {
|
||||
tableComment = tableComments.get(tableName);
|
||||
}
|
||||
}
|
||||
// create table
|
||||
TdView table = RelationalFactory.eINSTANCE.createTdView();
|
||||
@@ -1425,6 +1515,24 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
return valueOfString;
|
||||
}
|
||||
|
||||
private boolean hasRemarksColumn(ResultSet resultSet) {
|
||||
try {
|
||||
if (resultSet == null || resultSet.getMetaData() == null) {
|
||||
return false;
|
||||
}
|
||||
int numOfCols = resultSet.getMetaData().getColumnCount();
|
||||
for (int i = 1; i < numOfCols + 1; i++) {
|
||||
String colName = resultSet.getMetaData().getColumnLabel(i);
|
||||
if (StringUtils.equals(colName, GetColumn.REMARKS.name())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
CommonExceptionHandler.process(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getRemarksFromResultSet(ResultSet resultSet) {
|
||||
String valueOfString = null;
|
||||
try {
|
||||
|
||||
@@ -805,6 +805,33 @@ public class MetadataConnectionUtils {
|
||||
|
||||
}
|
||||
|
||||
public static String getCommonQueryStr(String productName) {
|
||||
if (productName == null) {
|
||||
return null;
|
||||
}
|
||||
productName = productName.replaceAll(" ", "_"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
EDataBaseType eDataBaseType = null;
|
||||
try {
|
||||
eDataBaseType = EDataBaseType.valueOf(productName);
|
||||
} catch (Exception e) {
|
||||
eDataBaseType = EDataBaseType.Microsoft_SQL_Server;
|
||||
}
|
||||
String sqlStr = ""; //$NON-NLS-1$
|
||||
switch (eDataBaseType) {
|
||||
case Oracle:
|
||||
sqlStr = "SELECT COMMENTS FROM USER_TAB_COMMENTS WHERE TABLE_NAME= ? "; //$NON-NLS-1$
|
||||
break;
|
||||
case MySQL:
|
||||
sqlStr = "SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME= ? "; //$NON-NLS-1$
|
||||
break;
|
||||
default:
|
||||
sqlStr = null;
|
||||
|
||||
}
|
||||
return sqlStr;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get Comment Query Str.
|
||||
*
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -240,20 +241,14 @@ public class MigrationToolService implements IMigrationToolService {
|
||||
sortMigrationTasks(toExecute);
|
||||
|
||||
final List<MigrationTask> done = new ArrayList<MigrationTask>(storedMigrations);
|
||||
int nbMigrationsToDo = 0;
|
||||
for (IProjectMigrationTask task : toExecute) {
|
||||
MigrationTask mgTask = MigrationUtil.findMigrationTask(done, task);
|
||||
if (mgTask == null && !task.isDeprecated()) {
|
||||
nbMigrationsToDo++;
|
||||
}
|
||||
}
|
||||
boolean hasTaskToExecute = toExecute.stream()
|
||||
.anyMatch(task -> !task.isDeprecated() && MigrationUtil.findMigrationTask(done, task) == null);
|
||||
|
||||
// force to redo the migration task for the relations only if user ask for "clean" or if relations is empty
|
||||
// or if there is at least another migration to do.
|
||||
if (!beforeLogon
|
||||
&& (!RelationshipItemBuilder.INDEX_VERSION.equals(project.getEmfProject().getItemsRelationVersion()) || nbMigrationsToDo > 0)) {
|
||||
if (!beforeLogon && (!RelationshipItemBuilder.INDEX_VERSION.equals(project.getEmfProject().getItemsRelationVersion())
|
||||
|| hasTaskToExecute)) {
|
||||
// force to redo this migration task, to make sure the relationship is done correctly
|
||||
// done.remove(RELATION_TASK);
|
||||
MigrationUtil.removeMigrationTaskById(done, RELATION_TASK);
|
||||
RelationshipItemBuilder.getInstance().unloadRelations();
|
||||
|
||||
@@ -264,41 +259,37 @@ public class MigrationToolService implements IMigrationToolService {
|
||||
RelationshipItemBuilder.JOBLET_RELATION, true);
|
||||
// reset
|
||||
RelationshipItemBuilder.getInstance().unloadRelations();
|
||||
|
||||
nbMigrationsToDo++;
|
||||
hasTaskToExecute = true;
|
||||
}
|
||||
if (nbMigrationsToDo == 0) {
|
||||
|
||||
boolean checkDupContext = !beforeLogon && Boolean.getBoolean("duplicate.context.reference.check");
|
||||
if (!hasTaskToExecute && !checkDupContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
// force execute migration in case user copy-past items with diffrent path on the file system and refresh
|
||||
// the studio,it may cause bug TDI-19229
|
||||
MigrationUtil.removeMigrationTaskById(done, "org.talend.repository.model.migration.FixProjectResourceLink");
|
||||
// force to re-generate all job poms
|
||||
MigrationUtil.removeMigrationTaskById(done, "org.talend.repository.model.migration.GenerateJobPomMigrationTask");
|
||||
|
||||
if (beforeLogon) {
|
||||
// for every migration, force reset to default maven template
|
||||
MigrationUtil.removeMigrationTaskById(done, "org.talend.repository.model.migration.ResetMavenTemplateMigrationTask");
|
||||
if (checkDupContext) {
|
||||
MigrationUtil.removeMigrationTaskById(done,
|
||||
"org.talend.repository.model.migration.RemoveDuplicateContextReferencesMigrationTask");
|
||||
}
|
||||
if (hasTaskToExecute) {
|
||||
// force execute migration in case user copy-past items with diffrent path on the file system and refresh
|
||||
// the studio,it may cause bug TDI-19229
|
||||
MigrationUtil.removeMigrationTaskById(done, "org.talend.repository.model.migration.FixProjectResourceLink");
|
||||
// force to re-generate all job poms
|
||||
MigrationUtil.removeMigrationTaskById(done, "org.talend.repository.model.migration.GenerateJobPomMigrationTask");
|
||||
|
||||
boolean haveAnyBinFolder = false; // to avoid some problems of migration, sometimes
|
||||
for (ERepositoryObjectType type : (ERepositoryObjectType[]) ERepositoryObjectType.values()) {
|
||||
if (!type.hasFolder()) {
|
||||
continue;
|
||||
if (beforeLogon) {
|
||||
// for every migration, force reset to default maven template
|
||||
MigrationUtil.removeMigrationTaskById(done,
|
||||
"org.talend.repository.model.migration.ResetMavenTemplateMigrationTask");
|
||||
}
|
||||
String folderName = ERepositoryObjectType.getFolderName(type);
|
||||
if (folderName == null || "".equals(folderName)) {
|
||||
continue;
|
||||
boolean hasBinFolder = Stream.of((ERepositoryObjectType[]) ERepositoryObjectType.values())
|
||||
.filter(type -> type.hasFolder()).map(ERepositoryObjectType::getFolderName).filter(StringUtils::isNotBlank)
|
||||
.map(folderName -> fsProject.getFolder(folderName))
|
||||
.anyMatch(folder -> folder.exists() && folder.getFolder("bin").exists());
|
||||
if (hasBinFolder) {
|
||||
MigrationUtil.removeMigrationTaskById(done, "org.talend.repository.model.migration.RemoveBinFolderMigrationTask");
|
||||
}
|
||||
IFolder folder = fsProject.getFolder(folderName);
|
||||
if (folder.exists() && folder.getFolder("bin").exists()) { //$NON-NLS-1$
|
||||
haveAnyBinFolder = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (haveAnyBinFolder) {
|
||||
MigrationUtil.removeMigrationTaskById(done, "org.talend.repository.model.migration.RemoveBinFolderMigrationTask");
|
||||
}
|
||||
|
||||
final SubProgressMonitor subProgressMonitor = new SubProgressMonitor(monitorWrap, toExecute.size());
|
||||
|
||||
@@ -17,11 +17,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
@@ -29,7 +24,6 @@ import org.eclipse.jface.wizard.IWizard;
|
||||
import org.eclipse.jface.wizard.WizardDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.progress.UIJob;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
@@ -830,177 +824,145 @@ public abstract class AbstractCreateTableAction extends AbstractCreateAction {
|
||||
|
||||
private void openDatabaseTableWizard(final DatabaseConnectionItem item, final MetadataTable metadataTable,
|
||||
final boolean forceReadOnly, final RepositoryNode node, final boolean creation) {
|
||||
UIJob job = new UIJob(Messages.getString("CreateTableAction.action.createTitle")) { //$NON-NLS-1$
|
||||
String name = "User action : " + getText(); //$NON-NLS-1$
|
||||
RepositoryWorkUnit<Object> repositoryWorkUnit = new RepositoryWorkUnit<Object>(name, this) {
|
||||
|
||||
@Override
|
||||
public IStatus runInUIThread(final IProgressMonitor monitor) {
|
||||
String name = "User action : " + getText(); //$NON-NLS-1$
|
||||
RepositoryWorkUnit<Object> repositoryWorkUnit = new RepositoryWorkUnit<Object>(name, this) {
|
||||
|
||||
@Override
|
||||
protected void run() throws LoginException, PersistenceException {
|
||||
|
||||
monitor.beginTask(Messages.getString("CreateTableAction.action.createTitle"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
|
||||
|
||||
if (!monitor.isCanceled()) {
|
||||
final ManagerConnection managerConnection = new ManagerConnection();
|
||||
|
||||
DatabaseConnection connection = (DatabaseConnection) item.getConnection();
|
||||
boolean useKrb = Boolean.valueOf(connection.getParameters().get(
|
||||
ConnParameterKeys.CONN_PARA_KEY_USE_KRB));
|
||||
// TUP-596 : Update the context name in connection when the user does a context switch in DI
|
||||
String oldContextName = connection.getContextName();
|
||||
IMetadataConnection metadataConnection = ConvertionHelper.convert(connection, false, null);
|
||||
String newContextName = connection.getContextName();
|
||||
if (oldContextName != null && newContextName != null && !oldContextName.equals(newContextName)) {
|
||||
if (node != null && node.getObject() != null && node.getObject().getProperty() != null) {
|
||||
Item itemTemp = node.getObject().getProperty().getItem();
|
||||
if (itemTemp != null && itemTemp instanceof ConnectionItem) {
|
||||
ConnectionItem connItem = (ConnectionItem) itemTemp;
|
||||
SwitchContextGroupNameImpl.getInstance().updateContextGroup(connItem, newContextName);
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean isTcomDB = false;
|
||||
IGenericDBService dbService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
|
||||
dbService = (IGenericDBService) GlobalServiceRegister.getDefault().getService(
|
||||
IGenericDBService.class);
|
||||
}
|
||||
if(dbService != null){
|
||||
for(ERepositoryObjectType type : dbService.getExtraTypes()){
|
||||
if(type.getLabel().equals(metadataConnection.getDbType())){
|
||||
isTcomDB = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!metadataConnection.getDbType().equals(EDatabaseConnTemplate.GODBC.getDBDisplayName())
|
||||
&& !metadataConnection.getDbType().equals(EDatabaseConnTemplate.ACCESS.getDBDisplayName())
|
||||
&& !metadataConnection.getDbType().equals(
|
||||
EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())
|
||||
&& !isTcomDB) {
|
||||
// TODO 1. To identify if it is hive connection.
|
||||
String hiveMode = (String) metadataConnection
|
||||
.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
|
||||
if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
|
||||
// metadataConnection.setDriverJarPath((String)metadataConnection
|
||||
// .getParameter(ConnParameterKeys.CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR));
|
||||
if (HiveModeInfo.get(hiveMode) == HiveModeInfo.EMBEDDED) {
|
||||
JavaSqlFactory.doHivePreSetup((DatabaseConnection) metadataConnection
|
||||
.getCurrentConnection());
|
||||
}
|
||||
} else if (EDatabaseTypeName.IMPALA.getDisplayName().equals(metadataConnection.getDbType())) {
|
||||
DatabaseConnection originalValueConnection = null;
|
||||
IRepositoryContextService repositoryContextService = CoreRuntimePlugin.getInstance()
|
||||
.getRepositoryContextService();
|
||||
if (repositoryContextService != null) {
|
||||
originalValueConnection = repositoryContextService
|
||||
.cloneOriginalValueConnection(connection, false, null);
|
||||
}
|
||||
if (originalValueConnection != null) {
|
||||
metadataConnection.setUrl(originalValueConnection.getURL());
|
||||
}
|
||||
} else {
|
||||
String genUrl = DatabaseConnStrUtil.getURLString(metadataConnection.getDbType(),
|
||||
metadataConnection.getDbVersionString(), metadataConnection.getServerName(),
|
||||
metadataConnection.getUsername(), metadataConnection.getPassword(),
|
||||
metadataConnection.getPort(), metadataConnection.getDatabase(),
|
||||
metadataConnection.getFileFieldName(), metadataConnection.getDataSourceName(),
|
||||
metadataConnection.getDbRootPath(), metadataConnection.getAdditionalParams());
|
||||
if (!(metadataConnection.getDbType().equals(EDatabaseConnTemplate.IMPALA.getDBDisplayName()) && useKrb)) {
|
||||
metadataConnection.setUrl(genUrl);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// bug 23508:even open type is metaTable,not connection,we always need the connection's
|
||||
// datapackage to find the table schema when click the retrieve schema button
|
||||
if (connection != null) {
|
||||
EList<orgomg.cwm.objectmodel.core.Package> dp = connection.getDataPackage();
|
||||
Collection<Package> newDataPackage = EcoreUtil.copyAll(dp);
|
||||
ConnectionHelper.addPackages(newDataPackage,
|
||||
(DatabaseConnection) metadataConnection.getCurrentConnection());
|
||||
}
|
||||
if (creation) {
|
||||
String hiveMode = (String) metadataConnection
|
||||
.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
|
||||
if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
|
||||
try {
|
||||
HiveConnectionManager.getInstance().checkConnection(metadataConnection);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
managerConnection.check(metadataConnection);
|
||||
}
|
||||
|
||||
// ExtractMetaDataUtils.metadataCon = metadataConnection;
|
||||
// when open,set use synonyms false.
|
||||
ExtractMetaDataUtils.getInstance().setUseAllSynonyms(false);
|
||||
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
boolean repositoryObjectEditable = factory.isEditableAndLockIfPossible(node.getObject());
|
||||
if (!repositoryObjectEditable) {
|
||||
boolean flag = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell(), Messages.getString("CreateTableAction.action.Warning"),
|
||||
Messages.getString("CreateTableAction.action.NotLockMessage"));
|
||||
if (flag) {
|
||||
DatabaseTableWizard databaseTableWizard = new DatabaseTableWizard(
|
||||
PlatformUI.getWorkbench(), creation, node.getObject(), metadataTable,
|
||||
getExistingNames(), forceReadOnly, managerConnection, metadataConnection);
|
||||
|
||||
WizardDialog wizardDialog = new WizardDialog(PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell(), databaseTableWizard);
|
||||
wizardDialog.setBlockOnOpen(true);
|
||||
handleWizard(node, wizardDialog);
|
||||
}
|
||||
} else {
|
||||
DatabaseTableWizard databaseTableWizard = new DatabaseTableWizard(PlatformUI.getWorkbench(),
|
||||
creation, node.getObject(), metadataTable, getExistingNames(), forceReadOnly,
|
||||
managerConnection, metadataConnection);
|
||||
|
||||
WizardDialog wizardDialog = new WizardDialog(PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell(), databaseTableWizard);
|
||||
wizardDialog.setBlockOnOpen(true);
|
||||
handleWizard(node, wizardDialog);
|
||||
}
|
||||
} else {
|
||||
// added for bug 16595
|
||||
// no need connect to database when double click one schema.
|
||||
final boolean skipStep = true;
|
||||
|
||||
DatabaseTableWizard databaseTableWizard = new DatabaseTableWizard(PlatformUI.getWorkbench(),
|
||||
creation, node.getObject(), metadataTable, getExistingNames(), forceReadOnly,
|
||||
managerConnection, metadataConnection);
|
||||
databaseTableWizard.setSkipStep(skipStep);
|
||||
WizardDialog wizardDialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell(), databaseTableWizard);
|
||||
handleWizard(node, wizardDialog);
|
||||
}
|
||||
protected void run() throws LoginException, PersistenceException {
|
||||
final ManagerConnection managerConnection = new ManagerConnection();
|
||||
|
||||
DatabaseConnection connection = (DatabaseConnection) item.getConnection();
|
||||
boolean useKrb = Boolean.valueOf(connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_USE_KRB));
|
||||
// TUP-596 : Update the context name in connection when the user does a context switch in DI
|
||||
String oldContextName = connection.getContextName();
|
||||
IMetadataConnection metadataConnection = ConvertionHelper.convert(connection, false, null);
|
||||
String newContextName = connection.getContextName();
|
||||
if (oldContextName != null && newContextName != null && !oldContextName.equals(newContextName)) {
|
||||
if (node != null && node.getObject() != null && node.getObject().getProperty() != null) {
|
||||
Item itemTemp = node.getObject().getProperty().getItem();
|
||||
if (itemTemp != null && itemTemp instanceof ConnectionItem) {
|
||||
ConnectionItem connItem = (ConnectionItem) itemTemp;
|
||||
SwitchContextGroupNameImpl.getInstance().updateContextGroup(connItem, newContextName);
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean isTcomDB = false;
|
||||
IGenericDBService dbService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
|
||||
dbService = (IGenericDBService) GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
|
||||
}
|
||||
if (dbService != null) {
|
||||
for (ERepositoryObjectType type : dbService.getExtraTypes()) {
|
||||
if (type.getLabel().equals(metadataConnection.getDbType())) {
|
||||
isTcomDB = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!metadataConnection.getDbType().equals(EDatabaseConnTemplate.GODBC.getDBDisplayName())
|
||||
&& !metadataConnection.getDbType().equals(EDatabaseConnTemplate.ACCESS.getDBDisplayName())
|
||||
&& !metadataConnection.getDbType().equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())
|
||||
&& !isTcomDB) {
|
||||
// TODO 1. To identify if it is hive connection.
|
||||
String hiveMode = (String) metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
|
||||
if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
|
||||
// metadataConnection.setDriverJarPath((String)metadataConnection
|
||||
// .getParameter(ConnParameterKeys.CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR));
|
||||
if (HiveModeInfo.get(hiveMode) == HiveModeInfo.EMBEDDED) {
|
||||
JavaSqlFactory.doHivePreSetup((DatabaseConnection) metadataConnection.getCurrentConnection());
|
||||
}
|
||||
} else if (EDatabaseTypeName.IMPALA.getDisplayName().equals(metadataConnection.getDbType())) {
|
||||
DatabaseConnection originalValueConnection = null;
|
||||
IRepositoryContextService repositoryContextService = CoreRuntimePlugin.getInstance()
|
||||
.getRepositoryContextService();
|
||||
if (repositoryContextService != null) {
|
||||
originalValueConnection = repositoryContextService.cloneOriginalValueConnection(connection, false,
|
||||
null);
|
||||
}
|
||||
if (originalValueConnection != null) {
|
||||
metadataConnection.setUrl(originalValueConnection.getURL());
|
||||
}
|
||||
} else {
|
||||
String genUrl = DatabaseConnStrUtil.getURLString(metadataConnection.getDbType(),
|
||||
metadataConnection.getDbVersionString(), metadataConnection.getServerName(),
|
||||
metadataConnection.getUsername(), metadataConnection.getPassword(), metadataConnection.getPort(),
|
||||
metadataConnection.getDatabase(), metadataConnection.getFileFieldName(),
|
||||
metadataConnection.getDataSourceName(), metadataConnection.getDbRootPath(),
|
||||
metadataConnection.getAdditionalParams());
|
||||
if (!(metadataConnection.getDbType().equals(EDatabaseConnTemplate.IMPALA.getDBDisplayName()) && useKrb)) {
|
||||
metadataConnection.setUrl(genUrl);
|
||||
}
|
||||
}
|
||||
};
|
||||
repositoryWorkUnit.setAvoidUnloadResources(isAvoidUnloadResources());
|
||||
IRepositoryService repositoryService = (IRepositoryService) GlobalServiceRegister.getDefault().getService(
|
||||
IRepositoryService.class);
|
||||
repositoryService.getProxyRepositoryFactory().executeRepositoryWorkUnit(repositoryWorkUnit);
|
||||
monitor.done();
|
||||
return Status.OK_STATUS;
|
||||
};
|
||||
};
|
||||
job.setUser(true);
|
||||
job.addJobChangeListener(new JobChangeAdapter() {
|
||||
|
||||
@Override
|
||||
public void done(IJobChangeEvent event) {
|
||||
if (!event.getResult().isOK()) {
|
||||
log.error(event.getResult().getMessage(), event.getResult().getException());
|
||||
} // else eveything is fine so do not log anything
|
||||
}
|
||||
// bug 23508:even open type is metaTable,not connection,we always need the connection's
|
||||
// datapackage to find the table schema when click the retrieve schema button
|
||||
if (connection != null) {
|
||||
EList<orgomg.cwm.objectmodel.core.Package> dp = connection.getDataPackage();
|
||||
Collection<Package> newDataPackage = EcoreUtil.copyAll(dp);
|
||||
ConnectionHelper.addPackages(newDataPackage, (DatabaseConnection) metadataConnection.getCurrentConnection());
|
||||
}
|
||||
if (creation) {
|
||||
String hiveMode = (String) metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
|
||||
if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
|
||||
try {
|
||||
HiveConnectionManager.getInstance().checkConnection(metadataConnection);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
managerConnection.check(metadataConnection);
|
||||
}
|
||||
|
||||
// ExtractMetaDataUtils.metadataCon = metadataConnection;
|
||||
// when open,set use synonyms false.
|
||||
ExtractMetaDataUtils.getInstance().setUseAllSynonyms(false);
|
||||
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
boolean repositoryObjectEditable = factory.isEditableAndLockIfPossible(node.getObject());
|
||||
if (!repositoryObjectEditable) {
|
||||
boolean flag = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
|
||||
Messages.getString("CreateTableAction.action.Warning"),
|
||||
Messages.getString("CreateTableAction.action.NotLockMessage"));
|
||||
if (flag) {
|
||||
DatabaseTableWizard databaseTableWizard = new DatabaseTableWizard(PlatformUI.getWorkbench(), creation,
|
||||
node.getObject(), metadataTable, getExistingNames(), forceReadOnly, managerConnection,
|
||||
metadataConnection);
|
||||
|
||||
WizardDialog wizardDialog = new WizardDialog(
|
||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), databaseTableWizard);
|
||||
wizardDialog.setBlockOnOpen(true);
|
||||
handleWizard(node, wizardDialog);
|
||||
}
|
||||
} else {
|
||||
DatabaseTableWizard databaseTableWizard = new DatabaseTableWizard(PlatformUI.getWorkbench(), creation,
|
||||
node.getObject(), metadataTable, getExistingNames(), forceReadOnly, managerConnection,
|
||||
metadataConnection);
|
||||
|
||||
WizardDialog wizardDialog = new WizardDialog(
|
||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), databaseTableWizard);
|
||||
wizardDialog.setBlockOnOpen(true);
|
||||
handleWizard(node, wizardDialog);
|
||||
}
|
||||
} else {
|
||||
// added for bug 16595
|
||||
// no need connect to database when double click one schema.
|
||||
final boolean skipStep = true;
|
||||
|
||||
DatabaseTableWizard databaseTableWizard = new DatabaseTableWizard(PlatformUI.getWorkbench(), creation,
|
||||
node.getObject(), metadataTable, getExistingNames(), forceReadOnly, managerConnection,
|
||||
metadataConnection);
|
||||
databaseTableWizard.setSkipStep(skipStep);
|
||||
WizardDialog wizardDialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
|
||||
databaseTableWizard);
|
||||
handleWizard(node, wizardDialog);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
job.schedule();
|
||||
|
||||
};
|
||||
repositoryWorkUnit.setAvoidUnloadResources(isAvoidUnloadResources());
|
||||
IRepositoryService repositoryService = (IRepositoryService) GlobalServiceRegister.getDefault()
|
||||
.getService(IRepositoryService.class);
|
||||
repositoryService.getProxyRepositoryFactory().executeRepositoryWorkUnit(repositoryWorkUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.repository.ui.wizards.metadata.table.database;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.metadata.builder.database.TableNode;
|
||||
|
||||
/**
|
||||
* wzhang class global comment. Detailled comment
|
||||
*/
|
||||
public class DefaultSelectorTreeViewerProvider extends SelectorTreeViewerProvider {
|
||||
|
||||
public DefaultSelectorTreeViewerProvider() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getChildren(Object parentElement) {
|
||||
TableNode tableNode = (TableNode) parentElement;
|
||||
List<TableNode> child = tableNode.getChildren();
|
||||
return child.toArray();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,8 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.Driver;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
@@ -80,6 +82,7 @@ import org.talend.commons.ui.swt.formtools.Form;
|
||||
import org.talend.commons.ui.swt.formtools.UtilsButton;
|
||||
import org.talend.commons.utils.data.text.IndiceHelper;
|
||||
import org.talend.commons.utils.threading.TalendCustomThreadPoolExecutor;
|
||||
import org.talend.core.database.EDatabase4DriverClassName;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.ConnParameterKeys;
|
||||
import org.talend.core.model.metadata.IMetadataConnection;
|
||||
@@ -89,6 +92,7 @@ import org.talend.core.model.metadata.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.metadata.builder.database.DriverShim;
|
||||
import org.talend.core.model.metadata.builder.database.ExtractMetaDataFromDataBase;
|
||||
import org.talend.core.model.metadata.builder.database.ExtractMetaDataFromDataBase.ETableTypes;
|
||||
import org.talend.core.model.metadata.builder.database.ExtractMetaDataUtils;
|
||||
@@ -388,6 +392,7 @@ public class SelectorTableForm extends AbstractForm {
|
||||
// TDI-28768 after add checkStateProvider, the catalog and schema checked status become true , then
|
||||
// force them to false
|
||||
if (parentNode.getType() == TableNode.CATALOG || parentNode.getType() == TableNode.SCHEMA) {
|
||||
retrieveSchema(parentNode);
|
||||
needUpdate = false;
|
||||
}
|
||||
boolean firstExpand = false;
|
||||
@@ -396,6 +401,9 @@ public class SelectorTableForm extends AbstractForm {
|
||||
} else {
|
||||
firstExpand = true;
|
||||
}
|
||||
if (treeItem.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
for (TreeItem item : treeItem.getItems()) {
|
||||
if (item.getData() != null) {
|
||||
TableNode node = (TableNode) item.getData();
|
||||
@@ -466,7 +474,7 @@ public class SelectorTableForm extends AbstractForm {
|
||||
viewProvider = provider.getMetadataViewProvider();
|
||||
|
||||
} else {
|
||||
viewProvider = new SelectorTreeViewerProvider();
|
||||
viewProvider = new DefaultSelectorTreeViewerProvider();
|
||||
}
|
||||
|
||||
viewer.setLabelProvider(viewProvider);
|
||||
@@ -476,7 +484,237 @@ public class SelectorTableForm extends AbstractForm {
|
||||
scrolledCompositeFileViewer.setContent(tree);
|
||||
scrolledCompositeFileViewer.setMinSize(tree.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||
}
|
||||
|
||||
private void retrieveSchema(TableNode tableNode) {
|
||||
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
monitor.beginTask(Messages.getString("CreateTableAction.action.createTitle"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
|
||||
|
||||
List<TableNode> child = tableNode.getChildren();
|
||||
boolean extended = false;
|
||||
if (!child.isEmpty()) {
|
||||
for (TableNode node : child) {
|
||||
if (node.getType() == TableNode.TABLE) {
|
||||
extended = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if extended is true, means table already got,no need to get again.
|
||||
if (extended) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<MetadataTable> tableList = new ArrayList<MetadataTable>();
|
||||
retrieveAllSubNodes(tableNode, tableList);
|
||||
|
||||
Display.getDefault().syncExec(() -> {
|
||||
viewer.setInput(tableNodeList);
|
||||
viewer.expandToLevel(tableNode, viewer.ALL_LEVELS);
|
||||
});
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
try {
|
||||
this.parentWizardPage.getWizard().getContainer().run(true, true, runnable);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void retrieveAllSubNodes(TableNode tableNode, List<MetadataTable> tableList) {
|
||||
tableList.clear();
|
||||
List<TableNode> child = tableNode.getChildren();
|
||||
boolean extended = false;
|
||||
if (!child.isEmpty()) {
|
||||
for (TableNode node : child) {
|
||||
if (node.getType() == TableNode.TABLE) {
|
||||
extended = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if extended is true, means table already got,no need to get again.
|
||||
if (extended) {
|
||||
return;
|
||||
}
|
||||
|
||||
IMetadataConnection metadataConn = tableNode.getMetadataConn();
|
||||
|
||||
Connection conn = null;
|
||||
Driver driver = null;
|
||||
|
||||
DatabaseMetaData dbMetaData = null;
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
// Added by Marvin Wang on Mar. 13, 2013 for loading hive jars dynamically, refer to TDI-25072.
|
||||
if (EDatabaseTypeName.HIVE.getXmlName().equalsIgnoreCase(metadataConn.getDbType())) {
|
||||
try {
|
||||
dbMetaData = HiveConnectionManager.getInstance().extractDatabaseMetaData(metadataConn);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
} else if (EDatabaseTypeName.IMPALA.getDisplayName().equalsIgnoreCase(metadataConn.getDbType())) {
|
||||
try {
|
||||
dbMetaData = ImpalaConnectionManager.getInstance().createConnection(metadataConn).getMetaData();
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
} else {
|
||||
List list = extractMeta.getConnectionList(metadataConn);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i) instanceof Connection) {
|
||||
conn = (Connection) list.get(i);
|
||||
}
|
||||
if (list.get(i) instanceof DriverShim) {
|
||||
driver = (DriverShim) list.get(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
dbMetaData = extractMeta.getDatabaseMetaData(conn, metadataConn.getDbType(), metadataConn.isSqlMode(),
|
||||
metadataConn.getDatabase());
|
||||
}
|
||||
|
||||
int type = tableNode.getType();
|
||||
orgomg.cwm.objectmodel.core.Package pack = null;
|
||||
|
||||
if (type == tableNode.CATALOG) {
|
||||
if (tableNode.getChildren().isEmpty()) {
|
||||
pack = tableNode.getCatalog();
|
||||
} else {
|
||||
for (TableNode n : tableNode.getChildren()) {
|
||||
retrieveAllSubNodes(n, tableList);
|
||||
}
|
||||
}
|
||||
} else if (type == tableNode.SCHEMA) {
|
||||
pack = tableNode.getSchema();
|
||||
}
|
||||
try {
|
||||
if (pack != null) {
|
||||
TableInfoParameters paras = tableNode.getParas();
|
||||
List<ETableTypes> paraType = paras.getTypes();
|
||||
Set<String> availableTableTypes = new HashSet<String>();
|
||||
for (ETableTypes tableType : paraType) {
|
||||
availableTableTypes.add(tableType.getName());
|
||||
}
|
||||
// get all tables/views depending the filter selected
|
||||
|
||||
Set<String> tableNameFilter = null;
|
||||
|
||||
if (!paras.isUsedName()) {
|
||||
tableNameFilter = new HashSet<String>();
|
||||
if (paras.getSqlFiter() != null && !"".equals(paras.getSqlFiter())) { //$NON-NLS-1$
|
||||
PreparedStatement stmt = extractMeta.getConn().prepareStatement(paras.getSqlFiter());
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
while (rsTables.next()) {
|
||||
String nameKey = rsTables.getString(1).trim();
|
||||
tableNameFilter.add(nameKey);
|
||||
}
|
||||
rsTables.close();
|
||||
stmt.close();
|
||||
}
|
||||
} else {
|
||||
tableNameFilter = paras.getNameFilters();
|
||||
}
|
||||
|
||||
List<MetadataTable> tempListTables = new ArrayList<MetadataTable>();
|
||||
MetadataFillFactory dbInstance = MetadataFillFactory.getDBInstance(metadataConn);
|
||||
for (String filter : tableNameFilter) {
|
||||
tempListTables = dbInstance.fillAll(pack, dbMetaData, metadataConn, null, filter,
|
||||
availableTableTypes.toArray(new String[] {}));
|
||||
for (MetadataTable table : tempListTables) {
|
||||
boolean contains = false;
|
||||
for (MetadataTable inListTable : tableList) {
|
||||
if (inListTable.getName().equals(table.getName())) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contains) {
|
||||
tableList.add(table);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tableNameFilter.isEmpty()) {
|
||||
tempListTables = dbInstance.fillAll(pack, dbMetaData, metadataConn, null, null,
|
||||
availableTableTypes.toArray(new String[] {}));
|
||||
for (MetadataTable table : tempListTables) {
|
||||
boolean contains = false;
|
||||
for (MetadataTable inListTable : tableList) {
|
||||
if (inListTable.getName().equals(table.getName())) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contains) {
|
||||
tableList.add(table);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
} finally {
|
||||
String dbType = metadataConn.getDbType();
|
||||
// bug 22619
|
||||
String driverClass = metadataConn.getDriverClass();
|
||||
if (conn != null) {
|
||||
ConnectionUtils.closeConnection(conn);
|
||||
}
|
||||
// for specific db such as derby
|
||||
if (driver != null) {
|
||||
if ((driverClass != null && driverClass.equals(EDatabase4DriverClassName.JAVADB_EMBEDED.getDriverClass()))
|
||||
|| (dbType != null && (dbType.equals(EDatabaseTypeName.JAVADB_EMBEDED.getDisplayName())
|
||||
|| dbType.equals(EDatabaseTypeName.JAVADB_DERBYCLIENT.getDisplayName())
|
||||
|| dbType.equals(EDatabaseTypeName.JAVADB_JCCJDBC.getDisplayName())
|
||||
|| dbType.equals(EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName())))) {
|
||||
try {
|
||||
driver.connect("jdbc:derby:;shutdown=true", null); //$NON-NLS-1$
|
||||
} catch (SQLException e) {
|
||||
// exception of shutdown success. no need to catch.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(tableNode.getType() == TableNode.CATALOG && pack == null)) {
|
||||
transferToTableNode(tableList, tableNode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void transferToTableNode(List<MetadataTable> list, TableNode parentNode) {
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (MetadataTable table : list) {
|
||||
if (table instanceof TdTable) {
|
||||
TdTable td = (TdTable) table;
|
||||
TableNode tableNode = new TableNode();
|
||||
tableNode.setType(TableNode.TABLE);
|
||||
tableNode.setValue(td.getLabel());
|
||||
tableNode.setItemType(td.getTableType());
|
||||
tableNode.setTable(td);
|
||||
tableNode.setParent(parentNode);
|
||||
parentNode.addChild(tableNode);
|
||||
} else if (table instanceof TdView) {
|
||||
TdView tv = (TdView) table;
|
||||
TableNode tableNode = new TableNode();
|
||||
tableNode.setType(TableNode.TABLE);
|
||||
tableNode.setValue(tv.getLabel());
|
||||
tableNode.setItemType(tv.getTableType());
|
||||
tableNode.setView(tv);
|
||||
tableNode.setParent(parentNode);
|
||||
parentNode.addChild(tableNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final Collator col = Collator.getInstance(Locale.getDefault());
|
||||
|
||||
/**
|
||||
@@ -943,6 +1181,10 @@ public class SelectorTableForm extends AbstractForm {
|
||||
}
|
||||
if (canAdd) {
|
||||
tableNodes.add(schemaNode);
|
||||
if (schemaNode.getValue() != null && StringUtils.isEmpty(schemaNode.getValue().trim())) {
|
||||
List<MetadataTable> tableList = new ArrayList<MetadataTable>();
|
||||
retrieveAllSubNodes(schemaNode, tableList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,8 +201,8 @@ SHOW_IF="USE_FILE_AMBIGUOUS=='true'">
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Talen File Enhanced"
|
||||
MODULE="talend_file_enhanced-1.1.jar"
|
||||
MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.1" REQUIRED="true" />
|
||||
MODULE="talend_file_enhanced-1.3.jar"
|
||||
MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" REQUIRED="true" />
|
||||
<IMPORT NAME="Talend_CSV" MODULE="talendcsv.jar"
|
||||
MVN="mvn:org.talend.libraries/talendcsv/6.0.0"
|
||||
REQUIRED="true" />
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
<version>1.0.0</version>
|
||||
<type>dll</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!--dependency>
|
||||
<groupId>org.talend.studio.test</groupId>
|
||||
<artifactId>nexus.upload.test.new</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>exe</type>
|
||||
</dependency>
|
||||
</dependency-->
|
||||
<dependency>
|
||||
<groupId>org.talend.studio.test</groupId>
|
||||
<artifactId>nexus.upload.test.new</artifactId>
|
||||
@@ -45,12 +45,12 @@
|
||||
<version>1.0.0</version>
|
||||
<type>dll</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!--dependency>
|
||||
<groupId>org.talend.studio.test</groupId>
|
||||
<artifactId>nexus.upload.test.old</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>exe</type>
|
||||
</dependency>
|
||||
</dependency-->
|
||||
<dependency>
|
||||
<groupId>org.talend.studio.test</groupId>
|
||||
<artifactId>nexus.upload.test.old</artifactId>
|
||||
|
||||
@@ -66,7 +66,7 @@ public class Nexus3RepositoryHandlerTest {
|
||||
private static Properties nexusprops = new Properties();
|
||||
private static ArtifactRepositoryBean customNexusServer;
|
||||
private static IRepositoryArtifactHandler repHandler;
|
||||
private static String[] types = new String[] {"jar", "pom", "exe", "zip", "dll"};
|
||||
private static String[] types = new String[] {"jar", "pom", "zip", "dll"};
|
||||
|
||||
@BeforeClass
|
||||
public static void init() throws FileNotFoundException, IOException {
|
||||
|
||||
Reference in New Issue
Block a user