Compare commits

..

7 Commits

Author SHA1 Message Date
nrousseau
ce666c6f9d merge r101746 from trunk to tempbuild-5_3_0
bug TDI-24576 : Restore URIConverter after computeProperty.


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_3_0@101758 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2013-04-24 04:48:58 +00:00
nrousseau
d2f7e669ad merge r101719 from trunk to tempbuild-5_3_0
TDI-25634 : update token info for data collector


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_3_0@101720 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2013-04-23 11:32:40 +00:00
nrousseau
43f38006e0 merge r101690 from trunk to tempbuild-5_3_0
bug TDI-25609 fixed : The item cannot be imported into 5.3.0 studio


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_3_0@101696 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2013-04-23 08:51:22 +00:00
nrousseau
0e40a73723 merge r101694 from trunk to tempbuild-5_3_0
bug TDI-24576 fixed : Performance issue when loading the list old jobs to import


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_3_0@101695 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2013-04-23 08:38:55 +00:00
gliu
bac612148b [TESB-9316] The generated Blueprint configuration is wrong if both Security and SAM are checked on cCXF
fix on 5.3_branch

git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_3_0@101682 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2013-04-23 07:10:03 +00:00
nrousseau
91e7399503 merge r101641 from trunk to tempbuild-5_3_0
bug  TDI-25580 fixed:version modification for Open another version is not correct


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_3_0@101680 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2013-04-23 07:00:24 +00:00
nrousseau
bea92e8be5 merge r101659 from trunk to tempbuild-5_3_0
bug TDI-25611 fixed: Open another version of pig udf does not work well


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_3_0@101669 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2013-04-23 03:27:44 +00:00
2641 changed files with 15691 additions and 32714 deletions

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -46,6 +46,7 @@ ComponentProjectPreferencePage.Warning=Warnung
AbstractXMLConfigPage.VERSIONTip=Ein Dezimalwert zur Angabe der Version Ihrer neuen Komponente.
WizardJetFilesChoosePage.Directory=Verzeichnis:
CreateComponentWizard.NewComponent=Neue Komponente
WizardComponentFolderPage.Name=Name
RemoveResourceAction.Remove=Entfernen
WizardJetFilesChoosePage.UseIconFrom=Verwende Icon von:
ImportComponentDialog.ImportFinished=Import der Komponente abgeschlossen

View File

@@ -19,21 +19,16 @@ WizardComponentFolderPage.ErrMSG1=Nije ozna\u010Den jezik za komponentu
CreateComponentWizard.FillIn=Popuni svojstva komponente
ComponentProjectPreferencePage.Warning=Upozorenje
AbstractXMLConfigPage.VERSIONTip=Decimalna vrijednost koja ozna\u010Dava verziju va\u0161e nove komponente.
WizardJetFilesChoosePage.Directory=Direktorij:
WizardComponentFolderPage.Name=Ime
RemoveResourceAction.Remove=Ukloni
WizardJetFilesChoosePage.UseIconFrom=Koristi ikonu iz:
AbstractXMLConfigPage.SetProperties=Postavi svojstva odabranog elementa.
AddResourceAction.AddLib=Dodaj biblioteke...
WizardComponentFolderPage.Perl=Perl
AbstractXMLConfigPage.NBLINESTip=Cjelobrojna vrijednost. Linije se prote\u017Eu od tog parametra unutar Component pogleda.
AbstractXMLConfigPage.MININPUTTip=Integer vrijednost. Najmanji broj ulaza za ovu vezu.
WizardJetFilesChoosePage.UseDefaultIcon=Koristi zadanu ikonu
WizardComponentFolderPage.LongName=Duga\u010Dko ime (mouseover tooltip)
CopyComponentActionProvider.CopyComponent=Kopiraj tu komponentu
AddExternalResourceAction.ErrorMsg=Ozna\u010Dena vanjska arhiva nije dostupna ili ne postoji.
CopyFromPaletteActionProvider.Label=Kopiraj komponentu iz izbornika Palette
WizardJetFilesChoosePage.ChoseAIcon=Odaberi ikonu
AbstractXMLConfigPage.LINESTYLETip=Cjelobrojna vrijednost'. Stil spojne linije (1. Puna, 2: Crtkana, 3: To\u010Dka, 4: Crta-To\u010Dka)
ComponentProjectPreferencePage.ButtonLabel0=U redu
CreateComponentWizard.MainProperties=Glavna svojstva

View File

@@ -1,108 +0,0 @@
AbstractXMLConfigPage.BooleanTip=Boolean value (true or false).
AbstractXMLConfigPage.COLORTip=Hex value of RGB. For example\: "00FF00"
AbstractXMLConfigPage.CTYPETip=Connector type.
AbstractXMLConfigPage.Delete=Delete
AbstractXMLConfigPage.EXTENSIONTip=String value of plugin name. This option is for external componet.
AbstractXMLConfigPage.IntValue=Integer value.
AbstractXMLConfigPage.LINESTYLETip=Integer value. Line style of the connetion. (1\: Solid Line, 2\: Dash Line, 3\: Dot Line, 4\: Dashdot Line)
AbstractXMLConfigPage.MAXINPUTTip=Integer value. Maximum input connection for this connection
AbstractXMLConfigPage.MAXOUTPUTTip=Integer value. Maximum output connection for this connection
AbstractXMLConfigPage.MININPUTTip=Integer value. Minimum input connection for this connection
AbstractXMLConfigPage.MINOUTPUTTip=Integer value. Minimum output connection for this connection
AbstractXMLConfigPage.NBLINESTip=Integer value. Lines spans of this parameter in the component's properties view
AbstractXMLConfigPage.NUMROWTip=Integer value. Row position of this parameter in the component's properties view
AbstractXMLConfigPage.New=New
AbstractXMLConfigPage.REPOSITORYVALUETip=Metadata repository to select.
AbstractXMLConfigPage.SetProperties=Set the properties for selected element.
AbstractXMLConfigPage.TYPETip=Data type.
AbstractXMLConfigPage.VERSIONTip=A decimal value to indicate the version of your new component.
AddExternalResourceAction.AddELibs=Add External Libraries...
AddExternalResourceAction.ErrorMsg=The selected external archive is unavailable or does not exist.
AddExternalResourceAction.ErrorTitle=External Archive Error
AddExternalResourceAction.JarSelection=Jar Selection
AddResourceAction.AddLib=Add Libraries...
AddResourceAction.ChooseResource=&Choose jars and zips to add\:
AddResourceAction.JARSecection=JAR Selection
ComponentProjectManager.CreationProblems=Creation Problems
ComponentProjectManager.InternalErrorMsg=Internal error\: {0}
ComponentProjectManager.NewProject=New Component Project
ComponentProjectManager.WarningMsg=The underlying file system is case insensitive. There is an existing project which conflicts with {0}
ComponentProjectPreferencePage.ButtonLabel0=Ok
ComponentProjectPreferencePage.ChooseProject=Choose a project folder for this component designer
ComponentProjectPreferencePage.ComponentProject=Component Project\:
ComponentProjectPreferencePage.SelectPath=Select Component Project Path
ComponentProjectPreferencePage.Warning=Warning
ComponentProjectPreferencePage.WarningMSG=Warning, this modification will only impact Component Designer, not the Palette.
CopyComponentActionProvider.CopyComponent=Copy This Component
CopyComponentActionProvider.CopyComponent2=Copy Component
CopyComponentActionProvider.InputName=Input a new component name for
CopyComponentValidator.ComponentExist=The component has been exsit
CopyFromPaletteActionProvider.Label=Copy Components from Palette
CopyFromPaletteActionProvider.Label2=Import components from palette
CreateComponentWizard.CreateXMLJava=Create the XML configuration file for JAVA Component
CreateComponentWizard.CreateXMLPerl=Create the XML configuration file for PERL Component
CreateComponentWizard.FillIn=Fill in component properties
CreateComponentWizard.MainProperties=Main Properties
CreateComponentWizard.NewComponent=New Component
CreateComponentWizard.SpecifyRes=Specify resources
EditComponentActionProvider.Edit=Edit This Component
EditComponentActionProvider.GroupEdit=group.edit
FileCopy.ExceptionMSG=The source File "
ImportComponentDialog.Browser=Browser..
ImportComponentDialog.ChooseComponentsLabel=Choose components to import\:
ImportComponentDialog.ErrorMSG4=No component was selected for importing.
ImportComponentDialog.Filter=Filter\:
ImportComponentDialog.ImportCanceled=Import Components Canceled
ImportComponentDialog.ImportCanceledMSG=Task import components from palette was canceled.
ImportComponentDialog.ImportFinished=Import Components Finished
ImportComponentDialog.ImportFinishedMSG=Components imported successfully.
ImportComponentDialog.NoComponentsAvailable=No Components available.
ImportComponentDialog.SelectDirectoryLabel=Select a directory\:
ImportComponentDialog.ShowPaletteComponents=Show Palette Components
ImportComponentDialog.WarningMSG=This operation will overwrite the existing components in workspace. Do you really want to import the selected components?
ImportComponentDialog.WarningTitle=Warning
NewActionProvider.New=New
NewActionProvider.NewComponent=New Component
PluginConstant.Borwser=Browser..
ProjectSelectionDialog.ChooseFolder=Choose a project folder for this session
ProjectSelectionDialog.ComponentProject=Component Project\:
ProjectSelectionDialog.SelectPath=Select Project Path
PushToPaletteActionProvider.Error=Error
PushToPaletteActionProvider.Error2=Error
PushToPaletteActionProvider.ErrorMSG=User component folder is not set.
PushToPaletteActionProvider.ErrorMSG2=User component folder doesn't exist.
PushToPaletteActionProvider.Information=Informaton
PushToPaletteActionProvider.InformationMSG=Components have been published. The palette is going to be refreshed.
PushToPaletteActionProvider.OK=OK
PushToPaletteActionProvider.OK2=OK
PushToPaletteActionProvider.OK3=OK
PushToPaletteActionProvider.PushComponentsToPalette=Push Components to Palette
PushToPaletteActionProvider.PushToPaletteActionProvider.failed=Push components to palette failed for these invalid XML files.\n
PushToPaletteActionProvider.PushToPaletteActionProvider.result=Validation result
RemoveResourceAction.Remove=Remove
ValidateComponentXMLActionProvider.error=\n\tThere is an Error on line {0}
ValidateComponentXMLActionProvider.fatalerror=\n\tThere is a Fatal Error on line {0}
ValidateComponentXMLActionProvider.invalid=Invalid component XML file\:\n
ValidateComponentXMLActionProvider.ok=OK
ValidateComponentXMLActionProvider.result=Validation result
ValidateComponentXMLActionProvider.valid=Component XML file is valid\!
ValidateComponentXMLActionProvider.validate=Validate Component XML
ValidateComponentXMLActionProvider.warning=\n\tThere is a Warning on line {0}
WizardComponentFolderPage.Available=Available in
WizardComponentFolderPage.ErrMSG1=The component language have not been selected
WizardComponentFolderPage.ErrMSG2=The component Name is empty
WizardComponentFolderPage.ErrMSG3=This component already exists
WizardComponentFolderPage.ErrMSG4=The component Long Name is empty
WizardComponentFolderPage.ErrMSG5=The component Family is empty
WizardComponentFolderPage.Family=Family
WizardComponentFolderPage.Java=Java
WizardComponentFolderPage.LongName=Long Name (mouseover tooltip)
WizardComponentFolderPage.Name=Name
WizardComponentFolderPage.Perl=Perl
WizardJetFilesChoosePage.BeginFile=Begin File
WizardJetFilesChoosePage.ChoseAIcon=Chose an icon
WizardJetFilesChoosePage.Directory=Directory\:
WizardJetFilesChoosePage.EndFile=End File
WizardJetFilesChoosePage.MainFile=Main File
WizardJetFilesChoosePage.UseDefaultIcon=Use default icon
WizardJetFilesChoosePage.UseIconFrom=Use icon from\:

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -1,6 +0,0 @@
ApplicationActionBarAdvisor.fileMenu=&File
ApplicationActionBarAdvisor.helpMenu=&Help
ApplicationActionBarAdvisor.windowMenu=&Window
ApplicationWorkbenchWindowAdvisor.rcpApp=RCP Application
FileWizard.0=File Wizard
ShowViewAction.actionLabel=Show view...

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -16,7 +16,7 @@
<extension point="org.eclipse.ui.perspectives">
<perspective class="org.talend.componentdesigner.ui.Perspective"
id="org.talend.componentdesigner.perspective"
name="Component Designer">
name="Component's Designer">
</perspective>
</extension>
<extension point="org.eclipse.ui.perspectiveExtensions">
@@ -99,7 +99,7 @@
<contentExtension
pattern="org.talend.componentdesigner.resourceContent" />
<contentExtension
pattern="org.talend.componentdesigner.ui.navigator.resources.filters.*" />
pattern="org.eclipse.ui.navigator.resources.filters.*" />
</includes>
</viewerContentBinding>
<viewerActionBinding
@@ -267,7 +267,7 @@
</filterExpression>
</commonFilter> -->
<commonFilter
id="org.talend.componentdesigner.ui.navigator.resources.filters.nonComponentProject"
id="org.eclipse.ui.navigator.resources.filters.nonComponentProject"
name="nonComponentProject" description="not the component project"
activeByDefault="true">
<filterExpression>

View File

@@ -260,6 +260,7 @@ public final class ComponentProjectManager {
addLibClasspathEntries(ces, "org.talend.metadata.managment"); //$NON-NLS-1$
addLibClasspathEntries(ces, "org.talend.core"); //$NON-NLS-1$
addLibClasspathEntries(ces, "org.talend.designer.codegen"); //$NON-NLS-1$
addLibClasspathEntries(ces, "org.talend.commons"); //$NON-NLS-1$
return ces;
}

View File

