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
4124 changed files with 39126 additions and 103479 deletions

View File

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

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

@@ -15,7 +15,6 @@ Require-Bundle: org.talend.model,
org.apache.log4j,
org.eclipse.jet.editor,
org.talend.core,
org.talend.core.ui,
org.talend.designer.components.localprovider,
org.eclipse.jdt.core,
org.eclipse.xsd,
@@ -29,4 +28,3 @@ Export-Package: org.talend.componentdesigner,
org.talend.componentdesigner.manager,
org.talend.componentdesigner.ui
Bundle-ClassPath: .
Bundle-Vendor: .Talend SA.

View File

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

View File

@@ -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,11 +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.GlobalServiceRegister;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.service.IComponentsLocalProviderService;
import org.talend.repository.model.ComponentsFactoryProvider;
/**
* DOC slanglois class global comment. Detailled comment
@@ -54,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) {
@@ -65,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
@@ -93,16 +86,9 @@ public class PushToPaletteActionProvider extends CommonActionProvider {
/*
* (non-Javadoc) Method declared on IAction.
*/
@Override
public void run() {
String path = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsLocalProviderService.class)) {
IComponentsLocalProviderService service = (IComponentsLocalProviderService) GlobalServiceRegister.getDefault()
.getService(IComponentsLocalProviderService.class);
if (service != null) {
path = service.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(),
@@ -144,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$
@@ -170,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();
@@ -186,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

@@ -242,6 +242,7 @@
<import plugin="com.ibm.icu" version="4.2.1.v20100412" match="equivalent"/>
<import plugin="org.eclipse.wst.common.core" version="1.1.201" match="compatible"/>
<import plugin="org.eclipse.osgi.util" version="3.1.300" match="compatible"/>
<import plugin="org.talend.libraries.jdom"/>
<import plugin="org.talend.common.ui.runtime"/>
<import plugin="org.talend.libraries.jdbc.mysql"/>
<import plugin="org.talend.libraries.jdbc.jtds"/>
@@ -1340,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"
@@ -1388,6 +1393,12 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.talend.libraries.jdom"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="org.talend.libraries.jexcel"
download-size="0"
@@ -1413,11 +1424,4 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.talend.osgi.lib.loader"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

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

@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Abstract Map Plug-in
Bundle-SymbolicName: org.talend.designer.abstractmap;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 2.2.0.qualifier
Bundle-Activator: org.talend.designer.abstractmap.MapPlugin
Require-Bundle: org.eclipse.core.runtime,
org.talend.core,

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

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

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,12 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Alfresco Output Component Plug-in
Bundle-Name: Alfresco Output external component
Bundle-SymbolicName: org.talend.designer.alfrescooutput;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 2.2.0.qualifier
Bundle-Vendor: .Talend SA.
Require-Bundle: org.eclipse.core.runtime,
org.talend.core,
org.talend.core.ui,
org.talend.commons.ui,
org.talend.libraries.dom4j-jaxen,
org.talend.designer.codegen,

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

@@ -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

@@ -45,7 +45,7 @@ BusinessPaletteFactory.InputComment=Cr
BusinessPaletteFactory.Data=Données
BusinessPaletteFactory.Ellipse=Ellipse
BusinessPaletteFactory.Input=Lecture
BusinessPaletteFactory.List=liste
BusinessPaletteFactory.List=Liste
BusinessPaletteFactory.Relationshop=Relation
BusinessAbstractParser.ValueOfBooleanIsExpected=Une valeur de type Boolean est attendue
BusinessPaletteFactory.decision=Décision

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

@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.talend.designer.business.diagram; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 2.2.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.talend.designer.business.model.business.diagram.part.BusinessDiagramEditorPlugin
Bundle-Vendor: %providerName
@@ -19,7 +19,6 @@ Require-Bundle: org.eclipse.ui.ide,
org.eclipse.gmf.runtime.diagram.ui.properties,
org.apache.commons.collections,
org.talend.core,
org.talend.core.ui,
org.talend.core.repository,
org.talend.repository,
org.talend.model,
@@ -32,6 +31,5 @@ Require-Bundle: org.eclipse.ui.ide,
org.apache.batik.ext.awt,
org.talend.metadata.managment,
com.ibm.icu,
org.talend.libraries.apache,
org.talend.repository.items.importexport
org.talend.libraries.apache
Eclipse-LazyStart: true

View File

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

View File

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

View File

@@ -590,20 +590,5 @@
type="BUSINESS_PROCESS">
</repositoryNode>
</extension>
<extension
point="org.talend.repository.items.importexport.handler">
<importItemsProvider
id="org.talend.designer.business.diagram.importProvider"
name="Business Diagram importer"
priority="NORMAL">
<importItemsHandler
class="org.talend.designer.business.diagram.views.handler.BusinessDiagramImportHandler">
<parameter
name="type"
value="BUSINESS_PROCESS">
</parameter>
</importItemsHandler>
</importItemsProvider>
</extension>
</plugin>

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

@@ -1,43 +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.designer.business.diagram.views.handler;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.talend.commons.emf.TalendXMIResource;
import org.talend.repository.items.importexport.handlers.imports.ImportRepTypeHandler;
/**
* DOC ggu class global comment. Detailled comment
*/
public class BusinessDiagramImportHandler extends ImportRepTypeHandler {
/**
* DOC ggu BusinessDiagramImportHandler constructor comment.
*/
public BusinessDiagramImportHandler() {
super();
}
/*
* (non-Javadoc)
*
* @see
* org.talend.repository.items.importexport.handlers.imports.ImportRepTypeHandler#createItemResource(org.eclipse
* .emf.common.util.URI)
*/
@Override
protected Resource createItemResource(URI pathUri) {
return new TalendXMIResource(pathUri);
}
}

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

@@ -49,6 +49,7 @@ import org.talend.core.model.properties.ItemState;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.repository.RepositoryManager;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.ui.ILastVersionChecker;
import org.talend.designer.business.diagram.custom.actions.DiagramResourceManager;
@@ -208,6 +209,7 @@ public class BusinessDiagramEditor extends FileDiagramEditor implements IGotoMar
}
propertyIsDirty = false;
firePropertyChange(IEditorPart.PROP_DIRTY);
RepositoryManager.refreshSavedNode(repositoryEditorInput.getRepositoryNode());
}
}

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

@@ -21,8 +21,6 @@ CodeGeneratorEmittersPoolFactory.componentCompiled=Komponenten kompiliert in {0}
CodeGeneratorEmittersPoolFactory.failCompail=Kompilierung der Komponenten fehlgeschlafen : \r\n
CodeGeneratorEmittersPoolFactory.initialException=Ausnahme bei der Initialisierung
CodeGeneratorEmittersPoolFactory.jetEmitterInitialException=Fehler bei der JetEmitter Initialisierung
CodeGeneratorService.invalidLanguage1=Ungültiger Sprachtyp
CodeGeneratorService.invalidLanguage2=Ungültiger Sprachtyp
CodeGenInit.createProject=Erstelle {0} Projekt
CodeGenInit.deleteProject=Lösche {0} Projekt
CodeGenInit.initTemplate=Initialisiere Templates
@@ -89,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

@@ -132,4 +132,3 @@ FAMILY.Vertica=Vertica
FAMILY.VtigerCRM=VtigerCRM
FAMILY.XML=XML
CodeGeneratorEmittersPoolFactory.updatePaletteForEditors=Update the palette for editors
ComponentsPreferencePage.componentAssist=Enable Component Creation Assistant

View File

@@ -43,7 +43,7 @@ CodeGeneratorEmittersPoolFactory.dialogContent=La g
CodeGeneratorEmittersPoolFactory.operationCanceled=Opération annulée
ComponentsFactory.afterSystemComponent=après le(s) composant(s) système
ComponentsFactory.componentNotFound=Impossible de trouver le dossier du composant :
ComponentsFactory.load.components=Chargement des composants...
ComponentsFactory.load.components=Charger des composants...
ComponentsFactory.parentNotRecompiled=Attention\: les parents de *.inc.javajet ne sont pas recompilés.
ComponentsLocalProviderService.componentLoadError=Erreur de chargement du composant
ComponentsLocalProviderService.talendExchangeError=Erreur de Talend Exchange
@@ -60,7 +60,6 @@ ComponenttRunJobPreferencePage.showCorrespondingJob=Afficher le Job correspondan
XsdValidationCacheManager.unableLoadxsd=impossible de charger le fichier de cache de validation xsd
XsdValidationCacheManager.unableSavexsd=impossible d'enregistrer le fichier de cache de validation xsd
prefs.configuration.LINK_STYLE.AUTO=Auto
prefs.configuration.LINK_STYLE.BEZIER_CURVE=Courbes
prefs.configuration.LINK_STYLE.LINE=Lignes (rapide)
FAMILY.AS400=AS400
FAMILY.Access=Access
@@ -112,7 +111,7 @@ FAMILY.OLAP_Cube=Cube OLAP
FAMILY.Oracle=Oracle
FAMILY.Orchestration=Orchestration
FAMILY.Output=Ecriture
FAMILY.ParAccel=Paraccel
FAMILY.ParAccel=ParAccel
FAMILY.PostgreSQL=PostgreSQL
FAMILY.PostgresPlus=PostgresPlus
FAMILY.Processing=Transformation
@@ -131,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

@@ -65,24 +65,24 @@ prefs.configuration.LINK_STYLE.LINE=\u76F4\u7DDA(\u6700\u901F)
FAMILY.AS400=AS400
FAMILY.Access=Access
FAMILY.Alfresco=Alfresco
FAMILY.Business=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3
FAMILY.Business_Intelligence=\u30D3\u30B8\u30CD\u30B9\u30A4\u30F3\u30C6\u30EA\u30B8\u30A7\u30F3\u30B9
FAMILY.Business=Business
FAMILY.Business_Intelligence=Business Intelligence
FAMILY.CentricCRM=CentricCRM
FAMILY.Charts=Charts
FAMILY.Connections=\u63A5\u7D9A
FAMILY.Custom_Code=\u30AB\u30B9\u30BF\u30E0\u30B3\u30FC\u30C9
FAMILY.Connections=Connections
FAMILY.Custom_Code=Custom Code
FAMILY.DB2=DB2
FAMILY.DB_Generic=\u6C4E\u7528ODBC
FAMILY.DB_JDBC=\u6C4E\u7528JDBC
FAMILY.DB_Generic=DB Generic
FAMILY.DB_JDBC=DB JDBC
FAMILY.DB_SCD=DB SCD
FAMILY.Data_Quality=\u30C7\u30FC\u30BF\u30AF\u30AA\u30EA\u30C6\u30A3
FAMILY.Databases=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9
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=\u9805\u76EE\u5024\u5909\u63DB
FAMILY.Fields=Fields
FAMILY.File=\u30D5\u30A1\u30A4\u30EB
FAMILY.FireBird=Firebird
FAMILY.Greenplum=Greenplum
@@ -91,31 +91,30 @@ FAMILY.Healthcare=Healthcare
FAMILY.Hive=Hive
FAMILY.Informix=Informix
FAMILY.Ingres=Ingres
FAMILY.Input=\u30D5\u30A1\u30A4\u30EB\u5165\u529B
FAMILY.Input=Input
FAMILY.Interbase=Interbase
FAMILY.Internet=Internet
FAMILY.Jasper=Jasper
FAMILY.JavaDB=JavaDB
FAMILY.JDBC=\u6C4E\u7528JDBC
FAMILY.JDBC=JDBC
FAMILY.LDAP=LDAP
FAMILY.Logs_Errors=\u30ED\u30B0\uFF06\u30A8\u30E9\u30FC\u30CF\u30F3\u30C9\u30EA\u30F3\u30B0
FAMILY.Logs_Errors=Logs & Errors
FAMILY.MS_SQL_Server=MS SQL Server
FAMILY.MSSql=MSSql
FAMILY.Management=\u30D5\u30A1\u30A4\u30EB\u64CD\u4F5C
FAMILY.Management=Management
FAMILY.MaxDB=MaxDB
FAMILY.Microsoft_AX=Microsoft AX
FAMILY.Microsoft_CRM=Microsoft CRM
FAMILY.Misc=\u305D\u306E\u4ED6
FAMILY.Misc=Misc
FAMILY.MySQL=MySQL
FAMILY.Netezza=Netezza
FAMILY.OLAP_Cube=OLAP\u30AD\u30E5\u30FC\u30D6
FAMILY.OLAP_Cube=OLAP Cube
FAMILY.Oracle=Oracle
FAMILY.Orchestration=\u30D7\u30ED\u30BB\u30B9\u5236\u5FA1
FAMILY.Output=\u30D5\u30A1\u30A4\u30EB\u51FA\u529B
FAMILY.Orchestration=Orchestration
FAMILY.ParAccel=ParAccel
FAMILY.PostgreSQL=PostgreSQL
FAMILY.PostgresPlus=PostgresPlus
FAMILY.Processing=\u5909\u63DB\u51E6\u7406
FAMILY.Processing=Processing
FAMILY.SAP=SAP
FAMILY.Sas=Sas
FAMILY.SCD=SCD
@@ -131,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

@@ -3,6 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: Test
Bundle-SymbolicName: org.talend.designer.codegen.test
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.talend.designer.codegen
Fragment-Host: org.talend.designer.codegen;bundle-version="2.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit4

View File

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

View File

@@ -1,21 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CodeGen Plug-in
Bundle-Name: Codegen Plug-in
Bundle-SymbolicName: org.talend.designer.codegen;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 2.2.0.qualifier
Bundle-Localization: plugin
Require-Bundle: org.talend.core.repository,
org.eclipse.emf.codegen,
org.eclipse.jdt.core,
org.talend.repository,
org.talend.commons.ui,
org.eclipse.emf.ecore.xmi,
org.talend.model,
org.talend.metadata.managment,
org.talend.designer.core,
org.apache.xerces,
org.talend.core,
org.talend.core.ui,
org.eclipse.ui.workbench,
org.apache.log4j
Eclipse-LazyStart: true

View File

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

View File

@@ -2,7 +2,6 @@
<?eclipse version="3.2"?>
<plugin>
<extension-point id="additional_jetfile" name="Additional Jet File to generate" schema="schema/additional_jetfile.exsd"/>
<extension-point id="componentFilter" name="Component filter" schema="schema/componentFilter.exsd"/>
<extension
point="org.eclipse.ui.commands">
<command
@@ -51,13 +50,13 @@
<page
category="org.talend.core.prefs"
class="org.talend.designer.codegen.components.ui.ComponentsPreferencePage"
id="org.talend.designer.codegen.components.preference"
id="org.talend.designer.codegen.components.localprovider.page1"
name="%components">
</page>
<page
category="org.talend.designer.codegen.components.preference"
class="org.talend.designer.components.preference.ComponentsFormatPreferencePage"
id="org.talend.designer.codegen.components.preference.format"
category="org.talend.designer.codegen.components.localprovider.page1"
class="org.talend.designer.components.preference.labelformat.ComponentsFormatPreferencePage"
id="org.talend.designer.codegen.components.localprovider.page1"
name="%format">
</page>
</extension>

View File

@@ -72,47 +72,25 @@
camelContext.setRegistry(contextRegister);
<%
boolean isStudioEEVersion = org.talend.core.PluginChecker.isTIS();
List<? extends INode> cxfNodes = process.getNodesOfType("cCXF");
if( null != cxfNodes && cxfNodes.size() >0 ){
boolean hasCXFConsumer = false;
boolean hasCXFSAMLProvider = false;
for(INode n: cxfNodes){
int incomingConnections = n.getIncomingConnections().size();
if(incomingConnections > 0){
hasCXFConsumer = true;
}else{
String dataformat = ElementParameterParser.getValue(n, "__DATAFORMAT__");
String useServiceRegistry = ElementParameterParser.getValue(n, "__ENABLE_REGISTRY__");
if(!isStudioEEVersion || "RAW".equals(dataformat) || "CXF_MESSAGE".equals(dataformat)){
useServiceRegistry = "false";
}
String useSecurity = ElementParameterParser.getValue(n, "__ENABLE_SECURITY__");
if("true".equals(useServiceRegistry) || "RAW".equals(dataformat) || "CXF_MESSAGE".equals(dataformat)){
useSecurity = "false";
}
if("true".equals(useServiceRegistry) || ("true".equals(useSecurity) && "SAML".equals(ElementParameterParser.getValue(n, "__SECURITY_TYPE__")))){
hasCXFSAMLProvider = true;
}
if(hasCXFConsumer && hasCXFSAMLProvider){
break;
}
break;
}
}
if(hasCXFConsumer){
%>
contextRegister.register("CXF_PAYLOAD_HEADER_FILTER", consumerSoapHeaderFilter);
contextRegister.register("CXF_PAYLOAD_HEADER_FILTER", new CxfConsumerSoapHeaderFilter());
<%
}
if(hasCXFSAMLProvider){
%>
contextRegister.register("DEFAULT_CXF_BINDING", new CXFProviderBinding());
<% }
}
%>
<%
//then process cBeanRegister components
List<? extends INode> beanRegisterNodes = process.getNodesOfType("cBeanRegister");
if(beanRegisterNodes != null && beanRegisterNodes.size()>0){

View File

@@ -49,7 +49,7 @@
return String.valueOf(obj);
}
}
<%
List<? extends INode> cMailNodes = process.getNodesOfType("cMail");
if(cMailNodes.size() > 0){
@@ -101,29 +101,18 @@
boolean hasCXFComponent = false;
boolean hasCXFSamlTokenProvider = false;
boolean hasCXFSamlTokenConsumer = false;
boolean hasCXFSamlTokenAuthorizationConsumer = false;
boolean hasCXFUsernameTokenProvider = false;
boolean hasCXFUsernameTokenConsumer = false;
boolean hasCXFHTTPAuthConsumer = false;
boolean hasCXFHTTPAuthProvider = false;
boolean hasCXFComponentConsumer = false;
boolean hasCXFRegistryProvider = false;
boolean hasCXFRegistryConsumer = false;
boolean hasCXFCorrelationConsumer = false;
boolean hasCXFSAMLPropagateConsumer = false;
boolean isStudioEEVersion = org.talend.core.PluginChecker.isTIS();
List<? extends INode> cxfNodes = process.getNodesOfType("cCXF");
if( null != cxfNodes && cxfNodes.size() >0 ){
hasCXFComponent = true;
for(INode n: cxfNodes){
String useRegistry = "false";
if(isStudioEEVersion){
useRegistry = ElementParameterParser.getValue(n, "__ENABLE_REGISTRY__");
}
String useSecurity = ElementParameterParser.getValue(n, "__ENABLE_SECURITY__");
String formatType = ElementParameterParser.getValue(n, "__DATAFORMAT__");
if("RAW".equals(formatType) || "CXF_MESSAGE".equals(formatType)){
useRegistry = "false";
useSecurity = "false";
}
String securityType = ElementParameterParser.getValue(n, "__SECURITY_TYPE__");
@@ -131,44 +120,12 @@
if(!hasCXFComponentConsumer && incomingConnections>0){
hasCXFComponentConsumer = true;
}
String useCorrelation = ElementParameterParser.getValue(n, "__ENABLE_CORRELATION__");
if("RAW".equals(formatType)){
useCorrelation = "false";
}
if("false".equals(useCorrelation)){
useCorrelation = useRegistry;
}
if("true".equals(useCorrelation) && incomingConnections>0 ){
hasCXFCorrelationConsumer = true;
}
if("true".equals(useRegistry)){
useSecurity = "false";
if(incomingConnections == 0){
hasCXFRegistryProvider = true;
}else{
hasCXFRegistryConsumer = true;
if(!hasCXFSAMLPropagateConsumer && Boolean.parseBoolean(ElementParameterParser.getValue(n, "__USE_PROPAGATE_CREDENTIAL__"))){
hasCXFSAMLPropagateConsumer = true;
}
}
}
if("true".equals(useSecurity)){
if("SAML".equals(securityType) && (!hasCXFSamlTokenProvider || !hasCXFSamlTokenConsumer || !hasCXFSAMLPropagateConsumer)){
if("SAML".equals(securityType) && (!hasCXFSamlTokenProvider || !hasCXFSamlTokenConsumer)){
if(incomingConnections == 0){
hasCXFSamlTokenProvider = true;
}else{
hasCXFSamlTokenConsumer = true;
if(!hasCXFSamlTokenAuthorizationConsumer && isStudioEEVersion){
if("true".equals(ElementParameterParser.getValue(n, "__USE_AUTHORIZATION__"))){
hasCXFSamlTokenAuthorizationConsumer = true;
}
}
if(!hasCXFSAMLPropagateConsumer){
String samlSecurityType = ElementParameterParser.getValue(n, "__SAML_SECURITY_TYPES__");
if("PROPAGATE_UP".equals(samlSecurityType) || "PROPAGATE_AP".equals(samlSecurityType)){
hasCXFSAMLPropagateConsumer = true;
}
}
}
}else if("USER".equals(securityType) && (!hasCXFUsernameTokenProvider || !hasCXFUsernameTokenConsumer)){
if(incomingConnections == 0){
@@ -187,74 +144,17 @@
}
}
if(hasCXFSAMLPropagateConsumer){
%>
class CXFConsumerBinding extends org.apache.camel.component.cxf.DefaultCxfBinding {
private org.apache.camel.component.cxf.CxfEndpoint endpoint;
public CXFConsumerBinding(org.apache.camel.component.cxf.CxfEndpoint endpoint){
this.endpoint = endpoint;
setHeaderFilterStrategy(consumerSoapHeaderFilter);
}
@Override
protected void propagateHeadersFromCamelToCxf(org.apache.camel.Exchange camelExchange,
Map<String, Object> camelHeaders, org.apache.cxf.message.Exchange cxfExchange,
Map<String, Object> cxfContext) {
super.propagateHeadersFromCamelToCxf(camelExchange, camelHeaders, cxfExchange, cxfContext);
Object samlToken = camelHeaders.get("samlToken");
if(samlToken == null){
return;
}
Map<String, Object> properties = endpoint.getProperties();
if(properties == null){
return;
}
Object object = properties.get(org.apache.cxf.ws.security.SecurityConstants.STS_CLIENT);
if(object == null || !(object instanceof org.apache.cxf.ws.security.trust.STSClient)){
return;
}
org.apache.cxf.ws.security.trust.STSClient stsClient = (org.apache.cxf.ws.security.trust.STSClient) object;
stsClient.setOnBehalfOf(samlToken);
}
}
<% }
if(hasCXFRegistryProvider || hasCXFSamlTokenProvider){
%>
class CXFProviderBinding extends org.apache.camel.component.cxf.DefaultCxfBinding{
@Override
protected void propagateHeadersFromCxfToCamel( org.apache.cxf.message.Message cxfMessage,
org.apache.camel.Message camelMessage, org.apache.camel.Exchange camelExchange) {
super.propagateHeadersFromCxfToCamel(cxfMessage, camelMessage, camelExchange);
camelExchange.getIn().removeHeader("samlToken");
org.apache.cxf.security.SecurityContext securityContext = cxfMessage.get(org.apache.cxf.security.SecurityContext.class);
if(securityContext != null && securityContext instanceof org.apache.cxf.interceptor.security.SAMLSecurityContext){
org.apache.cxf.interceptor.security.SAMLSecurityContext ssc = (org.apache.cxf.interceptor.security.SAMLSecurityContext) securityContext;
org.w3c.dom.Element assertionElement = ssc.getAssertionElement();
if(assertionElement != null){
camelExchange.getIn().setHeader("samlToken", assertionElement);
}
}
}
}
<%
}
if(hasCXFComponent){
%>
private org.apache.camel.component.cxf.CxfEndpoint getCxfEndpoint(String uri, boolean isProvider, boolean useAuthorization, boolean usePropagateSamlAP, String... token){
private org.apache.camel.component.cxf.CxfEndpoint getCxfEndpoint(String uri, boolean isProvider, String... token){
org.apache.camel.component.cxf.CxfEndpoint cxfEndpoint = (org.apache.camel.component.cxf.CxfEndpoint)endpoint(uri);
<%if(hasCXFUsernameTokenProvider || hasCXFSamlTokenProvider || hasCXFSamlTokenConsumer || hasCXFHTTPAuthProvider || hasCXFRegistryProvider || hasCXFRegistryConsumer){%>
if( null != bundleContext ){
<%if(hasCXFUsernameTokenProvider || hasCXFSamlTokenProvider || hasCXFSamlTokenConsumer || hasCXFRegistryProvider || hasCXFRegistryConsumer){%>
org.apache.cxf.Bus bus = cxfEndpoint.getBus();
org.apache.cxf.Bus bus = cxfEndpoint.getBus();
org.apache.cxf.configuration.ConfiguredBeanLocator cbl = bus==null?null:bus.getExtension(org.apache.cxf.configuration.ConfiguredBeanLocator.class);
if(cbl != null){
bus.setExtension(new org.apache.cxf.bus.osgi.OSGiBeanLocator(cbl, bundleContext), org.apache.cxf.configuration.ConfiguredBeanLocator.class);
}
<%
}
if(hasCXFUsernameTokenProvider){
%>
if(isProvider&&token!=null&&"UsernameToken".equals(token[0])){
@@ -275,18 +175,11 @@
%>
if(token!=null&&"SAMLToken".equals(token[0])){
addSAMLToken(cxfEndpoint, bus, isProvider, useAuthorization, usePropagateSamlAP, token);
}
<% }
if(hasCXFRegistryProvider || hasCXFRegistryConsumer){
%>
if(token!=null&&"Registry".equals(token[0])){
addRegistry(cxfEndpoint, bus, isProvider, usePropagateSamlAP, token);
addSAMLToken(cxfEndpoint, bus, isProvider, token);
}
<%}%>
}
<%
}
if(hasCXFUsernameTokenConsumer){
%>
if(!isProvider&&token!=null&&token.length>=3&&"UsernameToken".equals(token[0])){
@@ -397,7 +290,7 @@ if(hasCXFUsernameTokenConsumer){
<%
}
}
if(hasCXFSamlTokenConsumer || hasCXFRegistryConsumer){
if(hasCXFSamlTokenConsumer){
%>
private Map<String, String> clientProperties;
@@ -443,18 +336,12 @@ class WSPasswordCallbackHandler implements javax.security.auth.callback.Callback
if(hasCXFComponentConsumer){
%>
org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy consumerSoapHeaderFilter = new org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy(){
class CxfConsumerSoapHeaderFilter extends org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy{
public boolean applyFilterToCamelHeaders(String headerName,
Object headerValue, org.apache.camel.Exchange exchange) {
//filter propagated cxf header
if(org.apache.cxf.headers.Header.HEADER_LIST.equals(headerName)){
return true;
}
//remove correlationID header, if it's null or empty
if("CorrelationID".equals(headerName)
&& (headerValue == null || "".equals(headerValue.toString()))){
return true;
}
return super.applyFilterToCamelHeaders(headerName, headerValue, exchange);
}
@@ -465,139 +352,21 @@ org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy consumerSoa
}
return super.applyFilterToExternalHeaders(headerName, headerValue, exchange);
}
};
<%
}
if(hasCXFRegistryProvider || hasCXFRegistryConsumer){
%>
private void addRegistry(org.apache.camel.component.cxf.CxfEndpoint cxfEndpoint, org.apache.cxf.Bus bus,
boolean isProvider, boolean usePropagateSamlAP, final String... token) {
<%if(hasCXFRegistryConsumer){
%>
if(!isProvider){
if(usePropagateSamlAP && (token[4] == null)){
usePropagateSamlAP = false ;
}
org.apache.cxf.ws.security.trust.STSClient stsClient = new org.apache.cxf.ws.security.trust.STSClient(
bus);
stsClient.setServiceQName(new javax.xml.namespace.QName(
stsProperties.get("sts.namespace"), stsProperties
.get("sts.service.name")));
Map<String, Object> stsProps = new HashMap<String, Object>();
for (Map.Entry<String, String> entry : stsProperties.entrySet()) {
if (org.apache.cxf.ws.security.SecurityConstants.ALL_PROPERTIES
.contains(entry.getKey())) {
stsProps.put(entry.getKey(), entry.getValue());
}
}
if(usePropagateSamlAP) {
stsClient.setWsdlLocation(stsProperties.get("sts.x509.wsdl.location"));
stsClient.setEndpointQName(new javax.xml.namespace.QName(
stsProperties.get("sts.namespace"), stsProperties
.get("sts.x509.endpoint.name")));
stsProps.put(org.apache.cxf.ws.security.SecurityConstants.STS_TOKEN_USERNAME,
token[4]);
}else {
stsClient.setWsdlLocation(stsProperties.get("sts.wsdl.location"));
stsClient.setEndpointQName(new javax.xml.namespace.QName(
stsProperties.get("sts.namespace"), stsProperties
.get("sts.endpoint.name")));
stsProps.put(org.apache.cxf.ws.security.SecurityConstants.USERNAME,
token[1]);
stsProps.put(org.apache.cxf.ws.security.SecurityConstants.PASSWORD,
token[2]);
}
stsClient.setProperties(stsProps);
if (token[3]/*Role*/ != null && !("".equals(token[3]))) {
ClaimValueCallbackHandler roleCallbackHandler = new ClaimValueCallbackHandler();
roleCallbackHandler.setClaimValue(token[3]);
stsClient.setClaimsCallbackHandler(roleCallbackHandler);
}
Map<String, Object> clientProps = new HashMap<String, Object>();
clientProps.put(org.apache.cxf.ws.security.SecurityConstants.USERNAME,
token[1]);
clientProps.put(org.apache.cxf.ws.security.SecurityConstants.PASSWORD,
token[2]);
clientProps.put(
org.apache.cxf.ws.security.SecurityConstants.STS_CLIENT,
stsClient);
for (Map.Entry<String, String> entry : clientProperties.entrySet()) {
if (org.apache.cxf.ws.security.SecurityConstants.ALL_PROPERTIES
.contains(entry.getKey())) {
clientProps.put(entry.getKey(), entry.getValue());
}
}
if(usePropagateSamlAP) {
clientProps.put(org.apache.cxf.ws.security.SecurityConstants.SIGNATURE_USERNAME, token[4]);
clientProps
.put(org.apache.cxf.ws.security.SecurityConstants.CALLBACK_HANDLER,
new WSPasswordCallbackHandler(token[4], token[2]));
}else {
clientProps
.put(org.apache.cxf.ws.security.SecurityConstants.CALLBACK_HANDLER,
new WSPasswordCallbackHandler(
clientProperties
.get(org.apache.cxf.ws.security.SecurityConstants.SIGNATURE_USERNAME),
clientProperties
.get("ws-security.signature.password")));
}
clientProps.put("soap.no.validate.parts", Boolean.TRUE);
clientProps.put("use.service.registry", "true");
// set the cxfEndpoint Properties
cxfEndpoint.setProperties(clientProps);
}
<%
}
if(hasCXFRegistryProvider){
%>
if (isProvider) {
String userName = (String) securityProps.get("ws-security.signature.username");
String password = (String) securityProps.get("ws-security.signature.password");
String properties = (String) securityProps.get("ws-security.signature.properties");
String pdpAddress = (String) securityProps.get("tesb.pdp.address");
org.apache.ws.security.validate.JAASUsernameTokenValidator jaasUTValidator=
new org.apache.ws.security.validate.JAASUsernameTokenValidator();
jaasUTValidator.setContextName("karaf");
// set endpoint properties
org.apache.cxf.interceptor.security.NamePasswordCallbackHandler callbackHandler = new org.apache.cxf.interceptor.security.NamePasswordCallbackHandler(
userName, password, "setPassword");
Map<String, Object> endpointProps = new HashMap<String, Object>();
endpointProps.put("ws-security.signature.username", userName);
endpointProps.put("ws-security.signature.properties", properties);
endpointProps.put("ws-security.callback-handler", callbackHandler);
endpointProps.put("ws-security.ut.validator", jaasUTValidator);
endpointProps.put("tesb.pdp.address", pdpAddress);
endpointProps.put("use.service.registry", "true");
cxfEndpoint.setProperties(endpointProps);
}
<%}%>
}
<%
}
if(hasCXFSamlTokenProvider || hasCXFRegistryProvider){
if(hasCXFSamlTokenProvider){
%>
private Map<String, String> securityProps;
private Map<String, String> samlProps;
public void setSecurityProps(Map<String, String> securityProps){
this.securityProps = securityProps;
public void setSamlProps(Map<String, String> samlProps){
this.samlProps = samlProps;
}
<%
}
if(hasCXFSamlTokenProvider || hasCXFSamlTokenConsumer
||hasCXFRegistryProvider || hasCXFRegistryConsumer){
if(hasCXFSamlTokenProvider || hasCXFSamlTokenConsumer){
%>
@@ -629,79 +398,27 @@ public void registerPolicies(org.apache.cxf.Bus bus) {
org.apache.neethi.PolicyRegistry policyRegistry =
bus.getExtension(org.apache.cxf.ws.policy.PolicyEngine.class).getRegistry();
policyRegistry.register("org.talend.esb.job.token.policy",
loadPolicy(policies.get("policy.username"), bus));
loadPolicy(policies.get("policy.token"), bus));
policyRegistry.register("org.talend.esb.job.saml.policy",
loadPolicy(policies.get("policy.saml"), bus));
policyRegistry.register("org.talend.esb.job.saml.authz.policy",
loadPolicy(policies.get("policy.saml.authz"), bus));
}
}
<%if(hasCXFSamlTokenAuthorizationConsumer || hasCXFRegistryConsumer){%>
class ClaimValueCallbackHandler implements javax.security.auth.callback.CallbackHandler {
private String claimValue;
public void handle(javax.security.auth.callback.Callback[] callbacks)
throws java.io.IOException, javax.security.auth.callback.UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof org.apache.cxf.ws.security.trust.claims.ClaimsCallback) {
org.apache.cxf.ws.security.trust.claims.ClaimsCallback callback = (org.apache.cxf.ws.security.trust.claims.ClaimsCallback) callbacks[i];
callback.setClaims(createClaims());
} else {
throw new javax.security.auth.callback.UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
}
}
}
/**
* Create a Claims Element for a "role"
*/
private org.w3c.dom.Element createClaims() {
org.w3c.dom.Document doc = org.apache.cxf.helpers.DOMUtils.createDocument();
org.w3c.dom.Element claimsElement =
doc.createElementNS("http://docs.oasis-open.org/ws-sx/ws-trust/200512", "Claims");
claimsElement.setAttributeNS(null, "Dialect", "http://schemas.xmlsoap.org/ws/2005/05/identity");
org.w3c.dom.Element claimValueElement =
doc.createElementNS("http://schemas.xmlsoap.org/ws/2005/05/identity", "ClaimValue");
claimValueElement.setAttributeNS(null, "Uri", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role");
org.w3c.dom.Element value = doc.createElementNS("http://schemas.xmlsoap.org/ws/2005/05/identity", "Value");
value.setTextContent(claimValue);
claimValueElement.appendChild(value);
claimsElement.appendChild(claimValueElement);
return claimsElement;
}
public String getClaimValue() {
return claimValue;
}
public void setClaimValue(String claimValue) {
this.claimValue = claimValue;
}
}
<%}
if(hasCXFSamlTokenConsumer || hasCXFSamlTokenProvider){
%>
private void addSAMLToken(org.apache.camel.component.cxf.CxfEndpoint cxfEndpoint, org.apache.cxf.Bus bus,
boolean isProvider, boolean useAuthorization, boolean usePropagateSamlAP, String... token) {
boolean isProvider, String... token) {
<%
if(hasCXFSamlTokenConsumer){
%>
if (!isProvider) {
org.apache.cxf.ws.security.trust.STSClient stsClient = new org.apache.cxf.ws.security.trust.STSClient(
bus);
stsClient.setWsdlLocation(stsProperties.get("sts.wsdl.location"));
stsClient.setServiceQName(new javax.xml.namespace.QName(
stsProperties.get("sts.namespace"), stsProperties
.get("sts.service.name")));
.get("sts.service.name")));
stsClient.setEndpointQName(new javax.xml.namespace.QName(
stsProperties.get("sts.namespace"), stsProperties
.get("sts.endpoint.name")));
Map<String, Object> stsProps = new HashMap<String, Object>();
@@ -712,31 +429,12 @@ if(hasCXFSamlTokenConsumer){
}
}
if(usePropagateSamlAP) {
stsClient.setWsdlLocation(stsProperties.get("sts.x509.wsdl.location"));
stsClient.setEndpointQName(new javax.xml.namespace.QName(
stsProperties.get("sts.namespace"), stsProperties
.get("sts.x509.endpoint.name")));
stsProps.put(org.apache.cxf.ws.security.SecurityConstants.STS_TOKEN_USERNAME,
token[4]);
}else {
stsClient.setWsdlLocation(stsProperties.get("sts.wsdl.location"));
stsClient.setEndpointQName(new javax.xml.namespace.QName(
stsProperties.get("sts.namespace"), stsProperties
.get("sts.endpoint.name")));
stsProps.put(org.apache.cxf.ws.security.SecurityConstants.USERNAME,
token[1]);
stsProps.put(org.apache.cxf.ws.security.SecurityConstants.PASSWORD,
token[2]);
}
stsProps.put(org.apache.cxf.ws.security.SecurityConstants.USERNAME,
token[1]);
stsProps.put(org.apache.cxf.ws.security.SecurityConstants.PASSWORD,
token[2]);
stsClient.setProperties(stsProps);
<%if(hasCXFSamlTokenAuthorizationConsumer){%>
if (token[3] != null && !("".equals(token[3]))) {
ClaimValueCallbackHandler roleCallbackHandler = new ClaimValueCallbackHandler();
roleCallbackHandler.setClaimValue(token[3]);
stsClient.setClaimsCallbackHandler(roleCallbackHandler);
}
<%}%>
Map<String, Object> clientProps = new HashMap<String, Object>();
clientProps.put(
org.apache.cxf.ws.security.SecurityConstants.STS_CLIENT,
@@ -748,30 +446,19 @@ if(hasCXFSamlTokenConsumer){
clientProps.put(entry.getKey(), entry.getValue());
}
}
if(usePropagateSamlAP) {
clientProps.put(org.apache.cxf.ws.security.SecurityConstants.SIGNATURE_USERNAME, token[4]);
clientProps
.put(org.apache.cxf.ws.security.SecurityConstants.CALLBACK_HANDLER,
new WSPasswordCallbackHandler(token[4], token[2]));
}else {
clientProps
.put(org.apache.cxf.ws.security.SecurityConstants.CALLBACK_HANDLER,
new WSPasswordCallbackHandler(
clientProperties
.get(org.apache.cxf.ws.security.SecurityConstants.SIGNATURE_USERNAME),
clientProperties
.get("ws-security.signature.password")));
}
clientProps
.put(org.apache.cxf.ws.security.SecurityConstants.CALLBACK_HANDLER,
new WSPasswordCallbackHandler(
clientProperties
.get(org.apache.cxf.ws.security.SecurityConstants.SIGNATURE_USERNAME),
clientProperties
.get("ws-security.signature.password")));
// set the cxfEndpoint Properties
cxfEndpoint.setProperties(clientProps);
// add policy
org.apache.neethi.PolicyReference policyReference = new org.apache.neethi.PolicyReference();
if(useAuthorization){
policyReference.setURI("org.talend.esb.job.saml.authz.policy");
}else{
policyReference.setURI("org.talend.esb.job.saml.policy");
}
policyReference.setURI("org.talend.esb.job.saml.policy");
org.apache.neethi.Policy policy = new org.apache.neethi.Policy();
policy.addPolicyComponent(policyReference);
@@ -787,19 +474,17 @@ if(hasCXFSamlTokenProvider){
%>
if (isProvider) {
// get saml properties
String userName = (String) securityProps
String userName = (String) samlProps
.get("ws-security.signature.username");
String password = (String) securityProps
String password = (String) samlProps
.get("ws-security.signature.password");
String properties = (String) securityProps
String properties = (String) samlProps
.get("ws-security.signature.properties");
// add in intercept
Map<String, Object> props = new HashMap<String, Object>();
props.put(
org.apache.ws.security.handler.WSHandlerConstants.ACTION,
org.apache.ws.security.handler.WSHandlerConstants.ENCRYPT+" "
+org.apache.ws.security.handler.WSHandlerConstants.SAML_TOKEN_SIGNED+" "
+org.apache.ws.security.handler.WSHandlerConstants.SIGNATURE);
org.apache.ws.security.handler.WSHandlerConstants.SAML_TOKEN_SIGNED);
props.put(
org.apache.ws.security.handler.WSHandlerConstants.SIG_PROP_FILE,
properties);
@@ -817,20 +502,10 @@ if (isProvider) {
properties);
endpointProps.put("ws-security.callback-handler",
callbackHandler);
endpointProps.put("use.service.registry",
"false");
if(useAuthorization){
endpointProps.put("tesb.pdp.address", (String)securityProps
.get("tesb.pdp.address"));
}
cxfEndpoint.setProperties(endpointProps);
// add policy
org.apache.neethi.PolicyReference policyReference = new org.apache.neethi.PolicyReference();
if(!useAuthorization){
policyReference.setURI("org.talend.esb.job.saml.policy");
}else{
policyReference.setURI("org.talend.esb.job.saml.authz.policy");
}
policyReference.setURI("org.talend.esb.job.saml.policy");
org.apache.neethi.Policy policy = new org.apache.neethi.Policy();
policy.addPolicyComponent(policyReference);
@@ -841,13 +516,11 @@ if (isProvider) {
registerPolicies(bus);
}
<%
}//end if(hasCXFSamlTokenProvider){
%>
}<%
}//end if(hasCXFSamlTokenConsumer || hasCXFSamlTokenProvider){
}//end if(hasCXFSamlTokenProvider || hasCXFSamlTokenConsumer
//||hasCXFRegistryProvider || hasCXFRegistryConsumer){
}
%>
}
<%}%>
/**
* please initial uri map
*/
@@ -872,103 +545,44 @@ if (isProvider) {
String endpointVar = "endpoint_" + node.getUniqueName();
String uriRef = "uriMap.get(\"" + cid + "\")";
String formatType = ElementParameterParser.getValue(node, "__DATAFORMAT__");
boolean useRegistry = false;
boolean useSecurity = false;
if(!"RAW".equals(formatType) && !"CXF_MESSAGE".equals(formatType)){
if(isStudioEEVersion){
useRegistry = "true".equals(ElementParameterParser.getValue(node, "__ENABLE_REGISTRY__"));
}
if(!useRegistry){
useSecurity = "true".equals(ElementParameterParser.getValue(node, "__ENABLE_SECURITY__"));
}
String useSecurity = ElementParameterParser.getValue(node, "__ENABLE_SECURITY__");
if("RAW".equals(formatType) || "CXF_MESSAGE".equals(formatType)){
useSecurity = "false";
}
String role = ElementParameterParser.getValue(node, "__ROLE_NAME__");
String securityType = ElementParameterParser.getValue(node, "__SECURITY_TYPE__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String password = ElementParameterParser.getValue(node, "__PASSWORD__");
String roleName = "\"\"";
String alias = ElementParameterParser.getValue(node, "__ALIASNAME__").trim();
boolean isProvider = node.getIncomingConnections().size()>0?false:true;
boolean isUseAuthorization = false;
String securityToken = "(String[])null";
boolean isUsePropagateSamlUP = false;
boolean isUsePropagateSamlAP = false;
if(useRegistry){
securityToken = "\"Registry\"";
String usePropagate = ElementParameterParser.getValue(node, "__USE_PROPAGATE_CREDENTIAL__");
if("true".equals(usePropagate)){
if(alias == null || alias.matches("\"?\\s*\"?")) {
//no alias.
isUsePropagateSamlUP = true;
}else {
isUsePropagateSamlUP = false;
}
isUsePropagateSamlAP = !isUsePropagateSamlUP;
}
}else if(useSecurity){
if("true".equals(useSecurity)){
if("USER".equals(securityType)){
securityToken = "\"UsernameToken\"";
}else if("SAML".equals(securityType)){
securityToken = "\"SAMLToken\"";
String samlSecurityType = ElementParameterParser.getValue(node, "__SAML_SECURITY_TYPES__");
if("PROPAGATE_UP".equals(samlSecurityType)) {
isUsePropagateSamlUP = true;
}else if ("PROPAGATE_AP".equals(samlSecurityType)) {
isUsePropagateSamlAP = true;
username = "null";
}
if(isStudioEEVersion){
isUseAuthorization = "true".equals(ElementParameterParser.getValue(node, "__USE_AUTHORIZATION__"));
}
}else if("BASIC".equals(securityType)){
securityToken = "org.apache.cxf.transport.http.auth.HttpAuthHeader.AUTH_TYPE_BASIC";
}else if("DIGEST".equals(securityType)){
securityToken = "org.apache.cxf.transport.http.auth.HttpAuthHeader.AUTH_TYPE_DIGEST";
}
}else{
isProvider = false;
}
if(!isProvider && (useRegistry || isUseAuthorization)) {
roleName = ElementParameterParser.getValue(node, "__ROLE_NAME__");
if(null == roleName || "".equals(roleName)){
roleName = "\"\"";
}
}
%>
// CXF endpoint for <%=cid%>
org.apache.camel.component.cxf.CxfEndpoint <%=endpointVar%> = getCxfEndpoint(<%=uriRef%>, <%=isProvider%>, <%=isUseAuthorization%>, <%=isUsePropagateSamlAP%>, <%=securityToken%>
org.apache.camel.component.cxf.CxfEndpoint <%=endpointVar%> = getCxfEndpoint(<%=uriRef%>, <%=isProvider%>, <%=securityToken%>
<%
if((useSecurity || useRegistry) && !isProvider){
if("true".equals(useSecurity) && !isProvider){
%>
,<%=username%>,<%=password%>, <%=roleName%>, <%=alias%>
,<%=username%>,<%=password%>
<%
}
%>
);
<%
if((isUsePropagateSamlUP || isUsePropagateSamlAP) && !isProvider){
%>
<%=endpointVar%>.setCxfBinding(new CXFConsumerBinding(<%=endpointVar%>));
<%
}
String useSL = ElementParameterParser.getValue(node, "__ENABLE_SL__");
String useSAM = ElementParameterParser.getValue(node, "__ENABLE_SAM__");
String useCorrelation = ElementParameterParser.getValue(node, "__ENABLE_CORRELATION__");
if("RAW".equals(formatType)){
useCorrelation = "false";
}
String correlationValue = ElementParameterParser.getValue(node, "__CORRELATION_VALUE__");
if(correlationValue != null && "".equals(correlationValue.trim())){
correlationValue = null;
}
if ("true".equals(useCorrelation) && !useRegistry) {
%>
<%=endpointVar%>.getFeatures().add(new org.talend.esb.policy.correlation.feature.CorrelationIDFeature());
<% }
if ("true".equals(useSL) && (isProvider || !useRegistry)) {
if ("true".equals(useSL)) {
List<Map<String, String>> customProperties = (List<Map<String,String>>) ElementParameterParser.getObjectValue(node, "__SL_META_DATA__");
%>
// Add Service Locator Service to <%=endpointVar%>
@@ -1003,13 +617,11 @@ if (isProvider) {
<%
}
//http://jira.talendforge.org/browse/TESB-3850
// !"true".equals(useRegistry) - https://jira.talendforge.org/browse/TESB-10725
if ("true".equals(useSAM) && !"RAW".equals(formatType) && !useRegistry) {
if ("true".equals(useSAM) && !"RAW".equals(formatType)) {
%>
// Add Service Activity Monitor Service to <%=endpointVar%>
if (eventFeature != null) {
((org.apache.camel.component.cxf.CxfEndpoint)<%=endpointVar%>).getFeatures().add(new FeatureWrapper(eventFeature));
((org.apache.camel.component.cxf.CxfEndpoint)<%=endpointVar%>).getFeatures().add(eventFeature);
}
<%
}

View File

@@ -8,7 +8,6 @@
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.Set
@@ -135,13 +134,6 @@ start_Hash.put("<%=node.getUniqueName() %>", System.currentTimeMillis());
}
}
%>
<%
if(node.isVirtualGenerateNode()){
%>
currentVirtualComponent = "<%=NodeUtil.getVirtualUniqueName(node)%>";
<%
}
%>
currentComponent="<%=node.getUniqueName() %>";
<%

View File

@@ -33,7 +33,6 @@
List<IContextParameter> params = new ArrayList<IContextParameter>();
params=process.getContextManager().getDefaultContext().getContextParameterList();
String jobFolderName = JavaResourcesHelper.getJobFolderName(process.getName(), process.getVersion());
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(process, "__LOG4J_ACTIVATE__"));
boolean exist_tParallelize = false;
List<? extends INode> tParallelizeList = process.getNodesOfType("tParallelize");
@@ -91,7 +90,6 @@
public String fatherNode = null;
public long startTime = 0;
public boolean isChildJob = false;
public String log4jLevel = null;
private boolean execStat = true;
@@ -106,9 +104,9 @@
<% if (hasSAM4RS) { %>
// ESB Service Activity Monitor Feature
private org.apache.cxf.feature.Feature eventFeature;
private org.apache.cxf.feature.AbstractFeature eventFeature;
public void setEventFeature(org.apache.cxf.feature.Feature eventFeature) {
public void setEventFeature(org.apache.cxf.feature.AbstractFeature eventFeature) {
this.eventFeature = eventFeature;
}
<% } %>
@@ -144,12 +142,6 @@
final <%=process.getName() %> <%=process.getName() %>Class = new <%=process.getName() %>();
int exitCode = <%=process.getName() %>Class.runJobInTOS(args);
<%if(isLog4jEnabled){%>
if(exitCode==0){
log.info("TalendJob: '<%=codeGenArgument.getJobName()%>' - Done.");
}
<%}%>
System.exit(exitCode);
}
@@ -175,8 +167,6 @@
public int runJobInTOS(String[] args) {
// reset status
status = "";
String lastStr = "";
for (String arg : args) {
@@ -190,28 +180,6 @@
}
}
<%if(isLog4jEnabled){%>
if(log4jLevel!=null){
if("trace".equalsIgnoreCase(log4jLevel)){
log.setLevel(org.apache.log4j.Level.TRACE);
}else if("debug".equalsIgnoreCase(log4jLevel)){
log.setLevel(org.apache.log4j.Level.DEBUG);
}else if("info".equalsIgnoreCase(log4jLevel)){
log.setLevel(org.apache.log4j.Level.INFO);
}else if("warn".equalsIgnoreCase(log4jLevel)){
log.setLevel(org.apache.log4j.Level.WARN);
}else if("error".equalsIgnoreCase(log4jLevel)){
log.setLevel(org.apache.log4j.Level.ERROR);
}else if("fatal".equalsIgnoreCase(log4jLevel)){
log.setLevel(org.apache.log4j.Level.FATAL);
}else if ("off".equalsIgnoreCase(log4jLevel)){
log.setLevel(org.apache.log4j.Level.OFF);
}
org.apache.log4j.Logger.getRootLogger().setLevel(log.getLevel());
}
log.info("TalendJob: '<%=codeGenArgument.getJobName()%>' - Start.");
<%}%>
if(clientHost == null) {
clientHost = defaultClientHost;
}
@@ -740,9 +708,7 @@ if (execStat) {
context_param.put(keyValue.substring(0, index), keyValue.substring(index + 1) );
}
}
}else if (arg.startsWith("--log4jLevel=")) {
log4jLevel = arg.substring(13);
}
}
}

View File

@@ -80,27 +80,18 @@ if(librariesSb.length()>0){
}
<%
}
if(stats) { %>
// add statistics which shows on the connection
final routines.system.CamelStat runStat = new routines.system.CamelStat(getCamelContexts().get(0));
<%
for (INode node : processNodes) {
if (node.isActivate()) {
for(int i=0; i<node.getIncomingConnections().size(); i++) {
%>
runStat.addConnectionMapping("<%=node.getUniqueName()%>", "<%=node.getIncomingConnections().get(i).getUniqueName()%>");
<%
}
}
}
%>
runStat.initStatisticsInterceptor();
<% } //if stats %>
//start camel context
getCamelContexts().get(0).start();
<% if(stats) { %>
// add statistics which shows on the connection
routines.system.CamelStat runStat = new routines.system.CamelStat(getCamelContexts().get(0));
runStat.setParams();
runStat.openSocket(true);
runStat.setAllPID(pid, pid, pid, jobName);
runStat.startThreadStat(clientHost, portStats);
@@ -417,68 +408,62 @@ for (IContextParameter ctxParam : params) {
}
}
class <%=process.getName()%>_Registry extends SimpleRegistry {
class <%=process.getName()%>_Registry implements Registry {
private Map<String, Object> map = new HashMap<String, Object>();
private Registry wrapped = null;
public <%=process.getName()%>_Registry() {
this(new SimpleRegistry());
this(null);
}
public <%=process.getName()%>_Registry(Registry wrapped) {
this.wrapped = wrapped;
}
@Override
public Object lookupByName(String name) {
public Object lookup(String name) {
Object obj = null;
if (wrapped != null) {
obj = wrapped.lookupByName(name);
obj = wrapped.lookup(name);
}
if (obj == null) {
obj = super.lookupByName(name);
obj = map.get(name);
}
return obj;
}
@Override
public <T> T lookupByNameAndType(String name, Class<T> type) {
public <T> T lookup(String name, Class<T> type) {
T t = null;
if (wrapped != null) {
t = wrapped.lookupByNameAndType(name, type);
t = wrapped.lookup(name, type);
}
if (t == null) {
t = super.lookupByNameAndType(name, type);
t = (T) map.get(name);
}
return t;
}
@Override
public <T> Map<String, T> findByTypeWithName(Class<T> type) {
public <T> Map<String, T> lookupByType(Class<T> type) {
Map<String, T> result = null;
if (wrapped != null) {
result = wrapped.findByTypeWithName(type);
result = wrapped.lookupByType(type);
}
if (result == null) {
result = super.findByTypeWithName(type);
result = new HashMap<String, T>();
}
if (result.isEmpty()) {
for (Map.Entry<String, Object> entry : map.entrySet()) {
if (type.isInstance(entry.getValue())) {
result.put(entry.getKey(), type.cast(entry.getValue()));
}
}
}
return result;
}
@Override
public <T> Set<T> findByType(Class<T> type){
Set<T> result = null;
if (wrapped != null) {
result = wrapped.findByType(type);
}
if (result == null) {
result = super.findByType(type);
}
return result;
}
public void register(String name, Object instance) {
put(name, instance);
map.put(name, instance);
}
}

View File

@@ -118,8 +118,6 @@ boolean actAsConsumer = !process.getNodesOfType("tESBConsumer").isEmpty();
boolean talendEsbJob = actAsProvider || actAsConsumer || !process.getNodesOfType("tRouteInput").isEmpty();
boolean talendEsbJobFactory = actAsProvider || !process.getNodesOfType("tRouteInput").isEmpty();
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(process, "__LOG4J_ACTIVATE__"));
if (talendMdmJob) {
talendJobInterfaces += ", TalendMDMJob"; // Talend MDM job
}
@@ -131,10 +129,6 @@ if (talendEsbJobFactory) {
}
%>
public class <%=process.getName()%> implements <%=talendJobInterfaces%> {
<%if(isLog4jEnabled){%>
static {System.setProperty("TalendJob.log", "<%=process.getName() %>.log");}
private static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(<%=process.getName() %>.class);
<%}%>
<% if (talendEsbJob) { %>
private ESBEndpointRegistry registry = null;
@@ -266,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) {
@@ -380,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;
@@ -403,9 +377,6 @@ private class TalendException extends java.lang.Exception {
@Override
public void printStackTrace() {
if (!(e instanceof TalendException || e instanceof TDieException)) {
if(virtualComponentName!=null && currentComponent.indexOf(virtualComponentName+"_")==0){
globalMap.put(virtualComponentName+"_ERROR_MESSAGE",e.getMessage());
}
globalMap.put(currentComponent+"_ERROR_MESSAGE",e.getMessage());
System.err.println("Exception in component " + currentComponent);
}
@@ -522,6 +493,17 @@ private class TalendException extends java.lang.Exception {
}
}
%>
} else {
<%
if (isRunInMultiThread ) {
%>
((java.util.Map)threadLocal.get()).put("status", "failure");
<%
} else {%>
status = "failure";
<%
}
%>
}
}
}
@@ -543,11 +525,7 @@ private class TalendException extends java.lang.Exception {
// 1) add the message to the stack
%>
if(!(exception instanceof TDieException)){
<%if("true".equals(ElementParameterParser.getValue(assertCatcher, "__GET_ORIGINAL_EXCEPTION__"))){%>
<%=assertCatcher.getUniqueName()%>.addMessage(pid, projectName, jobName, "java", null, "Failed", "Job execution error", exception);
<%}else{%>
<%=assertCatcher.getUniqueName()%>.addMessage(pid, projectName, jobName, "java", null, "Failed", "Job execution error", exception.getMessage());
<%}%>
<%=assertCatcher.getUniqueName()%>.addMessage(pid, projectName, jobName, "java", null, "Failed", "Job execution error", exception.getMessage());
<%=assertCatcher.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
}
<%

View File

@@ -34,8 +34,6 @@
IProcess process = (IProcess) v.get(0);
String version = (String) v.get(1);
boolean isStudioEEVersion = org.talend.core.PluginChecker.isTIS();
List<? extends INode> processNodes = (List<? extends INode>) process.getGeneratingNodes();
List<? extends INode> graphicalNodes = (List<? extends INode>) process.getGraphicalNodes();
boolean stats = codeGenArgument.isStatistics();
@@ -87,8 +85,6 @@ package <%= packageName %>;
importsSet.add("import java.util.Properties");
importsSet.add("import org.apache.camel.management.JmxNotificationEventNotifier");
importsSet.add("import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext");
importsSet.add("import org.apache.camel.impl.SimpleRegistry");
importsSet.add("import java.util.Set");
String headerImports = ElementParameterParser.getValue(process, "__HEADER_IMPORT__");
if(headerImports!=null && !"".equals(headerImports.trim())){
@@ -166,49 +162,16 @@ package <%= packageName %>;
%>
<%
for (INode node : graphicalNodes) {
String useRegistry = "false";
String dataFormat = ElementParameterParser.getValue(node, "__DATAFORMAT__");
if(isStudioEEVersion && !"RAW".equals(dataFormat) && !"CXF_MESSAGE".equals(dataFormat)){
useRegistry = ElementParameterParser.getValue(node, "__ENABLE_REGISTRY__");
}
if("cCXF".equals(node.getComponent().getName())
&& "true".equals(ElementParameterParser.getValue(node, "__ENABLE_SAM__"))
&& !"RAW".equals(ElementParameterParser.getValue(node, "__DATAFORMAT__"))&& !"true".equals(useRegistry) ) { %>
&& !"RAW".equals(ElementParameterParser.getValue(node, "__DATAFORMAT__"))) { %>
//ESB Service Activity Monitor Feature
private org.apache.cxf.feature.Feature eventFeature;
private org.apache.cxf.feature.AbstractFeature eventFeature;
public void setEventFeature(org.apache.cxf.feature.Feature eventFeature) {
public void setEventFeature(org.apache.cxf.feature.AbstractFeature eventFeature) {
this.eventFeature = eventFeature;
}
// https://issues.apache.org/jira/browse/CAMEL-6783
static class FeatureWrapper extends org.apache.cxf.feature.AbstractFeature {
private final org.apache.cxf.feature.Feature f;
public FeatureWrapper(org.apache.cxf.feature.Feature f) {
this.f = f;
}
public void initialize(org.apache.cxf.endpoint.Server server, org.apache.cxf.Bus bus) {
f.initialize(server, bus);
}
public void initialize(org.apache.cxf.endpoint.Client client, org.apache.cxf.Bus bus) {
f.initialize(client, bus);
}
public void initialize(org.apache.cxf.interceptor.InterceptorProvider interceptorProvider, org.apache.cxf.Bus bus) {
f.initialize(interceptorProvider, bus);
}
public void initialize(org.apache.cxf.Bus bus) {
f.initialize(bus);
}
}
<% break;
}
}
@@ -315,35 +278,6 @@ for (INode node : graphicalNodes) {
uri = uri + sb.toString();
}
}
}else if("cDirectVM".equals(componentName)){
boolean inputName= getBoolValue(node, "____INPUT_ENDPOINT_NAME____");
boolean isProducer = node.getIncomingConnections().size()>0;
INode consumerNode = node;
if(isProducer && !inputName){
String desNodeName= (String)getValue(node, "____ROUTE_COMPONENT_TYPE_ID____");
if(desNodeName!=null){
List<? extends INode> allNodes = node.getProcess().getGraphicalNodes();
for(INode aNode : allNodes){
if(aNode.getUniqueName().equals(desNodeName)){
consumerNode=aNode;
break;
}
}
}
}
String endpointName=getValue(consumerNode, "__ENDPOINT_NAME__");
uri="\"direct-vm:\"+" + endpointName;
if(isProducer){
boolean isBlock= getBoolValue(node, "____BLOCK____");
if(isBlock){
uri += "+\"?block=true&timeout="+getValue(consumerNode, "__TIMEOUT__")+"\"";
}
}
}else if("cTimer".equals(componentName)){
uri = "\"timer:\"+\""+node.getUniqueName()+"\"";
StringBuilder sb = new StringBuilder();
@@ -363,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);
@@ -508,26 +442,16 @@ for (INode node : graphicalNodes) {
} else if ("cCXF".equals(componentName)) {
String url = ElementParameterParser.getValue(node, "__ADDRESS__").trim();
String dataformat = ElementParameterParser.getValue(node, "__DATAFORMAT__");
String useServiceRegistry = ElementParameterParser.getValue(node, "__ENABLE_REGISTRY__");
if(!isStudioEEVersion || "RAW".equals(dataformat) || "CXF_MESSAGE".equals(dataformat)){
useServiceRegistry = "false";
}
String useSecurity = ElementParameterParser.getValue(node, "__ENABLE_SECURITY__");
if("true".equals(useServiceRegistry) || "RAW".equals(dataformat) || "CXF_MESSAGE".equals(dataformat)){
useSecurity = "false";
}
List<? extends IConnection> conns = node.getIncomingConnections();
if ("true".equals(ElementParameterParser.getValue(node, "__ENABLE_SL__"))
&& "false".equals(useServiceRegistry)) {
if ("true".equals(ElementParameterParser.getValue(node, "__ENABLE_SL__"))) {
if (!conns.isEmpty()) {
// consumer role
url = "((null == bundleContext) ? " + url + " : \"locator://locator/\")";
INode source = conns.get(0).getSource();
if (!("cErrorHandler".equals(source.getComponent().getName())
&& source.getIncomingConnections().isEmpty())) {
// consumer role
url = "((null == bundleContext) ? " + url + " : \"locator://locator/\")";
}
}
}
@@ -555,7 +479,7 @@ for (INode node : graphicalNodes) {
}
String dataformat = ElementParameterParser.getValue(node, "__DATAFORMAT__");
sb.append("+\"&dataFormat=" + dataformat + "\"");
String specifyService = ElementParameterParser.getValue(node, "__SPECIFY_SERVICE__");
@@ -573,8 +497,6 @@ for (INode node : graphicalNodes) {
if(!conns.isEmpty()){
sb.append("+\"&headerFilterStrategy=#CXF_PAYLOAD_HEADER_FILTER\"");
}else if("true".equals(useServiceRegistry) || ("true".equals(useSecurity) && "SAML".equals(ElementParameterParser.getValue(node, "__SECURITY_TYPE__")))) {
sb.append("+\"&cxfBinding=#DEFAULT_CXF_BINDING\"");
}
uri = sb.toString();

View File

@@ -69,15 +69,7 @@ if(execStat){
talendThreadPool.setErrorThread(this);
talendThreadPool.stopAllWorkers();
TalendException te = new TalendException(e, currentComponent, globalMap);
<%
if(NodeUtil.hasVirtualComponent(subTree.getNodes())){
%>
te.setVirtualComponentName(currentVirtualComponent);
<%
}
%>
te.printStackTrace();
new TalendException(e, currentComponent, globalMap).printStackTrace();
}
this.isRunning = false;

View File

@@ -183,13 +183,6 @@ for (IConnection iterateConn : iterateConnSet) { //1
this.isRunning = true;
String currentComponent = "";
<%
if(NodeUtil.hasVirtualComponent(subTree.getNodes())){
%>
String currentVirtualComponent = null;
<%
}
%>
try {
<%
if(stat){

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,8 +10,6 @@
org.talend.core.model.process.ElementParameterParser
java.util.List
java.util.Iterator
org.talend.core.model.process.IProcess
org.talend.core.model.utils.NodeUtil
"
class="SubProcessFooter"
%>
@@ -19,8 +17,7 @@
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
boolean stat = codeGenArgument.isStatistics();
NodesSubTree subTree = (NodesSubTree) codeGenArgument.getArgument();
IProcess process = subTree.getRootNode().getProcess();
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(process, "__LOG4J_ACTIVATE__"));
for (INode node : subTree.getNodes()) {
List<IMetadataTable> metadatas = node.getMetadataList();
List< ? extends IConnection> conns = node.getOutgoingConnections();
@@ -123,42 +120,6 @@
%>
}//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"
{
@@ -206,23 +167,46 @@
}
%>
<%
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);
<%
}
}
}
%>
} catch(java.lang.Exception e) {
<%if(isLog4jEnabled){%>
log.error(currentComponent + " " + e.getMessage());
<%}%>
TalendException te = new TalendException(e, currentComponent, globalMap);
<%
if(NodeUtil.hasVirtualComponent(subTree.getNodes())){
%>
te.setVirtualComponentName(currentVirtualComponent);
<%
}
%>
throw te;
throw new TalendException(e, currentComponent, globalMap);
} catch(java.lang.Error error) {
@@ -233,7 +217,7 @@
<%
}
%>
throw error;
throw new java.lang.Error(error);
}
<%

View File

@@ -58,15 +58,10 @@
hSet.add(conn.getName() + templateOrigin);
IMetadataTable metadata = conn.getMetadataTable();
boolean changeHashAndEqualsForBigDecimal = false;
Set<String> hashableColumnsNames = new HashSet<String>();
INode targetNode = conn.getTarget();
if(targetNode instanceof IHashableInputConnections) {
if(targetNode.getUniqueName().startsWith("tMap")) {
changeHashAndEqualsForBigDecimal = "true".equals(ElementParameterParser.getValue(targetNode, "__CHANGE_HASH_AND_EQUALS_FOR_BIGDECIMAL__"));
}
IHashableInputConnections target = (IHashableInputConnections)targetNode;
Set<String> hashableColumnsNames = new HashSet<String>();
if(conn.getTarget() instanceof IHashableInputConnections) {
IHashableInputConnections target = (IHashableInputConnections) conn.getTarget();
IHashConfiguration hashConfiguration = target.getHashConfiguration(conn.getName());
if(hashConfiguration != null) {
for(IHashableColumn hashableColumn : hashConfiguration.getHashableColumns()) {
@@ -200,10 +195,6 @@ public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements ro
result = prime * result + java.util.Arrays.hashCode(this.<%=column.getLabel() %>);
<%
} else if((javaType == JavaTypesManager.BIGDECIMAL) && changeHashAndEqualsForBigDecimal) {
%>
result = prime * result + ((this.<%=column.getLabel() %> == null) ? 0 : new Double(this.<%=column.getLabel() %>.doubleValue()).hashCode());
<%
} else {
%>
result = prime * result + ((this.<%=column.getLabel() %> == null) ? 0 : this.<%=column.getLabel() %>.hashCode());
@@ -249,11 +240,7 @@ public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements ro
if (this.<%=column.getLabel() %> == null) {
if (other.<%=column.getLabel() %> != null)
return false;
<%if((javaType == JavaTypesManager.BIGDECIMAL) && changeHashAndEqualsForBigDecimal) {%>
} else if ((other.<%=column.getLabel() %> == null) || (this.<%=column.getLabel() %>.compareTo(other.<%=column.getLabel() %>)!=0))
<%} else {%>
} else if (!this.<%=column.getLabel() %>.equals(other.<%=column.getLabel() %>))
<%}%>
} else if (!this.<%=column.getLabel() %>.equals(other.<%=column.getLabel() %>))
return false;
<%
}
@@ -1020,11 +1007,6 @@ public void <%=subTree.getName() %>Process(final java.util.Map<String, Object> g
<%
}else{//isParallelize
if(NodeUtil.hasVirtualComponent(subTree.getNodes())){
%>
String currentVirtualComponent = null;
<%
}
%>
String iterateId = "";

View File

@@ -1,102 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.talend.designer.codegen" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.talend.designer.codegen" id="componentFilter" name="Component filter"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="Filter"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="Filter">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn=":org.talend.designer.codegen.components.model.IComponentFactoryFilter"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiinfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@@ -50,7 +50,6 @@ ComponentsFactory.parentNotRecompiled=Warning\: parents of *.inc.javajet are not
ComponentsLocalProviderService.componentLoadError=Component load error
ComponentsLocalProviderService.talendExchangeError=Talend Exchange Error
ComponentsPreferencePage.ButtonLabel0=Ok
ComponentsPreferencePage.componentAssist=Enable Component Creation Assistant
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 !

View File

@@ -45,7 +45,6 @@ import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.model.RepositoryFactoryProvider;
import org.talend.core.repository.utils.ProjectHelper;
import org.talend.designer.codegen.i18n.Messages;
import org.talend.repository.model.RepositoryConstants;
/***/
public class CodeGenInit implements IApplication {
@@ -158,8 +157,7 @@ public class CodeGenInit implements IApplication {
Context ctx = CorePlugin.getContext();
ctx.putProperty(Context.REPOSITORY_CONTEXT_KEY, repositoryContext);
repositoryFactory.setRepositoryFactoryFromProvider(RepositoryFactoryProvider
.getRepositoriyById(RepositoryConstants.REPOSITORY_LOCAL_ID));
repositoryFactory.setRepositoryFactoryFromProvider(RepositoryFactoryProvider.getRepositoriyById("local")); //$NON-NLS-1$
repositoryFactory.initialize();
}

View File

@@ -14,7 +14,6 @@ package org.talend.designer.codegen;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
@@ -99,65 +98,12 @@ public class CodeGenerator implements ICodeGenerator {
private String exportAsOSGI = "false";
private static final long INIT_TIMEOUT = 15 * 60 * 1000; // 15s
private static final long INIT_TIMEOUT = 15000; // 15s
private static final long INIT_PAUSE = 1000; // 1s
private static final boolean DEBUG = false;
private class OnRowsEndCode {
private int count = 0; // count onRowsEnd components generates how many times
private List<StringBuffer> bufferList = new ArrayList<StringBuffer>();
private Map<String, Boolean> markedMap = new HashMap<String, Boolean>();
public OnRowsEndCode() {
count = 0;
}
public int getCount() {
return count;
}
public void increase() {
count++;
}
public void decrease() {
count--;
}
public void clear() {
count = 0;
bufferList.clear();
markedMap.clear();
}
public void add(StringBuffer buf) {
if (buf != null) {
bufferList.add(buf);
}
}
public List<StringBuffer> getBuffers() {
return this.bufferList;
}
public Boolean mark(String key) {
return this.markedMap.put(key, true);
}
public Boolean getMarked(String key) {
return this.markedMap.get(key);
}
}
// this one is used to store all the generated code of the subjobs which start with the IN of the virtual component
// with OnRowsEnd. It is used to fix TDI-26484
private OnRowsEndCode onRowsEndCode = new OnRowsEndCode();
/**
* Constructor : use the process and laguage to initialize internal components.
*
@@ -259,14 +205,12 @@ 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
// generate Assembly Code for individual Components
StringBuffer componentsCode = new StringBuffer();
// used to collect all the generated code of onRowsEnd components
long startTimer = System.currentTimeMillis();
long endTimer = startTimer;
try {
@@ -329,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.
@@ -409,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();
@@ -459,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) {
@@ -500,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);
}
}
/**
@@ -658,10 +622,9 @@ public class CodeGenerator implements ICodeGenerator {
private StringBuffer generateComponentsCode(NodesSubTree subProcess, INode node, ECodePart part, String incomingName,
ETypeGen typeGen) throws CodeGeneratorException {
StringBuffer codeComponent = new StringBuffer();
Boolean isMarked = subProcess.isMarkedNode(node, part);
boolean isIterate = isSpecifyInputNode(node, incomingName, EConnectionType.ITERATE);
boolean isOnRowsEnd = isSpecifyInputNode(node, incomingName, EConnectionType.ON_ROWS_END);
if ((isMarked != null) && (!isMarked)) {
switch (part) {
case BEGIN:
@@ -698,83 +661,47 @@ 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() + "\")");
}
}
// This code is used to generate the Virtual_IN--->Out part in previous
boolean isNextOnRowsEnd = false;
IConnection conn = null;
if (node.getOutgoingConnections(EConnectionType.ON_ROWS_END).size() == 1) {
conn = node.getOutgoingConnections(EConnectionType.ON_ROWS_END).get(0);
isNextOnRowsEnd = isSpecifyInputNode(conn.getTarget(), conn.getName(), EConnectionType.ON_ROWS_END);
}
if (isNextOnRowsEnd && conn != null && (onRowsEndCode.getMarked(conn.getTarget().getUniqueName()) == null)) {
StringBuffer buffer = new StringBuffer();
onRowsEndCode.add(buffer);
onRowsEndCode.mark(conn.getTarget().getUniqueName());
onRowsEndCode.increase();
buffer.append(generatesTreeCode(subProcess, conn.getTarget(), ECodePart.BEGIN, typeGen));
buffer.append(generateComponentCode(subProcess, conn.getTarget(), ECodePart.BEGIN, incomingName, typeGen));
buffer.append(generateComponentCode(subProcess, conn.getTarget(), ECodePart.MAIN, incomingName, typeGen));
buffer.append(generatesTreeCode(subProcess, conn.getTarget(), ECodePart.MAIN, typeGen));
buffer.append(generateComponentCode(subProcess, conn.getTarget(), ECodePart.END, incomingName, typeGen));
buffer.append(generatesTreeCode(subProcess, conn.getTarget(), ECodePart.END, typeGen));
}
codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.MAIN, typeGen));
}
break;
case END:
boolean isOnRowsEnd = isSpecifyInputNode(node, incomingName, EConnectionType.ON_ROWS_END);
if (isOnRowsEnd) {
// append the onRowsEnd code to the end part of the first virtual_Out
onRowsEndCode.decrease();
if (onRowsEndCode.getCount() == 0) {
for (int i = 0; i < onRowsEndCode.getBuffers().size(); i++) {
codeComponent.append(onRowsEndCode.getBuffers().get(i));
}
onRowsEndCode.clear();
}
codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.BEGIN, typeGen));
codeComponent.append(generateComponentCode(subProcess, node, ECodePart.BEGIN, incomingName, typeGen));
// onRowsEndCode.clear();
codeComponent.append(generateComponentCode(subProcess, node, ECodePart.MAIN, incomingName, typeGen));
codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.MAIN, typeGen));
// codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.BEGIN, typeGen));
// codeComponent.append(generateComponentCode(subProcess, node, ECodePart.BEGIN, incomingName,
// typeGen));
//
// codeComponent.append(generateComponentCode(subProcess, node, ECodePart.MAIN, incomingName,
// typeGen));
// codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.MAIN, typeGen));
//
// codeComponent.append(generateComponentCode(subProcess, node, ECodePart.END, incomingName,
// typeGen));
// codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.END, typeGen));
codeComponent.append(generateComponentCode(subProcess, node, ECodePart.END, incomingName, typeGen));
codeComponent.append(generatesTreeCode(subProcess, node, ECodePart.END, typeGen));
} else {
// if (!isIterate) {
@@ -959,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()
@@ -971,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);
@@ -994,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);
@@ -1078,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();
@@ -1192,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,38 +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;
}
@Override
public boolean isInitializingJet() {
return !CodeGeneratorEmittersPoolFactory.isInitialized() && CodeGeneratorEmittersPoolFactory.isInitializeStart();
}
}

View File

@@ -23,11 +23,11 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.talend.commons.exception.BusinessException;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.service.IComponentsLocalProviderService;
import org.talend.designer.codegen.components.model.ComponentFileChecker;
import org.talend.designer.codegen.components.ui.ComponenttRunJobPreferencePage;
import org.talend.designer.codegen.components.ui.IComponentPreferenceConstant;
import org.talend.designer.codegen.i18n.Messages;
import org.talend.designer.components.IComponentsLocalProviderService;
/**
* DOC Administrator class global comment. Detailled comment <br/>

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

@@ -1,73 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2010 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.additionaljet;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.designer.codegen.components.model.IComponentFactoryFilter;
import org.talend.designer.codegen.i18n.Messages;
/**
* DOC zwzhao class global comment. Detailled comment
*/
public class ComponentsFactoryProviderManager {
private static Logger log = Logger.getLogger(ComponentsFactoryProviderManager.class);
private static final ComponentsFactoryProviderManager INSTANCE = new ComponentsFactoryProviderManager();
private Collection<IComponentFactoryFilter> filters;
private ComponentsFactoryProviderManager() {
}
public static ComponentsFactoryProviderManager getInstance() {
return INSTANCE;
}
public Collection<IComponentFactoryFilter> getProviders() {
if (filters == null) {
loadFromExtension();
}
return filters;
}
private void loadFromExtension() {
filters = new ArrayList<IComponentFactoryFilter>();
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint("org.talend.designer.codegen.componentFilter"); //$NON-NLS-1$
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : configurationElements) {
try {
IComponentFactoryFilter filter = (IComponentFactoryFilter) configurationElement
.createExecutableExtension("class"); //$NON-NLS-1$
filters.add(filter);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
}
}
}

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;
@@ -64,25 +64,32 @@ import org.talend.core.model.component_cache.ComponentsCache;
import org.talend.core.model.component_cache.util.ComponentCacheResourceFactoryImpl;
import org.talend.core.model.components.AbstractComponentsProvider;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.ComponentManager;
import org.talend.core.model.components.ComponentUtilities;
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;
import org.talend.designer.codegen.CodeGeneratorActivator;
import org.talend.designer.codegen.additionaljet.ComponentsFactoryProviderManager;
import org.talend.designer.codegen.i18n.Messages;
import org.talend.designer.core.ITisLocalProviderService;
import org.talend.designer.core.ITisLocalProviderService.ResClassLoader;
import org.talend.designer.core.model.components.ComponentBundleToPath;
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/>
@@ -104,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;
@@ -120,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;
@@ -128,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) {
@@ -144,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);
}
}
}
}
/**
@@ -259,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 {
@@ -279,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);
@@ -290,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() {
@@ -315,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())) {
@@ -335,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());
}
};
@@ -348,7 +575,7 @@ public class ComponentsFactory implements IComponentsFactory {
IBrandingService service = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
// String[] availableComponents = service.getBrandingConfiguration().getAvailableComponents();
String[] availableComponents = service.getBrandingConfiguration().getAvailableComponents();
FileFilter skeletonFilter = new FileFilter() {
@@ -372,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,
@@ -400,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);
@@ -464,52 +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, provider);
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.
}
boolean hiddenComponent = false;
Collection<IComponentFactoryFilter> filters = ComponentsFactoryProviderManager.getInstance()
.getProviders();
for (IComponentFactoryFilter filter : filters) {
if (!filter.isAvailable(currentComp.getName())) {
hiddenComponent = true;
break;
}
}
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 (hiddenComponent
&& !(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;
}
@@ -518,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 (hiddenComponent
&& (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);
}
@@ -532,10 +712,8 @@ public class ComponentsFactory implements IComponentsFactory {
if (componentList.contains(currentComp)) {
log.warn("Component " + currentComp.getName() + " already exists. Cannot load user version."); //$NON-NLS-1$ //$NON-NLS-2$
} else {
// currentComp.setResourceBundle(getComponentResourceBundle(currentComp, source.toString(),
// null,
// provider));
currentComp.setProvider(provider);
currentComp.setResourceBundle(getComponentResourceBundle(currentComp, source.toString(), null,
provider));
componentList.add(currentComp);
if (isCustom) {
customComponentList.add(currentComp);
@@ -551,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) {
@@ -778,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;
}
/*
@@ -799,6 +995,7 @@ public class ComponentsFactory implements IComponentsFactory {
componentList = null;
skeletonList = null;
customComponentList = null;
allComponents = null;
}
@@ -807,6 +1004,8 @@ public class ComponentsFactory implements IComponentsFactory {
componentList = null;
skeletonList = null;
customComponentList = null;
allComponents = null;
isReset = true;
if (!CommonsPlugin.isHeadless()) {
CoreImageProvider.clearComponentIconImages();
}
@@ -844,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

@@ -1,22 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2010 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;
/**
* DOC zwzhao class global comment. Detailled comment
*/
public interface IComponentFactoryFilter {
public boolean isAvailable(String componentName);
}

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

@@ -43,13 +43,10 @@ import org.talend.commons.ui.utils.workbench.preferences.ComboFieldEditor;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
import org.talend.core.model.components.ComponentPaletteUtilities;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.designer.codegen.CodeGeneratorActivator;
import org.talend.designer.codegen.ICodeGeneratorService;
import org.talend.designer.codegen.i18n.Messages;
import org.talend.designer.core.DesignerPlugin;
import org.talend.designer.core.assist.TalendEditorComponentCreationUtil;
import org.talend.designer.core.ui.preferences.TalendDesignerPrefConstants;
/**
* This class represents a preference page that is contributed to the Preferences dialog. By subclassing
@@ -65,8 +62,6 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
private CheckBoxFieldEditor doNotShowJobletAfterDoubleClickCheckBoxField;
private CheckBoxFieldEditor enableComponentAssistCheckBoxField;
private DirectoryFieldEditor filePathTemp;
private final String dataViewer = "Data Viewer"; //$NON-NLS-1$
@@ -77,8 +72,6 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
private final String joblet = "Joblet"; //$NON-NLS-1$
private final String assist = "Component Assist"; //$NON-NLS-1$
private static String oldPath = null;
/**
@@ -197,16 +190,6 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
return group;
}
protected Composite createForComponentAssist(Composite parent) {
Group group = createGroup(parent);
group.setText(assist);
Composite composite = createComposite(group);
addFontAndColorFieldsForAssist(composite);
GridLayout layout = createLayout();
composite.setLayout(layout);
return group;
}
protected Group createGroup(Composite parent) {
Group group = new Group(parent, SWT.NONE);
GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
@@ -239,7 +222,6 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
protected void addFontAndColorFieldsForDataViewer(Composite composite) {
IntegerFieldEditor rowLimit = new IntegerFieldEditor(IComponentPreferenceConstant.LIMIT,
Messages.getString("ComponentsPreferencePage.rowLimit"), composite);//$NON-NLS-1$
rowLimit.setValidRange(1, 1000);
addField(rowLimit);
Text textControl = rowLimit.getTextControl(composite);
GridData layoutData = new GridData();
@@ -263,12 +245,6 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
addField(doNotShowJobletAfterDoubleClickCheckBoxField);
}
protected void addFontAndColorFieldsForAssist(Composite composite) {
enableComponentAssistCheckBoxField = new CheckBoxFieldEditor(TalendDesignerPrefConstants.COMPONENT_ASSIST,
Messages.getString("ComponentsPreferencePage.componentAssist"), composite); //$NON-NLS-1$
addField(enableComponentAssistCheckBoxField);
}
@Override
public void createFieldEditors() {
final Composite parent = getFieldEditorParent();
@@ -285,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)) { //$NON-NLS-1$
if (!file.exists()) {
// getPreferenceStore().setValue(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER, "");
filePathTemp.showErrorMessage();
setValid(false);
@@ -304,7 +280,6 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
if (PluginChecker.isJobLetPluginLoaded()) {
createForJoblet(parent);
}
createForComponentAssist(parent);
parent.pack();
}
@@ -319,35 +294,6 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
@Override
public void init(IWorkbench workbench) {
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#initialize()
*/
@Override
protected void initialize() {
super.initialize();
// Because should save the value of TalendDesignerPrefConstants.COMPONENT_ASSIST in
// DesignerPlugin.getDefault().getPreferenceStore()
enableComponentAssistCheckBoxField.setPreferenceStore(DesignerPlugin.getDefault().getPreferenceStore());
enableComponentAssistCheckBoxField.load();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performDefaults()
*/
@Override
protected void performDefaults() {
super.performDefaults();
// Because should save the value of TalendDesignerPrefConstants.COMPONENT_ASSIST in
// DesignerPlugin.getDefault().getPreferenceStore(), also PreferenceInitializer
enableComponentAssistCheckBoxField.setPreferenceStore(DesignerPlugin.getDefault().getPreferenceStore());
enableComponentAssistCheckBoxField.loadDefault();
}
@Override
@@ -355,22 +301,19 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
boolean flag = super.performOk();
String newPath = CodeGeneratorActivator.getDefault().getPreferenceStore()
.getString(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER);
if ("".equals(oldPath)) { //$NON-NLS-1$
if ("".equals(oldPath)) {
oldPath = null;
}
if ("".equals(newPath)) { //$NON-NLS-1$
if ("".equals(newPath)) {
newPath = null;
}
DesignerPlugin.getDefault().getPreferenceStore()
.setValue(TalendDesignerPrefConstants.COMPONENT_ASSIST, enableComponentAssistCheckBoxField.getBooleanValue());
TalendEditorComponentCreationUtil.updateAssistListener();
if (this.oldPath != newPath) {
final IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Loading user component ......", 100); //$NON-NLS-1$
monitor.beginTask("Loading user component ......", 100);
Display display = Display.getCurrent();
if (display == null) {
display = Display.getDefault();
@@ -393,7 +336,7 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
@Override
public void done(org.eclipse.core.runtime.jobs.IJobChangeEvent event) {
ComponentPaletteUtilities.updatePalette();
ComponentUtilities.updatePalette();
monitor.worked(100);
monitor.done();
};

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

@@ -52,7 +52,6 @@ public enum EInternalTemplate {
MR_COMPONENT_MRCONFIG_HEADER("mr_component_mrconfig_header", "0.0.1"), //$NON-NLS-1$ //$NON-NLS-2$
MR_COMPONENT_MRCONFIG_FOOTER("mr_component_mrconfig_footer", "0.0.1"), //$NON-NLS-1$ //$NON-NLS-2$
MR_SUBPROCESS_HEADER("mr_subprocess_header", "0.0.1"), //$NON-NLS-1$ //$NON-NLS-2$
MR_SUBPROCESS_RUN("mr_subprocess_run", "0.0.1"), //$NON-NLS-1$ //$NON-NLS-2$
MR_SUBPROCESS_FOOTER("mr_subprocess_footer", "0.0.1"), //$NON-NLS-1$ //$NON-NLS-2$
HEADER_ADDITIONAL("header_additional", "0.0.1"); //$NON-NLS-1$ //$NON-NLS-2$

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

@@ -1,159 +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.designer.codegen.config;
import java.util.ArrayList;
import java.util.List;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.IConnectionCategory;
import org.talend.core.model.process.INode;
/**
* Use for wrap a {@link INode} to provide faster and convenient methods to get
* connections, such as {@link #inputConn}, {@link #connResponse},
* {@link #connFault}, {@link #dataOutputs}.
*
* @author GaoZone
* @update 2013-9-12 [TESB-11028]
*/
public class NodeConnectionsHelper {
/** The node. */
private final INode node;
/** The input conn. */
private IConnection inputConn;
/** The conn response. */
private IConnection connResponse;
/** The conn fault. */
private IConnection connFault;
/** The data outputs. */
private List<IConnection> dataOutputs;
/**
* Gets the input conn.
*
* @return the input conn
*/
public IConnection getInputConn() {
return inputConn;
}
/**
* Gets the output conn response.
*
* @return the output conn response
*/
public IConnection getOutputConnResponse() {
return connResponse;
}
/**
* Gets the output conn fault.
*
* @return the output conn fault
*/
public IConnection getOutputConnFault() {
return connFault;
}
/**
* Gets the data outputs.
*
* @return the data outputs
*/
public List<IConnection> getDataOutputs() {
return dataOutputs;
}
/**
* Instantiates a new node connections helper.
*
* @param node
* the node
*/
public NodeConnectionsHelper(INode node) {
this(node, false);
}
/**
* Instantiates a new node connections helper.
*
* @param node
* the node
* @param stopInitialWhenNoInput
* the stop initial when no input
*/
public NodeConnectionsHelper(INode node, boolean stopInitialWhenNoInput) {
this.node = node;
initConnections(stopInitialWhenNoInput);
}
/**
* Inits the connections.
*
* @param stopInitialWhenNoInput
* the stop initial when no input
*/
private void initConnections(boolean stopInitialWhenNoInput) {
initInputConnection();
if (!(stopInitialWhenNoInput && inputConn == null)) {
initOutputConnections();
}
}
/**
* Inits the {@link #inputConn} connection.
*/
private void initInputConnection() {
List<? extends IConnection> incomingConnections = node.getIncomingConnections();
if (incomingConnections != null) {
for (IConnection conn : incomingConnections) {
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
inputConn = conn;
break;
}
}
}
}
/**
* Inits the {@link #dataOutputs}, {@link #connResponse}, {@link #connFault}
* connections.
*/
private void initOutputConnections() {
List<? extends IConnection> conns = node.getOutgoingSortedConnections();
dataOutputs = new ArrayList<IConnection>();
if (conns != null) {
for (IConnection conn : conns) {
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
dataOutputs.add(conn);
}
}
}
List<? extends IConnection> connsResponse = node.getOutgoingConnections("RESPONSE");
List<? extends IConnection> connsFault = node.getOutgoingConnections("FAULT");
if (connsResponse.size() == 1) {
connResponse = connsResponse.get(0);
}
if (connsFault.size() == 1) {
connFault = connsFault.get(0);
}
}
}

View File

@@ -1,232 +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.designer.codegen.config;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
/**
* Use for wrap a {@link INode} to provide faster and convenient methods to get
* parameters.
*
* @author GaoZone
* @update 2013-9-12 [TESB-11028]
*/
public class NodeParamsHelper {
/** The node use to wrap. */
private final INode node;
/** The parameter map use to cache params by name. */
private final HashMap<String, IElementParameter> parameterMap;
/**
* Use for method return property(K-V) entries in list/map.
*/
private class PropEntry implements Map.Entry<String, String> {
/** The key. */
private final String key;
/** The value. */
private final String value;
/**
* Instantiates a new prop entry.
*
* @param key
* the key
* @param value
* the value
*/
public PropEntry(String key, String value) {
this.key = key;
this.value = value;
}
@Override
public String getKey() {
return key;
}
@Override
public String getValue() {
return value;
}
@Override
public String setValue(String value) {
throw new UnsupportedOperationException();
}
}
/**
* Instantiates a new node params helper.
*
* @param node
* the node
*/
public NodeParamsHelper(INode node) {
this.node = node;
// cache ParameterMap
parameterMap = new HashMap<String, IElementParameter>();
for (IElementParameter parameter : node.getElementParametersWithChildrens()) {
parameterMap.put(parameter.getVariableName(), parameter);
}
}
/**
* Gets the parameter from cached name map.
*
* @param key
* the key
* @return the parameter
*/
private IElementParameter getParameter(String key) {
return parameterMap.get(key);
}
/**
* Gets the boolean parameter by {@code key}. If no {@code key} provided
*
* @param key
* the key
* @return the boolean parameter
*/
public boolean getBoolParam(String key) {
return "true".equals(getStringParam(key));
}
/**
* Gets the string parameter by {@code key}.
*
* @param key
* the key
* @return the parameter value in String
*/
public String getStringParam(String key) {
// return ElementParameterParser.getValue(node, key);
try {
IElementParameter param = getParameter(key);
return getDisplayValue(param);
} catch (Throwable e) {
// ignore and return "";
e.printStackTrace();
return "";
}
}
/**
* Gets string parameter by {@code key}. Especially, if the parameter's
* controller is not visible, then also return {@code ""}.
*
* @param key
* the key
* @return the parameter value
*/
public String getVisibleStringParam(String key) {
String value = getStringParam(key);
if (!("").equals(value)) {
IElementParameter param = getParameter(key);
if (param.isShow(node.getElementParametersWithChildrens())) {
return value;
}
}
return "";
}
/**
* Gets the object param. </br>//TODO Not used name map yet, and be improve
* by expose methods from {@link ElementParameterParser}
*
* @param <T>
* the generic type
* @param key
* the key
* @return the object param
*/
@SuppressWarnings("unchecked")
public <T> T getObjectParam(String key) {
return (T) ElementParameterParser.getObjectValue(node, key);
}
/**
* Gets boolean parameter by {@code key}. Especially, if the parameter's
* controller is not visible, then also return {@code false}.
*
* @param key
* the key
* @return the parameter value
*/
public boolean getVisibleBoolParam(final String key) {
if (key == null) {
return false;
}
if (getBoolParam(key)) {
// value is true, then check visible
// no need null check, has true value must not null.
IElementParameter param = getParameter(key);
return param.isShow(node.getElementParametersWithChildrens());
}
return false;
}
/**
* Gets the properties pram.
*
* @param key
* the key
* @return the properties pram
*/
public List<Entry<String, String>> getPropertiesPram(String key) {
try {
List<Map<String, String>> paramValue = getObjectParam(key);
List<Entry<String, String>> properties = new ArrayList<Entry<String, String>>(paramValue.size());
for (Map<String, String> map : paramValue) {
properties.add(new PropEntry(map.get("PROP_NAME"), map.get("PROP_VALUE")));
}
return properties;
} catch (Throwable e) {
// ignore and return empty list.
e.printStackTrace();
return Collections.emptyList();
}
}
/**
* Gets the display value.
*
* @param param
* the param
* @return the display value
* {@code ElementParameterParser.getDisplayValue(final IElementParameter param)}
*/
private static String getDisplayValue(final IElementParameter param) {
if (param == null) {
return "";
}
return ElementParameterParser.getStringElementParameterValue(param);
}
}

View File

@@ -47,7 +47,7 @@ public class NodesTree {
buildSubTrees(true);
}
}
public NodesTree(IProcess process, List<? extends INode> treeNodes, boolean init, ETypeGen typeGen) {
this.nodes = treeNodes;
buildRootNodes(process);
@@ -111,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

@@ -16,34 +16,31 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
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.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
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;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.emf.codegen.CodeGenPlugin;
import org.eclipse.emf.codegen.jet.JETCompiler;
@@ -52,20 +49,14 @@ import org.eclipse.emf.codegen.jet.JETException;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.common.util.Monitor;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.CompilationProgress;
import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
import org.osgi.framework.Bundle;
import org.talend.commons.debug.TalendDebugHandler;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.generation.JavaUtils;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.designer.codegen.i18n.Messages;
import org.talend.designer.core.model.components.ComponentBundleToPath;
/**
* DOC mhirt class global comment. Detailled comment <br/>
@@ -87,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.
*
@@ -109,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;
}
@@ -170,6 +158,8 @@ public class TalendJetEmitter extends JETEmitter {
IProject project;
IJavaProject javaProject;
public TalendEclipseHelper(IProgressMonitor progressMonitor, TalendJetEmitter jetEmitter, boolean rebuild)
throws JETException {
progressMonitor.beginTask("", 10); //$NON-NLS-1$
@@ -192,12 +182,35 @@ 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()) {
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));
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));
}
}
javaProject = JavaCore.create(project);
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETInitializingProject_message", //$NON-NLS-1$
new Object[] { project.getName() }));
IClasspathEntry classpathEntry = JavaCore.newSourceEntry(new Path("/" + project.getName() + "/src")); //$NON-NLS-1$ //$NON-NLS-2$
IClasspathEntry jreClasspathEntry = JavaCore
.newContainerEntry(new Path("org.eclipse.jdt.launching.JRE_CONTAINER")); //$NON-NLS-1$
Set<IClasspathEntry> classpath = new HashSet<IClasspathEntry>();
classpath.add(classpathEntry);
classpath.add(jreClasspathEntry);
classpath.addAll(jetEmitter.getClasspathEntries());
IFolder sourceFolder = project.getFolder(new Path("src")); //$NON-NLS-1$
if (!sourceFolder.exists()) {
sourceFolder.create(false, true, new SubProgressMonitor(progressMonitor, 1));
@@ -207,6 +220,14 @@ public class TalendJetEmitter extends JETEmitter {
runtimeFolder.create(false, true, new SubProgressMonitor(progressMonitor, 1));
}
if (isClasspathDifferent(javaProject, classpath)) {
IClasspathEntry[] classpathEntryArray = classpath.toArray(new IClasspathEntry[classpath.size()]);
javaProject.setRawClasspath(classpathEntryArray, new SubProgressMonitor(progressMonitor, 1));
javaProject.setOutputLocation(new Path("/" + project.getName() + "/runtime"), new SubProgressMonitor( //$NON-NLS-1$ //$NON-NLS-2$
progressMonitor, 1));
javaProject.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
}
progressMonitor.done();
} catch (CoreException exception) {
throw new JETException(exception);
@@ -297,8 +318,7 @@ public class TalendJetEmitter extends JETEmitter {
}
}
boolean needRebuild = true;
String targetFileName = jetCompiler.getSkeleton().getClassName() + ".java"; //$NON-NLS-1$
IFile targetFile = sourceContainer.getFile(new Path(targetFileName));
IFile targetFile = sourceContainer.getFile(new Path(jetCompiler.getSkeleton().getClassName() + ".java")); //$NON-NLS-1$
if (!targetFile.exists()) {
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreating_message", //$NON-NLS-1$
new Object[] { targetFile.getFullPath() }));
@@ -333,23 +353,28 @@ 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() }));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
compileSingleClass(project, targetFile, baos);
String output = baos.toString();
// project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new
// SubProgressMonitor(subProgressMonitor, 1));
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(subProgressMonitor, 1));
IMarker[] markers = targetFile.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
boolean errors = false;
if (!output.isEmpty()) {
errors = true;
log.error(output);
setClassAvailable(false);
for (int i = 0; i < markers.length; ++i) {
IMarker marker = markers[i];
if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) == IMarker.SEVERITY_ERROR) {
errors = true;
subProgressMonitor.subTask(marker.getAttribute(IMarker.MESSAGE) + " : " //$NON-NLS-1$
+ (CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) })));
log.error(jetEmitter.templateURI.substring(jetEmitter.templateURI.lastIndexOf("/") + 1) //$NON-NLS-1$
+ Messages.getString(
"TalendJetEmitter.compileFail", //$NON-NLS-1$
marker.getAttribute(IMarker.MESSAGE),
(CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) }))));
}
}
if (!errors) {
@@ -358,7 +383,8 @@ public class TalendJetEmitter extends JETEmitter {
// Construct a proper URL for relative lookup.
//
URL url = new File(project.getLocation() + "/" + "runtime" + "/") //$NON-NLS-1$ //$NON-NLS-2$
URL url = new File(project.getLocation()
+ "/" + javaProject.getOutputLocation().removeFirstSegments(1) + "/") //$NON-NLS-1$ //$NON-NLS-2$
.toURL();
URLClassLoader theClassLoader = new URLClassLoader(new URL[] { url }, jetEmitter.classLoader);
Class theClass = theClassLoader.loadClass((packageName.length() == 0 ? "" : packageName + ".") //$NON-NLS-1$ //$NON-NLS-2$
@@ -399,263 +425,4 @@ public class TalendJetEmitter extends JETEmitter {
}
}
}
private void compileSingleClass(IProject project, IFile javaFile, OutputStream errorMsgStream) {
compileSingleClass(project, javaFile, null, errorMsgStream, null);
}
/**
* DOC ycbai Comment method "compileSingleClass".
* <p>
* Compile one class directly.
*
* @param project
* @param javaFile
* @param standardMsgStream
* @param errorMsgStream
* @param progress
*/
private void compileSingleClass(IProject project, IFile javaFile, OutputStream standardMsgStream,
OutputStream errorMsgStream, CompilationProgress progress) {
OutputStream msgStream = standardMsgStream;
OutputStream errorStream = errorMsgStream;
if (msgStream == null) {
msgStream = System.out;
}
if (errorStream == null) {
errorStream = System.err;
}
BatchCompiler.compile(getBatchCompilerCmd(project, javaFile), new PrintWriter(msgStream), new PrintWriter(errorStream),
progress);
}
/**
* DOC ycbai Comment method "getBatchCompilerCmd".
*
* @param project
* @param javaFile
* @return
*/
private String[] getBatchCompilerCmd(IProject project, IFile javaFile) {
List<String> cmdList = new ArrayList<String>();
cmdList.add(javaFile.getLocation().toPortableString());
String classpathStr = getClasspathStr();
if (!classpathStr.isEmpty()) {
cmdList.add("-classpath"); //$NON-NLS-1$
cmdList.add(classpathStr);
}
//cmdList.add("-time"); //$NON-NLS-1$
cmdList.add("-g:none"); //$NON-NLS-1$
cmdList.add("-warn:none"); //$NON-NLS-1$
cmdList.add("-1.5"); //$NON-NLS-1$
cmdList.add("-d"); //$NON-NLS-1$
cmdList.add(getClassOutputPath(project, javaFile));
return cmdList.toArray(new String[0]);
}
/**
* DOC ycbai Comment method "getClassOutputPath".
* <p>
* Get class output folder of project.
*
* @param project
* @param javaFile
* @return
*/
private String getClassOutputPath(IProject project, IFile javaFile) {
IFolder runtimeFolder = project.getFolder("runtime"); //$NON-NLS-1$
return runtimeFolder.getLocation().toPortableString();
}
/**
* DOC ycbai Comment method "getClasspathStr".
* <p>
* Get character string of classpath with separator.
*
* @return
*/
private String getClasspathStr() {
StringBuffer cps = new StringBuffer();
String classPathSeparator = JavaUtils.JAVA_CLASSPATH_SEPARATOR;
List<IClasspathEntry> cpes = getClasspathEntries();
for (IClasspathEntry cpe : cpes) {
String classpath = getClasspathFromEntry(cpe);
cps.append(classpath).append(classPathSeparator);
}
if (cps.length() > 0) {
cps.deleteCharAt(cps.length() - 1);
}
return cps.toString();
}
/**
* DOC ycbai Comment method "getClasspathFromEntry".
* <p>
* Get the absolute classpath.
*
* @param entry
* @return
*/
private String getClasspathFromEntry(IClasspathEntry entry) {
if (entry == null) {
return null;
}
IClasspathAttribute[] extraAttributes = entry.getExtraAttributes();
if (extraAttributes.length > 0) {
for (IClasspathAttribute ca : extraAttributes) {
if ("plugin_id".equals(ca.getName())) { //$NON-NLS-1$
String pluginId = ca.getValue();
if (pluginId != null) {
File plugin = new File(ComponentBundleToPath.getPathFromBundle(pluginId));
String pluginPath = plugin.getAbsolutePath();
if (Platform.inDevelopmentMode() && plugin.isDirectory()) {
String output;
try {
output = getIdeOutputSubDir(Platform.getBundle(pluginId));
if (output != null) {
pluginPath = pluginPath + File.separator + output;
}
} catch (IOException e) {
// for dev only so just keep a print stacktrace
e.printStackTrace();
}
}
return pluginPath;
}
}
}
}
return null;
}
/**
* DOC ycbai Comment method "getIdeOutputSubDir".
* <p>
* Get class folder path of bundle. Just use for development environment.
*
* @param bundle
* @return
* @throws IOException
*/
private String getIdeOutputSubDir(Bundle bundle) throws IOException {
String outputSubDir = null;
// get output folder path in case we are running from the IDE
URL buildPropUrl = bundle.getEntry("/build.properties"); //$NON-NLS-1$
if (buildPropUrl != null) {
Properties buildProp = new Properties();
InputStream buildPropStream = buildPropUrl.openStream();
try {
buildProp.load(buildPropStream);
outputSubDir = buildProp.getProperty("output..", null); //$NON-NLS-1$
} finally {
buildPropStream.close();
}
}
return outputSubDir;
}
/*
* (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,8 +15,10 @@ 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;
@@ -24,46 +26,46 @@ import java.util.Set;
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
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.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
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.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;
import org.talend.commons.model.components.IComponentConstants;
import org.talend.commons.ui.runtime.CommonUIPlugin;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.utils.StringUtils;
import org.talend.commons.utils.io.IOUtils;
import org.talend.commons.utils.time.TimeMeasure;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.PluginChecker;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.components.ComponentCompilations;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentFileNaming;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.temp.ECodePart;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.core.utils.AccessingEmfJob;
import org.talend.designer.codegen.CodeGeneratorActivator;
import org.talend.designer.codegen.ICodeGeneratorService;
import org.talend.designer.codegen.config.CodeGeneratorProgressMonitor;
import org.talend.designer.codegen.config.EInternalTemplate;
import org.talend.designer.codegen.config.JetBean;
import org.talend.designer.codegen.config.LightJetBean;
@@ -95,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.
*/
@@ -129,22 +129,36 @@ public final class CodeGeneratorEmittersPoolFactory {
TimeMeasure.measureActive = CommonsPlugin.isDebugMode();
TimeMeasure.begin("initialize Jet Emitters"); //$NON-NLS-1$
ComponentsFactoryProvider.saveComponentVisibilityStatus();
jetFilesCompileFail.clear();
IProgressMonitor monitorWrap = null;
monitorWrap = new NullProgressMonitor();
boolean headless = CommonsPlugin.isHeadless();
if (!headless) {
try {
Display.getDefault();
} catch (SWTError e) {
headless = true;
}
}
if (!headless) {
monitorWrap = new CodeGeneratorProgressMonitor(delegateMonitor);
} else {
monitorWrap = new NullProgressMonitor();
}
ECodeLanguage codeLanguage = LanguageManager.getCurrentLanguage();
initializeJetEmittersProject(monitorWrap);
TimeMeasure.step("initialize Jet Emitters", "initialize JET Project"); //$NON-NLS-1$ //$NON-NLS-2$
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();
@@ -155,7 +169,6 @@ public final class CodeGeneratorEmittersPoolFactory {
List<TemplateUtil> templates = templatesFactory.getTemplates();
Set<IComponent> components = componentsFactory.getComponents();
TimeMeasure.step("initialize Jet Emitters", "getComponents"); //$NON-NLS-1$ //$NON-NLS-2$
monitorWrap.beginTask(Messages.getString("CodeGeneratorEmittersPoolFactory.initMessage"), //$NON-NLS-1$
(2 * templates.size() + 5 * components.size()));
@@ -170,14 +183,15 @@ public final class CodeGeneratorEmittersPoolFactory {
monitorBuffer = 0;
}
}
TimeMeasure.step("initialize Jet Emitters", "initialize jet beans from templates"); //$NON-NLS-1$ //$NON-NLS-2$
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);
@@ -185,12 +199,10 @@ public final class CodeGeneratorEmittersPoolFactory {
}
}
}
TimeMeasure.step("initialize Jet Emitters", "initialize jet beans from components"); //$NON-NLS-1$ //$NON-NLS-2$
monitorWrap.worked(monitorBuffer);
initializeEmittersPool(jetBeans, codeLanguage, monitorWrap);
monitorWrap.done();
TimeMeasure.step("initialize Jet Emitters", "initialize and generate each jet emitters"); //$NON-NLS-1$ //$NON-NLS-2$
if (!CommonUIPlugin.isFullyHeadless()) {
Job job = new Job(Messages.getString("CodeGeneratorEmittersPoolFactory.updatePaletteForEditors")) { //$NON-NLS-1$
@@ -198,7 +210,7 @@ public final class CodeGeneratorEmittersPoolFactory {
@Override
protected IStatus run(IProgressMonitor monitor) {
CorePlugin.getDefault().getDesignerCoreService()
.synchronizeDesignerUI(new PropertyChangeEvent(this, IComponentConstants.NORMAL, null, null));
.synchronizeDesignerUI(new PropertyChangeEvent(this, ComponentUtilities.NORMAL, null, null));
return Status.OK_STATUS;
}
@@ -223,17 +235,15 @@ public final class CodeGeneratorEmittersPoolFactory {
TimeMeasure.measureActive = false;
return new Status(IStatus.ERROR, CodeGeneratorActivator.PLUGIN_ID,
Messages.getString("CodeGeneratorEmittersPoolFactory.initialException"), e); //$NON-NLS-1$
} finally {
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = workspace.getRoot().getProject(".JETEmitters"); //$NON-NLS-1$
project.build(IncrementalProjectBuilder.AUTO_BUILD, null);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
// finally {
// try {
// IWorkspace workspace = ResourcesPlugin.getWorkspace();
// IProject project = workspace.getRoot().getProject(JET_PROJECT);
// project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
// TimeMeasure.step("initialize Jet Emitters", "build project .JETEmitters"); //$NON-NLS-1$ //$NON-NLS-2$
// } catch (CoreException e) {
// ExceptionHandler.process(e);
// }
// }
TimeMeasure.end("initialize Jet Emitters"); //$NON-NLS-1$
TimeMeasure.display = false;
TimeMeasure.displaySteps = false;
@@ -255,48 +265,13 @@ 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));
}
}
};
public static Job initialize() {
Job job = new Job(Messages.getString("CodeGeneratorEmittersPoolFactory.initMessage")) { //$NON-NLS-1$
Job job = new AccessingEmfJob(Messages.getString("CodeGeneratorEmittersPoolFactory.initMessage")) { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
protected IStatus doRun(IProgressMonitor monitor) {
synchronized (delegateMonitor) {
if (jobRunnable == null) {
jobRunnable = new JobRunnable(Messages.getString("CodeGeneratorEmittersPoolFactory.codeThread")); //$NON-NLS-1$
@@ -324,8 +299,8 @@ public final class CodeGeneratorEmittersPoolFactory {
}
};
job.setUser(false);
job.setPriority(Job.LONG);
job.setUser(true);
job.setPriority(Job.INTERACTIVE);
job.schedule();
job.wakeUp(); // start as soon as possible
@@ -419,9 +394,6 @@ public final class CodeGeneratorEmittersPoolFactory {
if (component.getAvailableCodeParts().contains(ECodePart.MRCODE)) {
initComponent(codeLanguage, jetBeans, ECodePart.MRCODE, component);
}
if (component.getAvailableCodeParts().contains(ECodePart.MRJOBFOOTER)) {
initComponent(codeLanguage, jetBeans, ECodePart.MRJOBFOOTER, component);
}
if (component.getAvailableCodeParts().contains(ECodePart.MRCONFIG)) {
initComponent(codeLanguage, jetBeans, ECodePart.MRCONFIG, component);
}
@@ -469,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) {
@@ -496,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) {
@@ -503,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()) {
@@ -529,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);
@@ -555,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;
@@ -577,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
}
@@ -627,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$
}
}
}
}
@@ -640,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;
@@ -659,13 +687,8 @@ public final class CodeGeneratorEmittersPoolFactory {
* @return
*/
public static JETEmitter getJETEmitter(JetBean jetBean) {
if (emitterPool == null || (!isInitialized() && !isInitializeStart())) {
try {
new CodeGeneratorManager().initTemplate();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (!isInitialized() && !isInitializeStart()) {
initialize();
}
// only for components, not for /resources jet file, if it compile error, it will get the
@@ -775,37 +798,4 @@ public final class CodeGeneratorEmittersPoolFactory {
public static boolean isInitializeStart() {
return initializeStart;
}
static class CodeGeneratorManager {
private IStatus status;
public IStatus initTemplate() throws InterruptedException {
final Job initializeTemplatesJob = initialize();
Job.getJobManager().addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (event.getJob().equals(initializeTemplatesJob)) {
setStatus(event.getResult());
}
}
});
while (status == null) {
Thread.sleep(10);
}
return status;
}
private void setStatus(IStatus result) {
this.status = result;
}
private ICodeGeneratorService getCodeGenerationService() {
IService service = GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
return (ICodeGeneratorService) service;
}
}
}

View File

@@ -17,6 +17,7 @@ import java.io.File;
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -24,6 +25,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.emf.codegen.CodeGenPlugin;
import org.eclipse.jdt.core.JavaCore;
import org.talend.core.language.ECodeLanguage;
/**
@@ -75,7 +77,11 @@ public final class EmfEmittersPersistenceFactory {
project.create(new SubProgressMonitor(progressMonitor, 1));
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreatingProject_message", //$NON-NLS-1$
new Object[] { project.getName() }));
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));
}
} catch (CoreException e) {
log.error(e.getMessage(), e);

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

@@ -1,3 +1,3 @@
Exchange=Exchange
Exchange=Training
DownloadComponenentsAction.Label=\u4E0B\u8F7D\u9009\u62E9\u7684\u7EC4\u4EF6
RefreshComponenentsAction.Label=\u5237\u65B0\u7EC4\u4EF6\u6E05\u5355

View File

@@ -1,7 +1,4 @@
AvailableExtensionsComposite.FilterTitle=Filter
AvailableExtensionsComposite.ViewDetail.installOperateStatus=Installieren
AvailableExtensionsComposite.ViewDetail.WriteReview=Bericht schreiben
AvailableExtensionsComposite.ViewDetail.InsertionReviewFailureTip=Sie sollten es prüfen.
DownloadedExtensionsComposite.installedOperateStatus=Installiert
DownloadedExtensionsComposite.updateOperateStatus=Update
MyExtensionsComposite.UpdateOperateStatus=Update
@@ -9,10 +6,12 @@ MyExtensionsComposite.ModifyOperateStatus=Modifiziere
MyExtensionsComposite.DeleteOperateStatus=Löschen
MyExtensionsComposite.Form.Description=Beschreibung
MyExtensionsComposite.Form.Upload.Browse=Durchsuchen...
DeleteExtensionJob.DeleteFailure=Löschung fehlgeschlagen
DeleteExtensionJob.DeleteFailureTip=Sie sollten es prüfen.
DownloadComponenentsAction.DownloadTaskName=Lade Datei von URL:
ImportExchangeDialog.WARNING=Warnung
ImportExchangeDialog.AUTHOR_NAME=Name des Autors
ImportExchangeDialog.LATEST_REVISION=Aktuellste Revision
ImportExchangeDialog.JOB_BUTTON=Job-Design
ImportExchangeDialog.ROUTINES_BUTTON=Routinen
ImportExchangeDialog.ROUTINES_PROGRESSBAR=Lade einige Routinen...
ImportExchangeDialog.TEMPLATES_BUTTON=SQL Templates
ImportExchangeDialog.OPERATION_CANCELLED=Operation wurde abgebrochen

View File

@@ -19,5 +19,12 @@ ImportExchangeDialog.EXTENSION_NAME=\u038C\u03BD\u03BF\u03BC\u03B1 \u0395\u03C0\
ImportExchangeDialog.AUTHOR_NAME=\u038C\u03BD\u03BF\u03BC\u03B1 \u03A3\u03C5\u03B3\u03B3\u03C1\u03B1\u03C6\u03AD\u03B1
ImportExchangeDialog.LATEST_REVISION=\u03A4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B1 \u0391\u03BD\u03B1\u03B8\u03B5\u03CE\u03C1\u03B7\u03C3\u03B7
ImportExchangeDialog.EXTENSION_DESCRIPTION=\u03A0\u03B5\u03C1\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u0395\u03C0\u03AD\u03BA\u03C4\u03B1\u03C3\u03B7\u03C2
ImportExchangeDialog.JOB_BUTTON=\u03A3\u03C7\u03AD\u03B4\u03B9\u03B1 \u0395\u03C1\u03B3\u03B1\u03C3\u03B9\u03CE\u03BD
ImportExchangeDialog.DOWNLOAD_JOB=\u039B\u03AE\u03C8\u03B7 \u039A\u03AC\u03C0\u03BF\u03B9\u03C9\u03BD \u03A3\u03C7\u03B5\u03B4\u03AF\u03C9\u03BD \u0395\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1\u03C2...
ImportExchangeDialog.ROUTINES_BUTTON=\u03A1\u03BF\u03C5\u03C4\u03AF\u03BD\u03B5\u03C2
ImportExchangeDialog.ROUTINES_PROGRESSBAR=\u039B\u03AE\u03C8\u03B7 \u039A\u03AC\u03C0\u03BF\u03B9\u03C9\u03BD \u03A1\u03BF\u03C5\u03C4\u03B9\u03BD\u03CE\u03BD...
ImportExchangeDialog.TEMPLATES_BUTTON=\u03A0\u03C1\u03CC\u03C4\u03C5\u03C0\u03B1 SQL
ImportExchangeDialog.TEMPLATES_PROGRESSBAR=\u039B\u03AE\u03C8\u03B7 \u039A\u03AC\u03C0\u03BF\u03B9\u03C9\u03BD \u03A0\u03C1\u03BF\u03C4\u03CD\u03C0\u03C9\u03BD SQL...
ImportExchangeDialog.REFRESH_BUTTON=\u0391\u03BD\u03B1\u03BD\u03AD\u03C9\u03C3\u03B7
ImportExchangeDialog.NOT_SELECT_BUTTON=\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03CE \u03BA\u03AC\u03BD\u03C4\u03B5 \u03BC\u03B9\u03B1 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE \u03C0\u03C1\u03CE\u03C4\u03B1
ImportExchangeDialog.OPERATION_CANCELLED=\u0397 \u03BB\u03B5\u03B9\u03C4\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1 \u03B1\u03BA\u03C5\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5

View File

@@ -89,8 +89,15 @@ 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
Exchange.logon.error=Exchange user have not been registered, please register using the preferences .
ImportExchangeDialog.download.extensions=Download extensions\! Please Wait\!

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