@@ -34,9 +34,6 @@ import org.talend.componentdesigner.i18n.internal.Messages;
import org.talend.componentdesigner.util.XSDValidator;
import org.talend.componentdesigner.util.file.FileCopy;
import org.talend.core.CorePlugin;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.repository.model.ComponentsFactoryProvider;
/**
* DOC slanglois class global comment. Detailled comment
@@ -52,7 +49,6 @@ public class PushToPaletteActionProvider extends CommonActionProvider {
*
* @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite)
*/
@Override
public void init(ICommonActionExtensionSite anExtensionSite) {
if (anExtensionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
@@ -63,7 +59,6 @@ public class PushToPaletteActionProvider extends CommonActionProvider {
/**
* Adds a submenu to the given menu with the name "New Component".
*/
@Override
public void fillContextMenu(IMenuManager menu) {
menu.insertBefore("group.edit", copyProjectAction); //$NON-NLS-1$
// Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();// need to get all
@@ -91,10 +86,9 @@ public class PushToPaletteActionProvider extends CommonActionProvider {
/*
* (non-Javadoc) Method declared on IAction.
*/
@Override
public void run() {
String path = CorePlugin.getDefault().getComponentsLocalProviderService().getPreferenceStore()
.getString("USER_COMPONENTS_FOLDER"); //$NON-NLS-1$
String path = CorePlugin.getDefault().getComponentsLocalProviderService().getPreferenceStore().getString(
"USER_COMPONENTS_FOLDER"); //$NON-NLS-1$
if (path == null || path.length() == 0) {
new MessageDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
@@ -136,15 +130,6 @@ public class PushToPaletteActionProvider extends CommonActionProvider {
}
}
// add for bug TDI-26719, clear image cash from EmfComponent
IComponentsFactory components = ComponentsFactoryProvider.getInstance();
List<IComponent> comList = components.getCustomComponents();
for (IComponent com : comList) {
if (com.getImageRegistry() != null) {
com.getImageRegistry().clear();
}
}
MessageDialog warningMessageDialog = new MessageDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
Messages.getString("PushToPaletteActionProvider.Information"), null, Messages.getString("PushToPaletteActionProvider.InformationMSG"), MessageDialog.INFORMATION, //$NON-NLS-1$ //$NON-NLS-2$
@@ -162,8 +147,7 @@ public class PushToPaletteActionProvider extends CommonActionProvider {
MessageDialog warningMessageDialog = new MessageDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
Messages.getString("PushToPaletteActionProvider.PushToPaletteActionProvider.result"), null, waringInfo, //$NON-NLS-1$
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.getString("PushToPaletteActionProvider.PushToPaletteActionProvider.result"), null, waringInfo, //$NON-NLS-1$
MessageDialog.WARNING, new String[] { Messages.getString("PushToPaletteActionProvider.OK3") }, 0); //$NON-NLS-1$
warningMessageDialog.open();
@@ -178,7 +162,6 @@ public class PushToPaletteActionProvider extends CommonActionProvider {
// get the correct XML file for components
File[] list = componentFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
// _java.xml
String javaXmlName = dir.getName() + "_java.xml"; //$NON-NLS-1$

View File

@@ -12,15 +12,11 @@
// ============================================================================
package org.talend.componentdesigner.ui.preferencepage;
import java.io.File;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
@@ -31,8 +27,8 @@ import org.talend.componentdesigner.i18n.internal.Messages;
/**
* This class represents a preference page that is contributed to the Preferences dialog. By subclassing
* <samp>FieldEditorPreferencePage</samp>, we can use the field support built into JFace that allows us to create a page
* that is small and knows how to save, restore and apply itself.
* <samp>FieldEditorPreferencePage</samp>, we can use the field support built into JFace that allows us to create a
* page that is small and knows how to save, restore and apply itself.
* <p>
* This page is used to modify preferences only. They are stored in the preference store that belongs to the main
* plug-in class. That way, preferences can be accessed directly via the preference store.
@@ -69,39 +65,23 @@ public class ComponentProjectPreferencePage extends FieldEditorPreferencePage im
GridData gd = new GridData();
gd.horizontalSpan = 3;
l.setLayoutData(gd);
filePathTemp = new DirectoryFieldEditor(PluginConstant.PROJECT_URL,
Messages.getString("ComponentProjectPreferencePage.ComponentProject"), //$NON-NLS-1$
filePathTemp = new DirectoryFieldEditor(PluginConstant.PROJECT_URL, Messages
.getString("ComponentProjectPreferencePage.ComponentProject"), //$NON-NLS-1$
getFieldEditorParent());
addField(filePathTemp);
// addModifyListener for the filePath text
filePathTemp.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String newPath = filePathTemp.getTextControl(getFieldEditorParent()).getText();
File file = new File(newPath);
if (!file.exists() && !"".equals(newPath)) {
filePathTemp.showErrorMessage();
setValid(false);
} else {
setValid(true);
}
}
});
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.preference.FieldEditorPreferencePage#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
super.propertyChange(event);
MessageDialog warningMessageDialog = new MessageDialog(getFieldEditorParent().getShell(),
Messages.getString("ComponentProjectPreferencePage.Warning"), null, //$NON-NLS-1$
MessageDialog warningMessageDialog = new MessageDialog(getFieldEditorParent().getShell(), Messages
.getString("ComponentProjectPreferencePage.Warning"), null, //$NON-NLS-1$
Messages.getString("ComponentProjectPreferencePage.WarningMSG"), MessageDialog.WARNING, //$NON-NLS-1$
new String[] { Messages.getString("ComponentProjectPreferencePage.ButtonLabel0") }, 0); //$NON-NLS-1$
warningMessageDialog.open();

View File

@@ -1341,12 +1341,16 @@
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="org.talend.libraries.csv"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="org.talend.libraries.jdbc.sybase"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="org.talend.librariesmanager"

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -1,20 +0,0 @@
prefs.configuration.title=Map components preferences :
prefs.configuration.LINK_STYLE=Default mapping links display as :
prefs.configuration.LINK_STYLE.AUTO=Auto
prefs.configuration.LINK_STYLE.BEZIER_CURVE=Curves
prefs.configuration.LINK_STYLE.LINE=Lines (fast)
DraggingInfosPopup.draggingEntry=Dragging {0} entry.
DraggingInfosPopup.dropInvalid=\n<< Drop invalid >>\n
DraggingInfosPopup.draggingEntries=Dragging {0} entries.
DraggingInfosPopup.dropInvalidWithKey=\n<< Drop invalid >>\nPress both Shift and Ctrl keys to map one to one and overwrite
DraggingInfosPopup.overwriteMode=\ > Overwrite mode
DraggingInfosPopup.appendMode=\ > Append mode
DraggingInfosPopup.appendModeToOverwrite=\ > Append mode (Ctrl key to overwrite)
DraggingInfosPopup.insertAllSelectedEntries=\ > Insert all selected entries
DraggingInfosPopup.insertRemainingEntries=\ > Insert remaining entries
DraggingInfosPopup.eachSourceEntryExpressionToEachTargetExpression= > Each source entry expression to each target expression
DraggingInfosPopup.eachSourceEntryToEachTargetExpression= > Each source entry to each target expression
DraggingInfosPopup.allSourceEntriesExpressionToASingleOneTargetExpressionShiftKey= > All source entries expression to a single one target expression (Shift key to change mapping)
DraggingInfosPopup.allSourceEntriesExpressionToASingleOneTargetExpression= > All source entries expression to a single one target expression
DraggingInfosPopup.allSourceEntriesToASingleOneTargetExpressionShiftKey= > All source entries to a single one target expression (Shift key to change mapping)
DraggingInfosPopup.allSourceEntriesToASingleOneTargetExpression= > All source entries to a single one target expression

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -26,16 +26,16 @@ import org.apache.oro.text.regex.Substitution;
import org.apache.oro.text.regex.Util;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.core.model.context.UpdateContextVariablesHelper;
import org.talend.core.model.process.AbstractExternalNode;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.node.IExternalMapEntry;
import org.talend.core.model.process.node.MapperExternalNode;
import org.talend.designer.abstractmap.ui.prefs.MapPrefsConstants;
/**
* DOC amaumont class global comment. Detailled comment <br/>
*
*/
public abstract class AbstractMapComponent extends MapperExternalNode {
public abstract class AbstractMapComponent extends AbstractExternalNode {
/**
* DOC amaumont AbstractMapComponent constructor comment.
@@ -79,7 +79,7 @@ public abstract class AbstractMapComponent extends MapperExternalNode {
protected boolean hasDataIntoExpression(Pattern pattern, PatternMatcher matcher, String expression) {
if (expression != null) {
if (matcher.matches(expression, pattern)) {
if (matcher.contains(expression, pattern)) {
return true;
}
}

View File

@@ -40,10 +40,6 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
private Point lastCursorPosition;
private long lastDragTime;
private boolean scrollUp = false;
public DefaultDropTargetListener(AbstractMapperManager mapperManager) {
super();
this.mapperManager = mapperManager;
@@ -57,14 +53,12 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
return mapperManager.getUiManager();
}
@Override
public void dragEnter(DropTargetEvent event) {
// updatePopupPosition(event);
updatePopupPosition(event);
setPopupVisible(true);
event.detail = mapperManager.getUiManager().getCurrentDragDetail();
}
@Override
public void dragLeave(DropTargetEvent event) {
dragFinished();
}
@@ -82,7 +76,6 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
draggingInfosPopup.setVisible(visible);
}
@Override
public void dragOperationChanged(DropTargetEvent event) {
updatePopupPosition(event);
detectPressedKeys(event);
@@ -131,7 +124,6 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
}
@Override
public void dragOver(DropTargetEvent event) {
// System.out.println(((DropTarget)event.widget).getControl());
event.detail = DND.DROP_NONE;
@@ -141,17 +133,20 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
}
private void updatePopupPosition(DropTargetEvent event) {
Point cursorPosition = new Point(event.x, event.y);
if (!cursorPosition.equals(lastCursorPosition)) {
AbstractUIManager uiManager = mapperManager.getUiManager();
DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
draggingInfosPopup.setCursorPosition(event.x, event.y);
}
// System.out.println("updatePopupPosition:" + lastCursorPosition + "-->" + cursorPosition);
lastCursorPosition = cursorPosition;
}
private void autoScroll(DropTargetEvent event) {
if (lastCursorPosition == null || lastCursorPosition.y == event.y) {
return;
}
Composite currentComposite = null;
Object source = event.getSource();
if (source instanceof DropTarget) {
@@ -168,51 +163,22 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
if (parentScrolledComposite == null) {
return;
}
ScrollBar vBar = parentScrolledComposite.getVerticalBar();
int increment = event.y - lastCursorPosition.y;
if (increment > 0) {
increment = increment + 3;
} else {
increment = increment - 3;
}
Control content = parentScrolledComposite.getContent();
if (content != null) {
Point location = content.getLocation();
int vSelection = vBar.getSelection();
int increment = 0;
int thumb = vBar.getThumb();
if (lastCursorPosition == null || lastCursorPosition.y == event.y) {
long currentTimeMillis = System.currentTimeMillis();
long time = currentTimeMillis - lastDragTime;
if (lastDragTime != 0 && time > 100) {
Point pointToScrollComposite = parentScrolledComposite.toControl(event.x, event.y);
// scroll up
if (pointToScrollComposite.y < 40) {
increment = -20;
}
// scroll down
else if (thumb - pointToScrollComposite.y < 40) {
increment = 20;
} else {
return;
}
} else {
return;
}
} else {
increment = event.y - lastCursorPosition.y;
if (increment > 0) {
increment = increment + 3;
} else {
increment = increment - 3;
}
}
if (vSelection >= 0 && vSelection + increment > 0 && vSelection + increment < vBar.getMaximum()) {
vBar.setSelection(vSelection + increment);
}
content.setLocation(location.x, -vSelection);
mapperManager.getUiManager().refreshBackground(true, false);
lastDragTime = System.currentTimeMillis();
}
// Event e = new Event();
@@ -239,7 +205,6 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
return getParentScrolledComposite(composite.getParent());
}
@Override
public void drop(DropTargetEvent event) {
dragFinished();
}
@@ -253,7 +218,6 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
return getClass() != DefaultDropTargetListener.class;
}
@Override
public void dropAccept(DropTargetEvent event) {
}
@@ -263,7 +227,6 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
*
* @see org.eclipse.jface.util.TransferDropTargetListener#getTransfer()
*/
@Override
public Transfer getTransfer() {
return TableEntriesTransfer.getInstance();
}
@@ -273,7 +236,6 @@ public class DefaultDropTargetListener implements TransferDropTargetListener {
*
* @see org.eclipse.jface.util.TransferDropTargetListener#isEnabled(org.eclipse.swt.dnd.DropTargetEvent)
*/
@Override
public boolean isEnabled(DropTargetEvent event) {
return true;
}

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -14,4 +14,5 @@ AlfrescoOutputModelManager.prefixConflict=Kann das Modell nicht hinzuf
AlfrescoOutputModelManager.notYetAdded=Dieses Modell wurde noch nicht hinzugefügt.
AlfrescoModelDialog.type=Typ
AlfrescoModelDialog.addModelFailed=Modell hinzufügen fehlgeschlagen
AlfrescoModelDialog.modelTable.name=Name
AlfrescoModelDialog.remove=Entfernen

View File

@@ -10,5 +10,4 @@ AlfrescoOutputModelManager.prefixConflict=Ne mogu dodati model, prefix je u konf
AlfrescoOutputModelManager.notYetAdded=Taj model jo\u0161 nije dodan
AlfrescoModelDialog.addModelFailed=Dodavanje modela nije uspjelo
AlfrescoModelDialog.modelTable.name=Ime
AlfrescoModelDialog.remove=Ukloni
AlfrescoOutputManager.failedLoadModel=U\u010Ditavanje modela iz metapodataka komponente nije uspjelo, reinicijaliziram

View File

@@ -1,21 +0,0 @@
AlfrescoOutputManager.failedLoadModel=Failed to load model from component metadata, reinitializing
AlfrescoOutputManager.schemaError.title=Error in schema
AlfrescoOutputManager.schemaError.msg=Please synchronize schema first
AlfrescoOutputModelManager.alreadyAdded=This model has already been added
AlfrescoOutputModelManager.errorReadingModel=Error reading Alfresco model file
AlfrescoOutputModelManager.notYetAdded=This model has not yet been added
AlfrescoOutputModelManager.prefixConflict=Unable to add the model, prefix conflict with previously added model for
AlfrescoModelDialog.type=Type
AlfrescoModelDialog.aspects=Aspects
AlfrescoModelDialog.availableAspects=Available Aspects
AlfrescoModelDialog.add=Add...
AlfrescoModelDialog.addModelFailed=Failed to add model
AlfrescoModelDialog.remove=Remove
AlfrescoModelDialog.removeModelFailed=Failed to remove model
AlfrescoModelDialog.missingTypeDefinitions.title=Missing type definitions
AlfrescoModelDialog.missingTypeDefinitions.msg=The chosen type refers to unknown Alfresco type(s) or aspect(s) : ${0}.\n\
Please provide the alfresco model files that define them.
AlfrescoModelDialog.missingAspectDefinitions.title=Missing aspects definitions
AlfrescoModelDialog.missingAspectDefinitions.msg=The chosen aspects refer to unknown Alfresco aspect(s) : ${0}.\nPlease provide the alfresco model files that define them.
AlfrescoModelDialog.modelTable.title=Title
AlfrescoModelDialog.modelTable.name=Name

View File

@@ -1,4 +1,3 @@
AlfrescoModelDialog.modelTable.title=Ba\u015Fl\u0131k
AlfrescoModelDialog.add=Ekle...
AlfrescoModelDialog.type=Tip
AlfrescoModelDialog.modelTable.name=Ad\u0131

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -6,8 +6,4 @@ bin.includes = META-INF/,\
plugin_en.properties,\
plugin_fr.properties,\
plugin_it.properties,\
plugin_zh_CN.properties\
,plugin_ru.properties\
,plugin_el.properties\
,plugin_ja.properties\
,plugin_swtbot.properties
plugin_zh.properties

View File

@@ -1,3 +1,2 @@
providerName=.Talend SA.
pluginName=\u0395\u03C0\u03B9\u03C7\u03B5\u03B9\u03C1\u03B7\u03C3\u03B9\u03B1\u03BA\u03CC \u03A0\u03C1\u03CC\u03C3\u03B8\u03B5\u03C4\u03BF
repository.businessProcess=\u0395\u03C0\u03B9\u03C7\u03B5\u03B9\u03C1\u03B7\u03BC\u03B1\u03C4\u03B9\u03BA\u03AC \u039C\u03BF\u03BD\u03C4\u03AD\u03BB\u03B1

View File

@@ -1,3 +0,0 @@
pluginName=Business Plugin
providerName=.Talend SA.
repository.businessProcess=Business Models

View File

@@ -53,4 +53,3 @@ BusinessNewDiagramFileWizard.SelectDiagramRootElement=\u0627\u062E\u062A\u0631 \
BusinessAbstractParser.StringFloatConvertError=\u0644\u0627 \u064A\u0645\u0643\u0646 \u062A\u062D\u0648\u064A\u0644 \u0642\u064A\u0645\u0629 \u0646\u0635\u064A\u0629 \u0625\u0644\u0649 \u0642\u064A\u0645\u0629 \u0639\u0634\u0631\u064A\u0629
BusinessAbstractParser.StringValueDoesNotConvertToByteValue=\u0644\u0627 \u064A\u0645\u0643\u0646 \u062A\u062D\u0648\u064A\u0644 \u0642\u064A\u0645\u0629 \u0646\u0635\u064A\u0629 \u0625\u0644\u0649 \u0642\u064A\u0645\u0629 \u0628\u0627\u064A\u062A
DeleteAssignmentAction.DeleteAssignment=\u062D\u0630\u0641 \u062A\u0643\u0644\u064A\u0641
BusinessDiagramEditor.canNotSaveTitle=\u062A\u062D\u0630\u064A\u0631

View File

@@ -16,6 +16,7 @@ BusinessModelingAssistantProvider.AvaiableDomainModelElements=Verf
BusinessPaletteFactory.BidirectionalRelationShip=Bidirektionale Beziehung
BusinessPaletteFactory.CreateDirectionalRelationShip=Direktionale Beziehung hinzufügen
BusinessPaletteFactory.CreateBidirectionalRelationShip=Bidirektionale Beziehung hinzufügen
AssignmentPropertySection.Name=Name
CreateAssignmentCommand.CannotAssign=Zuordnung nicht möglich.
BusinessNewDiagramFileWizard.DiagramRootElement=Diagramm root-Element
BusinessNewDiagramFileWizard.NoDiagramRootElementSelectedError=Kein Diagram-Root Element ausgewählt

View File

@@ -75,4 +75,3 @@ BusinessAbstractParser.StringValueDoesNotConvertToByteValue=\u03A4\u03B9\u03BC\u
BusinessNewDiagramFileWizard.IntialNewEcoreDiagramFile=\u0391\u03C1\u03C7\u03B9\u03BA\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7 \u03BD\u03AD\u03BF\u03C5 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5 \u03B4\u03B9\u03B1\u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03BF\u03C2 Ecore
BusinessTooltipFigure.assignedMeta={0} \u03BA\u03B1\u03B8\u03BF\u03C1\u03B9\u03C3\u03BC\u03AD\u03BD\u03B1 \u039C\u03B5\u03C4\u03B1\u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03B1
DeleteAssignmentAction.DeleteAssignment=\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u0391\u03BD\u03AC\u03B8\u03B5\u03C3\u03B7\u03C2
BusinessDiagramEditor.canNotSaveTitle=\u03A0\u03C1\u03BF\u03B5\u03B9\u03B4\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7

View File

@@ -64,4 +64,3 @@ BusinessAbstractParser.StringFloatConvertError=String nije mogu\u0107e konvertir
BusinessAbstractParser.StringValueDoesNotConvertToByteValue=String nije mogu\u0107e konvertirati u Byte
BusinessNewDiagramFileWizard.IntialNewEcoreDiagramFile=Inicijaliziranje nove datoteke za Ecore dijagram
DeleteAssignmentAction.DeleteAssignment=Izbri\u0161i pridru\u017Eivanje
BusinessDiagramEditor.canNotSaveTitle=Upozorenje

View File

@@ -80,4 +80,3 @@ BusinessNewDiagramFileWizard.IntialNewEcoreDiagramFile=\u65B0\u898F Ecore \u30C0
BusinessTooltipFigure.assignedMeta=\u5272\u308A\u5F53\u3066\u3089\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF {0}
DeleteAssignmentAction.DeleteAssignment=\u5272\u308A\u5F53\u3066\u306E\u524A\u9664
BusinessDiagramEditor.canNotSaveTitle=\u8B66\u544A
BusinessDiagramEditor.canNotSaveMessage=\u4ED6\u306E\u30E6\u30FC\u30B6\u304C\u64CD\u4F5C\u4E2D\u306E\u305F\u3081\u3001\u30D3\u30B8\u30CD\u30B9\u30E2\u30C7\u30EB\u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3002

View File

@@ -57,4 +57,3 @@ BusinessAbstractParser.StringFloatConvertError=Warto\u015B\u0107 typu znakowego
BusinessAbstractParser.StringValueDoesNotConvertToByteValue=Warto\u015B\u0107 typu znakowego nie mo\u017Ce by\u0107 skonwertowana na warto\u015B\u0107 typu Byte
BusinessNewDiagramFileWizard.IntialNewEcoreDiagramFile=Inicjalizuj nowy plik diagramu Ecore
DeleteAssignmentAction.DeleteAssignment=Skasuj przypisanie
BusinessDiagramEditor.canNotSaveTitle=Ostrze\u017Cenie

View File

@@ -1,83 +0,0 @@
CreateDiagramAction.CreateBusinessModel=Create Business Model
CreateAssignmentCommand.CannotAssign=Cannot Assign.
FindAssignmentAction.FindAssignments=Find Assignments
EditAction.Edit=Edit
SimpleBusinessCreationWizardPage.Super=BusinessProcessCreatePage
SimpleBusinessCreationWizardPage.Title=New Business Model
SimpleBusinessCreationWizard.NewBusinessModel=New Business Model
OpenDiagramAction.EditBusinessModel=Edit Business Model
OpenDiagramAction.ReadBusinessModel=Read Business Model
DeleteAssignmentAction.DeleteAssignment =Delete Assignment
AssignmentPropertySection.Type=Type
AssignmentPropertySection.Name=Name
AssignmentPropertySection.Comment=Comment
AssignmentPropertySection.DeleteAssignment=Delete Assignment
BusinessPaletteFactory.DecisionComment=Create new Decision
BusinessPaletteFactory.TerminalComment=Create new Terminal
BusinessPaletteFactory.DocuemntComment=Create new Document
BusinessPaletteFactory.DatabaseComment=Create new Database
BusinessInitDiagramFileAction.Error=Error
BusinessVisualIDRegistry.ParseError=Unable to parse view type as a visualID number:
BusinessPaletteFactory.decision=Decision
BusinessPaletteFactory.Action=Action
BusinessPaletteFactory.Actor=Actor
BusinessPaletteFactory.ActionComment=Create new Action
BusinessPaletteFactory.CreateEllipse=Create new Ellipse
BusinessAbstractParser.InvalidInputAt=Invalid input at
BusinessAbstractParser.UnknownLiteral=Unknown literal:
BusinessPaletteFactory.Terminal=Terminal
BusinessPaletteFactory.DataComment=Create new Data
BusinessPaletteFactory.Document=Document
BusinessPaletteFactory.InputComment=Create new Input
BusinessPaletteFactory.ListComment=Create new List
BusinessPaletteFactory.CreateActor=Create new Actor
BusinessPaletteFactory.CreateGear=Create new Gear
BusinessPaletteFactory.Database=Database
BusinessPaletteFactory.Ellipse=Ellipse
BusinessPaletteFactory.Relationshop=Relationship
BusinessInitDiagramFileAction.LoadFaild=Model file loading failed
BusinessInitDiagramFileAction.IntialNew=Initialize new
BusinessInitDiagramFileAction.DiagramFile=\ diagram file
BusinessPaletteFactory.RelationshopComment=Create new Relationship
BusinessPaletteFactory.DirectionalRelationShip=Directional Relationship
BusinessPaletteFactory.CreateDirectionalRelationShip=Create new Directional Relationship
BusinessPaletteFactory.BidirectionalRelationShip=Bidirectional Relationship
BusinessPaletteFactory.CreateBidirectionalRelationShip=Create new Bidirectional Relationship
BusinessNewDiagramFileWizard.DiagramFile=Diagram file
BusinessInitDiagramFileAction.UnableToLoadResource=Unable to load resource:
BusinessAbstractParser.ValueOfTypeStringIsExpected=Value of type String is expected
BusinessCreationWizardPage.CreateBusinessDiagram=Create Business Diagram
BusinessAbstractParser.ValueOfTypeByteIsExpected=Value of type Byte is expected
BusinessAbstractParser.StringIntegerConvertError=String value does not convert to Integer value
BusinessNewDiagramFileWizard.CreateNewDiagram=Create new diagram based on {0} model content
BusinessAbstractParser.StringShortConverError=String value does not convert to Short value
BusinessAbstractParser.ValueOfShortIsExpected=Value of type Short is expected
BusinessAbstractParser.StringLongConverError=String value does not convert to Long value
BusinessAbstractParser.ValueOfLongIsExpected=Value of type Long is expected
BusinessAbstractParser.ValueOfFloatIsExpected=Value of type Float is expected
BusinessNewDiagramFileWizard.SelectRootElement=Select diagram root element
BusinessAbstractParser.StringFloatConvertError=String value does not convert to Float value
BusinessAbstractParser.ValueOfDoubleIsExpected=Value of type Double is expected
BusinessNewDiagramFileWizard.DiagramRootElement=Diagram root element
BusinessAbstractParser.ValueOfBooleanIsExpected=Value of type Boolean is expected
BusinessAbstractParser.ValueOfIntegerIsExpected=Value of type Integer is expected
BusinessAbstractParser.StringDoubleConvertError=String value does not convert to Double value
BusinessCreationWizardPage.CreatenewBusinessDiagram=Create a new Business diagram.
BusinessNewDiagramFileWizard.IntialNewEcoreDiagramFile=Initialize new Ecore diagram file
BusinessNewDiagramFileWizard.SelectSemanticModelElement=Select semantic model element to be depicted on diagram
BusinessNewDiagramFileWizard.SelectDiagramRootElement=Select diagram root element:
BusinessAbstractParser.ValueOfTypeCharacterIsExpected=Value of type Character is expected
BusinessNewDiagramFileWizard.NoDiagramRootElementSelectedError=No diagram root element selected
BusinessNewDiagramFileWizard.InvalidDiagramRootElementSelected=Invalid diagram root element was selected
BusinessModelingAssistantProvider.AvaiableDomainModelElements=Available domain model elements:
BusinessAbstractParser.StringValueDoesNotConvertToByteValue=String value does not convert to Byte value
BusinessModelingAssistantProvider.SelectDomainModelElement=Select domain model element
BusinessPaletteFactory.Data=Data
BusinessPaletteFactory.Input=Input
BusinessPaletteFactory.List=List
BusinessPaletteFactory.Gear=Gear
BusinessTooltipFigure.assignedMeta={0} assigned Metadata
RepositoryFactoryProxyLabelProvider.NotFound=\ (Not Found)
RepositoryFactoryProxyLabelProvider.Deleted=\ (Deleted)
BusinessDiagramEditor.canNotSaveTitle=Warning
BusinessDiagramEditor.canNotSaveMessage=Business Model is not locked by user, can not save.

View File

@@ -1,4 +1,3 @@
AssignmentPropertySection.Type=Tip
AssignmentPropertySection.Name=Ad\u0131
BusinessInitDiagramFileAction.Error=Hata
BusinessPaletteFactory.InputComment=Yeni giri\u015F olu\u015Ftur

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -79,6 +79,8 @@ BusinessPaletteFactory.Gear=Gear
BusinessTooltipFigure.assignedMeta={0} assigned Metadata
RepositoryFactoryProxyLabelProvider.NotFound=\ (Not Found)
RepositoryFactoryProxyLabelProvider.Deleted=\ (Deleted)
AssignmentPropertySection.Type=Type
AssignmentPropertySection.Name=Name
AssignmentPropertySection.Comment=Comment
BusinessDiagramEditor.canNotSaveTitle=Warning
BusinessDiagramEditor.canNotSaveMessage=Business Model is not locked by user, can not save.

View File

@@ -86,7 +86,8 @@ public class CreateDiagramAction extends AContextualAction implements IIntroActi
if (nodeType == ERepositoryObjectType.BUSINESS_PROCESS) {
enabled = true;
}
if (repositoryNode.getObject() != null && repositoryNode.getObject().isDeleted()) {
if (repositoryNode.getObject() != null
&& repositoryNode.getObject().getProperty().getItem().getState().isDeleted()) {
enabled = false;
}
}

View File

@@ -82,7 +82,6 @@ import org.talend.designer.core.ui.views.jobsettings.JobSettingsView;
import org.talend.designer.core.ui.views.jobsettings.tabs.AbstractTabComposite;
import org.talend.designer.core.utils.EmfPropertyHelper;
import org.talend.designer.core.utils.KeyHelper;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IRepositoryNode;
import org.talend.repository.model.IRepositoryNode.ENodeType;
import org.talend.repository.model.IRepositoryNode.EProperties;
@@ -412,12 +411,11 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
}
}
}
if (ProjectManager.getInstance().isInCurrentMainProject(repositoryNode)) {
CorePlugin.getDefault().getDiagramModelService()
.addDeleteAssignmentAction(mgr, tableViewer.getSelection());
}
}
CorePlugin.getDefault().getDiagramModelService().addDeleteAssignmentAction(mgr, tableViewer.getSelection());
}
}
});
Menu menu = menuMgr.createContextMenu(tableViewer.getControl());

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -3,14 +3,4 @@ output.. = class/
bin.includes = META-INF/,\
.,\
plugin_en.properties,\
plugin_zh_CN.properties\
,plugin_ru.properties\
,plugin_hr.properties\
,plugin_fr.properties\
,plugin_el.properties\
,plugin_ja.properties\
,plugin_it.properties\
,plugin_es.properties\
,plugin_pl.properties\
,plugin_de.properties\
,plugin_swtbot.properties
plugin_zh.properties

View File

@@ -1,5 +0,0 @@
pluginName = EmittersPool Model
providerName = www.example.org
components=Components
trunjob=tRunJob
format=Format

View File

@@ -87,7 +87,7 @@ FAMILY.Misc=Verschiedenes
FAMILY.MySQL=MySQL
FAMILY.Netezza=Netezza
FAMILY.OLAP_Cube=OLAP Würfel
FAMILY.Oracle=Oracle
FAMILY.Oracle=Dieser Quellcode wurde automatisiert generiert durch {0}
FAMILY.Orchestration=Instrumentation
FAMILY.Output= Ausgabe
FAMILY.ParAccel=Paraccel

View File

@@ -130,4 +130,3 @@ FAMILY.Teradata=Teradata
FAMILY.Vertica=Vertica
FAMILY.VtigerCRM=VtigerCRM
FAMILY.XML=XML
CodeGeneratorEmittersPoolFactory.updatePaletteForEditors=Mettre à jour la palette pour les éditeurs

View File

@@ -25,4 +25,3 @@ FAMILY.Input=Unos
FAMILY.MySQL=MySQL
FAMILY.Oracle=Oracle
FAMILY.PostgreSQL=PostgreSQL
FAMILY.XML=XML

View File

@@ -130,4 +130,3 @@ FAMILY.Teradata=Teradata
FAMILY.Vertica=Vertica
FAMILY.VtigerCRM=VtigerCRM
FAMILY.XML=XML
CodeGeneratorEmittersPoolFactory.updatePaletteForEditors=\u30A8\u30C7\u30A3\u30BF\u306E\u30D1\u30EC\u30C3\u30C8\u306E\u66F4\u65B0

View File

@@ -1,135 +0,0 @@
generatedcode.copyright.title=Copyright (c) 2005-2010, Talend Inc.
generatedcode.copyright.body1=This source code has been automatically generated by {0}
generatedcode.copyright.body2= / JobDesigner (CodeGenerator version {0}).
generatedcode.copyright.body3=You can find more information about Talend products at www.talend.com.
generatedcode.copyright.body4=You may distribute this code under the terms of the GNU LGPL license
generatedcode.copyright.body5=(http://www.gnu.org/licenses/lgpl.html).
generatedcode.footerprocess.nbcharsgenerated={0} characters generated by {1}
CodeGenerator.getGraphicalNode1=------process.getGraphicalNodes()------
CodeGenerator.getGraphicalNode2=------process.getGeneratingNodes()------
CodeGenerator.JET.TimeOut=JET initialisation Time Out
CodeGenerator.newLine=\n\n\n\n
CodeGenerator.Node.NotFound=Node not found in current process
JavaRoutineSynchronizer.UnsupportedOperation.Exception1=method not implemented: org.talend.designer.codegen.JavaRoutineSynchronizer line:49
JavaRoutineSynchronizer.UnsupportedOperation.Exception2=method not implemented: org.talend.designer.codegen.JavaRoutineSynchronizer line:58
JetSkeletonManager.unableLoad=unable to load skeleton update cache file
JetSkeletonManager.unableSave=unable to save skeleton update cache file
JetSkeletonManager.updateProblem=when update skeleton persistence data, there have some problems
EmfEmittersPersistence.CodeGen.DataMissing=Code Generation Datas missing. Starting Full Code Generation.
CodeGeneratorEmittersPoolFactory.PersitentData.Error=Persitent data cannot be saved :
CodeGeneratorEmittersPoolFactory.JETEmitters.NoPresent=JETEmitters Project not present, full reinitialize is needed
CodeGeneratorEmittersPoolFactory.Class.NotFound=Template still present, but class {0} has disapeared from workspace. This unit needs to be recompiled.
CodeGeneratorEmittersPoolFactory.codeThread=Code generation background thread
CodeGeneratorEmittersPoolFactory.componentCompiled=Components compiled in {0} ms
CodeGeneratorEmittersPoolFactory.dialogContent=JetEmitter Generation is canceled,to avoid problems cause by this, please press Ctrl+Shift+F3 to generate again\!
CodeGeneratorEmittersPoolFactory.failCompail=Components compile fail : \r\n
EmittersPoolFactoryImpl.Class.IllegalArg=The class ' {0}' is not a valid classifier
CodeGeneratorEmittersPoolFactory.initialException=Exception during Initialization
CodeGeneratorEmittersPoolFactory.initMessage=Generation Engine Initialization in progress...
CodeGeneratorEmittersPoolFactory.jetEmitterInitialException=Error during JetEmitter initalization
CodeGeneratorEmittersPoolFactory.operationCanceled=Operation Canceled
CodeGeneratorEmittersPoolFactory.updatePaletteForEditors=Update the palette for editors
CodeGeneratorService.invalidLanguage1=invalid language type.
CodeGeneratorService.invalidLanguage2=invalid language type.
CodeGenInit.addMarkers=Adding markers to workspace
CodeGenInit.createProject=create {0} project
CodeGenInit.deleteProject=delete {0} project
CodeGenInit.initTemplate=init Templates
CodeGenInit.removeLink=Remove linked resources
CodeGenInit.saveWorkspace=Saving workspace
DocumentRootImpl.mixed=\ (mixed:
NodesSubTree.enableParallel=__ENABLE_PARALLEL__
PoolTypeImpl.persistentPool=\ (persistentPool: {0} )
TalendJetEmitter.compileFail=\ compile fail : {0} : {1}
TalendJetEmitter.exception=Exception on
JetFilesProviderManager.unableLoad=Unable to load {0}JetFilesProviderManager.unableLoad=Unable to load {0}JetFilesProviderManager.unableLoad=Unable to load {0}
ComponentsFactory.afterSystemComponent=after system component
ComponentsFactory.componentNotFound=Component folder not found\:
ComponentsFactory.load.components=Load Components...
ComponentsFactory.parentNotRecompiled=Warning\: parents of *.inc.javajet are not recompiled \!
ComponentsLocalProviderService.componentLoadError=Component load error
ComponentsLocalProviderService.talendExchangeError=Talend Exchange Error
ComponentsPreferencePage.ButtonLabel0=Ok
ComponentsPreferencePage.configuration.LINK_STYLE=Default mapping links display as :
ComponentsPreferencePage.rowLimit=Row limit
ComponentsPreferencePage.WarningMsg=Need to restart Talend Open Studio to load extral components !
ComponentsPreferencePage.WarningTitle=Warning
ComponentsPreferencePage.directoryFieldLabel=User component folder\:
ComponentsProviderManager.unableLoad=unable to load component provider
ComponenttRunJobPreferencePage.label=Don't show corresponding job after double click on a tRunJob Component.
ComponentJobletPreferencePage.label=Don't show corresponding job after double click on a Joblet Component.
ComponenttRunJobPreferencePage.showCorrespondingJob=Show corresponding job after double click on a tRunJob Component.
XsdValidationCacheManager.unableLoadxsd=unable to load xsd validation cache file
XsdValidationCacheManager.unableSavexsd=unable to save xsd validation cache file
prefs.configuration.LINK_STYLE.AUTO=Auto
prefs.configuration.LINK_STYLE.BEZIER_CURVE=Curves
prefs.configuration.LINK_STYLE.LINE=Lines (fast)
FAMILY.AS400=AS400
FAMILY.Access=Access
FAMILY.Alfresco=Alfresco
FAMILY.Business=Business
FAMILY.Business_Intelligence=Business Intelligence
FAMILY.CentricCRM=CentricCRM
FAMILY.Charts=Charts
FAMILY.Connections=Connections
FAMILY.Custom_Code=Custom Code
FAMILY.DB2=DB2
FAMILY.DB_Generic=DB Generic
FAMILY.DB_JDBC=DB JDBC
FAMILY.DB_SCD=DB SCD
FAMILY.Data_Quality=Data Quality
FAMILY.Databases=Databases
FAMILY.ELT=ELT
FAMILY.ESB=ESB
FAMILY.EXASolution=EXASolution
FAMILY.eXist=eXist
FAMILY.FTP=FTP
FAMILY.Fields=Fields
FAMILY.File=File
FAMILY.FireBird=FireBird
FAMILY.Greenplum=Greenplum
FAMILY.HSQLDb=HSQLDb
FAMILY.Healthcare=Healthcare
FAMILY.Hive=Hive
FAMILY.Informix=Informix
FAMILY.Ingres=Ingres
FAMILY.Input=Input
FAMILY.Interbase=Interbase
FAMILY.Internet=Internet
FAMILY.Jasper=Jasper
FAMILY.JavaDB=JavaDB
FAMILY.JDBC=JDBC
FAMILY.LDAP=LDAP
FAMILY.Logs_Errors=Logs & Errors
FAMILY.MS_SQL_Server=MS SQL Server
FAMILY.MSSql=MSSql
FAMILY.Management=Management
FAMILY.MaxDB=MaxDB
FAMILY.Microsoft_AX=Microsoft AX
FAMILY.Microsoft_CRM=Microsoft CRM
FAMILY.Misc=Misc
FAMILY.MySQL=MySQL
FAMILY.Netezza=Netezza
FAMILY.OLAP_Cube=OLAP Cube
FAMILY.Oracle=Oracle
FAMILY.Orchestration=Orchestration
FAMILY.Output=Output
FAMILY.ParAccel=ParAccel
FAMILY.PostgreSQL=PostgreSQL
FAMILY.PostgresPlus=PostgresPlus
FAMILY.Processing=Processing
FAMILY.SAP=SAP
FAMILY.Sas=Sas
FAMILY.SCD=SCD
FAMILY.SCP=SCP
FAMILY.SPSS=SPSS
FAMILY.SQLite=SQLite
FAMILY.Salesforce=Salesforce
FAMILY.SugarCRM=SugarCRM
FAMILY.Sybase=Sybase
FAMILY.System=System
FAMILY.Technical=Technical
FAMILY.Teradata=Teradata
FAMILY.Vertica=Vertica
FAMILY.VtigerCRM=VtigerCRM
FAMILY.XML=XML

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -56,7 +56,7 @@
<page
category="org.talend.designer.codegen.components.localprovider.page1"
class="org.talend.designer.components.preference.labelformat.ComponentsFormatPreferencePage"
id="org.talend.designer.codegen.components.localprovider.page2"
id="org.talend.designer.codegen.components.localprovider.page1"
name="%format">
</page>
</extension>

View File

@@ -106,7 +106,6 @@
boolean hasCXFHTTPAuthConsumer = false;
boolean hasCXFHTTPAuthProvider = false;
boolean hasCXFComponentConsumer = false;
boolean hasCXFComponentConsumerWithCXFMESSAGE = false;
List<? extends INode> cxfNodes = process.getNodesOfType("cCXF");
if( null != cxfNodes && cxfNodes.size() >0 ){
hasCXFComponent = true;
@@ -121,9 +120,6 @@
if(!hasCXFComponentConsumer && incomingConnections>0){
hasCXFComponentConsumer = true;
}
if(!hasCXFComponentConsumerWithCXFMESSAGE && incomingConnections>0 && "CXF_MESSAGE".equals(formatType)){
hasCXFComponentConsumerWithCXFMESSAGE = true;
}
if("true".equals(useSecurity)){
if("SAML".equals(securityType) && (!hasCXFSamlTokenProvider || !hasCXFSamlTokenConsumer)){
if(incomingConnections == 0){
@@ -523,64 +519,8 @@ if (isProvider) {
}
%>
}
<%
}
if(hasCXFComponentConsumerWithCXFMESSAGE){
%>
/*
* on CXF_MESSAGE case (call a service)
* if the response is fault, then will run into problem
*/
private void addCXFMESSAGEFaultInterceptor(org.apache.camel.component.cxf.CxfEndpoint cxfEndpoint){
cxfEndpoint.getBus().getInFaultInterceptors().add(new org.apache.cxf.interceptor.DocLiteralInInterceptor() {
@Override
public void handleMessage(org.apache.cxf.message.Message message) {
// if has List content, then return
if(message.getContent(java.util.List.class) != null){
return;
}
if (isFaultMessage(message)) {
org.apache.cxf.message.Message inFaultMessage = message
.getExchange().getInFaultMessage();
org.apache.cxf.message.MessageContentsList parameters = new org.apache.cxf.message.MessageContentsList();
if (inFaultMessage != null) {
org.apache.cxf.staxutils.W3CDOMStreamWriter content = inFaultMessage
.get(org.apache.cxf.staxutils.W3CDOMStreamWriter.class);
parameters.add(content);
}
message.setContent(java.util.List.class, parameters);
}
}
private boolean isFaultMessage(org.apache.cxf.message.Message msg) {
if (msg == null
|| !(msg instanceof org.apache.cxf.binding.soap.SoapMessage)) {
return false;
}
org.apache.cxf.binding.soap.SoapMessage message = (org.apache.cxf.binding.soap.SoapMessage) msg;
//if it's not a CXF_MESSAGE, then return false
Object dataFormat = message.getContextualProperty(org.apache.camel.component.cxf.common.message.CxfConstants.DATA_FORMAT_PROPERTY);
if(org.apache.camel.component.cxf.DataFormat.CXF_MESSAGE != dataFormat){
return false;
}
javax.xml.stream.XMLStreamReader xmlReader = message
.getContent(javax.xml.stream.XMLStreamReader.class);
if (xmlReader == null) {
return false;
}
if (message.getVersion().getFault()
.equals(xmlReader.getName())
&& isRequestor(message)) {
return true;
}
return false;
}
});
}
<%}%>
/**
* please initial uri map
*/
@@ -639,11 +579,7 @@ if(hasCXFComponentConsumerWithCXFMESSAGE){
}
%>
);
<%
if("CXF_MESSAGE".equals(formatType) && node.getIncomingConnections().size() > 0){
%>
addCXFMESSAGEFaultInterceptor(<%=endpointVar%>);
<% }
<%
String useSL = ElementParameterParser.getValue(node, "__ENABLE_SL__");
String useSAM = ElementParameterParser.getValue(node, "__ENABLE_SAM__");
if ("true".equals(useSL)) {

View File

@@ -16,7 +16,6 @@
org.talend.core.model.metadata.types.JavaType
java.util.Map
java.util.List
java.util.ArrayList
java.util.Set
java.util.HashSet
"
@@ -38,44 +37,23 @@ boolean isRunInMultiThread = codeGenArgument.getIsRunInMultiThread();
Set<IConnection> connSet = new HashSet<IConnection>();
connSet.addAll(node.getIncomingConnections(EConnectionType.FLOW_MAIN));
connSet.addAll(node.getOutgoingConnections(EConnectionType.FLOW_MERGE));
connSet.addAll(node.getIncomingConnections(EConnectionType.FLOW_MERGE));
Set<IConnection> iterateConnSet = new HashSet<IConnection>();
iterateConnSet.addAll(node.getOutgoingConnections(EConnectionType.ITERATE));
List<IConnection> allSubProcessConnection = codeGenArgument.getAllMainSubTreeConnections();
if((codePart.equals(ECodePart.END))&&(stat)){
boolean iterateInVFComp = (node.getVirtualLinkTo() != null && node.getVirtualLinkTo() == EConnectionType.ITERATE);
if(iterateInVFComp){
List<String> needToEndConnNames = new ArrayList<String>();
INode nextNode = node.getOutgoingConnections(EConnectionType.ITERATE).get(0).getTarget();
NodeUtil.fillConnectionsForStat(needToEndConnNames, nextNode);
%>
if(execStat){
<%
for(String connName : needToEndConnNames){
%>
runStat.updateStatOnConnection("<%=connName%>"+iterateId,2, 0);
<%
}
%>
}
<%
}
if(connSet.size()>0){
for(IConnection con:connSet){
%>
if(execStat){
if(resourceMap.get("inIterateVComp") == null || !((Boolean)resourceMap.get("inIterateVComp"))){
runStat.updateStatOnConnection("<%=con.getUniqueName()%>"+iterateId,2, 0);
}
}
<%
}
}
}
if((codePart.equals(ECodePart.END))&&(stat)&&connSet.size()>0){
for(IConnection con:connSet){
%>
if(execStat){
runStat.updateStatOnConnection("<%=con.getUniqueName()%>"
+iterateId,2, 0);
}
<%
}
}%>
<%
@@ -333,9 +311,6 @@ end_Hash.put("<%=node.getUniqueName() %>", System.currentTimeMillis());
if (!status.equals("failure")) {
status = errorThread_<%=iterateTargetNodeName %>.status;
}
if(errorThread_<%=iterateTargetNodeName %>.exception!=null){
throw errorThread_<%=iterateTargetNodeName %>.exception;
}
}else{
Integer threadErrorCode = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getErrorCode();
String threadStatus = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getStatus();
@@ -363,9 +338,6 @@ end_Hash.put("<%=node.getUniqueName() %>", System.currentTimeMillis());
if (!localStatus.equals("failure")) {
((java.util.Map) threadLocal.get()).put("status", errorThread_<%=iterateTargetNodeName %>.status);
}
if(errorThread_<%=iterateTargetNodeName %>.exception!=null){
throw errorThread_<%=iterateTargetNodeName %>.exception;
}
}else{
Integer threadErrorCode = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getErrorCode();
String threadStatus = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getStatus();

View File

@@ -8,11 +8,9 @@
org.talend.core.model.process.EConnectionType
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.utils.NodeUtil
org.talend.core.model.process.IConnectionCategory
java.util.List
java.util.ArrayList
java.util.Set
java.util.Set
java.util.HashSet
java.util.Iterator
"
@@ -35,12 +33,12 @@
List<IConnection> allSubProcessConnection = codeGenArgument.getAllMainSubTreeConnections();
%>
/**
* [<%=node.getUniqueName() %> <%=codePart %> ] start
*/
<%
/**
* [<%=node.getUniqueName() %> <%=codePart %> ] start
*/
<%
//This part in order to feedback with the iterate_subprocess_header.javajet and iterate_subprocess_footer.javajet
if (codePart.equals(ECodePart.BEGIN)) {
@@ -49,195 +47,139 @@
for (IConnection iterateConn : iterateConnSet) {
parallelIterate = "true".equals(ElementParameterParser.getValue(iterateConn, "__ENABLE_PARALLEL__"));
if (parallelIterate) {
%>
TalendThreadPool mtp_<%=iterateConn.getTarget().getUniqueName() %> = new TalendThreadPool(<%=ElementParameterParser.getValue(iterateConn,"__NUMBER_PARALLEL__") %>);
%>
TalendThreadPool mtp_<%=iterateConn.getTarget().getUniqueName() %> = new TalendThreadPool(<%=ElementParameterParser.getValue(iterateConn,"__NUMBER_PARALLEL__") %>);
<%
if(!hasParallelIterate){
hasParallelIterate = true;
%>
<%
if(!hasParallelIterate){
hasParallelIterate = true;
%>
final Object[] lockWrite = new Object[0];
int threadIdCounter =0;
<%
}
%>
final Object[] lockWrite = new Object[0];
int threadIdCounter =0;
<%}%>
<%
<%
}
String iterateNodeName = iterateConn.getTarget().getUniqueName();
%>
%>
int NB_ITERATE_<%=iterateNodeName %> = 0; //for statistics
<%
<%
continue;
}
}
%>
%>
<%
<%
if (codePart.equals(ECodePart.BEGIN)) {
%>
<%
if(trace){
%>
globalMap.put("ENABLE_TRACES_CONNECTION_<%=startNodeCid%>",Boolean.FALSE);
<%
}
%>
ok_Hash.put("<%=node.getUniqueName() %>", false);
start_Hash.put("<%=node.getUniqueName() %>", System.currentTimeMillis());
<%
%>
<% if(trace){ %>
globalMap.put("ENABLE_TRACES_CONNECTION_<%=startNodeCid%>",Boolean.FALSE);
<% } %>
ok_Hash.put("<%=node.getUniqueName() %>", false);
start_Hash.put("<%=node.getUniqueName() %>", System.currentTimeMillis());
<%
String statCatcher = ElementParameterParser.getValue(node,"__TSTATCATCHER_STATS__");
if ((node.getProcess().getNodesOfType("tStatCatcher").size() > 0) && (statCatcher.equals("true"))) {
for (INode statCatcherNode : node.getProcess().getNodesOfType("tStatCatcher")) {
%>
<%=statCatcherNode.getUniqueName() %>.addMessage("begin","<%=node.getUniqueName() %>");
<%=statCatcherNode.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
<%
%>
<%=statCatcherNode.getUniqueName() %>.addMessage("begin","<%=node.getUniqueName() %>");
<%=statCatcherNode.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
<%
}
}
}
if(codePart.equals(ECodePart.MAIN)) {
List<INode> meterCatchers = (List<INode>)node.getProcess().getNodesOfType("tFlowMeterCatcher");
if ((node.getProcess().getNodesOfType("tFlowMeter").size() > 0)){
for(IConnection temp_conn : node.getIncomingConnections(EConnectionType.FLOW_MAIN)){
if ((node.getProcess().getNodesOfType("tFlowMeter").size() > 0))
{
for(IConnection temp_conn : node.getIncomingConnections(EConnectionType.FLOW_MAIN))
{
String name_conn = temp_conn.getUniqueName();
if(temp_conn.isUseByMetter()){
%>
<%
if (meterCatchers != null) {
for (INode meterCatcher : meterCatchers) {
%>
<%=meterCatcher.getUniqueName() %>.addLineToRow("<%=name_conn%>_count");
<%
}
}
if(temp_conn.isUseByMetter())
{
%>
<%
if (meterCatchers != null) {
for (INode meterCatcher : meterCatchers) {
%>
<%=meterCatcher.getUniqueName() %>.addLineToRow("<%=name_conn%>_count");
<%
}
}
%>
<%
}
}
for(IConnection temp_conn : node.getIncomingConnections(EConnectionType.FLOW_MERGE)){
for(IConnection temp_conn : node.getIncomingConnections(EConnectionType.FLOW_MERGE))
{
String name_conn = temp_conn.getUniqueName();
if(name_conn == incomingName && temp_conn.isUseByMetter()){
if (meterCatchers != null) {
for (INode meterCatcher : meterCatchers) {
%>
<%=meterCatcher.getUniqueName() %>.addLineToRow("<%=name_conn%>_count");
<%
}
}
if(name_conn == incomingName && temp_conn.isUseByMetter())
{
%>
<%
if (meterCatchers != null) {
for (INode meterCatcher : meterCatchers) {
%>
<%=meterCatcher.getUniqueName() %>.addLineToRow("<%=name_conn%>_count");
<%
}
}
%>
<%
}
}
}
}
%>
<%
if(node.isVirtualGenerateNode()){
%>
currentVirtualComponent = "<%=NodeUtil.getVirtualUniqueName(node)%>";
<%
}
%>
currentComponent="<%=node.getUniqueName() %>";
%>
currentComponent="<%=node.getUniqueName() %>";
<%
<%
connSet = new HashSet<IConnection>();
connSet.addAll(node.getIncomingConnections(EConnectionType.FLOW_MAIN));
connSet.addAll(node.getOutgoingConnections(EConnectionType.FLOW_MERGE));
connSet.addAll(node.getIncomingConnections(EConnectionType.FLOW_MERGE));
if ((codePart.equals(ECodePart.BEGIN))&&(stat)&&connSet.size()>0) {
for(IConnection con:connSet){
%>
if (execStat) {
if(resourceMap.get("inIterateVComp") == null){
java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_<%=con.getUniqueName() %> = (java.util.concurrent.ConcurrentHashMap) globalMap.get("concurrentHashMap");
concurrentHashMap_<%=con.getUniqueName() %>.putIfAbsent("<%=con.getUniqueName() %>" + iterateLoop,new java.util.concurrent.atomic.AtomicInteger(0));
java.util.concurrent.atomic.AtomicInteger stats_<%=con.getUniqueName() %> = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_<%=con.getUniqueName() %>.get("<%=con.getUniqueName() %>" + iterateLoop);
runStat.updateStatOnConnection("<%=con.getUniqueName() %>" + iterateId, stats_<%=con.getUniqueName() %>.incrementAndGet()<=1?0:1, 0);
}
}
%>
<%
}
if (execStat) {
java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_<%=con.getUniqueName() %> = (java.util.concurrent.ConcurrentHashMap) globalMap.get("concurrentHashMap");
concurrentHashMap_<%=con.getUniqueName() %>.putIfAbsent("<%=con.getUniqueName() %>" + iterateLoop,new java.util.concurrent.atomic.AtomicInteger(0));
java.util.concurrent.atomic.AtomicInteger stats_<%=con.getUniqueName() %> = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_<%=con.getUniqueName() %>.get("<%=con.getUniqueName() %>" + iterateLoop);
runStat.updateStatOnConnection("<%=con.getUniqueName() %>" + iterateId, stats_<%=con.getUniqueName() %>.incrementAndGet()<=1?0:1, 0);
}
<% }
}
if((codePart.equals(ECodePart.MAIN))&&(stat)&&connSet.size()>0){
for(IConnection con:connSet){
%>
%>
//<%=con.getUniqueName()%>
//<%=(String)codeGenArgument.getIncomingName()%>
//<%=con.getUniqueName()%>
//<%=(String)codeGenArgument.getIncomingName()%>
<%if (!node.getComponent().useMerge()) {%>
if(execStat){
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId,1, 1);
}
<%
} else if(con.getUniqueName().equals((String)codeGenArgument.getIncomingName())){
%>
if(execStat){
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId,1, 1);
}
<%}%>
<%if (!node.getComponent().useMerge()) {%>
if(execStat){
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId,1, 1);
}
<%
} else if(con.getUniqueName().equals((String)codeGenArgument.getIncomingName())){
%>
if(execStat){
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId,1, 1);
}
<%}%>
<%
<%
}
}
%>
%>
<%
if(codePart.equals(ECodePart.BEGIN)){
%>
int tos_count_<%=node.getUniqueName() %> = 0;
<%
}
if(stat){
boolean iterateInVFComp = (node.getVirtualLinkTo() != null && node.getVirtualLinkTo() == EConnectionType.ITERATE);
if(iterateInVFComp){
if(codePart.equals(ECodePart.BEGIN)){
List<String> needToStartConnNames = new ArrayList<String>();
INode nextNode = node.getOutgoingConnections(EConnectionType.ITERATE).get(0).getTarget();
NodeUtil.fillConnectionsForStat(needToStartConnNames, nextNode);
%>
if(execStat){
<%
for(String connName : needToStartConnNames){
%>
java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_<%=connName%> = (java.util.concurrent.ConcurrentHashMap) globalMap.get("concurrentHashMap");
concurrentHashMap_<%=connName%>.putIfAbsent("<%=connName%>" + iterateLoop,new java.util.concurrent.atomic.AtomicInteger(0));
java.util.concurrent.atomic.AtomicInteger stats_<%=connName%> = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_<%=connName%>.get("<%=connName%>" + iterateLoop);
runStat.updateStatOnConnection("<%=connName%>" + iterateId, stats_<%=connName%>.incrementAndGet()<=1?0:1, 0);
<%
}
%>
}
<%
}else if(codePart.equals(ECodePart.MAIN)){
%>
resourceMap.put("inIterateVComp", true);
<%
}else if(codePart.equals(ECodePart.END)){
%>
resourceMap.remove("inIterateVComp");
<%
}
}else{
IConnection preIterate = (node.getIncomingConnections(EConnectionType.ITERATE) != null && node.getIncomingConnections(EConnectionType.ITERATE).size() == 1) ? node.getIncomingConnections(EConnectionType.ITERATE).get(0) : null;
if(preIterate != null){
boolean iterateInVSComp = (preIterate.getSource().getVirtualLinkTo() != null && preIterate.getSource().getVirtualLinkTo() == EConnectionType.ITERATE);
if(iterateInVSComp){
if(codePart.equals(ECodePart.BEGIN)){
%>
resourceMap.remove("inIterateVComp");
<%
}else if(codePart.equals(ECodePart.END)){
%>
resourceMap.put("inIterateVComp", true);
<%
}
}
}
}
}
%>
<%if(codePart.equals(ECodePart.BEGIN)){ %>
int tos_count_<%=node.getUniqueName() %> = 0;
<%}%>

View File

@@ -167,9 +167,7 @@
public int runJobInTOS(String[] args) {
// reset status
status = "";
String lastStr = "";
for (String arg : args) {
if (arg.equalsIgnoreCase("--context_param")) {

View File

@@ -35,10 +35,9 @@ public class CLASS
// toReturn += failure_singleThread;
// }
toReturn += "globalMap.put(\""+rootNode.getUniqueName()+ "_SUBPROCESS_STATE\", -1);\n";
toReturn += "\ne_" + rootNode.getUniqueName() + ".printStackTrace();\n";
toReturn += "globalMap.put(\""+rootNode.getUniqueName()+ "_SUBPROCESS_STATE\", -1);\n";
//List< ? extends IConnection> onSubJobErrorConns = rootNode.getOutgoingConnections(EConnectionType.ON_SUBJOB_ERROR);
//if(onSubJobErrorConns!=null){
@@ -48,8 +47,8 @@ public class CLASS
//}
if(isMultiThread){
toReturn += "\n}catch (Error e_" + rootNode.getUniqueName() + ") {\n";
toReturn += "globalMap.put(\""+rootNode.getUniqueName()+ "_SUBPROCESS_STATE\", -1);\n";
toReturn += "\ne_" + rootNode.getUniqueName() + ".printStackTrace();\n";
toReturn += "globalMap.put(\""+rootNode.getUniqueName()+ "_SUBPROCESS_STATE\", -1);\n";
}
toReturn += "\n}";
return toReturn;

View File

@@ -260,38 +260,23 @@ public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> get<%=Ch
private final String projectName = "<%=codeGenArgument.getCurrentProjectName() %>";
public Integer errorCode = null;
private String currentComponent = "";
<%
//tParallelize will wrap globalMap with synchronizedMap
if(!isRunInMultiThread){
%>
private final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
<%
}else{
%>
private final java.util.Map<String, Object> globalMap = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Object>());
<%
}
boolean exist_tParallelize = false;
List<? extends INode> tParallelizeList = process.getNodesOfType("tParallelize");
if(tParallelizeList != null && tParallelizeList.size() > 0){
exist_tParallelize = true;
}
if(!isRunInMultiThread && !exist_tParallelize){
%>
private final java.util.Map<String, Long> start_Hash = new java.util.HashMap<String, Long>();
private final java.util.Map<String, Long> end_Hash = new java.util.HashMap<String, Long>();
private final java.util.Map<String, Boolean> ok_Hash = new java.util.HashMap<String, Boolean>();
public final java.util.List<String[]> globalBuffer = new java.util.ArrayList<String[]>();
<%
}else{
%>
private final java.util.Map<String, Long> start_Hash = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Long>());
private final java.util.Map<String, Long> end_Hash = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Long>());
private final java.util.Map<String, Boolean> ok_Hash = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Boolean>());
public final java.util.List<String[]> globalBuffer = java.util.Collections.synchronizedList(new java.util.ArrayList<String[]>());
<%
}
%>
<%
if(!isRunInMultiThread ){
%>
private final java.util.Map<String, Long> start_Hash = new java.util.HashMap<String, Long>();
private final java.util.Map<String, Long> end_Hash = new java.util.HashMap<String, Long>();
private final java.util.Map<String, Boolean> ok_Hash = new java.util.HashMap<String, Boolean>();
private final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
public final java.util.List<String[]> globalBuffer = new java.util.ArrayList<String[]>();
<%
} else {
%>
private final java.util.Map<String, Long> start_Hash = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Long>());
private final java.util.Map<String, Long> end_Hash = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Long>());
private final java.util.Map<String, Boolean> ok_Hash = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Boolean>());
private final java.util.Map<String, Object> globalMap = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Object>());
public final java.util.List<String[]> globalBuffer = java.util.Collections.synchronizedList(new java.util.ArrayList<String[]>());
<% } %>
<%
if (stats) {
@@ -374,11 +359,6 @@ private class TalendException extends java.lang.Exception {
private java.util.Map<String, Object> globalMap = null;
private java.lang.Exception e = null;
private String currentComponent = null;
private String virtualComponentName = null;
public void setVirtualComponentName (String virtualComponentName){
this.virtualComponentName = virtualComponentName;
}
private TalendException(java.lang.Exception e, String errorComponent, final java.util.Map<String, Object> globalMap) {
this.currentComponent= errorComponent;
@@ -394,32 +374,10 @@ private class TalendException extends java.lang.Exception {
return this.currentComponent;
}
<%//For TDI-27789%>
public String getExceptionCauseMessage(java.lang.Exception e){
Throwable cause = e;
String message = null;
int i = 10;
while (null != cause && 0 < i--) {
message = cause.getMessage();
if (null == message) {
cause = cause.getCause();
} else {
break;
}
}
if (null == message) {
message = e.getClass().getName();
}
return message;
}
@Override
public void printStackTrace() {
if (!(e instanceof TalendException || e instanceof TDieException)) {
if(virtualComponentName!=null && currentComponent.indexOf(virtualComponentName+"_")==0){
globalMap.put(virtualComponentName+"_ERROR_MESSAGE",getExceptionCauseMessage(e));
}
globalMap.put(currentComponent+"_ERROR_MESSAGE",getExceptionCauseMessage(e));
globalMap.put(currentComponent+"_ERROR_MESSAGE",e.getMessage());
System.err.println("Exception in component " + currentComponent);
}
if (!(e instanceof TDieException)) {
@@ -535,6 +493,17 @@ private class TalendException extends java.lang.Exception {
}
}
%>
} else {
<%
if (isRunInMultiThread ) {
%>
((java.util.Map)threadLocal.get()).put("status", "failure");
<%
} else {%>
status = "failure";
<%
}
%>
}
}
}

View File

@@ -297,7 +297,7 @@ for (INode node : graphicalNodes) {
}
}
String delay = ElementParameterParser.getValue(node, "__DELAY__");
if(delay!=null && !delay.trim().equals("")){
if(delay!=null && !delay.trim().equals("") && !"1000".equals(delay)){
if(sb.length()==0){
sb.append("+\"?delay=\"+");
sb.append(delay);

View File

@@ -12,20 +12,16 @@
org.talend.designer.codegen.config.NodesSubTree
org.talend.core.model.utils.NodeUtil
java.util.List
java.util.Set
java.util.Set
java.util.HashSet
java.util.Iterator
java.util.Vector
"
class="IterateSubProcessFooter"
skeleton="subprocess_header_java.skeleton"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
Vector v = (Vector) codeGenArgument.getArgument();
INode node = (INode) v.get(0);
String finallyPart = v.get(1).toString();
INode node = (INode)codeGenArgument.getArgument();
ECodePart codePart = codeGenArgument.getCodePart();
//boolean trace = codeGenArgument.isTrace();
boolean stat = codeGenArgument.isStatistics();
@@ -55,81 +51,57 @@
schemaInstanceDeclaration = "," + schemaInstanceDeclaration.substring(0,schemaInstanceDeclaration.length()-1);
}
if(stat){
%>
if(execStat){
runStat.updateStatOnConnection("<%=iterateConn.getUniqueName() %>",2,"exec"+iterateId);
}
<%
%>
if(execStat){
runStat.updateStatOnConnection("<%=iterateConn.getUniqueName() %>",2,"exec"+iterateId);
}
<%
}
%>
} catch (java.lang.Exception e) {
this.status = "failure";
Integer localErrorCode = (Integer) (((java.util.Map) threadLocal.get()).get("errorCode"));
if (localErrorCode != null) {
if (this.errorCode == null || localErrorCode.compareTo(this.errorCode) > 0) {
this.errorCode = localErrorCode;
}
}
TalendException te = new TalendException(e, currentComponent, globalMap);
<%
if(NodeUtil.hasVirtualComponent(subTree.getNodes())){
%>
te.setVirtualComponentName(currentVirtualComponent);
<%
}
%>
this.exception = te;
talendThreadPool.setErrorThread(this);
talendThreadPool.stopAllWorkers();
%>
} catch (java.lang.Exception e) {
this.status = "failure";
Integer localErrorCode = (Integer) (((java.util.Map) threadLocal.get()).get("errorCode"));
if (localErrorCode != null) {
if (this.errorCode == null || localErrorCode.compareTo(this.errorCode) > 0) {
this.errorCode = localErrorCode;
}
}
talendThreadPool.setErrorThread(this);
talendThreadPool.stopAllWorkers();
new TalendException(e, currentComponent, globalMap).printStackTrace();
}
this.isRunning = false;
Integer localErrorCode = (Integer) (((java.util.Map) threadLocal.get()).get("errorCode"));
String localStatus = (String) (((java.util.Map) threadLocal.get()).get("status"));
if (localErrorCode != null) {
if (this.errorCode == null || localErrorCode.compareTo(this.errorCode) > 0) {
this.errorCode = localErrorCode;
}
}
if (!this.status.equals("failure")) {
this.status = localStatus;
}
talendThreadPool.getTalendThreadResult().setErrorCode(this.errorCode);
talendThreadPool.getTalendThreadResult().setStatus(this.status);
}
}
<%=node.getUniqueName() %>Thread bt_<%=node.getUniqueName() %> = new <%=node.getUniqueName() %>Thread(globalMap<%=schemaInstanceDeclaration %>,threadIdCounter++);
mtp_<%=node.getUniqueName() %>.execute(bt_<%=node.getUniqueName() %>);
} finally {
try{
<%=finallyPart%>
}catch(java.lang.Exception e){
//ignore
}catch(java.lang.Error error){
//ignore
}
resourceMap = null;
}
this.isRunning = false;
Integer localErrorCode = (Integer) (((java.util.Map) threadLocal.get()).get("errorCode"));
String localStatus = (String) (((java.util.Map) threadLocal.get()).get("status"));
if (localErrorCode != null) {
if (this.errorCode == null || localErrorCode.compareTo(this.errorCode) > 0) {
this.errorCode = localErrorCode;
}
}
if (!this.status.equals("failure")) {
this.status = localStatus;
}
talendThreadPool.getTalendThreadResult().setErrorCode(this.errorCode);
talendThreadPool.getTalendThreadResult().setStatus(this.status);
}
}
<%=node.getUniqueName() %>Thread bt_<%=node.getUniqueName() %> = new <%=node.getUniqueName() %>Thread(globalMap<%=schemaInstanceDeclaration %>,threadIdCounter++);
mtp_<%=node.getUniqueName() %>.execute(bt_<%=node.getUniqueName() %>);
<%
<%
continue;
}else {//3
if(stat){
if(node.getDesignSubjobStartNode().getComponent().getName().equals("tCollector")){
%>
if(execStat){
runStat.updateStatOnIterate("<%=iterateConn.getUniqueName() %>", RunStat.END);
}
<%
}else{%>
if(execStat){
runStat.updateStatOnConnection("<%=iterateConn.getUniqueName() %>", 2, "exec" + NB_ITERATE_<%=iterateNodeName %>);
}
<%
}
%>
if(execStat){
runStat.updateStatOnConnection("<%=iterateConn.getUniqueName() %>", 2, "exec" + NB_ITERATE_<%=iterateNodeName %>);
}
<%
}
}//3
}//2

View File

@@ -50,10 +50,12 @@ params = process.getContextManager().getDefaultContext().getContextParameterList
List<IConnection> allSubProcessConnection = codeGenArgument.getAllMainSubTreeConnections();
boolean parallelIterate = false;
for (IConnection iterateConn : iterateConnSet) { //1
%>
NB_ITERATE_<%=iterateNodeName %>++;
iterateLoop++;
<%
<%
parallelIterate = "true".equals(ElementParameterParser.getValue(iterateConn, "__ENABLE_PARALLEL__"));
if (parallelIterate) {//2
if (codePart.equals(ECodePart.BEGIN)) {//3
@@ -62,176 +64,156 @@ for (IConnection iterateConn : iterateConnSet) { //1
rowList += conn.getUniqueName()+"Struct "+conn.getUniqueName()+",";
}
rowList = rowList.substring(0, rowList.length()-1);
%>
class <%=node.getUniqueName() %>Thread extends TalendThread {//implements routines.system.TalendThreadPool.PropertySettable
%>
class <%=node.getUniqueName() %>Thread extends TalendThread {//implements routines.system.TalendThreadPool.PropertySettable
class ThreadedMap extends java.util.HashMap<String, Object> {
class ThreadedMap extends java.util.HashMap<String, Object> {
private static final long serialVersionUID = 0L;
public ThreadedMap(java.util.Map<String, Object> globalMap) {
super(globalMap);
}
@Override
public Object put(String key, Object value) {
<%if(!isRunInMultiThread){%>
synchronized (<%=process.getName()%>.this.obj) {
<%}%>
super.put(key, value);
return <%=process.getName()%>.this.globalMap.put(key, value);
<%if(!isRunInMultiThread){%>
}
<%}%>
}
}
<% if(isRunJob) {%>
private final ContextProperties localContext = new ContextProperties();
<% } %>
private java.util.Map<String, Object> globalMap = null;
boolean isRunning = false;
String iterateId = "";
int iterateLoop = 0;
<%
if(!subTree.isMergeSubTree()) {
List< ? extends IConnection> rootConns = subTree.getRootNode().getOutgoingConnections();
if ((rootConns!=null)&&(rootConns.size()>0)) {
%>
<%=createPrivateClassInstance(subTree.getRootNode(), rootConns.get(0).getName(), false)%>
<%
}
} else {
List<INode> sortedMergeBranchStarts = subTree.getSortedMergeBranchStarts();
for (INode startNode : sortedMergeBranchStarts) {
List< ? extends IConnection> rootConns = startNode.getOutgoingConnections();
if ((rootConns!=null)&&(rootConns.size()>0)) {
%>
<%=createPrivateClassInstance(startNode, rootConns.get(0).getName(), false)%>
<%
}
private static final long serialVersionUID = 0L;
public ThreadedMap(java.util.Map<String, Object> globalMap) {
super(globalMap);
}
@Override
public Object put(String key, Object value) {
<%if(!isRunInMultiThread){%>
synchronized (<%=process.getName()%>.this.obj) {
<%}%>
super.put(key, value);
return <%=process.getName()%>.this.globalMap.put(key, value);
<%if(!isRunInMultiThread){%>
}
<%}%>
}
}
<% if(isRunJob) {%>
private final ContextProperties localContext = new ContextProperties();
<% } %>
private java.util.Map<String, Object> globalMap = null;
boolean isRunning = false;
String iterateId = "";
int iterateLoop = 0;
<%
if(!subTree.isMergeSubTree()) {
List< ? extends IConnection> rootConns = subTree.getRootNode().getOutgoingConnections();
if ((rootConns!=null)&&(rootConns.size()>0)) {
%>
<%=createPrivateClassInstance(subTree.getRootNode(), rootConns.get(0).getName(), false)%>
<%
}
} else {
List<INode> sortedMergeBranchStarts = subTree.getSortedMergeBranchStarts();
for (INode startNode : sortedMergeBranchStarts) {
List< ? extends IConnection> rootConns = startNode.getOutgoingConnections();
if ((rootConns!=null)&&(rootConns.size()>0)) {
%>
<%=createPrivateClassInstance(startNode, rootConns.get(0).getName(), false)%>
<%
}
}
List< ? extends IConnection> rootConns = subTree.getMergeNode().getOutgoingConnections();
if ((rootConns!=null)&&(rootConns.size()>0)) {
%>
<%=createPrivateClassInstance(subTree.getMergeNode(), rootConns.get(0).getName(), false)%>
<%
}
List< ? extends IConnection> rootConns = subTree.getMergeNode().getOutgoingConnections();
if ((rootConns!=null)&&(rootConns.size()>0)) {
%>
<%=createPrivateClassInstance(subTree.getMergeNode(), rootConns.get(0).getName(), false)%>
<%
}
}
String schemaInstanceDeclaration = createPriveClassMethodDeclaration(subTree.getRootNode(), subTree.getRootNode().getOutgoingConnections().get(0).getName(), false, new java.util.HashSet<String>());
if (schemaInstanceDeclaration.length()>0) {
schemaInstanceDeclaration = "," + schemaInstanceDeclaration.substring(0,schemaInstanceDeclaration.length()-1);
}
%>
String schemaInstanceDeclaration = createPriveClassMethodDeclaration(subTree.getRootNode(), subTree.getRootNode().getOutgoingConnections().get(0).getName(), false, new java.util.HashSet<String>());
if (schemaInstanceDeclaration.length()>0) {
schemaInstanceDeclaration = "," + schemaInstanceDeclaration.substring(0,schemaInstanceDeclaration.length()-1);
}
%>
public <%=node.getUniqueName() %>Thread(java.util.Map<String, Object> globalMap<%=schemaInstanceDeclaration %>, int threadID) {
super();
<%
for (IConnection connection : allSubProcessConnection) {
IMetadataTable table = connection.getMetadataTable();
%>
if(<%= connection.getName() %> != null){
<%
List<IMetadataColumn> listColumns = table.getListColumns();
for (IMetadataColumn column : listColumns) {
%>
this.<%= connection.getName() %>.<%= column.getLabel() %> = <%= connection.getName() %>.<%= column.getLabel() %>;
<%
}
%>
}
<%
}
%>
<%
// if codeGenArgument.getIsRunInMultiThread() is true, the job.this.globalMap will wrapped with synchronizedMap, use synchronized(job.this.globalMap) when use globalMap.keySet().iterator()
// when codeGenArgument.getIsRunInMultiThread() is false, the job.this.globalMap is HashMap, use synchronized(job.this.object) when do the job.this.globalMap.put() operation(tMap,tIterateToFlow).
if(isRunInMultiThread){%>
synchronized (globalMap) {
this.globalMap = java.util.Collections.synchronizedMap(new ThreadedMap(globalMap));
<%}else{%>
synchronized (<%=process.getName()%>.this.obj) {
this.globalMap = new ThreadedMap(globalMap);
<%}%>
}
iterateId = "." + threadID;
iterateLoop++;
<%if(isRunJob) {%>
//bug21906 copy context to local for mutilthread
context.synchronizeContext();
java.util.Enumeration<?> propertyNames = context.propertyNames();
while(propertyNames.hasMoreElements()) {
String propertyName = (String)propertyNames.nextElement();
String propertyValue = context.getProperty(propertyName);
localContext.setProperty(propertyName, propertyValue);
}
<% for (IContextParameter ctxParam : params){%>
localContext.<%=ctxParam.getName()%> = context.<%=ctxParam.getName()%>;
<%
}
}
%>
public <%=node.getUniqueName() %>Thread(java.util.Map<String, Object> globalMap<%=schemaInstanceDeclaration %>, int threadID) {
super();
<%
for (IConnection connection : allSubProcessConnection) {
IMetadataTable table = connection.getMetadataTable();
%>
if(<%= connection.getName() %> != null){
<%
List<IMetadataColumn> listColumns = table.getListColumns();
for (IMetadataColumn column : listColumns) {
%>this.<%= connection.getName() %>.<%= column.getLabel() %> = <%= connection.getName() %>.<%= column.getLabel() %>;
<%
}
%>
}
<%
}
%>
<%
// if codeGenArgument.getIsRunInMultiThread() is true, the job.this.globalMap will wrapped with synchronizedMap, use synchronized(job.this.globalMap) when use globalMap.keySet().iterator()
// when codeGenArgument.getIsRunInMultiThread() is false, the job.this.globalMap is HashMap, use synchronized(job.this.object) when do the job.this.globalMap.put() operation(tMap,tIterateToFlow).
if(isRunInMultiThread){%>
synchronized (globalMap) {
this.globalMap = java.util.Collections.synchronizedMap(new ThreadedMap(globalMap));
<%}else{%>
synchronized (<%=process.getName()%>.this.obj) {
this.globalMap = new ThreadedMap(globalMap);
<%}%>
}
iterateId = "." + threadID;
iterateLoop++;
<%if(isRunJob) {%>
//bug21906 copy context to local for mutilthread
context.synchronizeContext();
java.util.Enumeration<?> propertyNames = context.propertyNames();
while(propertyNames.hasMoreElements()) {
String propertyName = (String)propertyNames.nextElement();
String propertyValue = context.getProperty(propertyName);
localContext.setProperty(propertyName, propertyValue);
}
<% for (IContextParameter ctxParam : params){%>
localContext.<%=ctxParam.getName()%> = context.<%=ctxParam.getName()%>;
<% } %>
<% } %>
}
public void run() {
java.util.Map threadRunResultMap = new java.util.HashMap();
threadRunResultMap.put("errorCode", null);
threadRunResultMap.put("status", "");
threadLocal.set(threadRunResultMap);
this.isRunning = true;
String currentComponent = "";
java.util.Map<String, Object> resourceMap = new java.util.HashMap<String, Object>();
<%
if(NodeUtil.hasVirtualComponent(subTree.getNodes())){
%>
String currentVirtualComponent = null;
<%
}
%>
try {
<%
if(stat){
%>
if(execStat){
runStat.updateStatOnConnection("<%=iterateConn.getUniqueName() %>",0,"exec"+iterateId);
}
<%
}
}//3
continue;
}else {//2
if(stat){
//iterateConn.getSource().getVirtualLinkTo() only works on the first component of a virtual component, if it works for the second one, the code should change
boolean iterateInVComp = iterateConn.getSource().getVirtualLinkTo() != null && iterateConn.getSource().getVirtualLinkTo() == EConnectionType.ITERATE;
if(!iterateInVComp){
public void run() {
java.util.Map threadRunResultMap = new java.util.HashMap();
threadRunResultMap.put("errorCode", null);
threadRunResultMap.put("status", "");
threadLocal.set(threadRunResultMap);
this.isRunning = true;
String currentComponent = "";
try {
<%
if(stat){
%>
if(execStat){
runStat.updateStatOnConnection("<%=iterateConn.getUniqueName() %>",0,"exec"+iterateId);
}
<%
}
}//3
continue;
}else {//2
if(stat){
%>
<%
Set<? extends IConnection> allInLineJobConns = NodeUtil.getAllInLineJobConnections(iterateConn.getTarget());
for (IConnection inLineConn : allInLineJobConns) {
%>
if(execStat){
runStat.updateStatOnConnection("<%=inLineConn.getUniqueName() %>", 3, 0);
}
<%
}
}
if(node.getDesignSubjobStartNode().getComponent().getName().equals("tCollector")){
%>
if(execStat){
runStat.updateStatOnIterate("<%=iterateConn.getUniqueName() %>", RunStat.RUNNING);
}
<%
}else{
%>
if(execStat){
runStat.updateStatOnConnection("<%=iterateConn.getUniqueName() %>", 1, "exec" + NB_ITERATE_<%=iterateNodeName %>);
//Thread.sleep(1000);
}
<%
}
}
}//2
}//1
%>
if(execStat){
runStat.updateStatOnConnection("<%=inLineConn.getUniqueName() %>", 3, 0);
}
<%
}
%>
if(execStat){
runStat.updateStatOnConnection("<%=iterateConn.getUniqueName() %>", 1, "exec" + NB_ITERATE_<%=iterateNodeName %>);
//Thread.sleep(1000);
}
<%
}
}//2
}//1
%>

View File

@@ -0,0 +1,18 @@
<%@ jet
package="org.talend.designer.codegen.translators"
imports="
org.talend.core.model.process.IContextParameter
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
java.util.Properties
java.io.ByteArrayOutputStream
org.talend.core.model.utils.TalendTextUtils
org.talend.core.model.process.IProcess2
"
class="Context"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
IProcess2 p2 = (IProcess2) codeGenArgument.getArgument();
%>
<%=p2.getSpringContent() %>

View File

@@ -10,24 +10,21 @@
org.talend.core.model.process.ElementParameterParser
java.util.List
java.util.Iterator
java.util.Vector
org.talend.core.model.utils.NodeUtil
"
class="SubProcessFooter"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
Vector v = (Vector) codeGenArgument.getArgument();
NodesSubTree subTree = (NodesSubTree) v.get(0);
String finallyPart = v.get(1).toString();
boolean stat = codeGenArgument.isStatistics();
for(INode node : subTree.getNodes()){
NodesSubTree subTree = (NodesSubTree) codeGenArgument.getArgument();
for (INode node : subTree.getNodes()) {
List<IMetadataTable> metadatas = node.getMetadataList();
List< ? extends IConnection> conns = node.getOutgoingConnections();
}
boolean isParallelize = false;
for(INode node : subTree.getNodes()){
for (INode node : subTree.getNodes()) {
if(node!=null){
String parallelize = ElementParameterParser.getValue(node, "__PARALLELIZE__");
if(parallelize!=null &&parallelize.equals("true")){
@@ -37,7 +34,7 @@
}
}
if(isParallelize){
%>
%>
} catch (java.lang.Exception e) {
this.status = "failure";
@@ -50,15 +47,6 @@
pool.setErrorThread(this, new TalendException(e, currentComponent, globalMap));
//pool.setErrorThread(this,e);
pool.stopAllThreads();
}finally{
try{
<%=finallyPart%>
}catch(java.lang.Exception e){
//ignore
}catch(java.lang.Error error){
//ignore
}
resourceMap = null;
}
this.isRunning = false;
@@ -88,7 +76,7 @@
}
} else {
// Start a new thread
<%=subTree.getName()%>_ParallelThread pt = new <%=subTree.getName()%>_ParallelThread(
<%=subTree.getName() %>_ParallelThread pt = new <%=subTree.getName()%>_ParallelThread(
globalMap, (Object[]) globalMap
.get("PARALLEL_FLOW_LOCK_<%=(subTree.getName()).replaceAll("tAsyncIn", "tAsyncOut")%>"));
pt.putBuffer(buffer);
@@ -99,198 +87,199 @@
} catch (java.lang.Exception te) {
throw new TalendException(te, currentComponent, globalMap);
}
<%
<%
}else{
%>
}//end the resume
%>
<%
if(subTree.getRootNode().getProcess().getNodesOfType("tFlowMeterCatcher").size() > 0
&& subTree.getRootNode().getProcess().getNodesOfType("tFlowMeter").size() > 0){
List<INode> metterCatchers = (List<INode>)subTree.getRootNode().getProcess().getNodesOfType("tFlowMeterCatcher");
List<INode> metters = (List<INode>)subTree.getRootNode().getProcess().getNodesOfType("tFlowMeter");
List<INode> nodes = (List<INode>)subTree.getNodes();
boolean hasMetterProcess = false;
for(INode tmp : nodes){
for(INode metter : metters){
if(tmp.getUniqueName().equals(metter.getUniqueName())){
hasMetterProcess = true;
break;
}
}
if(hasMetterProcess){
break;
}
}
if(hasMetterProcess){
for(INode metterCatcher : metterCatchers){
%>
<%=metterCatcher.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
<%
}
}
}
//this part for "Resume Management"
<%
//this part for "Resume Management"
{
INode firstNode = subTree.getNode(subTree.getName());
List<String> beforeSubProcesses = subTree.getBeforeSubProcesses();
//System.out.println(firstNode.getUniqueName());
List<? extends IConnection> outConns = firstNode.getOutgoingConnections();
//System.out.println(inConns.size());
for(IConnection conn : outConns){
// boolean activeResume = "true".equals(ElementParameterParser.getValue(conn, "__RESUMING_CHECKPOINT__"));
boolean activeResume = true;
//System.out.println("Test:" + ElementParameterParser.getValue(conn, "__RESUMING_CHECKPOINT__"));
String uniqueNameTargetNode = conn.getTarget().getUniqueName();
EConnectionType lineStyle = conn.getLineStyle();
}
}
%>
}//end the resume
<%
//this part for "Resume Management"
{
INode firstNode = subTree.getNode(subTree.getName());
List<String> beforeSubProcesses = subTree.getBeforeSubProcesses();
//System.out.println(firstNode.getUniqueName());
List<? extends IConnection> outConns = firstNode.getOutgoingConnections();
//System.out.println(inConns.size());
for(IConnection conn : outConns){
// boolean activeResume = "true".equals(ElementParameterParser.getValue(conn, "__RESUMING_CHECKPOINT__"));
boolean activeResume = true;
//System.out.println("Test:" + ElementParameterParser.getValue(conn, "__RESUMING_CHECKPOINT__"));
String uniqueNameTargetNode = conn.getTarget().getUniqueName();
EConnectionType lineStyle = conn.getLineStyle();
if(beforeSubProcesses.indexOf(uniqueNameTargetNode) != -1) {
if(activeResume){
%>
if( resumeEntryMethodName == null || globalResumeTicket){
resumeUtil.addLog("CHECKPOINT", "CONNECTION:<%=lineStyle.getName() %>:<%=subTree.getName() %>:<%=conn.getName() %><%=conn.getOutputId() > 0 ? conn.getOutputId() : "" %>", "", Thread.currentThread().getId() + "", "", "", "", "", "");
}
<%
}
%>
<%
if(stat){
%>
if(execStat){
runStat.updateStatOnConnection("<%=conn.getUniqueName() %>", 0, "ok");
}
<%
}
%>
<%= uniqueNameTargetNode %>Process(globalMap);
<%
}
}
}
%>
<%
if (subTree.getRootNode().getProcess().getNodesOfType("tFlowMeterCatcher").size() > 0
&& subTree.getRootNode().getProcess().getNodesOfType("tFlowMeter").size() >0 ) {
List<INode> metterCatchers = (List<INode>)subTree.getRootNode().getProcess().getNodesOfType("tFlowMeterCatcher");
List<INode> metters = (List<INode>)subTree.getRootNode().getProcess().getNodesOfType("tFlowMeter");
List<INode> nodes = (List<INode>)subTree.getNodes();
boolean hasMetterProcess = false;
for(INode tmp : nodes)
{
for(INode metter : metters)
{
if(tmp.getUniqueName().equals(metter.getUniqueName()))
{
INode firstNode = subTree.getNode(subTree.getName());
List<String> beforeSubProcesses = subTree.getBeforeSubProcesses();
//System.out.println(firstNode.getUniqueName());
List<? extends IConnection> outConns = firstNode.getOutgoingConnections();
//System.out.println(inConns.size());
for(IConnection conn : outConns){
//boolean activeResume = "true".equals(ElementParameterParser.getValue(conn, "__RESUMING_CHECKPOINT__"));
boolean activeResume = true;
//System.out.println("Test:" + ElementParameterParser.getValue(conn, "__RESUMING_CHECKPOINT__"));
String uniqueNameTargetNode = conn.getTarget().getUniqueName();
EConnectionType lineStyle = conn.getLineStyle();
if(beforeSubProcesses.indexOf(uniqueNameTargetNode) != -1){
if(activeResume){
%>
if(resumeEntryMethodName == null || globalResumeTicket){
resumeUtil.addLog("CHECKPOINT", "CONNECTION:<%=lineStyle.getName() %>:<%=subTree.getName() %>:<%=conn.getName() %><%=conn.getOutputId() > 0 ? conn.getOutputId() : "" %>", "", Thread.currentThread().getId() + "", "", "", "", "", "");
}
<%
}
if(stat){
%>
if(execStat){
runStat.updateStatOnConnection("<%=conn.getUniqueName() %>", 0, "ok");
}
<%
}
%>
<%= uniqueNameTargetNode %>Process(globalMap);
<%
}
}
hasMetterProcess = true;
break;
}
%>
}
if(hasMetterProcess)
{
break;
}
}
if(hasMetterProcess)
{
for (INode metterCatcher : metterCatchers) {
%>
<%=metterCatcher.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
<%
}
}
}
%>
}catch(java.lang.Exception e){
} catch(java.lang.Exception e) {
TalendException te = new TalendException(e, currentComponent, globalMap);
<%
if(NodeUtil.hasVirtualComponent(subTree.getNodes())){
%>
te.setVirtualComponentName(currentVirtualComponent);
<%
}
for(INode node : subTree.getNodes()){
if(node!=null){
if("tDepartitioner".equals(node.getComponent().getName())){
String cid = node.getUniqueName();
%>
if(resourceMap.get("finish_<%=cid%>") == null){
if(resourceMap.get("start_<%=cid%>") != null){
globalMap.put("THREADS_HAVE_ERROR", e);
return;
}
}
<%
}
}
}
%>
throw te;
}catch(java.lang.Error error){
<%
if(stat){
%>
runStat.stopThreadStat();
<%
}
for(INode node : subTree.getNodes()){
if(node!=null){
if("tDepartitioner".equals(node.getComponent().getName())){
String cid = node.getUniqueName();
%>
if(resourceMap.get("finish_<%=cid%>") == null){
if(resourceMap.get("start_<%=cid%>") != null){
globalMap.put("THREADS_HAVE_ERROR",error);
return;
}
}
<%
}
}
}
%>
throw error;
}finally{
<%
//generate the code to free memory for lookup link and virtual component buffered datas
List<INode> nodes = subTree.getNodes();
for(INode node:nodes){
boolean isVirtualGenerateNode = node.isVirtualGenerateNode();
//check the virtual component generate node
if(isVirtualGenerateNode){
String origin = ElementParameterParser.getValue(node, "__ORIGIN__");
if(origin != null && !"".equals(origin)){
%>
//free memory for "<%=node.getUniqueName()%>"
globalMap.remove("<%=origin%>");
<%
}
}else{
//check the Lookup link
List<? extends IConnection> lookupInput = node.getIncomingConnections(EConnectionType.FLOW_REF);
if(lookupInput!=null && lookupInput.size()>0){
//check the tMap like this, instanceof can't work
if(node.getClass().getName().equals("org.talend.designer.mapper.MapperComponent")){
for(IConnection connection:lookupInput){
%>
//free memory for "<%=node.getUniqueName()%>"
globalMap.remove("tHash_Lookup_<%=connection.getName()%>");
<%
}
}else{
for(IConnection connection:lookupInput){
%>
//free memory for "<%=node.getUniqueName()%>"
globalMap.remove("tHash_<%=connection.getName()%>");
<%
}
}
}
}
}
%>
try{
<%=finallyPart%>
}catch(java.lang.Exception e){
//ignore
}catch(java.lang.Error error){
//ignore
}
resourceMap = null;
}
<%
}//isParallelize
%>
globalMap.put("<%=subTree.getName() %>_SUBPROCESS_STATE", 1);
throw new TalendException(e, currentComponent, globalMap);
} catch(java.lang.Error error) {
<%
if(stat){
%>
runStat.stopThreadStat();
<%
}
<%
if(subTree.isMethodSizeNeeded()){
%>
throw new java.lang.Error(error);
}
<%
//generate the code to free memory for lookup link and virtual component buffered datas
boolean firstIn = true;
boolean needGc = false;
List<INode> nodes = subTree.getNodes();
for(INode node:nodes){
boolean isVirtualGenerateNode = node.isVirtualGenerateNode();
//check the virtual component generate node
if(isVirtualGenerateNode){
String origin = ElementParameterParser.getValue(node, "__ORIGIN__");
if(origin != null && !"".equals(origin)){
if(!needGc) needGc = true;
%>
/**
* End of Function: <%=subTree.getName() %>Process
*/
<%
}
%>
<%if(firstIn){%> finally{ <% firstIn = false;}%>
//free memory for "<%=node.getUniqueName() %>"
globalMap.remove("<%=origin %>");
<%
}
}else{
//check the Lookup link
List<? extends IConnection> lookupInput = node.getIncomingConnections(EConnectionType.FLOW_REF);
if(lookupInput!=null && lookupInput.size()>0){
if(!needGc) needGc = true;
//check the tMap like this, instanceof can't work
if(node.getClass().getName().equals("org.talend.designer.mapper.MapperComponent")){
for(IConnection connection:lookupInput){
%>
<%if(firstIn){%> finally{ <% firstIn = false;}%>
//free memory for "<%=node.getUniqueName() %>"
globalMap.remove("tHash_Lookup_<%=connection.getName() %>");
<%
}
}else{
for(IConnection connection:lookupInput){
%>
<%if(firstIn){%> finally{ <% firstIn = false;}%>
//free memory for "<%=node.getUniqueName() %>"
globalMap.remove("tHash_<%=connection.getName() %>");
<%
}
}
}
}
}
if(needGc) {
%>
}
<%
}
}//isParallelize
%>
globalMap.put("<%=subTree.getName() %>_SUBPROCESS_STATE", 1);
}
<% if (subTree.isMethodSizeNeeded()){ %>
/**
* End of Function: <%=subTree.getName() %>Process
*/
<% } %>

View File

@@ -1003,32 +1003,16 @@ public void <%=subTree.getName() %>Process(final java.util.Map<String, Object> g
this.isRunning = true;
String currentComponent = "";
java.util.Map<String, Object> resourceMap = new java.util.HashMap<String, Object>();
try{
<%
}else{//isParallelize
if(NodeUtil.hasVirtualComponent(subTree.getNodes())){
%>
String currentVirtualComponent = null;
<%
}
%>
<%
if(subTree.getRootNode().getComponent().getName().equals("tCollector")){
%>
String iterateId = "." + globalMap.get("<%=subTree.getRootNode().getDesignSubjobStartNode().getUniqueName()%>_THREAD_ID");
<%
}else{
%>
String iterateId = "";
<%
}
%>
String iterateId = "";
int iterateLoop = 0;
String currentComponent = "";
java.util.Map<String, Object> resourceMap = new java.util.HashMap<String, Object>();
try {
String currentMethodName = new java.lang.Exception().getStackTrace()[0].getMethodName();

View File

@@ -31,7 +31,6 @@ import org.talend.core.language.ECodeLanguage;
import org.talend.core.model.components.IComponentFileNaming;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.IConnectionCategory;
import org.talend.core.model.process.IContext;
@@ -206,7 +205,6 @@ public class CodeGenerator implements ICodeGenerator {
* @return the generated code
* @throws CodeGeneratorException if an error occurs during Code Generation
*/
@Override
@SuppressWarnings("unchecked")
public String generateProcessCode() throws CodeGeneratorException {
// Parse Process, generate Code for Individual Components
@@ -275,12 +273,14 @@ public class CodeGenerator implements ICodeGenerator {
// Fix bug TESB-2951 Generated Codes error when Route
// starts with cFile/cFTP/cActiveMQ/cFTP/cJMS
// LiXiaopeng 2011-09-05
INode subProcessStartNode = subTree.getRootNode().getSubProcessStartNode(true);
String startNodeName = subProcessStartNode.getComponent().getName();
IElementParameter family = subProcessStartNode.getElementParameter("FAMILY");
if (subProcessStartNode.isStart() && null != family && "Messaging".equals(family.getValue())) {
INode subProcessStartNode = subTree.getRootNode()
.getSubProcessStartNode(true);
String startNodeName = subProcessStartNode
.getComponent().getName();
IElementParameter family = subProcessStartNode.getElementParameter("FAMILY");
if(subProcessStartNode.isStart() && null != family && "Messaging".equals(family.getValue())){
nodeSubTreeList.add(subTree);
} else if ("cConfig".equals(startNodeName)) {
} else if ("cConfig".equals(startNodeName)) {
// Customized remove the cConfig routeId codes.
// TESB-2825 LiXP 20110823
// Do nothing.
@@ -327,15 +327,8 @@ public class CodeGenerator implements ICodeGenerator {
componentsCode.append(generateTypedComponentCode(EInternalTemplate.PART_ENDMAIN,
subTree.getRootNode()));
componentsCode.append(generateComponentsCode(subTree, subTree.getRootNode(), ECodePart.END, null));
StringBuffer finallyPart = new StringBuffer();
finallyPart.append(generateComponentsCode(subTree, subTree.getRootNode(), ECodePart.FINALLY, null));
Vector subprocess_footerArgument = new Vector(2);
subprocess_footerArgument.add(subTree);
subprocess_footerArgument.add(finallyPart.toString());
componentsCode.append(generateTypedComponentCode(EInternalTemplate.SUBPROCESS_FOOTER,
subprocess_footerArgument));
componentsCode.append(generateTypedComponentCode(EInternalTemplate.SUBPROCESS_FOOTER, subTree));
} else {
StringBuffer finallyPart = new StringBuffer();
componentsCode.append(generateTypedComponentCode(EInternalTemplate.SUBPROCESS_HEADER, subTree));
componentsCode.append(generateComponentsCode(subTree, subTree.getMergeNode(), ECodePart.BEGIN, null));
@@ -348,17 +341,13 @@ public class CodeGenerator implements ICodeGenerator {
subTree.getRootNode()));
componentsCode.append(generateComponentsCode(subTree, startNode, ECodePart.END, null));
finallyPart.append(generateComponentsCode(subTree, startNode, ECodePart.FINALLY, null));
}
componentsCode.append(generateComponentsCode(subTree, subTree.getMergeNode(), ECodePart.END, null));
finallyPart.append(generateComponentsCode(subTree, subTree.getMergeNode(), ECodePart.FINALLY, null));
Vector subprocess_footerArgument = new Vector(2);
subprocess_footerArgument.add(subTree);
subprocess_footerArgument.add(finallyPart.toString());
componentsCode.append(generateTypedComponentCode(EInternalTemplate.SUBPROCESS_FOOTER,
subprocess_footerArgument));
componentsCode.append(generateTypedComponentCode(EInternalTemplate.SUBPROCESS_FOOTER, subTree));
}
}
}
}
@@ -366,11 +355,10 @@ public class CodeGenerator implements ICodeGenerator {
Vector footerArgument = new Vector(2);
footerArgument.add(process);
footerArgument.add(processTree.getRootNodes());
if (isCamel) {
if (isCamel)
componentsCode.append(generateTypedComponentCode(EInternalTemplate.FOOTER_ROUTE, footerArgument));
} else {
else
componentsCode.append(generateTypedComponentCode(EInternalTemplate.FOOTER, footerArgument));
}
componentsCode.append(generateTypedComponentCode(EInternalTemplate.PROCESSINFO, componentsCode.length()));
// ####
return componentsCode.toString();
@@ -416,7 +404,6 @@ public class CodeGenerator implements ICodeGenerator {
* @return the generated code
* @throws CodeGeneratorException if an error occurs during Code Generation
*/
@Override
public String generateContextCode(IContext designerContext) throws CodeGeneratorException {
if (process != null) {
if (designerContext == null) {
@@ -457,22 +444,42 @@ public class CodeGenerator implements ICodeGenerator {
}
return ""; //$NON-NLS-1$
}
/*
* ADDED for TESB-7887 By GangLiu(non-Javadoc)
*
* @see org.talend.designer.codegen.ICodeGenerator#generateSpringContent()
*/
@Override
public String generateSpringContent() throws CodeGeneratorException {
if (process == null || !(process instanceof IProcess2)) {
return null;
}
IProcess2 process2 = (IProcess2) process;
if (!process2.needsSpring() || process2.getSpringContent() == null) {
return null;
}
return process2.getSpringContent();
if (process == null || !( process instanceof IProcess2) ){
return null;
}
IProcess2 process2 = (IProcess2) process;
if(!process2.needsSpring() || process2.getSpringContent() == null){
return null;
}
CodeGeneratorArgument codeGenArgument = new CodeGeneratorArgument();
codeGenArgument.setJobName(jobName);
codeGenArgument.setJobVersion(jobVersion);
codeGenArgument.setNode(process);
codeGenArgument.setIsRunInMultiThread(getRunInMultiThread());
codeGenArgument.setPauseTime(CorePlugin.getDefault().getRunProcessService().getPauseTime());
JetBean jetBean = initializeJetBean(codeGenArgument);
jetBean.setTemplateRelativeUri(TemplateUtil.RESOURCES_DIRECTORY + TemplateUtil.DIR_SEP
+ EInternalTemplate.SPRING + TemplateUtil.EXT_SEP + language.getExtension() + TemplateUtil.TEMPLATE_EXT);
JetProxy proxy = new JetProxy(jetBean);
try {
return proxy.generate();
} catch (JETException e) {
log.error(e.getMessage(), e);
throw new CodeGeneratorException(e);
} catch (CoreException e) {
log.error(e.getMessage(), e);
throw new CodeGeneratorException(e);
}
}
/**
@@ -642,16 +649,8 @@ public class CodeGenerator implements ICodeGenerator {
codeComponent.append(generateComponentCode(subProcess, node, ECodePart.END, incomingName, typeGen));
codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.END, typeGen));
StringBuffer finallyPart = new StringBuffer();
// if iterate with parallel
finallyPart.append(generateComponentsCode(subProcess, node, ECodePart.FINALLY, incomingName, typeGen));
Vector iterate_Argument = new Vector(2);
iterate_Argument.add(node);
iterate_Argument.add(finallyPart.toString());
codeComponent.append(generateTypedComponentCode(EInternalTemplate.ITERATE_SUBPROCESS_FOOTER,
iterate_Argument, ECodePart.END, incomingName, subProcess));
codeComponent.append(generateTypedComponentCode(EInternalTemplate.ITERATE_SUBPROCESS_FOOTER, node,
ECodePart.END, incomingName, subProcess));
} else {
if (ETypeGen.CAMEL == typeGen) {
if (node.getIncomingConnections() != null && node.getIncomingConnections().size() > 0) {
@@ -662,28 +661,32 @@ public class CodeGenerator implements ICodeGenerator {
}
codeComponent.append(generateComponentCode(subProcess, node, ECodePart.MAIN, incomingName, typeGen));
if (ETypeGen.CAMEL == typeGen) {
if (node.getIncomingConnections().size() < 1 && node.isStart()) {
// http://jira.talendforge.org/browse/TESB-4086 XiaopengLi
String label = null;
IElementParameter parameter = node.getElementParameter("LABEL");
if (parameter != null && !"__UNIQUE_NAME__".equals(parameter.getValue())) {
label = (String) parameter.getValue();
}
if (node.getIncomingConnections().size() < 1 && node.isStart()){
// http://jira.talendforge.org/browse/TESB-4086 XiaopengLi
String label = null;
IElementParameter parameter = node
.getElementParameter("LABEL");
if (parameter != null
&& !"__UNIQUE_NAME__".equals(parameter
.getValue())) {
label = (String) parameter.getValue();
}
/*
* Fix https://jira.talendforge.org/browse/TESB-6685 label + uniqueName to make it unique
*/
if (label == null) {
label = node.getUniqueName();
} else {
label += "_" + node.getUniqueName();
}
if (!"cErrorHandler".equals(node.getComponent().getName())) {
codeComponent.append(".routeId(\"" + label + "\")");
}
} else {
codeComponent.append(".id(\"" + node.getUniqueName() + "\")");
}
/*
* Fix https://jira.talendforge.org/browse/TESB-6685
* label + uniqueName to make it unique
*/
if (label == null) {
label = node.getUniqueName();
}else{
label += "_"+node.getUniqueName();
}
if(!"cErrorHandler".equals(node.getComponent().getName())){
codeComponent.append(".routeId(\"" + label + "\")");
}
}else{
codeComponent.append(".id(\"" + node.getUniqueName() + "\")");
}
}
codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.MAIN, typeGen));
}
@@ -711,10 +714,6 @@ public class CodeGenerator implements ICodeGenerator {
// }
}
break;
case FINALLY:
codeComponent.append(generateComponentCode(subProcess, node, ECodePart.FINALLY, incomingName, typeGen));
codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.FINALLY, typeGen));
break;
default:
// do nothing
}
@@ -787,21 +786,24 @@ public class CodeGenerator implements ICodeGenerator {
}
if (ETypeGen.ETL == typeGen) {
for (IConnection connection : node.getOutgoingConnections()) {
/**
* fix for bug: TDI-8508 aim: change the order of end parts to be the opposite order of begin parts
*/
// for (IConnection connection : node.getOutgoingConnections()) {
for (int i = 0; i < node.getOutgoingConnections().size(); i++) {
if ((connection.getLineStyle() == EConnectionType.ITERATE) && (part != ECodePart.MAIN)
&& (part != ECodePart.FINALLY)) {
IConnection connection = null;
if (part == ECodePart.END) {
connection = node.getOutgoingConnections().get(node.getOutgoingConnections().size() - (i + 1));
} else {
connection = node.getOutgoingConnections().get(i);
}
if ((connection.getLineStyle() == EConnectionType.ITERATE) && (part != ECodePart.MAIN)) {
continue;
}
if ((connection.getLineStyle() == EConnectionType.ITERATE)
&& ("true".equals(ElementParameterParser.getValue(connection, "__ENABLE_PARALLEL__"))) //$NON-NLS-1$//$NON-NLS-2$
&& part == ECodePart.FINALLY) {
continue;
}
if ((connection.getLineStyle() == EConnectionType.ON_ROWS_END) && (part != ECodePart.END)
&& (part != ECodePart.FINALLY)) {
if ((connection.getLineStyle() == EConnectionType.ON_ROWS_END) && (part != ECodePart.END)) {
continue;
}
@@ -884,9 +886,8 @@ public class CodeGenerator implements ICodeGenerator {
StringBuffer content = new StringBuffer();
try {
if (typeGen == ETypeGen.ETL) {
if (typeGen == ETypeGen.ETL)
content.append(generateTypedComponentCode(EInternalTemplate.PART_HEADER, node, part, incomingName, subProcess));
}
IComponentFileNaming componentFileNaming = ComponentsFactoryProvider.getFileNamingInstance();
String templateURI = node.getComponent().getPathSource() + TemplateUtil.DIR_SEP + node.getComponent().getName()
@@ -896,9 +897,8 @@ public class CodeGenerator implements ICodeGenerator {
jetBean.setTemplateRelativeUri(templateURI);
JetProxy proxy = new JetProxy(jetBean);
content.append(proxy.generate());
if (typeGen == ETypeGen.ETL) {
if (typeGen == ETypeGen.ETL)
content.append(generateTypedComponentCode(EInternalTemplate.PART_FOOTER, node, part, incomingName, subProcess));
}
} catch (JETException jetException) {
log.error(jetException.getMessage(), jetException);
@@ -919,7 +919,6 @@ public class CodeGenerator implements ICodeGenerator {
* @return the generated code
* @throws CodeGeneratorException if an error occurs during Code Generation
*/
@Override
public String generateComponentCode(INode node, ECodePart part) throws CodeGeneratorException {
CodeGeneratorArgument argument = new CodeGeneratorArgument();
argument.setNode(node);
@@ -1003,7 +1002,6 @@ public class CodeGenerator implements ICodeGenerator {
* @see org.talend.designer.codegen.ICodeGenerator#generateComponentCodeWithRows (java.lang.String,
* java.lang.Object)
*/
@Override
public String generateComponentCodeWithRows(String nodeName, IAloneProcessNodeConfigurer nodeConfigurer) {
StringBuffer componentsCode = new StringBuffer();
@@ -1034,7 +1032,6 @@ public class CodeGenerator implements ICodeGenerator {
// nodeConfigurer.configure(subTreeNode);
// }
componentsCode.append(generateTypedComponentCode(EInternalTemplate.SUBPROCESS_HEADER, subTree));
StringBuffer finallyPart = new StringBuffer();
if (subTreeNode != null) {
if (!subTree.isMergeSubTree()) {
@@ -1054,8 +1051,6 @@ public class CodeGenerator implements ICodeGenerator {
// generateTypedComponentCode
// (EInternalTemplate.SUBPROCESS_FOOTER,
// subTree));
finallyPart
.append(generateComponentsCode(subTree, subTree.getRootNode(), ECodePart.FINALLY, null));
} else {
// componentsCode.append(
// generateTypedComponentCode
@@ -1070,8 +1065,6 @@ public class CodeGenerator implements ICodeGenerator {
componentsCode.append(generateComponentsCode(subTree, startNode, ECodePart.MAIN, null));
componentsCode.append(generateComponentsCode(subTree, startNode, ECodePart.END, null));
finallyPart.append(generateComponentsCode(subTree, startNode, ECodePart.FINALLY, null));
}
componentsCode.append(generateTypedComponentCode(EInternalTemplate.PART_ENDMAIN,
@@ -1080,20 +1073,13 @@ public class CodeGenerator implements ICodeGenerator {
componentsCode
.append(generateComponentsCode(subTree, subTree.getMergeNode(), ECodePart.END, null));
finallyPart.append(generateComponentsCode(subTree, subTree.getMergeNode(), ECodePart.FINALLY,
null));
// componentsCode.append(
// generateTypedComponentCode
// (EInternalTemplate.SUBPROCESS_FOOTER,
// subTree));
}
}
Vector subprocess_footerArgument = new Vector(2);
subprocess_footerArgument.add(subTree);
subprocess_footerArgument.add(finallyPart.toString());
componentsCode.append(generateTypedComponentCode(EInternalTemplate.SUBPROCESS_FOOTER,
subprocess_footerArgument));
componentsCode.append(generateTypedComponentCode(EInternalTemplate.SUBPROCESS_FOOTER, subTree));
}
Vector footerArgument = new Vector(2);
footerArgument.add(process);
@@ -1129,7 +1115,6 @@ public class CodeGenerator implements ICodeGenerator {
return null;
}
@Override
public void setContextName(String contextName) {
this.contextName = contextName;
}

View File

@@ -13,21 +13,17 @@
package org.talend.designer.codegen;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.ui.runtime.CommonUIPlugin;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.components.ComponentCompilations;
import org.talend.core.model.process.Element;
import org.talend.core.model.process.IProcess;
import org.talend.designer.codegen.i18n.Messages;
import org.talend.designer.codegen.model.CodeGeneratorEmittersPoolFactory;
import org.talend.designer.core.ICamelDesignerCoreService;
import org.talend.designer.core.IDesignerCoreService;
import org.talend.designer.core.ui.views.properties.IComponentSettingsView;
import org.talend.repository.model.ComponentsFactoryProvider;
/**
@@ -141,33 +137,18 @@ public class CodeGeneratorService implements ICodeGeneratorService {
*/
@Override
public Job refreshTemplates() {
Element oldComponent = null;
IComponentSettingsView viewer = null;
if (!CommonUIPlugin.isFullyHeadless()) {
// TDI-25866:In case select a component and sctrl+shift+f3,need clean its componentSetting view
viewer = (IComponentSettingsView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.findView(IComponentSettingsView.ID);
if (viewer != null) {
oldComponent = viewer.getElement();
viewer.cleanDisplay();
}
}
ComponentCompilations.deleteMarkers();
ComponentsFactoryProvider.getInstance().resetCache();
// this will force to refresh all components libs when install run ctrl+f3
ILibraryManagerService librairesManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(
ILibraryManagerService.class);
librairesManagerService.clearCache();
CorePlugin.getDefault().getLibrariesService().syncLibraries();
ComponentCompilations.deleteMarkers();
ComponentsFactoryProvider.getInstance().resetCache();
Job job = CodeGeneratorEmittersPoolFactory.initialize();
// achen modify to record ctrl+shift+f3 is pressed to fix bug 0006107
CorePlugin.getDefault().getLibrariesService().syncLibraries();
IDesignerCoreService designerCoreService = (IDesignerCoreService) GlobalServiceRegister.getDefault().getService(
IDesignerCoreService.class);
designerCoreService.getLastGeneratedJobsDateMap().clear();
if (oldComponent != null) {
viewer.setElement(oldComponent);
}
return job;
}
}

View File

@@ -77,14 +77,9 @@ public class JavaRoutineSynchronizer extends AbstractRoutineSynchronizer {
*/
@Override
public void syncAllRoutines() throws SystemException {
syncRoutineItems(getRoutines(),false);
syncRoutineItems(getRoutines());
}
@Override
public void syncAllRoutinesForLogOn() throws SystemException {
syncRoutineItems(getRoutines(),true);
}
/*
* (non-Javadoc)
*
@@ -92,18 +87,13 @@ public class JavaRoutineSynchronizer extends AbstractRoutineSynchronizer {
*/
@Override
public void syncAllPigudf() throws SystemException {
syncRoutineItems(getAllPigudf(),false);
}
@Override
public void syncAllPigudfForLogOn() throws SystemException {
syncRoutineItems(getAllPigudf(), true);
syncRoutineItems(getAllPigudf());
}
private void syncRoutineItems(List<IRepositoryViewObject> routineObjects,boolean forceUpdate) throws SystemException {
private void syncRoutineItems(List<IRepositoryViewObject> routineObjects) throws SystemException {
for (IRepositoryViewObject routine : routineObjects) {
RoutineItem routineItem = (RoutineItem) routine.getProperty().getItem();
syncRoutine(routineItem, true,forceUpdate);
syncRoutine(routineItem, true);
}
try {

View File

@@ -13,6 +13,12 @@
package org.talend.designer.codegen;
import org.eclipse.jface.action.Action;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.components.ComponentCompilations;
import org.talend.designer.codegen.model.CodeGeneratorEmittersPoolFactory;
import org.talend.designer.core.IDesignerCoreService;
import org.talend.repository.model.ComponentsFactoryProvider;
/**
* DOC mhirt class global comment. Detailled comment <br/>
@@ -34,8 +40,14 @@ public class RefreshTemplatesAction extends Action {
*/
@Override
public void run() {
CodeGeneratorService service = new CodeGeneratorService();
service.refreshTemplates();
ComponentCompilations.deleteMarkers();
ComponentsFactoryProvider.getInstance().resetCache();
CorePlugin.getDefault().getLibrariesService().syncLibraries();
CodeGeneratorEmittersPoolFactory.initialize();
// achen modify to record ctrl+shift+f3 is pressed to fix bug 0006107
IDesignerCoreService designerCoreService = (IDesignerCoreService) GlobalServiceRegister.getDefault().getService(
IDesignerCoreService.class);
designerCoreService.getLastGeneratedJobsDateMap().clear();
}
}

View File

@@ -27,6 +27,7 @@ import org.osgi.framework.Bundle;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.BusinessException;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.utils.io.SHA1Util;
import org.talend.commons.xml.XSDValidator;
import org.talend.core.model.ModelPlugin;
import org.talend.designer.core.model.components.ComponentFilesNaming;
@@ -48,14 +49,18 @@ public class ComponentFileChecker {
checkFiles(currentFolder, languageSuffix);
File xmlMainFile = new File(currentFolder, ComponentFilesNaming.getInstance().getMainXMLFileName(currentFolder.getName(),
languageSuffix));
XsdValidationCacheManager xsdValidationCacheManager = XsdValidationCacheManager.getInstance();
FileInputStream fis = null;
try {
fis = new FileInputStream(xmlMainFile);
String sha1 = SHA1Util.calculateFromTextStream(fis);
// do not check anymore XSD when be in headless mode.
// check is mainly usefull for GUI to be able to check why component is not loaded after be developped.
// if be in headless mode (like commandline), it's supposed to use only stable components
if (!CommonsPlugin.isHeadless()) {
if (!CommonsPlugin.isHeadless() && xsdValidationCacheManager.needCheck(xmlMainFile, sha1)) {
checkXSD(xmlMainFile);
xsdValidationCacheManager.setChecked(xmlMainFile, sha1);
}
} catch (FileNotFoundException e) {
ExceptionHandler.process(e);

View File

@@ -14,24 +14,28 @@ package org.talend.designer.codegen.components.model;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -49,14 +53,10 @@ import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.BusinessException;
import org.talend.commons.ui.runtime.CommonUIPlugin;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.utils.io.FilesUtils;
import org.talend.commons.utils.io.SHA1Util;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.context.Context;
import org.talend.core.context.RepositoryContext;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.component_cache.ComponentCachePackage;
import org.talend.core.model.component_cache.ComponentInfo;
@@ -69,6 +69,7 @@ import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.components.IComponentsHandler;
import org.talend.core.model.general.Project;
import org.talend.core.model.properties.ComponentSetting;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.core.ui.images.CoreImageProvider;
import org.talend.core.utils.TalendCacheUtils;
@@ -81,7 +82,14 @@ import org.talend.designer.core.model.components.ComponentFilesNaming;
import org.talend.designer.core.model.components.EmfComponent;
import org.talend.designer.core.model.components.manager.ComponentManager;
import org.talend.designer.core.model.process.AbstractProcessProvider;
import org.talend.repository.model.ComponentsFactoryProvider;
import org.talend.repository.ProjectManager;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/**
* Component factory that look for each component and load their information. <br/>
@@ -103,9 +111,9 @@ public class ComponentsFactory implements IComponentsFactory {
private static HashSet<IComponent> componentList = null;
private static HashSet<IComponent> customComponentList = null;
private static List<IComponent> customComponentList = null;
private HashSet<IComponent> userComponentList = null;
private List<IComponent> userComponentList = null;
private IProgressMonitor monitor;
@@ -119,6 +127,8 @@ public class ComponentsFactory implements IComponentsFactory {
private static Map<String, AbstractComponentsProvider> componentsAndProvider = new HashMap<String, AbstractComponentsProvider>();
private Map<String, String> allComponents;
// 1. only the in the directory /components ,not including /resource
// 2. include the skeleton files and external include files
private static ArrayList<String> skeletonList = null;
@@ -127,13 +137,119 @@ public class ComponentsFactory implements IComponentsFactory {
private static final String INCLUDEFILEINJET_SUFFIX = ".inc.javajet"; //$NON-NLS-1$
private static final String FAMILY_SPEARATOR = "--FAMILY--"; //$NON-NLS-1$
private boolean isCreated = false;
private boolean isReset = false;
private IComponentsHandler componentsHandler;// Added by Marvin Wang on Jan. 11, 2012 for M/R.
private static boolean cleanDone = false;
// public XmiResourceManager xmiResourceManager = new XmiResourceManager();
// this list of component is always needed, they must always be loaded at least, since they can be used for code
// generation indirectly.
// tFileInputFullRow + tSocketOutput : needed for DataViewer
private static final String[] COMPONENTS_ALWAYS_NEEDED = { "tPrejob", "tPostjob", //$NON-NLS-1$ //$NON-NLS-2$
"tJava", "tLibraryLoad", "tFileInputFullRow", "tSocketOutput", "tFilterRow", "tELTMysqlMap" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
public ComponentsFactory() {
if (!INCLUDEFILEINJET_SUFFIX.equals(".inc.javajet")) { //$NON-NLS-1$
ExceptionHandler.process(new IllegalStateException(Messages.getString("ComponentsFactory.parentNotRecompiled")), //$NON-NLS-1$
Priority.WARN);
}
}
private List<ComponentSetting> getComponentsFromProject() {
// TODO check components used from ref projects.
Project currentProject = ProjectManager.getInstance().getCurrentProject();
if (currentProject != null && currentProject.getEmfProject() != null) {
List<ComponentSetting> components = currentProject.getEmfProject().getComponentsSettings();
return components;
}
return Collections.emptyList();
}
private boolean isComponentVisible(String componentName) {
Boolean visible = Boolean.TRUE;
if (ArrayUtils.contains(COMPONENTS_ALWAYS_NEEDED, componentName)) {
return true;
}
List<ComponentSetting> settingsFromCompName = new ArrayList<ComponentSetting>();
// here we just check if the component is visible somewhere in the settings.
// if it's visible in any category, we will load the component
// if the component is unknown (new component?), we will load also
// (technical components will always loaded by default as they're not saved in componentSettings)
// to avoid any problem, we also load by default the category named "Technical".
for (ComponentSetting componentSetting : getComponentsFromProject()) {
String name = componentSetting.getName();
if (name != null && name.equals(componentName)) {
settingsFromCompName.add(componentSetting);
// if (componentSetting.isHidden()) {
// // hide component only if hidden in all projects
// if (manager.getReferencedProjects(manager.getCurrentProject()).size() > 0
// && isHiddenInRefProjects(componentName)) {
// visible = Boolean.FALSE;
// } else {
// visible = Boolean.TRUE;
// componentSetting.setHidden(false);
// }
// } else {
// return true;
// }
if ("Technical".equals(componentSetting.getFamily())) { //$NON-NLS-1$
return true;
}
}
}
// load components those visible in any category
int hideCount = 0;
for (ComponentSetting componentSetting : settingsFromCompName) {
if (componentSetting.isHidden()) {
// hide component only if hidden in all projects
if (isHiddenInRefProjects(componentSetting)) {
hideCount++;
} else {
visible = Boolean.TRUE;
componentSetting.setHidden(false);
}
} else {
visible = Boolean.TRUE;
}
}
if (settingsFromCompName.size() > 0 && hideCount == settingsFromCompName.size()) {
visible = Boolean.FALSE;
}
return visible;
}
private boolean isHiddenInRefProjects(ComponentSetting settingInMain) {
if (settingInMain == null) {
return false;
}
int hiddenCount = 0;
ProjectManager manager = ProjectManager.getInstance();
List<Project> referencedProjects = manager.getReferencedProjects();
for (Project curProject : referencedProjects) {
List<ComponentSetting> componentsSettings = curProject.getEmfProject().getComponentsSettings();
for (ComponentSetting setting : componentsSettings) {
if (setting.isHidden() && setting.getName().equals(settingInMain.getName())
&& setting.getFamily().equals(settingInMain.getFamily())) {
hiddenCount++;
}
}
}
if (hiddenCount == referencedProjects.size()) {
return true;
}
return false;
}
private void init(boolean duringLogon) {
@@ -143,74 +259,164 @@ public class ComponentsFactory implements IComponentsFactory {
// TimeMeasure.display = true;
// TimeMeasure.displaySteps = true;
// TimeMeasure.measureActive = true;
// TimeMeasure.begin("initComponents");
componentList = new HashSet<IComponent>();
customComponentList = new HashSet<IComponent>();
customComponentList = new ArrayList<IComponent>();
skeletonList = new ArrayList<String>();
userComponentList = new HashSet<IComponent>();
String installLocation = new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
componentToProviderMap = new HashMap<IComponent, AbstractComponentsProvider>();
boolean isNeedClean = !cleanDone && TalendCacheUtils.isSetCleanComponentCache();
cleanDone = true; // only check this parameter one time, or it will reinitialize things all the time...
boolean isNeedClean = TalendCacheUtils.cleanComponentCache();
isCreated = hasComponentFile(installLocation) && !isNeedClean;
ComponentsCache cache = ComponentManager.getComponentCache();
if (isReset) {
isCreated = false;
}
ComponentsCache cache = ComponentManager.getInstance();
try {
if (isCreated) {
// if cache is created and empty, means we never loaded it before.
// if it was already loaded, then no need to go again, since it's a static variable, it's still in
// memory.
// it avoids to reload from disk again even more for commandline at each logon, since it's no use.
if (cache.getComponentEntryMap().isEmpty()) {
ComponentsCache loadCache = loadComponentResource(installLocation);
cache.getComponentEntryMap().putAll(loadCache.getComponentEntryMap());
}
ComponentsCache loadCache = loadComponentResource(installLocation);
cache.getComponentEntryMap().putAll(loadCache.getComponentEntryMap());
} else {
cache.getComponentEntryMap().clear();
}
// check if any component is missing from any provider
// if yes, re-create the cache.
if (isCreated && isAnyComponentMissing()) {
cache.getComponentEntryMap().clear();
isCreated = false;
}
} catch (IOException e) {
ExceptionHandler.process(e);
cache.getComponentEntryMap().clear();
isCreated = false;
}
loadComponentsFromComponentsProviderExtension();
// 1.Load Component from extension point: components_provider
if (isCreated) {
try {
reloadComponentsFromCache();
} catch (Exception e) {
ExceptionHandler.process(e);
// if any exception happen, reset all cache
cache.getComponentEntryMap().clear();
isCreated = false;
}
}
if (!isCreated) {
loadComponentsFromComponentsProviderExtension();
}
// TimeMeasure.step("initComponents", "loadComponentsFromProvider");
// 2.Load Component from extension point: component_definition
loadComponentsFromExtensions();
// TimeMeasure.step("initComponents", "loadComponentsFromExtension[joblets?]");
ComponentManager.saveResource(); // will save only if needed.
// TimeMeasure.step("initComponents", "reloadFromCache");
if (!isCreated) {
XsdValidationCacheManager.getInstance().save();
ComponentManager.saveResource();
isReset = false;
}
// TimeMeasure.step("initComponents", "createCache");
log.debug(componentList.size() + " components loaded in " + (System.currentTimeMillis() - startTime) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
if (!duringLogon) {
// CorePlugin.getDefault().getRunProcessService().updateLibraries(new HashSet<String>(), null);
}
// TimeMeasure.step("initComponents", "updateLibraries");
// TimeMeasure.end("initComponents");
// TimeMeasure.display = false;
// TimeMeasure.displaySteps = false;
// TimeMeasure.measureActive = false;
}
if (!CommonUIPlugin.isFullyHeadless()) {
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(
Context.REPOSITORY_CONTEXT_KEY);
if (repositoryContext == null) {
return;
private boolean isAnyComponentMissing() throws IOException {
final Set<String> componentsList = ComponentManager.getInstance().getComponentEntryMap().keySet();
ECodeLanguage currentLanguage = LanguageManager.getCurrentLanguage();
final FileFilter fileFilter = new FileFilter() {
@Override
public boolean accept(final File file) {
return file.isDirectory() && file.getName().charAt(0) != '.'
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER)
&& isComponentVisible(file.getName());
}
Project project = repositoryContext.getProject();
if (project == null) {
return;
}
org.talend.core.model.properties.Project emfProject = project.getEmfProject();
if (emfProject == null) {
return;
}
EList list = emfProject.getComponentsSettings();
if (list.isEmpty()) {
ComponentsFactoryProvider.saveComponentVisibilityStatus();
};
for (AbstractComponentsProvider componentsProvider : ComponentsProviderManager.getInstance().getProviders()) {
File source = componentsProvider.getInstallationFolder();
if (source != null && source.exists()) {
for (File component : source.listFiles(fileFilter)) {
if (!componentsList.contains(component.getName())) {
String mainXmlFileName = ComponentFilesNaming.getInstance().getMainXMLFileName(component.getName(),
currentLanguage.getName());
File mainXmlFile = new File(component, mainXmlFileName);
if (mainXmlFile.exists()) {
return true;
}
// no xml file for this language, ignore it
}
}
}
}
return false;
}
/**
* DOC guanglong.du Comment method "reloadComponentsFromCache".
*
* @throws BusinessException
*/
private void reloadComponentsFromCache() throws BusinessException {
ComponentsCache cache = ComponentManager.getInstance();
Iterator it = cache.getComponentEntryMap().entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, EList<ComponentInfo>> entry = (Map.Entry<String, EList<ComponentInfo>>) it.next();
EList<ComponentInfo> infoList = entry.getValue();
String name = entry.getKey();
if (!isComponentVisible(name)) {
continue;
}
for (ComponentInfo info : infoList) {
IBrandingService service = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
String[] availableComponents = service.getBrandingConfiguration().getAvailableComponents();
EmfComponent currentComp = new EmfComponent(info.getUriString(), info.getSourceBundleName(), name,
info.getPathSource(), cache, true);
// if the component is not needed in the current branding,
// and that this one IS NOT a specific component for code generation
// just don't load it
if (availableComponents != null
&& !ArrayUtils.contains(availableComponents, currentComp.getName())
&& !(ArrayUtils.contains(COMPONENTS_ALWAYS_NEEDED, currentComp.getName())
|| currentComp.getOriginalFamilyName().contains("Technical") || currentComp.isTechnical())) { //$NON-NLS-1$
continue;
}
// if the component is not needed in the current branding,
// and that this one IS a specific component for code generation,
// hide it
if (availableComponents != null
&& !ArrayUtils.contains(availableComponents, currentComp.getName())
&& (ArrayUtils.contains(COMPONENTS_ALWAYS_NEEDED, currentComp.getName())
|| currentComp.getOriginalFamilyName().contains("Technical") || currentComp.isTechnical())) { //$NON-NLS-1$
currentComp.setVisible(false);
currentComp.setTechnical(true);
}
currentComp.setPaletteType(currentComp.getType());
if (!componentList.contains(currentComp)) {
currentComp.setResourceBundle(getComponentResourceBundle(currentComp,
ComponentBundleToPath.getPathFromBundle(info.getSourceBundleName()) + info.getUriString(),
info.getPathSource(), null));
componentList.add(currentComp);
}
}
}
}
/**
@@ -258,6 +464,15 @@ public class ComponentsFactory implements IComponentsFactory {
}
}
public void loadComponentsFromExtension(String id) {
ComponentsProviderManager componentsProviderManager = ComponentsProviderManager.getInstance();
for (AbstractComponentsProvider componentsProvider : componentsProviderManager.getProviders()) {
if (componentsProvider.getId() != null && componentsProvider.getId().equals(id)) {
loadComponents(componentsProvider);
}
}
}
private void loadComponents(AbstractComponentsProvider componentsProvider) {
if (componentsProvider != null) {
try {
@@ -278,8 +493,8 @@ public class ComponentsFactory implements IComponentsFactory {
ComponentsProviderManager componentsProviderManager = ComponentsProviderManager.getInstance();
AbstractComponentsProvider componentsProvider = componentsProviderManager.loadUserComponentsProvidersFromExtension();
// remove old user components
if (!this.userComponentList.isEmpty()) {
ComponentsCache cache = ComponentManager.getComponentCache();
if (this.userComponentList != null) {
ComponentsCache cache = ComponentManager.getInstance();
for (IComponent component : userComponentList) {
if (componentList != null && componentList.contains(component)) {
componentList.remove(component);
@@ -289,12 +504,13 @@ public class ComponentsFactory implements IComponentsFactory {
}
if (cache.getComponentEntryMap().get(component.getName()) != null) {
cache.getComponentEntryMap().remove(component.getName());
ComponentManager.setModified(true);
}
}
}
loadComponents(componentsProvider);
ComponentManager.saveResource();
if (!CommonsPlugin.isHeadless()) {
ComponentManager.saveResource();
}
}
private void removeOldComponentsUserFolder() {
@@ -314,6 +530,17 @@ public class ComponentsFactory implements IComponentsFactory {
}
private void loadComponentsFromFolder(String pathSource, AbstractComponentsProvider provider) {
if (pathSource != null) {
Path userComponent = new Path(pathSource);
Path templatePath = new Path(IComponentsFactory.COMPONENTS_INNER_FOLDER + File.separatorChar
+ IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER + File.separatorChar
+ ComponentUtilities.getExtFolder(OLD_COMPONENTS_USER_INNER_FOLDER));
if (userComponent.equals(templatePath)) {
this.userComponentList = new ArrayList<IComponent>();
}
}
boolean isCustom = false;
if ("org.talend.designer.components.model.UserComponentsProvider".equals(provider.getId())
|| "org.talend.designer.components.exchange.ExchangeComponentsProvider".equals(provider.getId())) {
@@ -334,7 +561,8 @@ public class ComponentsFactory implements IComponentsFactory {
@Override
public boolean accept(final File file) {
return file.isDirectory() && file.getName().charAt(0) != '.'
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER);
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER)
&& isComponentVisible(file.getName());
}
};
@@ -371,17 +599,19 @@ public class ComponentsFactory implements IComponentsFactory {
if (context == null) {
context = CodeGeneratorActivator.getDefault().getBundle().getBundleContext();
}
// if (Platform.getProduct() != null) {
// context = Platform.getProduct().getDefiningBundle().getBundleContext();
// } else {
// context = CodeGeneratorActivator.getDefault().getBundle().getBundleContext();
// }
// if (context == null) {
// context = Platform.getProduct().getDefiningBundle().getBundleContext();
// if (context == null)
// context = CodeGeneratorActivator.getDefault().getBundle().getBundleContext();
// }
ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
PackageAdmin admin = (PackageAdmin) context.getService(sref);
String bundleName;
if (!isCustom) {
bundleName = admin.getBundle(provider.getClass()).getSymbolicName();
} else {
bundleName = IComponentsFactory.COMPONENTS_LOCATION;
}
if (childDirectories != null) {
if (monitor != null) {
this.subMonitor = SubMonitor.convert(monitor,
@@ -399,63 +629,34 @@ public class ComponentsFactory implements IComponentsFactory {
}
try {
ComponentFileChecker.checkComponentFolder(currentFolder, getCodeLanguageSuffix());
File xmlMainFile = new File(currentFolder, ComponentFilesNaming.getInstance().getMainXMLFileName(
currentFolder.getName(), getCodeLanguageSuffix()));
if (!xmlMainFile.exists()) {
// if not a component folder, ignore it.
continue;
}
String currentXmlSha1 = null;
try {
currentXmlSha1 = SHA1Util.calculateFromTextStream(new FileInputStream(xmlMainFile));
} catch (FileNotFoundException e) {
// nothing since exceptions are directly in the check bellow
}
// Need to check if this component is already in the cache or not.
// if yes, then we compare the sha1... and if different we reload the component
// if component is not in the cache, of course just load it!
ComponentsCache cache = ComponentManager.getComponentCache();
boolean foundComponentIsSame = false;
ComponentInfo existingComponentInfoInCache = null;
if (cache.getComponentEntryMap().containsKey(currentFolder.getName())) {
EList<ComponentInfo> infos = cache.getComponentEntryMap().get(currentFolder.getName());
for (ComponentInfo info : infos) {
if (StringUtils.equals(bundleName, info.getSourceBundleName())) {
existingComponentInfoInCache = info;
if (StringUtils.equals(info.getSha1(), currentXmlSha1)) {
foundComponentIsSame = true;
}
break; // found component, no matter changed or not
}
}
}
if (foundComponentIsSame) {
// check if component is already loaded in memory, if yes it will only reload existing xml
// it should go here mainly for commandline or if use like ctrl+shift+f3
if (componentsCache.containsKey(xmlMainFile.getAbsolutePath())) {
IComponent componentFromThisProvider = null;
for (IComponent component : componentsCache.get(xmlMainFile.getAbsolutePath()).values()) {
if (component instanceof EmfComponent) {
if (bundleName.equals(((EmfComponent) component).getSourceBundleName())) {
componentFromThisProvider = component;
break;
}
}
}
if (componentFromThisProvider != null) {
// In headless mode, we assume the components won't change and we will use a cache
componentList.add(componentFromThisProvider);
if (isCustom) {
customComponentList.add(componentFromThisProvider);
}
continue;
}
}
}
if (!foundComponentIsSame) {
ComponentFileChecker.checkComponentFolder(currentFolder, getCodeLanguageSuffix());
}
String bundleName;
if (!isCustom) {
bundleName = admin.getBundle(provider.getClass()).getSymbolicName();
} else {
bundleName = IComponentsFactory.COMPONENTS_LOCATION;
}
if (CommonsPlugin.isHeadless() && componentsCache.containsKey(xmlMainFile.getAbsolutePath())) {
IComponent componentFromThisProvider = null;
for (IComponent component : componentsCache.get(xmlMainFile.getAbsolutePath()).values()) {
if (component instanceof EmfComponent) {
if (bundleName.equals(((EmfComponent) component).getSourceBundleName())) {
componentFromThisProvider = component;
}
}
}
if (componentFromThisProvider != null) {
// In headless mode, we assume the components won't change and we will use a cache
componentList.add(componentFromThisProvider);
if (isCustom) {
customComponentList.add(componentFromThisProvider);
}
continue;
}
}
String pathName = xmlMainFile.getAbsolutePath();
String applicationPath = ComponentBundleToPath.getPathFromBundle(bundleName);
@@ -463,41 +664,30 @@ public class ComponentsFactory implements IComponentsFactory {
// pathName = C:\myapp\plugins\myplugin\components\mycomponent\mycomponent.xml
pathName = (new Path(pathName)).toPortableString();
// pathName = C:/myapp/plugins/myplugin/components/mycomponent/mycomponent.xml
pathName = pathName.replace(applicationPath, ""); //$NON-NLS-1$
pathName = pathName.replace(applicationPath, "");
// pathName = /components/mycomponent/mycomponent.xml
// if not already in memory, just load the component from cache.
// if the component is already existing in cache and if it's the same, it won't reload all (cf
// flag: foundComponentIsSame)
EmfComponent currentComp = new EmfComponent(pathName, bundleName, xmlMainFile.getParentFile().getName(),
pathSource, cache, foundComponentIsSame);
if (!foundComponentIsSame) {
// force to call some functions to update the cache. (to improve)
currentComp.isVisibleInComponentDefinition();
currentComp.isTechnical();
currentComp.getOriginalFamilyName();
currentComp.getTranslatedFamilyName();
currentComp.getPluginExtension();
currentComp.getVersion();
currentComp.getModulesNeeded();
currentComp.getPluginDependencies();
// end of force cache update.
EList<ComponentInfo> componentsInfo = cache.getComponentEntryMap().get(currentFolder.getName());
for (ComponentInfo cInfo : componentsInfo) {
if (cInfo.getSourceBundleName().equals(bundleName)) {
cInfo.setSha1(currentXmlSha1);
break;
}
}
ComponentManager.setModified(true); // this will force to save the cache later.
}
pathSource, ComponentManager.getInstance(), isCreated);
// force to call some functions to update the cache. (to improve)
currentComp.isVisibleInComponentDefinition();
currentComp.isTechnical();
currentComp.getOriginalFamilyName();
currentComp.getTranslatedFamilyName();
currentComp.getPluginExtension();
currentComp.getVersion();
currentComp.getModulesNeeded();
currentComp.getPluginDependencies();
// end of force cache update.
// if the component is not needed in the current branding,
// and that this one IS NOT a specific component for code generation
// just don't load it
if (availableComponents != null && !ArrayUtils.contains(availableComponents, currentComp.getName())
&& !(currentComp.getOriginalFamilyName().contains("Technical") || currentComp.isTechnical())) {
if (availableComponents != null
&& !ArrayUtils.contains(availableComponents, currentComp.getName())
&& !(ArrayUtils.contains(COMPONENTS_ALWAYS_NEEDED, currentComp.getName())
|| currentComp.getOriginalFamilyName().contains("Technical") || currentComp.isTechnical())) {
continue;
}
@@ -506,8 +696,10 @@ public class ComponentsFactory implements IComponentsFactory {
// if the component is not needed in the current branding,
// and that this one IS a specific component for code generation,
// hide it
if (availableComponents != null && !ArrayUtils.contains(availableComponents, currentComp.getName())
&& (currentComp.getOriginalFamilyName().contains("Technical") || currentComp.isTechnical())) {
if (availableComponents != null
&& !ArrayUtils.contains(availableComponents, currentComp.getName())
&& (ArrayUtils.contains(COMPONENTS_ALWAYS_NEEDED, currentComp.getName())
|| currentComp.getOriginalFamilyName().contains("Technical") || currentComp.isTechnical())) {
currentComp.setVisible(false);
currentComp.setTechnical(true);
}
@@ -537,13 +729,13 @@ public class ComponentsFactory implements IComponentsFactory {
}
}
// componentsCache only used bellow in case of headless (commandline) or if use like
// ctrl+shift+f3
String componentName = xmlMainFile.getAbsolutePath();
if (!componentsCache.containsKey(componentName)) {
componentsCache.put(componentName, new HashMap<String, IComponent>());
if (CommonsPlugin.isHeadless()) {
String componentName = xmlMainFile.getAbsolutePath();
if (!componentsCache.containsKey(componentName)) {
componentsCache.put(componentName, new HashMap<String, IComponent>());
}
componentsCache.get(xmlMainFile.getAbsolutePath()).put(currentComp.getPaletteType(), currentComp);
}
componentsCache.get(xmlMainFile.getAbsolutePath()).put(currentComp.getPaletteType(), currentComp);
} catch (MissingMainXMLComponentFileException e) {
log.trace(currentFolder.getName() + " is not a " + getCodeLanguageSuffix() + " component", e); //$NON-NLS-1$ //$NON-NLS-2$
} catch (BusinessException e) {
@@ -764,7 +956,25 @@ public class ComponentsFactory implements IComponentsFactory {
if (customComponentList == null) {
init(false);
}
return new ArrayList<IComponent>(customComponentList);
return customComponentList;
}
/*
* (non-Javadoc)
*
* @see org.talend.core.model.components.IComponentsFactory#getComponentPath()
*/
@Override
public URL getComponentPath() throws IOException {
String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
if (breaningService.isPoweredOnlyCamel()) {
componentsPath = IComponentsFactory.CAMEL_COMPONENTS_LOCATION;
}
Bundle b = Platform.getBundle(componentsPath);
URL url = FileLocator.toFileURL(FileLocator.find(b, new Path(IComponentsFactory.COMPONENTS_INNER_FOLDER), null));
return url;
}
/*
@@ -785,6 +995,7 @@ public class ComponentsFactory implements IComponentsFactory {
componentList = null;
skeletonList = null;
customComponentList = null;
allComponents = null;
}
@@ -793,6 +1004,8 @@ public class ComponentsFactory implements IComponentsFactory {
componentList = null;
skeletonList = null;
customComponentList = null;
allComponents = null;
isReset = true;
if (!CommonsPlugin.isHeadless()) {
CoreImageProvider.clearComponentIconImages();
}
@@ -830,6 +1043,150 @@ public class ComponentsFactory implements IComponentsFactory {
return translated;
}
/*
* (non-Javadoc)
*
* @see org.talend.core.model.components.IComponentsFactory#getAllComponentsCanBeProvided()
*/
@Override
public Map<String, String> getAllComponentsCanBeProvided() {
List source = new ArrayList();
if (allComponents == null) {
allComponents = new HashMap<String, String>();
source.add(IComponentsFactory.COMPONENTS_INNER_FOLDER);
ComponentsProviderManager componentsProviderManager = ComponentsProviderManager.getInstance();
source.addAll(componentsProviderManager.getProviders());
for (int i = 0; i < source.size(); i++) {
String path = null;
AbstractComponentsProvider provider = null;
Object object = source.get(i);
if (object instanceof String) {
path = (String) object;
} else if (object instanceof AbstractComponentsProvider) {
provider = ((AbstractComponentsProvider) object);
path = provider.getComponentsLocation();
}
if (path != null) {
// **if the components is from provider,should get components from provider path,see bug TDI-18036
File sourceFile = getComponentsLocation(path, provider);
File[] childDirectories;
FileFilter fileFilter = new FileFilter() {
@Override
public boolean accept(final File file) {
return file.isDirectory() && file.getName().charAt(0) != '.'
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER);
}
};
if (sourceFile == null) {
ExceptionHandler.process(new Exception("Component Not Found")); //$NON-NLS-1$
continue;
}
childDirectories = sourceFile.listFiles(fileFilter);
if (childDirectories != null) {
for (File currentFolder : childDirectories) {
try {
ComponentFileChecker.checkComponentFolder(currentFolder, getCodeLanguageSuffix());
} catch (BusinessException e) {
continue;
}
File xmlMainFile = new File(currentFolder, ComponentFilesNaming.getInstance().getMainXMLFileName(
currentFolder.getName(), getCodeLanguageSuffix()));
List<String> families = getComponentsFamilyFromXML(xmlMainFile);
if (families != null) {
for (String family : families) {
allComponents.put(family + FAMILY_SPEARATOR + currentFolder.getName(),
currentFolder.getName() + "_32");
if (object instanceof AbstractComponentsProvider) {
if (!componentsAndProvider.containsKey(family)) {
componentsAndProvider.put(family, (AbstractComponentsProvider) object);
}
}
}
}
}
}
}
}
}
return allComponents;
}
private List<String> getComponentsFamilyFromXML(File xmlMainFile) {
final DocumentBuilderFactory fabrique = DocumentBuilderFactory.newInstance();
final String familysTag = "FAMILIES"; //$NON-NLS-1$
final String header = "HEADER"; //$NON-NLS-1$
final String technical = "TECHNICAL"; //$NON-NLS-1$
List<String> familyNames = new ArrayList<String>();
DocumentBuilder analyseur;
try {
analyseur = fabrique.newDocumentBuilder();
analyseur.setErrorHandler(new ErrorHandler() {
@Override
public void error(final SAXParseException exception) throws SAXException {
throw exception;
}
@Override
public void fatalError(final SAXParseException exception) throws SAXException {
throw exception;
}
@Override
public void warning(final SAXParseException exception) throws SAXException {
throw exception;
}
});
Document document = analyseur.parse(xmlMainFile);
NodeList elementsByTagName = document.getElementsByTagName(header);
String technicalValue = null;
if (elementsByTagName != null && elementsByTagName.getLength() > 0) {
Node item = elementsByTagName.item(0);
NamedNodeMap attributes = item.getAttributes();
if (attributes != null) {
Node namedItem = attributes.getNamedItem(technical);
if (namedItem != null) {
technicalValue = namedItem.getNodeValue();
}
}
}
// techenical node are not visible ,so no need to return it's family
if (technicalValue == null || !"true".equals(technicalValue)) { //$NON-NLS-1$
NodeList element = document.getElementsByTagName(familysTag);
if (element != null && element.getLength() > 0) {
Node family = element.item(0);
NodeList childNodes = family.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
final Node item = childNodes.item(i);
if (item instanceof com.sun.org.apache.xerces.internal.dom.DeferredElementImpl
|| item instanceof org.apache.xerces.dom.DeferredElementImpl) {
familyNames.add(item.getTextContent());
}
}
}
}
} catch (ParserConfigurationException e) {
ExceptionHandler.process(e);
} catch (SAXException e) {
ExceptionHandler.process(e);
} catch (IOException e) {
ExceptionHandler.process(e);
}
return familyNames;
}
/*
* (non-Javadoc)
*

View File

@@ -0,0 +1,166 @@
// ============================================================================
//
// Copyright (C) 2006-2013 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.designer.codegen.components.model;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.talend.designer.codegen.CodeGeneratorActivator;
import org.talend.designer.codegen.i18n.Messages;
/**
* tfeng class global comment. Detailled comment <br/>
*
* $Id: talend.epf 1 2006-09-29 17:06:40Z nrousseau $
*
*/
public class XsdValidationCacheManager {
private Map<String, String> alreadyCheckedXsd = new HashMap<String, String>();
private static XsdValidationCacheManager instance;
private XsdValidationCacheManager() {
}
public synchronized static XsdValidationCacheManager getInstance() {
if (instance == null) {
instance = new XsdValidationCacheManager();
instance.load();
}
return instance;
}
private void load() {
try {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(".JETEmitters"); //$NON-NLS-1$
if (project.exists()) {
deserializeAlreadyChecked();
}
} catch (Exception e) {
IStatus status = new Status(IStatus.WARNING, CodeGeneratorActivator.PLUGIN_ID,
Messages.getString("XsdValidationCacheManager.unableLoadxsd"), e); //$NON-NLS-1$
CodeGeneratorActivator.getDefault().getLog().log(status);
}
}
public void save() {
try {
serializeAlreadyChecked();
} catch (Exception e) {
IStatus status = new Status(IStatus.WARNING, CodeGeneratorActivator.PLUGIN_ID,
Messages.getString("XsdValidationCacheManager.unableSavexsd"), e); //$NON-NLS-1$
CodeGeneratorActivator.getDefault().getLog().log(status);
}
}
public boolean needCheck(java.io.File file, String sha1) {
String name = file.getName();
String oldName = alreadyCheckedXsd.get(sha1);
if (oldName == null) {
return true;
}
boolean isChanged = !StringUtils.equals(name, oldName);
return isChanged;
}
public void setChecked(File file, String sha1) {
String name = file.getName();
alreadyCheckedXsd.put(sha1, name);
}
private File getSerializationFilePath() throws CoreException {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(".JETEmitters"); //$NON-NLS-1$
if (!project.exists()) {
project.create(new NullProgressMonitor());
}
if (!project.isOpen()) {
project.open(new NullProgressMonitor());
}
IFile file = project.getFile("XsdValidationCache"); //$NON-NLS-1$
if (!file.exists()) {
file.create(null, true, new NullProgressMonitor());
}
return file.getLocation().toFile();
}
private void serializeAlreadyChecked() throws IOException, CoreException {
BufferedOutputStream bufferedOutputStream = null;
try {
bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(getSerializationFilePath()));
ObjectOutputStream objectOut = new ObjectOutputStream(bufferedOutputStream);
objectOut.writeObject(alreadyCheckedXsd);
} catch (IOException e) {
throw e;
} finally {
try {
bufferedOutputStream.close();
} catch (Exception e) {
// ignore me even if i'm null
}
}
}
@SuppressWarnings("unchecked")
private void deserializeAlreadyChecked() throws Exception {
alreadyCheckedXsd = new HashMap<String, String>();
File file = getSerializationFilePath();
if (!file.exists()) {
return;
}
BufferedInputStream bufferedInputStream = null;
try {
bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
ObjectInputStream objectIn = new ObjectInputStream(bufferedInputStream);
Object object = objectIn.readObject();
if (object instanceof Map) {
Map<?, ?> map = (Map<?, ?>) (object);
for (Map.Entry<?, ?> entry : map.entrySet()) {
String key = entry.getKey().toString();
Object value = entry.getValue();
if (value instanceof String) {
alreadyCheckedXsd.put(key, (String) value);
}
}
}
} catch (Exception e) {
throw e;
} finally {
try {
bufferedInputStream.close();
} catch (Exception e) {
// ignore me even if i'm null
}
}
}
}

View File

@@ -261,7 +261,7 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
public void modifyText(ModifyEvent e) {
String newPath = filePathTemp.getTextControl(parent).getText();
File file = new File(newPath);
if (!file.exists() && !"".equals(newPath)) {
if (!file.exists()) {
// getPreferenceStore().setValue(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER, "");
filePathTemp.showErrorMessage();
setValid(false);

View File

@@ -19,9 +19,6 @@ import org.eclipse.core.runtime.ProgressMonitorWrapper;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Display;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.commons.ui.runtime.CommonUIPlugin;
/**
* DOC mhirt class global comment. Detailled comment <br/>
@@ -63,7 +60,6 @@ public class CodeGeneratorProgressMonitor extends ProgressMonitorWrapper impleme
/**
* @see IProgressMonitor#beginTask
*/
@Override
public void beginTask(String name, int totalWork) {
super.beginTask(name, totalWork);
taskName = name;
@@ -75,28 +71,13 @@ public class CodeGeneratorProgressMonitor extends ProgressMonitorWrapper impleme
*
* @see org.eclipse.core.runtime.IProgressMonitorWithBlocking#clearBlocked()
*/
@Override
public void clearBlocked() {
// Run the event loop.
if (CommonUIPlugin.isFullyHeadless()) {
return;
}
final Display disp = DisplayUtils.getDisplay();
disp.syncExec(new Runnable() {
@Override
public void run() {
Dialog.getBlockedHandler().clearBlocked();
}
});
Dialog.getBlockedHandler().clearBlocked();
}
/**
* @see IProgressMonitor#done
*/
@Override
public void done() {
super.done();
taskName = null;
@@ -106,7 +87,6 @@ public class CodeGeneratorProgressMonitor extends ProgressMonitorWrapper impleme
/**
* @see IProgressMonitor#internalWorked
*/
@Override
public void internalWorked(double work) {
super.internalWorked(work);
runEventLoop();
@@ -115,7 +95,6 @@ public class CodeGeneratorProgressMonitor extends ProgressMonitorWrapper impleme
/**
* @see IProgressMonitor#isCanceled
*/
@Override
public boolean isCanceled() {
runEventLoop();
return super.isCanceled();
@@ -127,42 +106,33 @@ public class CodeGeneratorProgressMonitor extends ProgressMonitorWrapper impleme
private void runEventLoop() {
// Only run the event loop so often, as it is expensive on some platforms
// (namely Motif).
final long t = System.currentTimeMillis();
long t = System.currentTimeMillis();
if (t - lastTime < tTHRESH) {
return;
}
lastTime = t;
// Run the event loop.
if (CommonUIPlugin.isFullyHeadless()) {
return;
}
final Display disp = DisplayUtils.getDisplay();
Display disp = Display.getDefault();
if (disp == null) {
return;
}
disp.syncExec(new Runnable() {
@Override
public void run() {
for (;;) {
try {
if (!disp.readAndDispatch()) {
break;
}
} catch (SWTException se) {
// do nothing;
}
// Only run the event loop for so long.
// Otherwise, this would never return if some other thread was
// constantly generating events.
if (System.currentTimeMillis() - t > tMAX) {
break;
}
for (;;) {
try {
if (!disp.readAndDispatch()) {
break;
}
} catch (SWTException se) {
// do nothing;
}
});
// Only run the event loop for so long.
// Otherwise, this would never return if some other thread was
// constantly generating events.
if (System.currentTimeMillis() - t > tMAX) {
break;
}
}
}
/*
@@ -170,29 +140,13 @@ public class CodeGeneratorProgressMonitor extends ProgressMonitorWrapper impleme
*
* @see org.eclipse.core.runtime.IProgressMonitorWithBlocking#setBlocked(org.eclipse.core.runtime.IStatus)
*/
@Override
public void setBlocked(final IStatus reason) {
// Run the event loop.
if (CommonUIPlugin.isFullyHeadless()) {
ExceptionHandler.process(reason.getException());
return;
}
final Display disp = DisplayUtils.getDisplay();
disp.syncExec(new Runnable() {
@Override
public void run() {
Dialog.getBlockedHandler().showBlocked(CodeGeneratorProgressMonitor.this, reason, taskName);
}
});
public void setBlocked(IStatus reason) {
Dialog.getBlockedHandler().showBlocked(this, reason, taskName);
}
/**
* @see IProgressMonitor#setCanceled
*/
@Override
public void setCanceled(boolean b) {
super.setCanceled(b);
taskName = null;
@@ -202,7 +156,6 @@ public class CodeGeneratorProgressMonitor extends ProgressMonitorWrapper impleme
/**
* @see IProgressMonitor#setTaskName
*/
@Override
public void setTaskName(String name) {
super.setTaskName(name);
taskName = name;
@@ -212,7 +165,6 @@ public class CodeGeneratorProgressMonitor extends ProgressMonitorWrapper impleme
/**
* @see IProgressMonitor#subTask
*/
@Override
public void subTask(String name) {
// Be prepared in case the first task was null
if (taskName == null) {
@@ -225,7 +177,6 @@ public class CodeGeneratorProgressMonitor extends ProgressMonitorWrapper impleme
/**
* @see IProgressMonitor#worked
*/
@Override
public void worked(int work) {
super.worked(work);
runEventLoop();

View File

@@ -12,6 +12,7 @@
// ============================================================================
package org.talend.designer.codegen.config;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
@@ -40,6 +41,8 @@ public class JetBean {
private String className = ""; //$NON-NLS-1$
private Method method = null;
private String version = null;
private String language = null;
@@ -52,8 +55,6 @@ public class JetBean {
private long crc = 0;
private String methodName;
/**
* Getter for crc.
*
@@ -292,6 +293,24 @@ public class JetBean {
this.loader = newloader;
}
/**
* Getter for method.
*
* @return the method
*/
public Method getMethod() {
return this.method;
}
/**
* Sets the method.
*
* @param method the method to set
*/
public void setMethod(Method method) {
this.method = method;
}
/**
* Getter for className.
*
@@ -372,26 +391,4 @@ public class JetBean {
this.family = family;
}
/**
* Getter for methodName.
*
* @return the methodName
*/
public String getMethodName() {
return this.methodName;
}
/**
* Sets the methodName.
*
* @param methodName the methodName to set
*/
public void setMethodName(String methodName) {
this.methodName = methodName;
}
public String getFullTemplatePath() {
return Platform.getPlugin(getJetPluginRepository()).getDescriptor().getInstallURL().toString() + getTemplateRelativeUri();
}
}

View File

@@ -19,7 +19,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.talend.core.model.process.AbstractNode;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.process.IConnection;
@@ -52,8 +51,6 @@ public class NodesSubTree {
HashMap<INode, Integer> visitedNodesEndCode;
HashMap<INode, Integer> visitedNodesFinallyCode;
private static final boolean DEBUG = false;
boolean isMergeSubTree = false;
@@ -66,10 +63,6 @@ public class NodesSubTree {
INode mergeNode;
boolean isRefSubTree = false;// for mr only
List<INode> refNodes; // for mr only
/* display size of method code in comment */
boolean methodSizeNeeded = false;
@@ -95,7 +88,6 @@ public class NodesSubTree {
this.visitedNodesMainCode = new HashMap<INode, Integer>();
this.visitedNodesBeginCode = new HashMap<INode, Integer>();
this.visitedNodesEndCode = new HashMap<INode, Integer>();
this.visitedNodesFinallyCode = new HashMap<INode, Integer>();
this.isMergeSubTree = node.isThereLinkWithMerge();
allMainSubTreeConnections = new ArrayList<IConnection>();
@@ -113,45 +105,17 @@ public class NodesSubTree {
}
}
public NodesSubTree(INode node, List<? extends INode> nodes, ETypeGen typeGen) {
if (typeGen == ETypeGen.CAMEL) {
this.rootNode = node;
this.name = node.getUniqueName();
this.nodes = new ArrayList<INode>();
this.visitedNodesMainCode = new HashMap<INode, Integer>();
allMainSubTreeConnections = new ArrayList<IConnection>();
this.rootNode = node;
this.name = node.getUniqueName();
this.nodes = new ArrayList<INode>();
this.visitedNodesMainCode = new HashMap<INode, Integer>();
allMainSubTreeConnections = new ArrayList<IConnection>();
buildCamelSubTree(node, false);
} else if (typeGen == ETypeGen.MR) {
this.rootNode = node;
this.name = node.getUniqueName();
this.nodes = new ArrayList<INode>();
afterSubProcesses = new ArrayList<String>();
beforeSubProcesses = new ArrayList<String>();
allMainSubTreeConnections = new ArrayList<IConnection>();
buildMRSubTree(node);
if (refNodes != null) {
for (INode refNode : refNodes) {
this.nodes.add(refNode);
for (IConnection connection : refNode.getOutgoingSortedConnections()) {
if (connection.getTarget().isActivate()) {
if (connection.getLineStyle().equals(EConnectionType.RUN_AFTER)) {
afterSubProcesses.add(connection.getTarget().getUniqueName());
}
if (connection.getLineStyle().equals(EConnectionType.ON_SUBJOB_OK)) {
beforeSubProcesses.add(connection.getTarget().getUniqueName());
}
}
}
}
}
}
buildCamelSubTree(node, false);
}
/**
* unite all the relative merge nodes to this subTree
@@ -195,32 +159,6 @@ public class NodesSubTree {
nodes.add(node);
}
private void buildMRSubTree(INode node) {
if (((AbstractNode) node).isThereLinkWithRef()) {
this.isRefSubTree = true;
this.refNodes = ((AbstractNode) node).getRefNodes();
}
for (IConnection connection : node.getOutgoingSortedConnections()) {
if (connection.getTarget().isActivate()) {
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {
if (!connection.getLineStyle().hasConnectionCategory(IConnectionCategory.USE_ITERATE)) {
allMainSubTreeConnections.add(connection);
}
buildMRSubTree(connection.getTarget());
}
if (connection.getLineStyle().equals(EConnectionType.RUN_AFTER)) {
afterSubProcesses.add(connection.getTarget().getUniqueName());
}
if (connection.getLineStyle().equals(EConnectionType.ON_SUBJOB_OK)) {
beforeSubProcesses.add(connection.getTarget().getUniqueName());
}
}
}
nodes.add(node);
}
private void buildSubTree(INode node, boolean breakWhenMerge) {
if (DEBUG) {
System.out.print(node.getUniqueName());
@@ -266,7 +204,6 @@ public class NodesSubTree {
visitedNodesMainCode.put(node, 0);
visitedNodesBeginCode.put(node, 0);
visitedNodesEndCode.put(node, 0);
visitedNodesFinallyCode.put(node, 0);
nodes.add(node);
}
@@ -300,13 +237,6 @@ public class NodesSubTree {
} else {
return false;
}
case FINALLY:
Integer countFinally = visitedNodesFinallyCode.get(node);
if (countFinally == null) {
return null;
} else {
return false;
}
default:
return result;
}
@@ -329,8 +259,6 @@ public class NodesSubTree {
case END:
visitedNodesEndCode.put(node, visitedNodesEndCode.get(node) + 1);
break;
case FINALLY:
visitedNodesFinallyCode.put(node, visitedNodesFinallyCode.get(node) + 1);
default:
// do nothing
}
@@ -440,7 +368,6 @@ public class NodesSubTree {
Collections.sort(mergeBranchStarts, new Comparator<INode>() {
@Override
public int compare(INode node1, INode node2) {
if (node1.getLinkedMergeInfo().get(mergeNode) > node2.getLinkedMergeInfo().get(mergeNode)) {
return 1;
@@ -488,40 +415,4 @@ public class NodesSubTree {
public void setSubTreeContainsParallelIterate(boolean subTreeContainsParallelIterate) {
this.subTreeContainsParallelIterate = subTreeContainsParallelIterate;
}
/**
* Getter for isRefSubTree.
*
* @return the isRefSubTree
*/
public boolean isRefSubTree() {
return this.isRefSubTree;
}
/**
* Sets the isRefSubTree.
*
* @param isRefSubTree the isRefSubTree to set
*/
public void setRefSubTree(boolean isRefSubTree) {
this.isRefSubTree = isRefSubTree;
}
/**
* Getter for refNodes.
*
* @return the refNodes
*/
public List<INode> getRefNodes() {
return this.refNodes;
}
/**
* Sets the refNodes.
*
* @param refNodes the refNodes to set
*/
public void setRefNodes(List<INode> refNodes) {
this.refNodes = refNodes;
}
}

View File

@@ -16,7 +16,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.temp.ETypeGen;
@@ -48,16 +47,12 @@ public class NodesTree {
buildSubTrees(true);
}
}
public NodesTree(IProcess process, List<? extends INode> treeNodes, boolean init, ETypeGen typeGen) {
this.nodes = treeNodes;
buildRootNodes(process);
if (init) {
if (typeGen == ETypeGen.CAMEL) {
buildCamelSubTrees(true);
} else if (typeGen == ETypeGen.MR) {
buildMRSubTrees();
}
buildCamelSubTrees(true);
}
}
@@ -98,21 +93,6 @@ public class NodesTree {
}
}
private void buildMRSubTrees() {
subTrees = new ArrayList<NodesSubTree>();
for (INode node : nodes) {
if (((node.isSubProcessStart()) && (node.isActivate())) || (rootNodes.contains(node))) {
if (node.getOutgoingConnections(EConnectionType.FLOW_REF) != null
&& node.getOutgoingConnections(EConnectionType.FLOW_REF).size() == 1) {
// ignore the node when it output connection is flow_ref, because it has been added in
// AbstractNode.setRefNodes
continue;
}
subTrees.add(new NodesSubTree(node, nodes, ETypeGen.MR));
}
}
}
/**
* Build Root Nodes List.
*
@@ -131,8 +111,7 @@ public class NodesTree {
for (INode node : nodes) {
String componentName = node.getComponent().getName();
if ((node.isStart()) && (node.isActivate()) && (node.isSubtreeStart() || node.isELTComponent())
&& (!componentName.equals("tPrejob"))//$NON-NLS-1$
if ((node.isStart()) && (node.isActivate()) && (!componentName.equals("tPrejob")) //$NON-NLS-1$
&& (!componentName.equals("tPostjob"))) { //$NON-NLS-1$
rootNodes.add(node);
}

View File

@@ -18,7 +18,6 @@ import java.io.DataInputStream;
import java.io.File;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
@@ -56,7 +55,7 @@ import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.talend.commons.debug.TalendDebugHandler;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.designer.codegen.i18n.Messages;
/**
@@ -79,10 +78,6 @@ public class TalendJetEmitter extends JETEmitter {
private static Logger log = Logger.getLogger(TalendJetEmitter.class);
private JetBean jetbean;
private boolean classAvailable = true;
/**
* DOC mhirt TalendJetEmitter constructor comment.
*
@@ -101,16 +96,17 @@ public class TalendJetEmitter extends JETEmitter {
this.talendEclipseHelper = new TalendEclipseHelper(progressMonitor, this, rebuild);
}
public TalendJetEmitter(JetBean jetbean, TalendEclipseHelper teh) {
super(jetbean.getFullTemplatePath(), jetbean.getClassLoader());
this.jetbean = jetbean;
this.templateName = jetbean.getClassName();
this.componentFamily = jetbean.getFamily();
this.templateLanguage = jetbean.getLanguage();
this.codePart = jetbean.getCodePart();
public TalendJetEmitter(String arg0, ClassLoader arg1, String componentFamily, String templateName, String templateLanguage,
String codePart, TalendEclipseHelper teh) {
super(arg0, arg1);
if (templateName.endsWith(codePart + "" + templateLanguage)) { //$NON-NLS-1$
this.templateName = templateName.substring(templateName.lastIndexOf(".") + 1, templateName.lastIndexOf(codePart)); //$NON-NLS-1$
} else {
this.templateName = templateName;
}
this.componentFamily = componentFamily;
this.templateLanguage = templateLanguage;
this.codePart = codePart;
this.talendEclipseHelper = teh;
}
@@ -186,16 +182,19 @@ public class TalendJetEmitter extends JETEmitter {
project.create(new SubProgressMonitor(progressMonitor, 1));
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreatingProject_message", //$NON-NLS-1$
new Object[] { project.getName() }));
}
if (!project.isOpen()) {
project.open(new SubProgressMonitor(progressMonitor, 5));
project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(progressMonitor, 1));
}
IProjectDescription description = project.getDescription();
// only in case it's one old workspace and got no nature defined.
if (!ArrayUtils.contains(description.getNatureIds(), JavaCore.NATURE_ID)) {
IProjectDescription description = workspace.newProjectDescription(project.getName());
description.setNatureIds(new String[] { JavaCore.NATURE_ID });
description.setLocation(null);
project.open(new SubProgressMonitor(progressMonitor, 1));
project.setDescription(description, new SubProgressMonitor(progressMonitor, 1));
} else {
project.open(new SubProgressMonitor(progressMonitor, 5));
IProjectDescription description = project.getDescription();
// only in case it's one old workspace and got no nature defined.
if (!ArrayUtils.contains(description.getNatureIds(), JavaCore.NATURE_ID)) {
description.setNatureIds(new String[] { JavaCore.NATURE_ID });
project.setDescription(description, new SubProgressMonitor(progressMonitor, 1));
}
}
javaProject = JavaCore.create(project);
@@ -354,10 +353,7 @@ public class TalendJetEmitter extends JETEmitter {
// if jetEmitter.getMethod() == null, means the class file doesn't exist anymore
// it should be impossible to have only the class file deleted and the .java never modified, but still
// handle this case.
// we could optimize the speed at this point by removing the method call here.
// but since this part is only called when there is a change detected in the jet emitters, it should be
// ok.
if (needRebuild || jetEmitter.method == null) {
if (needRebuild || jetEmitter.getMethod() == null) {
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETBuilding_message", //$NON-NLS-1$
new Object[] { project.getName() }));
@@ -378,7 +374,6 @@ public class TalendJetEmitter extends JETEmitter {
marker.getAttribute(IMarker.MESSAGE),
(CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) }))));
setClassAvailable(false);
}
}
@@ -430,106 +425,4 @@ public class TalendJetEmitter extends JETEmitter {
}
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.emf.codegen.jet.JETEmitter#getMethod()
*/
@Override
public Method getMethod() {
Method localMethod = super.getMethod();
if (localMethod == null) {
try {
localMethod = loadMethod();
} catch (Exception e) {
// nothing since if got exception here, the method will be reloaded bellow. (normal case)
// real error should be logged if the initialize fail.
}
// add this part in case there is any problem in the project (should never be called in normal use)
// but if there is any problem, it will force to regenerate again this component.
// This might be also called for custom components.
if (localMethod == null) {
try {
talendEclipseHelper.initialize(BasicMonitor.toMonitor(new NullProgressMonitor()), this, componentFamily,
templateName, templateLanguage, codePart);
localMethod = super.getMethod();
} catch (JETException e) {
ExceptionHandler.process(e);
}
} else {
setMethod(localMethod);
}
}
return localMethod;
}
/**
* DOC mhirt Comment method "loadMethod".
*
* @param methodName
* @return
* @throws MalformedURLException
* @throws ClassNotFoundException
*/
private Method loadMethod() throws ClassNotFoundException, MalformedURLException {
if (jetbean == null) {
return null;
}
if (currentClassLoader != jetbean.getClassLoader()) {
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = workspace.getRoot().getProject(projectName);
URL url = new File(project.getLocation() + "/runtime").toURL(); //$NON-NLS-1$
currentClassLoader = jetbean.getClassLoader();
theClassLoader = new URLClassLoader(new URL[] { url }, jetbean.getClassLoader());
}
Class theClass;
try {
theClass = theClassLoader.loadClass(jetbean.getClassName());
} catch (Error e) {
throw new ClassNotFoundException(e.getMessage(), e);
}
// TDI-23079
try {
Method[] methods = theClass.getDeclaredMethods();
for (int i = 0; i < methods.length; ++i) {
if (methods[i].getName().equals(jetbean.getMethodName())) {
return methods[i];
}
}
} catch (Exception e) {
return null;
}
return null;
}
private static ClassLoader currentClassLoader = null;
private static URLClassLoader theClassLoader = null;
/**
* Getter for classAvailable.
*
* @return the classAvailable
*/
public boolean isClassAvailable() {
return this.classAvailable;
}
public void setClassAvailable(boolean classAvailable) {
this.classAvailable = classAvailable;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.emf.codegen.jet.JETEmitter#generate(org.eclipse.emf.common.util.Monitor, java.lang.Object[],
* java.lang.String)
*/
@Override
public String generate(Monitor progressMonitor, Object[] arguments, String lineDelimiter) throws JETException {
getMethod(); // force to load the method before generate in case it was not set before.
return super.generate(progressMonitor, arguments, lineDelimiter);
}
}

View File

@@ -15,18 +15,17 @@ package org.talend.designer.codegen.model;
import java.beans.PropertyChangeEvent;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -34,16 +33,16 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.codegen.CodeGenPlugin;
import org.eclipse.emf.codegen.jet.JETEmitter;
import org.eclipse.emf.codegen.jet.JETException;
import org.eclipse.emf.common.CommonPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.widgets.Display;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.BusinessException;
@@ -98,8 +97,6 @@ public final class CodeGeneratorEmittersPoolFactory {
private static String defaultTemplate = null;
public static final String JET_PROJECT = ".JETEmitters"; //$NON-NLS-1$
/**
* Default Constructor. Must not be used.
*/
@@ -132,11 +129,20 @@ public final class CodeGeneratorEmittersPoolFactory {
TimeMeasure.measureActive = CommonsPlugin.isDebugMode();
TimeMeasure.begin("initialize Jet Emitters"); //$NON-NLS-1$
ComponentsFactoryProvider.saveComponentVisibilityStatus();
jetFilesCompileFail.clear();
IProgressMonitor monitorWrap = null;
boolean headless = CommonUIPlugin.isFullyHeadless();
boolean headless = CommonsPlugin.isHeadless();
if (!headless) {
try {
Display.getDefault();
} catch (SWTError e) {
headless = true;
}
}
if (!headless) {
monitorWrap = new CodeGeneratorProgressMonitor(delegateMonitor);
} else {
@@ -144,14 +150,14 @@ public final class CodeGeneratorEmittersPoolFactory {
}
ECodeLanguage codeLanguage = LanguageManager.getCurrentLanguage();
initializeJetEmittersProject(monitorWrap);
CodeGeneratorInternalTemplatesFactory templatesFactory = CodeGeneratorInternalTemplatesFactoryProvider
.getInstance();
templatesFactory.setCurrentLanguage(codeLanguage);
templatesFactory.init();
IComponentsFactory componentsFactory = ComponentsFactoryProvider.getInstance();
// do not call init because it may be already loaded by
// ComponentsFactoryProvider.saveComponentVisibilityStatus
componentsFactory.getComponents();
long startTime = System.currentTimeMillis();
@@ -181,9 +187,11 @@ public final class CodeGeneratorEmittersPoolFactory {
if (components != null) {
ECodePart codePart = ECodePart.MAIN;
for (IComponent component : new ArrayList<IComponent>(components)) {
// if (component.isTechnical() || component.isVisible()) {
if (component.getAvailableCodeParts().size() > 0) {
initComponent(codeLanguage, jetBeans, codePart, component);
}
// }
monitorBuffer++;
if (monitorBuffer % 100 == 0) {
monitorWrap.worked(100);
@@ -230,7 +238,7 @@ public final class CodeGeneratorEmittersPoolFactory {
} finally {
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = workspace.getRoot().getProject(JET_PROJECT);
IProject project = workspace.getRoot().getProject(".JETEmitters"); //$NON-NLS-1$
project.build(IncrementalProjectBuilder.AUTO_BUILD, null);
} catch (CoreException e) {
ExceptionHandler.process(e);
@@ -257,47 +265,6 @@ public final class CodeGeneratorEmittersPoolFactory {
return Status.OK_STATUS;
}
/**
* DOC nrousseau Comment method "initializeJetEmittersProject".
*
* @throws CoreException
*/
private void initializeJetEmittersProject(IProgressMonitor progressMonitor) throws CoreException {
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = workspace.getRoot().getProject(JET_PROJECT);
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETPreparingProject_message", //$NON-NLS-1$
new Object[] { project.getName() }));
File file = new File(workspace.getRoot().getLocation().append(JET_PROJECT).toPortableString());
if (file.exists() && !project.isAccessible()) {
// .metadata missing, so need to reimport project to add it in the metadata.
progressMonitor.subTask("Reinitilializing project " + project.getName()); //$NON-NLS-1$
project.create(new SubProgressMonitor(progressMonitor, 1));
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreatingProject_message", //$NON-NLS-1$
new Object[] { project.getName() }));
} else if (!project.isAccessible()) {
// project was deleted manually on the disk. The delete here will remove infos from metadata
// then we'll be able to create a new clean project.
project.delete(true, progressMonitor);
}
if (!project.exists()) {
progressMonitor.subTask("JET creating project " + project.getName()); //$NON-NLS-1$
project.create(new SubProgressMonitor(progressMonitor, 1));
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreatingProject_message", //$NON-NLS-1$
new Object[] { project.getName() }));
}
if (!project.isOpen()) {
project.open(new SubProgressMonitor(progressMonitor, 5));
project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(progressMonitor, 1));
}
IProjectDescription description = project.getDescription();
// only in case it's one old workspace and got no nature defined.
if (!ArrayUtils.contains(description.getNatureIds(), JavaCore.NATURE_ID)) {
description.setNatureIds(new String[] { JavaCore.NATURE_ID });
project.setDescription(description, new SubProgressMonitor(progressMonitor, 1));
}
}
};
public static Job initialize() {
@@ -424,9 +391,6 @@ public final class CodeGeneratorEmittersPoolFactory {
if (component.getAvailableCodeParts().contains(ECodePart.END)) {
initComponent(codeLanguage, jetBeans, ECodePart.END, component);
}
if (component.getAvailableCodeParts().contains(ECodePart.FINALLY)) {
initComponent(codeLanguage, jetBeans, ECodePart.FINALLY, component);
}
if (component.getAvailableCodeParts().contains(ECodePart.MRCODE)) {
initComponent(codeLanguage, jetBeans, ECodePart.MRCODE, component);
}
@@ -477,7 +441,10 @@ public final class CodeGeneratorEmittersPoolFactory {
alreadyCompiledEmitters = loadEmfPersistentData(EmfEmittersPersistenceFactory.getInstance(codeLanguage)
.loadEmittersPool(), components, monitorWrap);
for (JetBean jetBean : alreadyCompiledEmitters) {
TalendJetEmitter emitter = new TalendJetEmitter(jetBean, dummyEmitter.getTalendEclipseHelper());
TalendJetEmitter emitter = new TalendJetEmitter(getFullTemplatePath(jetBean), jetBean.getClassLoader(),
jetBean.getFamily(), jetBean.getClassName(), jetBean.getLanguage(), jetBean.getCodePart(),
dummyEmitter.getTalendEclipseHelper());
emitter.setMethod(jetBean.getMethod());
emitterPool.put(jetBean, emitter);
monitorBuffer++;
if (monitorBuffer % 100 == 0) {
@@ -504,6 +471,11 @@ public final class CodeGeneratorEmittersPoolFactory {
}
}
private static String getFullTemplatePath(JetBean jetBean) {
return Platform.getPlugin(jetBean.getJetPluginRepository()).getDescriptor().getInstallURL().toString()
+ jetBean.getTemplateRelativeUri();
}
private static void synchronizedComponent(List<JetBean> components, IProgressMonitor sub,
List<JetBean> alreadyCompiledEmitters, TalendJetEmitter dummyEmitter, int monitorBuffer, IProgressMonitor monitorWrap) {
for (JetBean jetBean : components) {
@@ -511,7 +483,9 @@ public final class CodeGeneratorEmittersPoolFactory {
ComponentCompilations.deleteMarkers();
// System.out.println("The new file is not in JetPersistence* cache:" + getFullTemplatePath(jetBean));
TalendJetEmitter emitter = new TalendJetEmitter(jetBean, dummyEmitter.getTalendEclipseHelper());
TalendJetEmitter emitter = new TalendJetEmitter(getFullTemplatePath(jetBean), jetBean.getClassLoader(),
jetBean.getFamily(), jetBean.getClassName(), jetBean.getLanguage(), jetBean.getCodePart(),
dummyEmitter.getTalendEclipseHelper());
// wzhang modified to fix bug 11439
if (monitorWrap.isCanceled()) {
if (!CommonUIPlugin.isFullyHeadless()) {
@@ -537,7 +511,9 @@ public final class CodeGeneratorEmittersPoolFactory {
continue;
}
if (emitter.isClassAvailable()) {
if (emitter.getMethod() != null) {
jetBean.setMethod(emitter.getMethod());
jetBean.setClassName(emitter.getMethod().getDeclaringClass().getName());
alreadyCompiledEmitters.add(jetBean);
} else {
jetFilesCompileFail.add(jetBean);
@@ -563,7 +539,7 @@ public final class CodeGeneratorEmittersPoolFactory {
for (JetBean unit : alreadyCompiledEmitters) {
// long unitCRC = extractTemplateHashCode(unit);
long unitCRC = unit.getCrc();
toReturn.add(new LightJetBean(unit.getTemplateRelativeUri(), unit.getClassName(), unit.getMethodName(), unit
toReturn.add(new LightJetBean(unit.getTemplateRelativeUri(), unit.getClassName(), unit.getMethod().getName(), unit
.getVersion(), unit.getLanguage(), unitCRC));
}
return toReturn;
@@ -585,7 +561,7 @@ public final class CodeGeneratorEmittersPoolFactory {
URL url;
try {
url = new URL(uri.toString());
unitCRC = IOUtils.computeCRC(url.openStream());
unitCRC = IOUtils.computeCRConTextFile(url.openStream());
} catch (Exception e) {
// ignore me even if i'm null
}
@@ -635,8 +611,15 @@ public final class CodeGeneratorEmittersPoolFactory {
}
if (lightBean != null && lightBean.getCrc() == unit.getCrc()) {
unit.setClassName(lightBean.getClassName());
unit.setMethodName(lightBean.getMethodName());
toReturn.add(unit);
try {
Method method = loadMethod(url, lightBean.getMethodName(), unit);
if (method != null) {
unit.setMethod(method);
toReturn.add(unit);
}
} catch (ClassNotFoundException e) {
log.info(Messages.getString("CodeGeneratorEmittersPoolFactory.Class.NotFound", unit.getClassName())); //$NON-NLS-1$
}
}
}
}
@@ -648,13 +631,50 @@ public final class CodeGeneratorEmittersPoolFactory {
return toReturn;
}
/**
* DOC mhirt Comment method "loadMethod".
*
* @param methodName
* @return
* @throws MalformedURLException
* @throws ClassNotFoundException
*/
private static Method loadMethod(URL url, String methodName, JetBean unit) throws ClassNotFoundException {
if (currentClassLoader != unit.getClassLoader()) {
currentClassLoader = unit.getClassLoader();
theClassLoader = new URLClassLoader(new URL[] { url }, unit.getClassLoader());
}
Class theClass;
try {
theClass = theClassLoader.loadClass(unit.getClassName());
} catch (Error e) {
throw new ClassNotFoundException(e.getMessage(), e);
}
// TDI-23079
try {
Method[] methods = theClass.getDeclaredMethods();
for (int i = 0; i < methods.length; ++i) {
if (methods[i].getName().equals(methodName)) {
return methods[i];
}
}
} catch (Exception e) {
return null;
}
return null;
}
private static ClassLoader currentClassLoader = null;
private static URLClassLoader theClassLoader = null;
/**
* Getter for emitterPool.
*
* @return the emitterPool
*/
public static HashMap<JetBean, JETEmitter> getEmitterPool() {
if (emitterPool == null || (!isInitialized() && !isInitializeStart())) {
if (!isInitialized() && !isInitializeStart()) {
initialize();
}
return emitterPool;
@@ -667,7 +687,7 @@ public final class CodeGeneratorEmittersPoolFactory {
* @return
*/
public static JETEmitter getJETEmitter(JetBean jetBean) {
if (emitterPool == null || (!isInitialized() && !isInitializeStart())) {
if (!isInitialized() && !isInitializeStart()) {
initialize();
}

View File

@@ -106,7 +106,7 @@ public final class JetSkeletonManager {
String path = file.getAbsolutePath();
long currentCRC = 0;
try {
currentCRC = IOUtils.computeCRC(new FileInputStream(file));
currentCRC = IOUtils.computeCRConTextFile(new FileInputStream(file));
} catch (FileNotFoundException e) {
// ignore here, only print
// e.printStackTrace();

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -1,16 +1,4 @@
source.. = src/main/java/
output.. = class/
bin.includes = META-INF/,\
.\
,plugin_zh_CN.properties\
,plugin_ru.properties\
,plugin_en.properties\
,plugin_hr.properties\
,plugin_fr.properties\
,plugin_pt_BR.properties\
,plugin_nl.properties\
,plugin_el.properties\
,plugin_ja.properties\
,plugin_it.properties\
,plugin_de.properties\
,plugin_swtbot.properties
.

View File

@@ -1,5 +0,0 @@
Exchange=Exchange
DownloadComponenentsAction.Label=Download Selected Components
RefreshComponenentsAction.Label=Refresh Componenents List
providerName=www.example.org
pluginName = Exchange Model

View File

@@ -4,6 +4,5 @@ MyExtensionsComposite.Version=Verzija
MyExtensionsComposite.UpdateOperateStatus=A\u017Euriraj
MyExtensionsComposite.DeleteOperateStatus=Obri\u0161i
MyExtensionsComposite.Form.Compatibility.Version=Verzija
MyExtensionsComposite.Form.Description=Opis
ImportExchangeDialog.WARNING=Upozorenje
ImportExchangeDialog.REFRESH_BUTTON=Osvje\u017Ei

View File

@@ -1,103 +0,0 @@
ExchangeView.Exchange=Exchange
AvailableExtensionsComposite.ExtensionName=Extension Name
AvailableExtensionsComposite.Version=Version
AvailableExtensionsComposite.Rating=Rating
AvailableExtensionsComposite.Author=Author
AvailableExtensionsComposite.FilterTitle=Filter
AvailableExtensionsComposite.ViewDetail.installOperateStatus=Install
AvailableExtensionsComposite.ViewDetail.WriteReview=Write a review
AvailableExtensionsComposite.ViewDetail.InsertionReviewFailure=Insertion Review failure.
AvailableExtensionsComposite.ViewDetail.InsertionReviewFailureTip=You should check it.
DownloadedExtensionsComposite.ExtensionName=Extension Name
DownloadedExtensionsComposite.DownloadedVersion=Downloaded Version
DownloadedExtensionsComposite.DownloadDate=Download Date
DownloadedExtensionsComposite.OperateStatus=Operate Status
DownloadedExtensionsComposite.installOperateStatus=Install
DownloadedExtensionsComposite.installedOperateStatus=Installed
DownloadedExtensionsComposite.updateOperateStatus=Update
MyExtensionsComposite.ExtensionName=Extension Name
MyExtensionsComposite.Version=Version
MyExtensionsComposite.UploadDate=Upload Date
MyExtensionsComposite.AddNewExtensionTitle=Add New Extension
MyExtensionsComposite.UpLoadNewVersionOperateStatus=UpLoad New Version
MyExtensionsComposite.UpdateOperateStatus=Update
MyExtensionsComposite.ModifyOperateStatus=Modify
MyExtensionsComposite.DeleteOperateStatus=Delete
MyExtensionsComposite.Form.Return=Return
MyExtensionsComposite.Form.ExtensionTitle=Extension Title
MyExtensionsComposite.Form.InitialVersion=Initial Version
MyExtensionsComposite.Form.Compatibility=Compatibility
MyExtensionsComposite.Form.Compatibility.AllVersions=All versions
MyExtensionsComposite.Form.Compatibility.Version=Version
MyExtensionsComposite.Form.Compatibility.AndOlder=and older
MyExtensionsComposite.Form.Compatibility.AndNewer=and newer
MyExtensionsComposite.Form.Compatibility.AllVersionsExcept=All versions except:
MyExtensionsComposite.Form.Compatibility.OnlyTheseVersions=Only these versions:
MyExtensionsComposite.Form.Description=Description
MyExtensionsComposite.Form.Visibility=Visibility
MyExtensionsComposite.Form.Visibility.Public=Public(visible by all)
MyExtensionsComposite.Form.Visibility.Private=Private(visible by me)
MyExtensionsComposite.Form.Upload=Upload
MyExtensionsComposite.Form.Upload.SelectAnItem=Select an item from the currently open project
MyExtensionsComposite.Form.Upload.File=File:
MyExtensionsComposite.Form.Upload.Browse=Browse
MyExtensionsComposite.Form.Upload.Browse.SelectFile=Select a File of the extension to upload
MyExtensionsComposite.Form.DeleteExtensionTile=Delete Extension
MyExtensionsComposite.Form.DeleteExtensionMessage=You sure delete this Extension
MyExtensionsComposite.Form.UploadExtension=Upload Extension
MyExtensionsComposite.Form.UpdateExtension=Update Extension
MyExtensionsComposite.Form.ModifyExtension=Modify Extension
Exchange.logon.error=Exchange user have not been registered, please register using the preferences .
RefreshJob.FindExtensions.Title=Finding available extensions
RefreshJob.FindExtensions.Message=Finding extensions from exchange...
ShowContributedExtensionsJob.ShowContributedExtensions.Title=Finding contributed extensions
ShowContributedExtensionsJob.ShowContributedExtensions.Message=Finding contributed extensions from exchange...
ShowInstalledExtensionsJob.ShowInstalledExtensions.Title=Finding installed extensions
ShowInstalledExtensionsJob.ShowInstalledExtensions.Message=Finding installed extensions from exchange...
DeleteExtensionJob.DeleteExtensionJob.Title=Delete an extension...
DeleteExtensionJob.DeleteExtensionJob.Message=Delete an extension...
DeleteExtensionJob.DeleteFailure=Delete failure.
DeleteExtensionJob.DeleteFailureTip=You should check it.
ModifyExtensionJob.Title=Modify an extension...
ModifyExtensionJob.Message=Modify an extension...
ModifyExtensionJob.ModifyFailure=Modify failure.
ModifyExtensionJob.ModifyFailureTip=You should check it.
InstalledExtensionJob.Title=Installed an extension...
InstalledExtensionJob.Message=Installed an extension...
InsertionExtensionAction.InstalledFailure=Installed failure.
InsertionExtensionAction.InstalledFailureTip=You should check it.
UploadRevisionJob.Title=Upload Revision...
UploadRevisionJob.Message=Upload Revision...
UploadRevisionAction.InstalledFailure=Upload Revision failure.
UploadRevisionAction.InstalledFailureTip=You should check it.
DownloadComponenentsAction.installExchange=Installed Exchange Components
DownloadComponenentsAction.DownloadTaskTitle=Downloading files from Exchange
DownloadComponenentsAction.DownloadTaskName=Downloading file from url:
DownloadComponenentsAction.ReloadPalette=Reloading palette...
DownloadComponenentsAction.DownloadFailure=Download failure.
DownloadComponenentsAction.DownloadFailureTip=You must change the Download Settings.
ExchangeWebService.insertionExtensionSuccessful=Insertion Extension successful.
ExchangeWebService.downloadingExtensionSuccessful=Downloaded Extension successful.
ExchangeWebService.deleteExtensionSuccessful=Deleted Extension successful.
ExchangeWebService.insertReviewSuccessful=Insertion Review successful.
ExchangeWebService.updateRevisionSuccessful=Update Revision successful.
ExchangeWebService.insertionRevisionSuccessful=Insertion Revision successful.
ImportExchangeDialog.dialogTitle=Select an item from Talend Exchange
ImportExchangeDialog.WARNING=WARNING
ImportExchangeDialog.NOTSELECTWARNING=Please select one item from table.....
ImportExchangeDialog.downloadProgressBar=Download Item,Please Wait\!
ImportExchangeDialog.EXTENSION_NAME=Extension Name
ImportExchangeDialog.AUTHOR_NAME=Author Name
ImportExchangeDialog.LATEST_REVISION=Latest Revision
ImportExchangeDialog.EXTENSION_DESCRIPTION=Extension Description
ImportExchangeDialog.download.components=Download Components Please Wait\!
ImportExchangeDialog.JOB_BUTTON=Job Designs
ImportExchangeDialog.DOWNLOAD_JOB=Download Some Job Designs...
ImportExchangeDialog.ROUTINES_BUTTON=Routines
ImportExchangeDialog.ROUTINES_PROGRESSBAR=Download Some Routines...
ImportExchangeDialog.TEMPLATES_BUTTON=SQL Templates
ImportExchangeDialog.TEMPLATES_PROGRESSBAR=Download Some SQL Templates...
ImportExchangeDialog.REFRESH_BUTTON=Refresh
ImportExchangeDialog.REFRESHING_PROGRESSBAR=Refreshing\! Please Wait.....
ImportExchangeDialog.NOT_SELECT_BUTTON=Please select a choice first
ImportExchangeDialog.OPERATION_CANCELLED=Operation was cancelled

View File

@@ -2,4 +2,3 @@ AvailableExtensionsComposite.Version=Versiyon
MyExtensionsComposite.Version=Versiyon
MyExtensionsComposite.DeleteOperateStatus=Sil
MyExtensionsComposite.Form.Compatibility.Version=Versiyon
MyExtensionsComposite.Form.Description=Aç\u0131klama

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -80,43 +80,15 @@
checkedType = "only"
filtervalue = document.getElementById(checkedType).value;
}
<!-- validate the createNewExtension text start-->
var labelValidate = document.getElementById("extension_label").value;
var lastVersionAvailableValidate = document.getElementById("lastVersionAvailable").value;
var filename = document.getElementById("filename").value;
var isSkipPage = true;
if(labelValidate==0){
alert("Extension Title is empty");
isSkipPage = false;
}else if(labelValidate=="null"){
alert("Extension Title can not be null");
isSkipPage = false;
}else if(lastVersionAvailableValidate==0){
alert("Initial Version is empty");
isSkipPage = false;
}else if(lastVersionAvailableValidate=="null"){
alert("Initial Version can not be null");
isSkipPage = false;
}else if(filename==0){
alert("Please input a vaild File path");
isSkipPage = false;
}
<!-- validate the createNewExtension text end-->
if (isSkipPage == true) {
var listVersionCompatibles = "listVersionCompatibles:" + "'" + checkedType + "'";
var filter = "filter:" + "'" + filtervalue + "'";
var filename = "filename:" + "'" + document.getElementById("filename").value + "'";
filename = filename.replaceAll2Excep("\\", "/");
var jsonObj = "{" + label + "," + lastVersionAvailable + "," + description + "," + listVersionCompatibles + "," + filter + "," + filename + "}"
var url = prefix + "&amp;extensionValues=" + jsonObj;
document.getElementById('commit').href = url;
window.location.href=document.getElementById('commit').href;
}
var listVersionCompatibles = "listVersionCompatibles:" + "'" + checkedType + "'";
var filter = "filter:" + "'" + filtervalue + "'";
var filename = "filename:" + "'" + document.getElementById("filename").value + "'";
filename = filename.replaceAll2Excep("\\", "/");
var jsonObj = "{" + label + "," + lastVersionAvailable + "," + description + "," + listVersionCompatibles + "," + filter + "," + filename + "}"
var url = prefix + "&amp;extensionValues=" + jsonObj;
document.getElementById('commit').href = url;
}
function updateReWriteUrl() {
@@ -144,31 +116,16 @@
checkedType = "only"
filtervalue = document.getElementById(checkedType + "_update").value;
}
<!-- validate the updateExtension text start-->
var lastVersionAvailable_updateValidate = document.getElementById("lastVersionAvailable_update").value;
var isSkipPage = true;
if(lastVersionAvailable_updateValidate==0){
alert("New Version is empty");
var isSkipPage = false;
}else if(lastVersionAvailable_updateValidate=="null"){
alert("New Version can not be null");
var isSkipPage = false;
}
<!-- validate the updateExtension text end-->
if (isSkipPage == true) {
var listVersionCompatibles = "listVersionCompatibles:" + "'" + checkedType + "'";
var filter = "filter:" + "'" + filtervalue + "'";
var filename = "filename:" + "'" + document.getElementById("filename_update").value + "'";
filename = filename.replaceAll2Excep("\\", "/");
var jsonObj = "{" + lastVersionAvailable + "," + listVersionCompatibles + "," + filter + "," + filename + "}"
var url = prefix + "&amp;extensionValues=" + jsonObj;
document.getElementById('commit_update').href = url;
window.location.href=document.getElementById('commit_update').href;
}
var listVersionCompatibles = "listVersionCompatibles:" + "'" + checkedType + "'";
var filter = "filter:" + "'" + filtervalue + "'";
var filename = "filename:" + "'" + document.getElementById("filename_update").value + "'";
filename = filename.replaceAll2Excep("\\", "/");
var jsonObj = "{" + lastVersionAvailable + "," + listVersionCompatibles + "," + filter + "," + filename + "}"
var url = prefix + "&amp;extensionValues=" + jsonObj;
document.getElementById('commit_update').href = url;
}
function modifyReWriteUrl() {
@@ -480,7 +437,7 @@
<td ></td>
<td>
<a class="xh" href="" id="commit" style="margin-left:5px;">
<button onclick="createNewExtensionWriteUrl()" style="width: 176px">
<button onclick="window.location.href=document.getElementById('commit').href" onmouseover="createNewExtensionWriteUrl()" style="width: 176px">
Add Extension
</button>
</a>
@@ -539,7 +496,7 @@
<td ></td>
<td>
<a class="xh" href="" id="commit_update" style="margin-left:5px;">
<button onclick="updateReWriteUrl()" style="width: 176px">
<button onclick="window.location.href=document.getElementById('commit_update').href" onmouseover="updateReWriteUrl()" style="width: 176px">
Upload Extension
</button>
</a>

View File

@@ -115,6 +115,7 @@ ImportExchangeDialog.TEMPLATES_BUTTON=SQL Templates
ImportExchangeDialog.TEMPLATES_PROGRESSBAR=Download Some SQL Templates...
ImportExchangeDialog.REFRESH_BUTTON=Refresh
ImportExchangeDialog.REFRESHING_PROGRESSBAR=Refreshing\! Please Wait.....
ImportExchangeDialog.WARNING=WARNING
ImportExchangeDialog.NOT_SELECT_BUTTON=Please select a choice first
ImportExchangeDialog.OPERATION_CANCELLED=Operation was cancelled

View File

@@ -25,6 +25,7 @@ import org.talend.core.model.general.IExchangeService;
import org.talend.core.model.general.Project;
import org.talend.designer.components.exchange.i18n.Messages;
import org.talend.designer.components.exchange.ui.views.ExchangeEditorInput;
import org.talend.designer.components.exchange.util.ExchangeUtils;
import org.talend.designer.components.exchange.util.ExchangeWebService;
import org.talend.repository.ProjectManager;
@@ -81,7 +82,7 @@ public class ExchangeService implements IExchangeService {
JSONObject tokenMessage = new JSONObject();
try {
tokenMessage.put("username", username);
tokenMessage.put("passwordHash", password);
tokenMessage.put("passwordHash", ExchangeUtils.getPasswordHash(password));
JSONObject token = new us.monoid.json.JSONObject();
token.put("contributedExtension", tokenMessage);

View File

@@ -162,14 +162,6 @@ public class AvailableCompositeProvider implements IIntroXHTMLContentProvider {
if (fAvailableExtensions != null) {
for (int i = 0; i < fAvailableExtensions.size(); i++) {
ComponentExtension extension = fAvailableExtensions.get(i);
// hide null entries directly
if (extension.getLabel().equals("null")) {
continue;
}
// set 0.1 as a default version
if (extension.getVersionExtension().equals("") || extension.getVersionExtension().equals("null")) {
extension.setVersionExtension("0.1");
}
Element trExtension = dom.createElement("tr");
Element tdExtension = dom.createElement("td");

View File

@@ -165,14 +165,7 @@ public class DownloadExtensionProvider implements IIntroXHTMLContentProvider {
while (ite.hasNext()) {
count++;
ComponentExtension object = (ComponentExtension) ite.next();
// hide null entries directly
if (object.getLabel().equals("null")) {
continue;
}
// set 0.1 as a default version
if (object.getDownloadedVersion().equals("") || object.getDownloadedVersion().equals("null")) {
object.setDownloadedVersion("0.1");
}
Element trExtension = dom.createElement("tr");
Element tdExtension = dom.createElement("td");
@@ -196,7 +189,6 @@ public class DownloadExtensionProvider implements IIntroXHTMLContentProvider {
style = style + ";background:#F7F7F7";
}
tdExtension.setAttribute("style", style);
// set 0.1 as a default version
tdExtension.appendChild(dom.createTextNode(object.getDownloadedVersion()));
trExtension.appendChild(tdExtension);

View File

@@ -49,6 +49,7 @@ import org.talend.commons.emf.EmfHelper;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.utils.StringUtils;
import org.talend.commons.utils.VersionUtils;
import org.talend.commons.utils.io.SHA1Util;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.components.ComponentUtilities;
@@ -327,7 +328,22 @@ public class ExchangeUtils {
public static String getPasswordHash() {
Project proj = ProjectManager.getInstance().getCurrentProject();
return proj.getExchangeUser().getPassword();
String passwordTemp = proj.getExchangeUser().getPassword();
try {
passwordTemp = SHA1Util.hex_sha1(passwordTemp);
} catch (Exception e) {
ExceptionHandler.process(e);
}
return passwordTemp;
}
public static String getPasswordHash(String passwordTemp) {
try {
return SHA1Util.hex_sha1(passwordTemp);
} catch (Exception e) {
ExceptionHandler.process(e);
}
return passwordTemp;
}
public static String getUserName() {

View File

@@ -527,7 +527,7 @@ public class ExchangeWebService {
tokenMessage.put("versionCompatibles", listVersionCompatibles);
tokenMessage.put("filename", new Path(filename).lastSegment());
tokenMessage.put("content", asHex(fileBytes));
tokenMessage.put("description", description.replace(" ", "%20"));
tokenMessage.put("description", description);
tokenMessage.put("agreement", agreement);
JSONObject token = new us.monoid.json.JSONObject();
token.put("newRevision", tokenMessage);
@@ -576,7 +576,7 @@ public class ExchangeWebService {
tokenMessage.put("typeExtension", typeExtension);
tokenMessage.put("version", version);
tokenMessage.put("listVersionCompatibles", listVersionCompatibles);
tokenMessage.put("description", description.replace(" ", "%20"));
tokenMessage.put("description", description);
tokenMessage.put("agreement", agreement);
JSONObject token = new us.monoid.json.JSONObject();
token.put("revision", tokenMessage);

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -71,15 +71,15 @@ public class SAXLooper {
}
private void judgeIsSimple() {
isSimpleParse = isSimplePath(loopPath);
for(String path : nodePaths) {
if(!isSimpleParse) {
if (this.loopPath.indexOf("..") >= 0 || this.loopPath.indexOf("*") >= 0) {
this.isSimpleParse = false;
}
for (int i = 0; i < nodePaths.length; i++) {
if (nodePaths[i].indexOf("..") >= 0 || nodePaths[i].indexOf("*") >= 0) {
this.isSimpleParse = false;
break;
}
isSimpleParse = isSimplePath(path);
}
if (this.isSimpleParse) {
looper = new SimpleSAXLooper(loopPath, nodePaths, asXMLs);
} else {
@@ -88,61 +88,30 @@ public class SAXLooper {
}
private void judegeMultiIsSimple() {
isSimpleParse = isSimplePath(rootPath);
for(String path : arrOrigLoopPath) {
if(!isSimpleParse) {
if (this.rootPath.indexOf("..") >= 0 || this.rootPath.indexOf("*") >= 0) {
this.isSimpleParse = false;
}
for (int i = 0; isSimpleParse && i < arrOrigLoopPath.length; i++) {
if (arrOrigLoopPath[i].indexOf("..") >= 0 || arrOrigLoopPath[i].indexOf("*") >= 0) {
this.isSimpleParse = false;
break;
}
isSimpleParse = isSimplePath(path);
}
for(String[] arrNodePath : arrNodePaths) {
for(String path : arrNodePath) {
if(!isSimpleParse) {
for (int i = 0; isSimpleParse && i < arrNodePaths.length; i++) {
for (int j = 0; j < arrNodePaths[i].length; j++) {
if (arrNodePaths[i][j].indexOf("..") >= 0 || arrNodePaths[i][j].indexOf("*") >= 0) {
this.isSimpleParse = false;
break;
}
isSimpleParse = isSimplePath(path);
}
if(!isSimpleParse) {
break;
}
}
this.isSimpleParse = false;
if (this.isSimpleParse) {
looper = new SimpleSAXLooper(rootPath, arrOrigLoopPath, arrNodePaths);
} else {
looper = new ComplexSAXLooper(rootPath, arrOrigLoopPath, arrNodePaths);
}
}
/**
* ../../../@attr also can read like a stream(now only consider the case)
* @param path
* @return
*/
private boolean isSimplePath(String path) {
if(path == null || !path.contains("..") && !path.contains("*")) {
return true;
}
boolean isSimplePath = true;
String[] nodes = path.split("/");
for(int i = 0;i<nodes.length;i++) {
String node = nodes[i];
if(i < (nodes.length - 1)) {
isSimplePath = isSimplePath && "..".equals(node);
} else {
isSimplePath = isSimplePath && node.startsWith("@");
}
}
return isSimplePath;
}
private String charset = "UTF-8";

View File

@@ -1,179 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2013 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.xml.sax.simpleparser;
import java.util.LinkedList;
import java.util.Map;
/**
* DOC Administrator class global comment. Detailled comment
*/
public class DataBufferCache2 {
// private static DataBufferCache instance = new DataBufferCache();
private long bufferSize = 5000;
private boolean isEnd = false;
private int bufferNum = 10;
private LinkedList<Buffer> buffers = new LinkedList<Buffer>();
private Buffer currentReadBuff = null;
private Buffer currentWriteBuff = null;
private DataBufferCache2() {
}
public static DataBufferCache2 getInstance() {
return new DataBufferCache2();
}
public void setIsEnd() {
synchronized (buffers) {
try {
if (!isEnd && currentWriteBuff != null) {
buffers.add(currentWriteBuff);
}
this.isEnd = true;
} finally {
this.buffers.notifyAll();
}
}
}
public void setBufferNum(int num) {
if (num <= 0)
return;
this.bufferNum = num;
}
public void setBufferSize(long size) {
if (size <= 0)
return;
this.bufferSize = size;
}
public boolean hasData() {
getCurrReadBuffer();
if (currentReadBuff == null) {
return false;
}
return this.currentReadBuff.hasNext();
}
public Map<String,Map<String,String>> readData() {
return this.currentReadBuff.Next();
}
private void getCurrReadBuffer() {
if (currentReadBuff != null && currentReadBuff.hasNext())
return;
synchronized (this.buffers) {
try {
while (!this.isEnd && buffers.size() < 1) {
try {
buffers.wait();
} catch (InterruptedException ex) {
System.err.println(ex.getMessage());
}
}
if (buffers.size() > 0) {
currentReadBuff = buffers.remove();
}
} finally {
this.buffers.notifyAll();
}
}
}
public void writeData(Map<String,Map<String,String>> map) {
if (currentWriteBuff == null) {
currentWriteBuff = new Buffer();
}
if (currentWriteBuff.size() < this.bufferSize) {
currentWriteBuff.add(map);
} else {
currentWriteBuff.add(map);
synchronized (buffers) {
try {
while (buffers.size() > bufferNum) {
try {
buffers.wait();
} catch (InterruptedException ex) {
System.err.println(ex.getMessage());
}
}
if (currentWriteBuff.size() > 0) {
this.buffers.add(currentWriteBuff);
}
currentWriteBuff = null;
} finally {
this.buffers.notifyAll();
}
}
}
}
public void notifyErrorOccurred() {
setIsEnd();
}
class Buffer {
private LinkedList<Map<String,Map<String,String>>> buffer = null;
private boolean isForRead = false; // false for write, true for read
public Buffer() {
buffer = createNewBuffer();
}
public void setIsForRead(boolean isForRead) {
this.isForRead = isForRead;
}
public boolean isForRead() {
return this.isForRead;
}
public boolean hasNext() {
return buffer.size() > 0;
}
public Map<String,Map<String,String>> Next() {
return buffer.remove();
}
public void add(Map<String,Map<String,String>> o) {
this.buffer.add(o);
}
public int size() {
return this.buffer.size();
}
public void clear() {
this.buffer.clear();
buffer = null;
}
private LinkedList<Map<String,Map<String,String>>> createNewBuffer() {
return new LinkedList<Map<String,Map<String,String>>>();
}
}
}

View File

@@ -0,0 +1,144 @@
// ============================================================================
//
// Copyright (C) 2006-2013 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.xml.sax.simpleparser;
import java.util.LinkedList;
import java.util.Map;
/**
* DOC Administrator class global comment. Detailled comment
*/
public class DataCache {
private LinkedList<Map<String, String>> cache = new LinkedList<Map<String, String>>();
private boolean isReadEnd = false;
private static DataCache instance = new DataCache();
private long bufferSize = 10000;
int startIndex = 0;
private DataCache() {
}
public static DataCache getInstance() {
if (instance == null)
instance = new DataCache();
return instance;
}
public void setBufferSize(long size) {
this.bufferSize = size;
}
public boolean isReadEnd() {
return isReadEnd;
}
public boolean hasData() {
return !(this.isReadEnd && this.cache.size() <= 0);
}
public void setReadEnd(boolean isEnd) {
synchronized (this.cache) {
this.isReadEnd = isEnd;
this.cache.notifyAll();
}
}
public Map<String, String> readData() {
Map<String, String> result = null;
synchronized (this.cache) {
if (!isReadEnd && this.cache.size() <= 0) {
try {
this.cache.wait();
} catch (InterruptedException ex) {
System.err.println(ex.getMessage());
}
}
if (cache.size() > 0)
result = this.cache.remove();
this.cache.notifyAll();
// System.out.println(result.get("@swid") + "#" + result.get("@login_date") + "#");
return result;
}
// if (cache.size() > 0) {
// result = cache.remove();
// if (this.isWriteWait) {
// synchronized (this) {
// this.notifyAll();
// }
// }
// return result;
// }
//
// while (!isReadEnd && cache.isEmpty()) {
// synchronized (this) {
// try {
// this.isReadWait = true;
// this.wait();
// result = cache.remove();
// this.isReadWait = false;
// this.notifyAll();
// return result;
// } catch (Exception ex) {
// System.err.println(ex.getMessage());
// }
// }
// }
// return result;
}
public void writeData(Map<String, String> map) {
synchronized (this.cache) {
if (this.cache.size() >= bufferSize) {
try {
this.cache.wait();
} catch (InterruptedException ex) {
System.err.println(ex.getMessage());
}
}
this.cache.add(map);
this.cache.notifyAll();
}
// if (this.cache.size() < this.bufferSize) {
// cache.add(map);
// if (this.isReadWait) {
// synchronized (this) {
// this.notifyAll();
// }
// }
// return;
// }
// while (this.cache.size() >= this.bufferSize) {
// synchronized (this) {
// try {
// this.isReadWait = true;
// this.wait();
// } catch (Exception ex) {
// System.err.println(ex.getMessage());
// }
// cache.add(map);
//
// isWriteWait = false;
//
// this.notifyAll();
// }
// }
}
}

View File

@@ -37,20 +37,12 @@ public class SimpleSAXLoopHandler extends DefaultHandler2 {
private boolean stop = false;
private DataBufferCache2 multiCache;
public SimpleSAXLoopHandler(XMLNodes nodes, DataBufferCache bcache) {
super();
this.nodes = nodes;
this.bufferCache = bcache;
}
public SimpleSAXLoopHandler(XMLNodes nodes, DataBufferCache2 multiCache) {
super();
this.nodes = nodes;
this.multiCache = multiCache;
}
/*
* (non-Javadoc)
*
@@ -66,11 +58,8 @@ public class SimpleSAXLoopHandler extends DefaultHandler2 {
* @see org.xml.sax.helpers.DefaultHandler#endDocument()
*/
public void endDocument() throws SAXException {
if(multiCache!=null) {
multiCache.setIsEnd();
} else {
bufferCache.setIsEnd();
}
// DataCache.getInstance().setReadEnd(true);
bufferCache.setIsEnd();
}
/*
@@ -124,18 +113,6 @@ public class SimpleSAXLoopHandler extends DefaultHandler2 {
}
}
} else {//process the attribute out of the loop
int index = node.nodePath.lastIndexOf("@");
if (index > 0) {
if (currentPath.equals(node.nodePath.substring(0, index - 1))) {
String attribute = attributes.getValue(node.nodePath.substring(index + 1));
if (attribute != null) {
node.addTextValue(attribute);
} else {
node.addTextValue("");
}
}
}
}
}
}
@@ -196,14 +173,12 @@ public class SimpleSAXLoopHandler extends DefaultHandler2 {
Map<String, String> map = new HashMap<String, String>();
for (XMLNode node : nodes.getNodesCollection()) {
map.put(node.originPath, node.getTextValue());
// ---------------------------------------------
// System.out.print("" + node.getTextValue() + "#");
// ---------------------------------------------
}
if(multiCache!=null) {
HashMap<String, Map<String, String>> row = new HashMap<String, Map<String, String>>(1);
row.put(nodes.getOriginalLoopPath(), map);
multiCache.writeData(row);
} else {
bufferCache.writeData(map);
}
bufferCache.writeData(map);
if (stop) {
throw new EnoughDataException("Get enough data,now stop the xml parse action");

View File

@@ -13,9 +13,7 @@
package org.talend.xml.sax.simpleparser;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
@@ -23,7 +21,6 @@ import java.util.concurrent.FutureTask;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.talend.xml.sax.SAXLoopCompositeHandler;
import org.talend.xml.sax.commons.ISAXLooper;
import org.talend.xml.sax.io.UnicodeReader;
import org.talend.xml.sax.simpleparser.model.XMLNode;
@@ -38,8 +35,6 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
private XMLNodes nodes = new XMLNodes();
private DataBufferCache bcache;
private DataBufferCache2 multiCache;
private Thread task;
@@ -49,14 +44,6 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
SimpleSAXLoopHandler hd = null;
private String[] arrOrigLoopPath;
private String rootPath;
private String[] arrLoopPath;
private List<XMLNodes> nodesList = new ArrayList<XMLNodes>();
public SimpleSAXLooper(String loopPath, String[] nodePaths, boolean[] asXMLs) {
futureTask = new FutureTask(this);
task = new Thread(futureTask);
@@ -67,53 +54,7 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
}
public SimpleSAXLooper(String rootPath, String[] arrLoopPath, String[][] arrNodePaths) {
futureTask = new FutureTask(this);
task = new Thread(futureTask);
this.arrOrigLoopPath = arrLoopPath;
String tmpRootPath = rootPath;
if (tmpRootPath.endsWith("/")) {
tmpRootPath = tmpRootPath.substring(0, tmpRootPath.length() - 1);
}
this.rootPath = tmpRootPath;
this.arrLoopPath = getLoopPaths(arrLoopPath);
for(int j = 0;j<arrNodePaths.length;j++) {
String[] nodePaths = arrNodePaths[j];
XMLNodes ns = new XMLNodes();
for (int i = 0; i < nodePaths.length; i++) {
ns.addNode(new XMLNode(this.arrOrigLoopPath[j], this.arrLoopPath[j],nodePaths[i], null));
}
nodesList.add(ns);
}
initLoopEntries();
}
private String[] getLoopPaths(String[] arrLoops) {
String[] loopPaths = new String[arrLoops.length];
for (int i = 0; i < arrLoops.length; i++) {
String column = arrLoops[i];
String resultCol = this.rootPath;
String[] splits = column.split("/");
for (String tmp : splits) {
if (tmp.equals("..")) {
resultCol = resultCol.substring(0, resultCol.lastIndexOf("/"));
} else if (tmp.equals(".")) {
} else if (!("").equals(tmp)) {
resultCol += "/" + tmp;
}
}
loopPaths[i] = resultCol;
}
return loopPaths;
}
/**
@@ -135,10 +76,7 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
String resultCol = node.loopPath;
String[] splits = column.split("/");
for (String tmp : splits) {
if (tmp.equals("..")) {
resultCol = resultCol.substring(0, resultCol.lastIndexOf("/"));
node.setAttrOutOfLoop(true);
} else if (tmp.equals(".")) {
if (tmp.equals(".")) {
node.isDot = true;
} else {
resultCol += "/" + tmp;
@@ -149,30 +87,7 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
}
private void initLoopEntries() {
multiCache = DataBufferCache2.getInstance();
for(XMLNodes ns : nodesList) {
for (XMLNode node : ns.getNodes().values()) {
String column = node.originPath;
String resultCol = node.loopPath;
String[] splits = column.split("/");
for (String tmp : splits) {
if (tmp.equals("..")) {
resultCol = resultCol.substring(0, resultCol.lastIndexOf("/"));
node.setAttrOutOfLoop(true);
} else if (tmp.equals(".")) {
node.isDot = true;
} else {
resultCol += "/" + tmp;
}
}
node.nodePath = resultCol;
}
}
}
/**
@@ -203,19 +118,7 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
public Object call() throws Exception {
Reader reader = null;
try {
DefaultHandler handler = null;
if(nodesList.size() > 0) {
SAXLoopCompositeHandler chd = new SAXLoopCompositeHandler();
for(int i=0;i<nodesList.size();i++) {
XMLNodes ns = nodesList.get(i);
chd.register(new SimpleSAXLoopHandler(ns, multiCache));
}
handler = chd;
} else {
hd = new SimpleSAXLoopHandler(nodes, bcache);
handler = hd;
}
hd = new SimpleSAXLoopHandler(nodes, bcache);
SAXParser saxParser = null;
if(!ignoreDTD) { //orginal code
saxParser = SAXParserFactory.newInstance().newSAXParser();
@@ -224,16 +127,16 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
spf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
saxParser = spf.newSAXParser();
}
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", hd);
if (fileURL != null) {
// routines.system.UnicodeReader.java is used to ignore the BOM of the source file.
reader = new UnicodeReader(new java.io.FileInputStream(fileURL),this.charset);
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
saxParser.parse(inSource, handler);
saxParser.parse(inSource, hd);
} else {
reader = new UnicodeReader(is,this.charset);
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
saxParser.parse(inSource, handler);
saxParser.parse(inSource, hd);
}
} finally {
try {
@@ -241,13 +144,7 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
reader.close();
}
} finally {
if(multiCache!=null) {
multiCache.notifyErrorOccurred();
}
if(bcache!=null) {
bcache.notifyErrorOccurred();
}
bcache.notifyErrorOccurred();
}
}
return null;
@@ -307,7 +204,8 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
* @see org.talend.xml.sax.commons.ISAXLooper#multiIterator()
*/
public Iterator<Map<String, Map<String, String>>> multiIterator() {
return new SimpleSAXMultiLoopIterator(multiCache);
// TODO Auto-generated method stub
return null;
}
public void setIgnoreDTD(boolean ignoreDTD) {

View File

@@ -1,26 +0,0 @@
package org.talend.xml.sax.simpleparser;
import java.util.Iterator;
import java.util.Map;
public class SimpleSAXMultiLoopIterator implements Iterator<Map<String, Map<String, String>>> {
private DataBufferCache2 cache;
public SimpleSAXMultiLoopIterator(DataBufferCache2 bcache) {
this.cache = bcache;
}
public boolean hasNext() {
return cache.hasData();
}
public Map<String,Map<String, String>> next() {
return cache.readData();
}
public void remove() {
throw new UnsupportedOperationException();
}
}

View File

@@ -23,8 +23,6 @@ public class XMLNode {
public boolean outputText = false;
public String originLoopPath;
public String loopPath;
public String nodePath;
@@ -34,14 +32,6 @@ public class XMLNode {
public boolean isAsXML = false;
public boolean isDot = false;
private boolean isAttrOutOfLoop = false;
private String attrValueOutOfLoop = "";
public void setAttrOutOfLoop(boolean isAttrOutOfLoop) {
this.isAttrOutOfLoop = isAttrOutOfLoop;
}
private StringBuffer value = new StringBuffer();
private boolean isNullValue = true;
@@ -61,18 +51,8 @@ public class XMLNode {
public XMLNode(String loopPath, String originPath, String nodePath) {
this(loopPath, originPath, nodePath, false, false);
}
public XMLNode(String originLoopPath,String loopPath, String originPath, String nodePath) {
this(loopPath, originPath, nodePath, false, false);
this.originLoopPath = originLoopPath;
}
public void addTextValue(String appendValue) {
if(isAttrOutOfLoop) {
attrValueOutOfLoop = appendValue;
return;
}
isNullValue = false;
if (appendValue != null) {
@@ -81,19 +61,11 @@ public class XMLNode {
}
public String getTextValue() {
if(isAttrOutOfLoop) {
return attrValueOutOfLoop;
}
if(isNullValue) return null;
return value.toString();
}
public void resetValue() {
if(isAttrOutOfLoop) {
return;
}
isNullValue = true;
value.setLength(0);
}

Some files were not shown because too many files have changed in this diff Show More