allTypeNames = Activator.getDefault().getAllTypeNames();
- if (candidate.indexOf(";") < 0) {
- return null;
- }
-
- String headerPlusType = candidate.substring(0, candidate.indexOf(";"));
- String typeName = headerPlusType.substring(candidate.indexOf(" ") + 1, headerPlusType.length());
- if (allTypeNames.contains(typeName)) {
-
- int index = candidate.indexOf(typeName);
- if (index != -1) {
-
- // detect region containing keyword
- IRegion targetRegion = new Region(lineRegion.getOffset() + index, typeName.length());
- if ((targetRegion.getOffset() <= offset) && ((targetRegion.getOffset() + targetRegion.getLength()) > offset)) {
- try {
- return new IHyperlink[] { new ImpexTypeHyperlink(targetRegion, document.get(targetRegion.getOffset(), targetRegion.getLength())) };
- }
- catch (BadLocationException e) {
- Activator.logError("BadLocationException", e);
- }
- }
- }
- }
- }
-
- return null;
- }
-
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/preferences/ImpexPreferencePage.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/preferences/ImpexPreferencePage.java
deleted file mode 100755
index a7edf027..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/preferences/ImpexPreferencePage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.preferences;
-
-import org.eclipse.jface.preference.ColorFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-import com.hybris.impexformatter.Activator;
-
-/**
- * This class represents a preference page that
- * is contributed to the Preferences dialog. By
- * subclassing FieldEditorPreferencePage, 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.
- *
- * 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.
- */
-
-public class ImpexPreferencePage
- extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
-
- public ImpexPreferencePage() {
- super(GRID);
- setPreferenceStore(Activator.getDefault().getPreferenceStore());
- setDescription("Colours");
- }
-
- /**
- * Creates the field editors. Field editors are abstractions of
- * the common GUI blocks needed to manipulate various types
- * of preferences. Each field editor knows how to save and
- * restore itself.
- */
- public void createFieldEditors() {
-
- addField(new ColorFieldEditor(PreferenceConstants.P_COMMENT_COLOR, "Comments: ", getFieldEditorParent()));
- addField(new ColorFieldEditor(PreferenceConstants.P_DEF_COLOR, "Variables ($productCatalog, $languages,...): ", getFieldEditorParent()));
- addField(new ColorFieldEditor(PreferenceConstants.P_TAG_COLOR, "Tags (INSERT, INSERT_UPDATE,...: ", getFieldEditorParent()));
- addField(new ColorFieldEditor(PreferenceConstants.P_INSTRUCT_COLOR, "Instructions: ", getFieldEditorParent()));
- addField(new ColorFieldEditor(PreferenceConstants.P_MODIF_COLOR, "Modifiers (unique, default,...: ", getFieldEditorParent()));
- addField(new ColorFieldEditor(PreferenceConstants.P_KVAL_COLOR, "Keywords (true, false,...: ", getFieldEditorParent()));
- addField(new ColorFieldEditor(PreferenceConstants.P_REF_COLOR, "References: ", getFieldEditorParent()));
- addField(new ColorFieldEditor(PreferenceConstants.P_STRING_COLOR, "Main Text: ", getFieldEditorParent()));
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
-
- }
-
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/preferences/PreferenceConstants.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/preferences/PreferenceConstants.java
deleted file mode 100755
index 84e634a1..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/preferences/PreferenceConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.preferences;
-
-
-/**
- * Constant definitions for plug-in preferences
- */
-public class PreferenceConstants {
-
- public static final String P_STRING_COLOR = "impexStringColorPreference";
- public static final String P_COMMENT_COLOR = "impexCommentColorPreference";
- public static final String P_INSTRUCT_COLOR = "impexInstructColorPreference";
- public static final String P_MODIF_COLOR = "impexModifColorPreference";
- public static final String P_TAG_COLOR = "impexTagColorPreference";
- public static final String P_KVAL_COLOR = "impexKvalColorPreference";
- public static final String P_REF_COLOR = "impexReferenceColorPreference";
- public static final String P_DEF_COLOR = "impexDefColorPreference";
-
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/preferences/PreferenceInitializer.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/preferences/PreferenceInitializer.java
deleted file mode 100755
index 8e3fccdc..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/preferences/PreferenceInitializer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-
-import com.hybris.impexformatter.Activator;
-import com.hybris.impexformatter.editors.ColorProvider;
-
-/**
- * Class used to initialize default preference values.
- */
-public class PreferenceInitializer extends AbstractPreferenceInitializer {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- public void initializeDefaultPreferences() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-
- PreferenceConverter.setDefault(store, PreferenceConstants.P_STRING_COLOR, ColorProvider.GREEN_COLOR);
- PreferenceConverter.setDefault(store, PreferenceConstants.P_COMMENT_COLOR, ColorProvider.GREY_COLOR);
- PreferenceConverter.setDefault(store, PreferenceConstants.P_INSTRUCT_COLOR, ColorProvider.DGREY_COLOR);
- PreferenceConverter.setDefault(store, PreferenceConstants.P_MODIF_COLOR, ColorProvider.PURPLE_COLOR);
- PreferenceConverter.setDefault(store, PreferenceConstants.P_TAG_COLOR, ColorProvider.PURPLE_COLOR);
- PreferenceConverter.setDefault(store, PreferenceConstants.P_KVAL_COLOR, ColorProvider.ORANGE_COLOR);
- PreferenceConverter.setDefault(store, PreferenceConstants.P_REF_COLOR, ColorProvider.RED_COLOR);
- PreferenceConverter.setDefault(store, PreferenceConstants.P_DEF_COLOR, ColorProvider.BLUE_COLOR);
-
- }
-
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/rules/RuleFactory.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/rules/RuleFactory.java
deleted file mode 100755
index 68928595..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/rules/RuleFactory.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.rules;
-
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.IWordDetector;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WordRule;
-
-public class RuleFactory {
-
- public enum ImpexRules {KEYWORD, VARIABLE, REFERENCE, SEMICOLON, COMMA}
-
- public static WordRule buildRule(ImpexRules ruleType, IToken token) {
- return switch (ruleType) {
- case KEYWORD -> buildKeywordRule(token);
- case VARIABLE -> buildVariableRule('$', token);
- case REFERENCE -> buildVariableRule('&', token);
- case SEMICOLON -> buildCharRule(';', token);
- case COMMA -> buildCharRule(',', token);
- default -> null;
- };
- }
-
- private static WordRule buildCharRule(final char startChar, IToken token) {
- if (token == null) {token = Token.UNDEFINED;}
- return new WordRule(new IWordDetector() {
-
- @Override
- public boolean isWordStart(char c) {
- return c == startChar;
- }
-
- @Override
- public boolean isWordPart(char c) {
- return false;
- }
- }, token);
- }
-
- private static WordRule buildKeywordRule(IToken token) {
- if (token == null) {token = Token.UNDEFINED;}
- return new WordRule(new IWordDetector() {
- public boolean isWordStart(char c) {
- return Character.isJavaIdentifierStart(c);
- }
-
- public boolean isWordPart(char c) {
- return Character.isJavaIdentifierPart(c);
- }
- }, token);
- }
-
- private static WordRule buildVariableRule(final char startChar, IToken token) {
- if (token == null) {token = Token.UNDEFINED;}
- return new WordRule(new IWordDetector() {
- public boolean isWordStart(char c) {
- return c == startChar;
- }
-
- public boolean isWordPart(char c) {
- return Character.isJavaIdentifierPart(c);
- }
- }, token);
- }
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/ImpexBracesAutoEditStrategy.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/ImpexBracesAutoEditStrategy.java
deleted file mode 100755
index af76479a..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/ImpexBracesAutoEditStrategy.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.scanners;
-
-import org.eclipse.jface.text.DocumentCommand;
-import org.eclipse.jface.text.IAutoEditStrategy;
-import org.eclipse.jface.text.IDocument;
-
-public class ImpexBracesAutoEditStrategy implements IAutoEditStrategy {
-
- @Override
- public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
-
- if (command.text.equalsIgnoreCase("\"")) {
- command.text = "\"\"";
- configureCommand(command);
- }
- else if (command.text.equalsIgnoreCase("'")) {
- command.text = "''";
- configureCommand(command);
- }
- else if (command.text.equalsIgnoreCase("[")) {
- command.text = "[]";
- configureCommand(command);
- }
- else if (command.text.equalsIgnoreCase("(")) {
- command.text = "()";
- configureCommand(command);
- }
-
- }
-
- private void configureCommand(DocumentCommand command) {
- // puts the caret between both the quotes
-
- command.caretOffset = command.offset + 1;
- command.shiftsCaret = false;
-
- }
-
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/ImpexPartitionScanner.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/ImpexPartitionScanner.java
deleted file mode 100755
index 70cca2d7..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/ImpexPartitionScanner.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.scanners;
-
-//import java.util.ArrayList;
-//import java.util.List;
-
-//import org.eclipse.jface.text.rules.EndOfLineRule;
-//import org.eclipse.jface.text.rules.IPredicateRule;
-//import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
-//import org.eclipse.jface.text.rules.SingleLineRule;
-//import org.eclipse.jface.text.rules.Token;
-
-public class ImpexPartitionScanner extends RuleBasedPartitionScanner {
-
- public final static String yIMPEX_DATA = "__y_impex_data";
- public final static String yIMPEX_COMMENT = "__y_impex_comment";
- public final static String yIMPEX_INSTRUCTION = "__y_impex_instruction";
- public final static String yIMPEX_HEADER = "__y_impex_header";
-
- public final static String[] yPARTITIONS = new String[] {yIMPEX_DATA, yIMPEX_COMMENT, yIMPEX_INSTRUCTION, yIMPEX_HEADER};
-
- public ImpexPartitionScanner() {
-
- /*super();
-
- IToken data = new Token(ImpexPartitionScanner.IMPEX_DATA);
- IToken comment = new Token(ImpexPartitionScanner.IMPEX_COMMENT);
- IToken instruction = new Token(ImpexPartitionScanner.IMPEX_INSTRUCTION);
- IToken header = new Token(ImpexPartitionScanner.IMPEX_HEADER);
-
- List rules = new ArrayList<>();
-
- rules.add(new EndOfLineRule(";", data));
- rules.add(new EndOfLineRule("#", comment));
- rules.add(new EndOfLineRule("#%", instruction));
- rules.add(new SingleLineRule("INSERT", null, header, '\\', true, true));
- rules.add(new SingleLineRule("UPDATE", null, header, '\\', true, true));
- rules.add(new SingleLineRule("REMOVE", null, header, '\\', true, true));
-
- IPredicateRule[] result= new IPredicateRule[rules.size()];
- rules.toArray(result);
- setPredicateRules(result);*/
- }
-
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/ImpexRuleScanner.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/ImpexRuleScanner.java
deleted file mode 100755
index 0cd9b18d..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/ImpexRuleScanner.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.scanners;
-
-import java.awt.Font;
-import java.util.List;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.EndOfLineRule;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WordRule;
-
-import com.google.common.collect.Lists;
-import com.hybris.impexformatter.Activator;
-import com.hybris.impexformatter.actions.Formatter;
-import com.hybris.impexformatter.editors.ColorProvider;
-import com.hybris.impexformatter.preferences.PreferenceConstants;
-import com.hybris.impexformatter.rules.RuleFactory;
-import com.hybris.impexformatter.rules.RuleFactory.ImpexRules;
-
-/**
- * Scanner which contains sequence of rules
- */
-public class ImpexRuleScanner extends RuleBasedScanner {
-
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-
- public ImpexRuleScanner(ColorProvider provider) {
- IToken stringToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_STRING_COLOR))));
- IToken commentToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_COMMENT_COLOR))));
- IToken instructToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_INSTRUCT_COLOR)), null, Font.ITALIC));
- IToken modifiersToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_MODIF_COLOR))));
- IToken impexTagsToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_TAG_COLOR)), null, Font.BOLD));
- IToken keywordsValuesToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_KVAL_COLOR))));
- IToken referenceToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_REF_COLOR)), null, Font.BOLD));
- IToken definitionsToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_DEF_COLOR)), null, Font.ITALIC));
-
- List rules = Lists.newArrayList();
- // trap instruction within quotes first to prevent being picked up by next rules
- rules.add(new EndOfLineRule("\"#%", instructToken));
-
- // rule for Strings - may span multiple lines
- rules.add(new MultiLineRule("\"", "\"", stringToken));
- rules.add(new MultiLineRule("\'", "\'", stringToken));
-
- rules.add(new EndOfLineRule("#%", instructToken));
- // rule for comments - ended by a line delimiter
- rules.add(new EndOfLineRule("#", commentToken));
-
- WordRule wordRule = RuleFactory.buildRule(ImpexRules.KEYWORD, null);
- // rule for modifiers
- for (String word : Formatter.IMPEX_KEYWORDS_ATTRIBUTES) {
- wordRule.addWord(word, modifiersToken);
- }
-
- // rule for impex tags
- for (String header : Formatter.HEADER_MODE_PROPOSALS) {
- wordRule.addWord(header, impexTagsToken);
- }
-
- // rule for keyword values
- for (String value : Formatter.KEYWORDS_VALUES) {
- wordRule.addWord(value, keywordsValuesToken);
- }
-
- rules.add(wordRule);
-
- // rule for definitions
- wordRule = RuleFactory.buildRule(ImpexRules.VARIABLE, definitionsToken);
- rules.add(wordRule);
- wordRule = RuleFactory.buildRule(ImpexRules.REFERENCE, referenceToken);
- rules.add(wordRule);
-
- wordRule = RuleFactory.buildRule(ImpexRules.SEMICOLON, modifiersToken);
- rules.add(wordRule);
- wordRule = RuleFactory.buildRule(ImpexRules.COMMA, modifiersToken);
- rules.add(wordRule);
-
- IRule[] ruleArray = new IRule[rules.size()];
- setRules(rules.toArray(ruleArray));
- }
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/InstructionsRuleScanner.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/InstructionsRuleScanner.java
deleted file mode 100755
index 4990884f..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/scanners/InstructionsRuleScanner.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.scanners;
-
-import java.awt.Font;
-import java.util.List;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.EndOfLineRule;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WordRule;
-
-import com.google.common.collect.Lists;
-import com.hybris.impexformatter.Activator;
-import com.hybris.impexformatter.actions.Formatter;
-import com.hybris.impexformatter.editors.ColorProvider;
-import com.hybris.impexformatter.preferences.PreferenceConstants;
-import com.hybris.impexformatter.rules.RuleFactory;
-import com.hybris.impexformatter.rules.RuleFactory.ImpexRules;
-
-/**
- * Scanner which contains sequence of rules
- */
-public class InstructionsRuleScanner extends RuleBasedScanner {
-
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-
- public InstructionsRuleScanner(ColorProvider provider) {
- IToken stringToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_STRING_COLOR))));
- IToken commentToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_COMMENT_COLOR))));
- IToken instructToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_INSTRUCT_COLOR)), null, Font.ITALIC));
- IToken definitionsToken = new Token(new TextAttribute(provider.getColor(PreferenceConverter.getColor(store, PreferenceConstants.P_DEF_COLOR)), null, Font.ITALIC));
-
- List rules = Lists.newArrayList();
- // rule for Strings - may spanning multiple lines
- rules.add(new MultiLineRule("\"", "\"", stringToken));
- rules.add(new MultiLineRule("\'", "\'", stringToken));
- rules.add(new EndOfLineRule("#%", instructToken));
- // rule for comments - ended by a line delimiter
- rules.add(new EndOfLineRule("//", commentToken));
-
- WordRule wordRule = RuleFactory.buildRule(ImpexRules.KEYWORD, null);
- // rule for instructions
- for (String word : Formatter.INSTRUCTION_CLASS_PROPOSALS) {
- wordRule.addWord(word, instructToken);
- }
-
- rules.add(wordRule);
-
- // rule for definitions
- wordRule = RuleFactory.buildRule(ImpexRules.VARIABLE, definitionsToken);
- rules.add(wordRule);
- IRule[] ruleArray = new IRule[rules.size()];
- setRules(rules.toArray(ruleArray));
- }
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/utils/ColorHelper.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/utils/ColorHelper.java
deleted file mode 100755
index f8ba1923..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/utils/ColorHelper.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.utils;
-
-import org.eclipse.swt.graphics.RGB;
-
-public class ColorHelper {
-
- public static final String rgbTohex(RGB color) {
- Integer value = color.blue | (color.green << 8) | (color.red << 16);
- return '#' + Integer.toHexString(value);
- }
-
- public static final RGB hexTorgb(String color) {
- java.awt.Color result = java.awt.Color.decode(color);
- RGB rgb = new RGB(result.getRed(), result.getGreen(), result.getBlue());
- return rgb;
- }
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/utils/StringHelper.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/utils/StringHelper.java
deleted file mode 100644
index a5e13f64..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/utils/StringHelper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.hybris.impexformatter.utils;
-
-public class StringHelper {
-
- /**
- * checks if in typecode
is possible to find prefix
. Case insensitive.
- * @param typeCode that is main string
- * @param prefix check if given prefix exists
- * @return true if there is a match case insensitive and is less than main string.
- */
- public static boolean findMatches(String typeCode, String prefix) {
- String tcUp = typeCode.toUpperCase();
- String cpUp = prefix.toUpperCase();
- return tcUp.startsWith(cpUp) && prefix.length() < typeCode.length();
- }
-
-
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/wizards/NewImpexWizard.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/wizards/NewImpexWizard.java
deleted file mode 100755
index 85745ef4..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/wizards/NewImpexWizard.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.wizards;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-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.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-import com.hybris.impexformatter.Activator;
-
-public class NewImpexWizard extends Wizard implements INewWizard {
-
- private NewImpexWizardPage wizardPage;
- private ISelection currentSelection;
-
- public NewImpexWizard() {
- super();
- setNeedsProgressMonitor(true);
- }
-
- @Override
- public void addPages() {
- wizardPage = new NewImpexWizardPage(currentSelection);
- addPage(wizardPage);
- }
-
- public void setCurrentSelection(ISelection selection) {
- this.currentSelection = selection;
- }
-
- @Override
- public boolean performFinish() {
- final String containerName = wizardPage.getContainerName();
- final String fileName = wizardPage.getFileName();
- IRunnableWithProgress irwp = new IRunnableWithProgress() {
- public void run(IProgressMonitor ipm) throws InvocationTargetException {
- try {
- createSampleFile(ipm, containerName, fileName);
- }
- catch (CoreException ce) {
- throw new InvocationTargetException(ce);
- }
- finally {
- ipm.done();
- }
- }
- };
- try {
- getContainer().run(true, false, irwp);
- }
- catch (InterruptedException ie) {
- Thread.currentThread().interrupt();
- return false;
- }
- catch (InvocationTargetException ite) {
- Throwable realException = ite.getTargetException();
- MessageDialog.openError(getShell(), "Error", realException.getMessage());
- return false;
- }
- return true;
- }
-
- private void createSampleFile(IProgressMonitor monitor, String containerName, String fileName) throws CoreException {
-
- monitor.beginTask("Creating " + fileName, 2);
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IResource resource = root.findMember(new Path(containerName));
- if (!resource.exists() || !(resource instanceof IContainer)) {
- throwCoreException("Container \"" + containerName + "\" does not exist.");
- }
- IContainer container = (IContainer) resource;
- final IFile file = container.getFile(new Path(fileName));
- try {
- InputStream stream = openContentStream();
- if (file.exists()) {
- file.setContents(stream, true, true, monitor);
- }
- else {
- file.create(stream, true, monitor);
- }
- if (stream != null) {
- stream.close();
- }
- }
- catch (IOException e) {
- Activator.logError("IOException", e);
- }
- monitor.worked(1);
- monitor.setTaskName("Opening file for editing...");
-
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- try {
- HashMap map = new HashMap();
- map.put(IDE.EDITOR_ID_ATTR, "com.hybris.impexformatter.editors.ImpexPageEditor");
- IMarker marker = file.createMarker(IMarker.TEXT);
- marker.setAttributes(map);
- IDE.openEditor(page, marker, true);
- marker.delete();
- }
- catch (PartInitException e) {
- Activator.logError("PartInitException", e);
- }
- catch (CoreException e) {
- Activator.logError("CoreException", e);
- }
- }
- });
- monitor.worked(1);
- }
-
- private InputStream openContentStream() {
- String contents = "# USE CTRL-SPACE for type-ahead support\n";
- return new ByteArrayInputStream(contents.getBytes());
- }
-
- private void throwCoreException(String message) throws CoreException {
- IStatus status = new Status(IStatus.ERROR, "impexFormatter", IStatus.OK, message, null);
- throw new CoreException(status);
- }
-
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.currentSelection = selection;
- }
-
-}
diff --git a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/wizards/NewImpexWizardPage.java b/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/wizards/NewImpexWizardPage.java
deleted file mode 100755
index 11e4af58..00000000
--- a/com.hybris.hyeclipse.impexed/src/com/hybris/impexformatter/wizards/NewImpexWizardPage.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright 2020 SAP
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
-package com.hybris.impexformatter.wizards;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-
-public class NewImpexWizardPage extends WizardPage {
-
- private Text containerText;
- private Text fileText;
- private ISelection selection;
-
- public NewImpexWizardPage(ISelection selection) {
- super("wizardPage");
- setTitle("New Impex File");
- setDescription("This wizard creates a new file with a *.impex extension that can be used with the Impex editor.");
- this.selection = selection;
- }
-
- @Override
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- container.setLayout(layout);
- layout.numColumns = 3;
- layout.verticalSpacing = 9;
- Label label = new Label(container, SWT.NULL);
- label.setText("&Project/Folder:");
-
- containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- containerText.setLayoutData(gd);
- containerText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- dialogChanged();
- }
- });
-
- Button button = new Button(container, SWT.PUSH);
- button.setText("Browse...");
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleBrowse();
- }
- });
- label = new Label(container, SWT.NULL);
- label.setText("&File name:");
-
- fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fileText.setLayoutData(gd);
- fileText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- dialogChanged();
- }
- });
- initialize();
- dialogChanged();
- setControl(container);
- }
-
- private void initialize() {
- if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection ssel) {
- if (ssel.size() > 1)
- return;
- Object obj = ssel.getFirstElement();
- if (obj instanceof IResource) {
- IContainer container;
- if (obj instanceof IContainer iContainer)
- container = iContainer;
- else
- container = ((IResource) obj).getParent();
- containerText.setText(container.getFullPath().toString());
- }
- else if (ssel instanceof TreeSelection treeSelection) {
- TreePath[] treePaths = treeSelection.getPaths();
- TreePath treePath = treePaths[0];
- Object lastSegmentObj = treePath.getLastSegment();
- if (lastSegmentObj instanceof IPackageFragmentRoot) {
- IPackageFragmentRoot packageRoot = (IPackageFragmentRoot) ((IAdaptable) lastSegmentObj).getAdapter(IPackageFragmentRoot.class);
- IPath packagePath = packageRoot.getPath();
- containerText.setText(packagePath.toString());
- }
- else if (lastSegmentObj instanceof IPackageFragment) {
- IPackageFragment packageFragment = (IPackageFragment) ((IAdaptable) lastSegmentObj).getAdapter(IPackageFragment.class);
- if (packageFragment != null) {
- IPath packagePath = packageFragment.getPath();
- containerText.setText(packagePath.toString());
- }
- }
- }
- }
- fileText.setText("test.impex");
- }
-
- private void handleBrowse() {
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace()
- .getRoot(), false, "Select Project/Folder");
- if (dialog.open() == ContainerSelectionDialog.OK) {
- Object[] result = dialog.getResult();
- if (result.length == 1) {
- containerText.setText(((Path) result[0]).toString());
- }
- }
- }
-
- private void dialogChanged() {
- IResource container = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(getContainerName()));
- String fileName = getFileName();
-
- if (getContainerName().length() == 0) {
- updateStatus("Project/Folder must be specified");
- return;
- }
- if (container == null || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
- updateStatus("Project/Folder must exist");
- return;
- }
- if (!container.isAccessible()) {
- updateStatus("Project/Folder must be writable");
- return;
- }
- if (fileName.length() == 0) {
- updateStatus("File name must be specified");
- return;
- }
- if (fileName.replace('\\', '/').indexOf('/', 1) > 0) {
- updateStatus("File name must be valid");
- return;
- }
- int dotLoc = fileName.lastIndexOf('.');
- if (dotLoc != -1) {
- String ext = fileName.substring(dotLoc + 1);
- if (ext.equalsIgnoreCase("impex") == false && ext.equalsIgnoreCase("csv") == false) {
- updateStatus("File extension must be \"impex\" or \"csv\"");
- return;
- }
- }
- updateStatus(null);
- }
-
- private void updateStatus(String message) {
- setErrorMessage(message);
- setPageComplete(message == null);
- }
-
- public String getContainerName() {
- return containerText.getText();
- }
-
- public String getFileName() {
- return fileText.getText();
- }
-}
diff --git a/com.hybris.hyeclipse.impexed/test.impex b/com.hybris.hyeclipse.impexed/test.impex
deleted file mode 100755
index 8853933e..00000000
--- a/com.hybris.hyeclipse.impexed/test.impex
+++ /dev/null
@@ -1,207 +0,0 @@
-# Einheiten
-# Hier werden alle Einheiten wie g, Kg, ml, usw. eingetragen. Dabei mĂĽssen alle Einheiten die aus der
-# "20130524_ Checkliste Compexpflege mit Datentyp IDs.xlsx" (aus allen Wertelisten) entnommen werden hintereinander weg aufgezählt werden.
-# Jede Einheit muss dazu mit einer eineindeutigen ID versehen werden. In unserem Beispiel ist das 1,2,3,4,5,6. Zusätzlich kann ein Einheitentyp
-# angegeben werden hier gewicht, länge... der für spätere konvertierungen genutzt werden kann. Das Typ-Feld ist dabei kann pflichtfeld.
-# Der englische und der deutsche name wurden hier auf den Wert des Symbols gesetzt. Auf der grafischen Oberfläche wird später nur das Symbol angezeigt.
-# INSERT_UPDATE ClassificationAttributeUnit -> Ein Befehl zum erstellen/aktuallisieren von Merkmalseinheiten. Unterhalb des Headers bleiben die Zeilen leer.
-# code[unique=true] -> Eine eineindeutige ID fĂĽr die Einheit. Unterhalb des Headers werden alle Einheiten ID's eingetragen.
-# name[lang=de] -> Der deutsche Name der Einheit. Unterhalb des Headers werden alle deutschen Namen der Einheit eingetragen.
-# name[lang=en] -> Der englische Name der Einheit. Unterhalb des Headers werden alle englischen Namen der Einheit eingetragen.
-# unitType -> Der Typ der Einheit. Unterhalb des Headers werden die Typen eingetragen, falls notwendig.
-# $classSystemVersion -> Die Version der Klassifizierung. Unterhalb des Headers bleiben die Zeilen leer. -> von SL mit default gesetzt
-
-# Pflichtfelder: code[unique=true] name[lang=de] name[lang=en] symbol
-
-INSERT_UPDATE Order; code[unique=true]; \
- @template1[translator=de.hybris.jakarta.ext.impex.jalo.translators.VelocityTranslator, expr='$item.user.getUID()']; \
- @template2[translator=de.hybris.jakarta.ext.impex.jalo.translators.VelocityTranslator, expr='$item.user.name']; \
- "@template3[translator=de.hybris.jakarta.ext.impex.jalo.translators.VelocityTranslator, expr='$item.paymentAddress.getAttribute(""streetname"")']"; \
- @template4[translator=de.hybris.jakarta.ext.impex.jalo.translators.VelocityTranslator, expr='$item.paymentAddress.country.IsoCode']
-
-INSERT_UPDATE ClassificationAttributeUnit;code[unique=true];name[lang=de];name[lang=en];symbol;unitType;$classSystemVersion
-;1;ml;ml;ml;Fuellmenge
-;2;g;g;g;Gewicht
-;3;kg;kg;kg;Gewicht
-;4;L;L;L;Fuellmenge
-;5;WL;WL;WL;Fuellmenge
-;6;m;m;m;Laenge
-
-
-
-# Wertelisten
-# Hier werden alle Wertelisten, die später aus einem DropDown-Menü gewählt werden können, eingetragen. Die Beispieldaten wurden aus der
-# "20130524_ Checkliste Compexpflege mit Datentyp IDs.xlsx" entnommen. Es ist zu beachten, dass nur nichtkomplexe Wertelisten eingetragen werden.
-# Nicht komplexe Wertelisten sind Wertelisten, die nur eine ID und einen Bezeichner enthalten. Komplexere Wertelisten werden später als Objekte in der Hybris
-# abgebildet und an das Produkt gehängt. (Beispiel komplexe Werteliste: Operative Einheit). Alle Werte aus den nicht komplexen Wertelisten werden hier aufgelistet.
-# Jeder Wert muss dazu mit einer eineindeutigen ID versehen werden (code[unique=true]). In unserem Beispiel ist das WL1,WL2,WL3,... . Das Feld "externalid" enthält
-# die CompexID's wie diese in der Datei "20130524_ Checkliste Compexpflege mit Datentyp IDs.xlsx" mitgeliefert wurden.
-# Bei nicht vorhandener ID wurde der Bezeichner als ID eingetragen.
-# INSERT_UPDATE ClassificationAttributeValue -> Ein Befehl zum erstellen/aktuallisieren von Wertelisten. Unterhalb des Headers bleiben die Zeilen leer.
-# code[unique=true] -> Eine eineindeutige ID fĂĽr den Wert. Unterhalb des Headers werden alle Werte ID's eingetragen.
-# externalid -> Eine nicht eineindeutige Compex ID. Unterhalb des Headers werden alle Compex ID's eingetragen.
-# name[lang=de] -> Der deutsche Name des Wertes. Unterhalb des Headers werden alle deutschen Namen der Werte eingetragen.
-# name[lang=en] -> Der englische Name des Wertes. Unterhalb des Headers werden alle englischen Namen der Werte eingetragen.
-# $classSystemVersion -> Die Version der Klassifizierung. Unterhalb des Headers bleiben die Zeilen leer. -> von SL mit default gesetzt
-
-# Pflichtfelder: code[unique=true] externalid name[lang=de] name[lang=en]
-
-INSERT_UPDATE ClassificationAttributeValue;code[unique=true];externalid;name[lang=de];name[lang=en];$classSystemVersion
-;WL1;1;Basis 1 KG;Basis 1 KG
-;WL2;100;Basis 100 gr;Basis 100 gr
-;WL3;0;keine Zuordnung;keine Zuordnung
-;WL4;2;GemĂĽse;GemĂĽse
-;WL5;3;TrockenfrĂĽchte/NĂĽsse;TrockenfrĂĽchte/NĂĽsse
-;WL6;4;Frische Kräuter;Frische Kräuter
-;WL7;5;vom Schwein;vom Schwein
-;WL8;6;vom Rind;vom Rind
-;WL9;7;vom Kalb;vom Kalb
-;WL10;8;vom Lamm;vom Lamm
-;WL11;9;GeflĂĽgel;GeflĂĽgel
-;WL12;10;Hackfleisch;Hackfleisch
-;WL13;11;Sonstiges Fleisch;Sonstiges Fleisch
-;WL14;12;WĂĽrstchen;WĂĽrstchen
-;WL15;13;Speck & Schinken;Speck & Schinken
-;WL16;14;Salami & Dauerwurst;Salami & Dauerwurst
-;WL17;15;Streichwurst;Streichwurst
-;WL18;16;Aufschnitt;Aufschnitt
-
-# Klassifizierende Merkmale
-# Hier werden alle Merkmale aufgelistet, die in den Klassifikationen auftauchen können (ohne die Klassifikation: Allgemeingültige Attribute).
-# Diese Merkmale wurden aus der XML-Datei (Klassifizierung Stand 08.07.2013.xlsx) extrahiert.
-# Die ID's wie "ARKU_400_0018" wurden von Softlution als Provisorium erstellt um ID's wie "Erfasser des Artikels" zu vermeiden.
-# INSERT_UPDATE ClassificationAttribute -> Ein Befehl zum erstellen/aktualisieren von Klassifikationensattributen. Unterhalb des Headers bleiben die Zeilen leer.
-# code[unique=true] -> Eine eineindeutige ID fĂĽr die Klassifikation. Unterhalb des Headers werden alle Klassifikations ID's eingetragen.
-# name[lang=de] -> Der deutsche Name der Klassifikation. Unterhalb des Headers werden alle deutschen Namen der Klassifikationen eingetragen.
-# name[lang=en] -> Der englische Name der Klassifikation. Unterhalb des Headers werden alle englischen Namen der Klassifikationen eingetragen.
-# Als Namen wurden die Hybris Bezeichner aus der XML-Datei (20130524_ Checkliste Compexpflege mit Datentyp IDs.xlsx) genommen.
-# $classSystemVersion -> Die Version der Klassifizierung. Unterhalb des Headers bleiben die Zeilen leer. -> von SL mit default gesetzt
-
-# Pflichtfelder: code[unique=true] name[lang=de] name[lang=en]
-
-INSERT_UPDATE ClassificationAttribute;code[unique=true];name[lang=de];name[lang=en];$classSystemVersion
-;ARKU_400_0018;Waagen Zuordnung;Waagen Zuordnung
-;ARKU_423_0001;Grundpreis Basis;Grundpreis Basis
-;ARKU_423_0002;gĂĽltig ab;gĂĽltig ab
-;ARKU_423_0003;gĂĽltig bis;gĂĽltig bis
-;ARKU_423_0004;Grundpreis Inhalt;Grundpreis Inhalt
-;ARKU_423_0005;Nettoinhalt/Abtropfgewicht;Nettoinhalt/Abtropfgewicht
-;ARKU_400_0026;Nachkommastellen;Nachkommastellen
-;ARKU_400_0031;Pfand;Pfand
-;ARKU_400_0032;Leergut;Leergut
-;ARKU_400_0033;Gefahrgut;Gefahrgut
-;ARKU_432_0004;Durchschnittsgewicht;Durchschnittsgewicht
-;ARKU_432_0005;Erfasser des Artikels;Erfasser des Artikels
-
-# Klassifikationen
-# Hier werden zunächst alle Klassifizierungen angelegt.
-# INSERT_UPDATE ClassificationClass -> Ein Befehl zum erstellen/aktuallisieren von Klassifikationen. Unterhalb des Headers bleiben die Zeilen leer.
-# code[unique=true] -> Eine eineindeutige ID fĂĽr die Klassifikation. Unterhalb des Headers werden alle Klassifikations ID's eingetragen.
-# name[lang=de] -> Der deutsche Name der Klassifikation. Unterhalb des Headers werden alle deutschen Namen der Klassifikationen eingetragen.
-# name[lang=en] -> Der englische Name der Klassifikation. Unterhalb des Headers werden alle englischen Namen der Klassifikationen eingetragen.
-# Als Namen wurden die Bezeichner aus der XML-Datei (Klassifizierung Stand 08.07.2013.xlsx) genommen.
-# allowedPrincipals(uid)[default='customergroup'] -> Die Nutzergruppe, die auf die Klassifikation zugreifen dürfen. Unterhalb des Headers können berechtigte Gruppen eingetragen werden. -> von SL mit default gesetzt
-# $classCatalogVersion -> Die Version der Klassifizierung. Unterhalb des Headers bleiben die Zeilen leer. -> von SL mit default gesetzt
-
-# Pflichtfelder: code[unique=true] name[lang=de] name[lang=en]
-
-INSERT_UPDATE ClassificationClass;code[unique=true];name[lang=de];name[lang=en];$classCatalogVersion;allowedPrincipals(uid)[default='customergroup']
-;Zuordnungspflichtig;Zuordnungspflichtig;Zuordnungspflichtig
-;Sortimentsartikel;Sortimentsartikel;Sortimentsartikel
-;Lebensmittel und lebenmittelnahe Produkte;Lebensmittel und lebenmittelnahe Produkte;Lebensmittel und lebenmittelnahe Produkte
-;nicht Lebensmittel (NF II);nicht Lebensmittel (NF II);nicht Lebensmittel (NF II)
-;Obst/GemĂĽse/Blumen;Obst/GemĂĽse/Blumen;Obst/GemĂĽse/Blumen
-;Obst/GemĂĽse;Obst/GemĂĽse;Obst/GemĂĽse
-;Fresh Cut;Fresh Cut;Fresh Cut
-;Blumen;Blumen;Blumen
-;Bedienung;Bedienung;Bedienung
-;interne Artikel;interne Artikel;interne Artikel
-;systemtechnische Artikel;systemtechnische Artikel;systemtechnische Artikel
-;Ladehilfsmittel und Transporthilfsmittel;Ladehilfsmittel und Transporthilfsmittel;Ladehilfsmittel und Transporthilfsmittel
-;Verbrauchsmaterial;Verbrauchsmaterial;Verbrauchsmaterial
-;technische Artikel;technische Artikel;technische Artikel
-;nicht logistische Artikel;nicht logistische Artikel;nicht logistische Artikel
-;Gruppenartikel Wert;Gruppenartikel Wert;Gruppenartikel Wert
-;Gruppenartikel Menge/ Wert;Gruppenartikel Menge/ Wert;Gruppenartikel Menge/ Wert
-;Pfand/Leergut Artikel;Pfand/Leergut Artikel;Pfand/Leergut Artikel
-;Zusatz;Zusatz;Zusatz
-;Eigenmarken;Eigenmarken;Eigenmarken
-;Gefahrgut;Gefahrgut;Gefahrgut
-;KĂĽhlpflichtig;KĂĽhlpflichtig;KĂĽhlpflichtig
-;Online Artikel;Online Artikel;Online Artikel
-;Pfandbehaftet;Pfandbehaftet;Pfandbehaftet
-
-# Klassifikationsbaum
-# Hier wird der Klassifikationsbaum aus der Excel-Datei (Klassifizierung Stand 08.07.2013.xlsx) aufgebaut. Dazu wurden die Spalten B bis E genutzt.
-# Die Spalte A wurde ignoriert, da die dort aufgelisteten Attribute schon am Produkt existieren sollen.
-# INSERT_UPDATE CategoryCategoryRelation -> Ein Befehl zum erstellen/aktuallisieren von Klassifikationensabhängigkeiten. Unterhalb des Headers bleiben die Zeilen leer.
-# $categories -> Die ID einer Subklassifikation
-# $supercategories -> Die ID einer Oberkategorie
-# Beispiel ($categories <-> $supercategories): Blumen <-> Obst/GemĂĽse/Blumen
-
-# Pflichtfelder: $categories $supercategories
-
-INSERT_UPDATE CategoryCategoryRelation;$categories;$supercategories
-;Sortimentsartikel;Zuordnungspflichtig
-;interne Artikel;Zuordnungspflichtig
-;technische Artikel;Zuordnungspflichtig
-
-;Lebensmittel und lebenmittelnahe Produkte;Sortimentsartikel
-;nicht Lebensmittel (NF II);Sortimentsartikel
-;Obst/GemĂĽse/Blumen;Sortimentsartikel
-;Bedienung;Sortimentsartikel
-
-;Obst/GemĂĽse;Obst/GemĂĽse/Blumen
-;Fresh Cut;Obst/GemĂĽse/Blumen
-;Blumen;Obst/GemĂĽse/Blumen
-
-;systemtechnische Artikel;interne Artikel
-;Ladehilfsmittel und Transporthilfsmittel;interne Artikel
-;Verbrauchsmaterial;interne Artikel
-
-;nicht logistische Artikel;technische Artikel
-;Gruppenartikel Wert;nicht logistische Artikel
-;Gruppenartikel Menge/ Wert;nicht logistische Artikel
-;Pfand/Leergut Artikel;technische Artikel
-
-;Eigenmarken;Zusatz
-;Gefahrgut;Zusatz
-;KĂĽhlpflichtig;Zusatz
-;Online Artikel;Zusatz
-;Pfandbehaftet;Zusatz
-
-# Wertelisten
-# Hier werden alle Wertelisten, die später aus einem DropDown-Menü gewählt werden können, eingetragen. Die Beispieldaten wurden aus der
-# "20130524_ Checkliste Compexpflege mit Datentyp IDs.xlsx" entnommen. Es ist zu beachten, dass nur nichtkomplexe Wertelisten eingetragen werden.
-# Nicht komplexe Wertelisten sind Wertelisten, die nur eine ID und einen Bezeichner enthalten. Komplexere Wertelisten werden später als Objekte in der Hybris
-# abgebildet und an das Produkt gehängt. (Beispiel komplexe Werteliste: Operative Einheit). Alle Werte aus den nicht komplexen Wertelisten werden hier aufgelistet.
-# Jeder Wert muss dazu mit einer eineindeutigen ID versehen werden (code[unique=true]). In unserem Beispiel ist das WL1,WL2,WL3,... . Das Feld "externalid" enthält
-# die CompexID's wie diese in der Datei "20130524_ Checkliste Compexpflege mit Datentyp IDs.xlsx" mitgeliefert wurden.
-# Bei nicht vorhandener ID wurde der Bezeichner als ID eingetragen.
-# INSERT_UPDATE ClassAttributeAssignment -> Ein Befehl zum erstellen/aktuallisieren von Zuweisungen zwischen Merkmal und Klassifikation. Unterhalb des Headers bleiben die Zeilen leer.
-# $class -> Die Klasse der ein Merkmal zugewiesen werden soll.
-# $attribute - Das Merkmal, dass einer Klassifizierung zugewiesen werden soll.
-# attributeType(code) -> Der Typ eines Merkmals. Hierbei ist zu beachten, dass Hybris nur die Typen date, number, string, boolean und enum kennt.
-# Enums sind die oben angelegten Wertelisten, die als DropDown-MenĂĽ angezeigt werden sollen. FĂĽr jeden wert, muss dabei eine neue Zeile angelegt werden.
-# $attributeValues -> Der Wert aus einer Werteliste, der einem Merkmal zugeordnet werden soll. Dieses Feld wird nur ausgefüllt, wenn der Merkmalstyp 'enum' gewählt wurde. Bleibt sonst leer
-# $unit -> Die ID einer Einheit, die neben dem Merkmal angeziegt/gewählt werden kann.
-# multivalued[default=false] -> Dieses Feld kann auf 'true' gesetzt werden, falls mehrere Werte aus einer DropDown-Liste gewählt werden sollen.
-
-# Pflichtfelder: $class $attribute attributeType(code) $attributeValues {nur bei enum} multivalued[default=false] {nur wenn mehrere Werte gewählt werden sollen}
-
-INSERT_UPDATE ClassAttributeAssignment;$class;$attribute;attributeType(code);$attributeValues;$unit;multivalued[default=false];$classSystemVersion
-;Sortimentsartikel;ARKU_423_0001;enum;WL1;
-;Sortimentsartikel;ARKU_423_0001;enum;WL2;
-;Sortimentsartikel;ARKU_423_0002;date;;
-;Sortimentsartikel;ARKU_423_0003;date;;
-;Sortimentsartikel;ARKU_423_0004;number;;1
-;Sortimentsartikel;ARKU_423_0005;number;;1
-;Sortimentsartikel;ARKU_415_0007;boolean;;
-;Sortimentsartikel;ARKU_415_0008;boolean;;
-;Sortimentsartikel;ARKU_415_0025;number;;
-;Sortimentsartikel;ARKU_415_0026;number;;
-;Sortimentsartikel;LILA_501_0001;string;;
-;Sortimentsartikel;LILA_501_0002;date;;
-;Sortimentsartikel;LILA_501_0003;string;;
-;Sortimentsartikel;LILA_501_0004;date;;
-
diff --git a/docs/dev/development.md b/docs/dev/development.md
index 0470add3..05a1ba35 100644
--- a/docs/dev/development.md
+++ b/docs/dev/development.md
@@ -6,6 +6,10 @@ The documentation site uses MkDocs with Material. `README.md` supplies the homep
the remaining pages and images come from `docs/`. Do not maintain a separate `docs/index.md`.
Navigation and site settings are in the root `mkdocs.yml`.
+Documentation tracks plugin release tags rather than a separate version counter.
+See [Documentation and plugin versioning](versioning.md) for update policy,
+release alignment, and how to read documentation for an installed version.
+
From the repository root, use Python 3.13 and an isolated environment:
```bash
@@ -30,13 +34,41 @@ External links are not checked by the strict build.
### GitHub Pages deployment
In repository **Settings → Pages**, select **GitHub Actions** as the source.
+Allow `master` and release tags matching `v*` in the `github-pages` environment's
+deployment rules if that environment restricts branches/tags. The workflow still
+rejects manual publication from other branches and validates release tag versions.
The Documentation and Eclipse update site workflow validates pull requests without deploying them and publishes
-documentation or `updatesite/` changes pushed to `master`. To rebuild manually, run the workflow from
-the Actions tab with `master` selected. Other branches cannot deploy.
+documentation or `updatesite/` changes pushed to `master`. Published GitHub releases also trigger
+archiving of their tagged documentation. To rebuild or backfill a release, run the workflow from
+the Actions tab with `master` selected; optionally provide `release_tag=vX.Y.Z`.
+Manual runs on other branches cannot deploy.
-The public site is https://sap.github.io/hybris-commerce-eclipse-plugin/.
+The public site is https://mikolayek.github.io/hybris-commerce-eclipse-plugin/; its root redirects to the latest working docs.
The same deployment also hosts the Eclipse p2 repository at
-https://sap.github.io/hybris-commerce-eclipse-plugin/updates/latest/.
+https://mikolayek.github.io/hybris-commerce-eclipse-plugin/updates/latest/.
+
+### Versioned documentation
+
+Mike stores generated snapshots on `docs-versions`; Material displays its version selector.
+`latest` redirects to `development`, while release snapshots use full `X.Y.Z` directories.
+See [Documentation and plugin versioning](versioning.md) for eligibility and archival policy.
+
+The build wrapper creates the combined Pages artifact at `site/`, validates its links,
+and adds one byte-preserved installer repository at `/updates/latest/`. It never pushes
+branches itself. CI exports `docs-history.bundle` and only the trusted deployment job
+pushes generated history, without force-pushing or changing source branches.
+
+For local multi-version preview, activate the documentation environment and run:
+
+```bash
+python tools/docs/versioned_site.py
+mike serve --branch docs-versions
+```
+
+These commands create local history commits but do not push or deploy. `mike serve`
+previews documentation history only; the canonical p2 files are added to the assembled
+`site/` artifact. `mkdocs serve` remains the live, single-version source preview.
+Do not use `mike deploy --push` as a separate Pages publisher: that would omit the installer files.
### Eclipse p2 hosting
@@ -158,6 +190,9 @@ Release notes are generated thanks to [gren](https://github.com/github-tools/git
Follow these steps to prepare, build, and publish a new release:
+Complete the [release documentation checklist](versioning.md#release-documentation-checklist)
+before tagging so the tag includes documentation matching the delivered artifacts.
+
### 1. Create a Release Branch
Start from the latest `master` (or target development branch):
```bash
@@ -230,6 +265,10 @@ together. Once merged into `master`, the Pages workflow publishes it at the stab
`updates/latest/` URL without rebuilding or re-signing it.
### 6. Commit and Tag Release
+Stage the reviewed `README.md`, `CHANGELOG.md`, and `docs/` changes alongside
+the synchronized release metadata. Do not tag a release with its matching
+documentation still uncommitted or add unrelated, unreviewed documentation files.
+
```bash
git add pom.xml */pom.xml */META-INF/MANIFEST.MF */feature.xml updatesite/neon/
git commit -m "chore(release): bump version to VERSION.RELEASE"
diff --git a/docs/dev/impex/editor-replacement-plan.md b/docs/dev/impex/editor-replacement-plan.md
new file mode 100644
index 00000000..9d85ac0e
--- /dev/null
+++ b/docs/dev/impex/editor-replacement-plan.md
@@ -0,0 +1,352 @@
+# ImpEx editor replacement plan
+
+Status: cutover approved on 23 November 2026; legacy source/bundle removed on `feature/impex-lsp-migration`.
+
+## Approved cutover
+
+The user approved removal of the old editor. `com.hybris.hyeclipse.impexed` is
+removed from the source, reactor, feature, and test dependencies. The replacement
+is now named **ImpEx Editor** and registered as the default for `.impex` files.
+Existing wizard/command IDs are preserved for user key bindings, not as dependencies
+on the removed implementation. The phases and verification history below record
+the original coexistence rollout.
+
+Manual UI/upgrade checks and known grammar/compatibility refinements remain pending;
+cutover approval is not a claim that those checks passed. Existing installations may
+need editor reassociation and explicit removal of an independently installed old bundle.
+Published release/update-site history is unchanged. See the replacement bundle's
+README for upgrade notes.
+
+Cutover verification: all 171 tests passed both in a clean build with local artifacts
+ignored and in the normal cached build. Runtime registration tests confirm the old
+bundle/editor/formatter contributions are absent and the replacement is default.
+The new p2 ZIP, feature, and metadata exclude the retired bundle.
+
+## Implementation progress
+
+- Added `com.hybris.hyeclipse.impex` and its independent OSGi test bundle to
+ the reactor, and the preview bundle to the installable feature.
+- Registered **Open With > ImpEx Editor (Preview)** as a non-default Generic
+ Editor, with an ImpEx content type and TM4E presentation reconciler.
+- Moved the grammar into the production bundle as the canonical resource;
+ implemented initial header/modifier/macro/data/comment/script scopes and
+ cell-aware quoting. Grammar and extension-registration tests cover this slice.
+- The 2026-09 target supplies TM4E. Its Generic Editor implementation class is
+ `org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor`; the preview
+ registration uses it directly and tests class resolution. Recheck this internal
+ entry point on future platform upgrades.
+- Verification: 9 new OSGi tests passed; the full 20-module package build passed
+ with tests skipped after the isolated test run. The resulting p2 ZIP contains
+ both editors and the packaged grammar. Interactive UI/upgrade checks remain.
+- Added the new-file wizard using Eclipse's standard selection/validation page,
+ UTF-8 workspace creation, project line delimiters, cancellation, and overwrite
+ protection. Moved the old wizard/command/shortcut registrations to the new
+ bundle while retaining their IDs. CSV creation is supported; its content-type
+ override/highlighting remains a compatibility gap, explicitly described in the UI.
+- Wizard verification: full reactor `verify` passed all 110 tests, including 19
+ ImpEx grammar, registration, and workspace-creation tests. The p2 ZIP contains
+ the wizard and its NLS resources with no legacy wizard registration. Interactive
+ browsing, Java selection, shortcut execution, and editor-opening checks remain.
+- Added a non-UI `com.hybris.hyeclipse.impex.ls` bundle with cell-aware scanning,
+ safe document/range formatting, full document synchronization, and an in-process
+ LSP4E connection. The server advertises implemented capabilities only and never
+ reads server files or executes scripts. See its README for the fixed alignment
+ policy and safety/resource limits.
+- Scoped the legacy formatter shortcut to its editor context; the preview uses
+ LSP4E's formatter action. Tests cover real JSON-RPC startup/restart/shutdown,
+ logical record boundaries, value preservation, UTF-16/ranges, cancellation,
+ and LSP4E's stale-edit rejection and compound document undo/redo.
+- Formatting verification: all 133 tests passed in the full 21-module reactor,
+ including 42 ImpEx tests. The p2 ZIP contains both editor bundles, the language
+ server, and its connection provider. Live shortcut/focus and upgrade checks remain.
+- Added context-aware LSP completion and definition navigation using a workspace
+ adapter to the shared type index, without introducing UI dependencies into the
+ language server. Includes inherited/nested reference attributes, modifier names
+ and values, precise token replacement, and earlier document-local macro proposals.
+- The adapter explicitly scopes the current single `platform` index to its Commerce
+ tree. Other roots and ambiguous aliases receive no indexed types; external
+ extensions and full multi-platform indexing remain limitations. Source navigation
+ checks workspace accessibility instead of guessing class/file locations.
+- Tests cover metadata refresh, distinct document catalogs, inaccessible/deleted
+ sources, UTF-16 ranges, stale requests, cancellation, and real JSON-RPC assistance.
+- Completion/navigation verification: all 156 tests passed in the full reactor,
+ including 65 ImpEx tests. The p2 ZIP contains the language features, scoped
+ workspace adapter, and localized proposal descriptions. Live content-assist,
+ hyperlink, and multi-platform workflow checks remain outstanding.
+- Added plain-text type/attribute/macro hover, lexical header/macro document symbols,
+ and pushed diagnostics for confirmed CSV quote errors. Diagnostics coalesce edits,
+ publish only current snapshots, and clear on correction/close; no runtime or
+ unknown-name validation is inferred. Symbol response shape follows client capabilities.
+- Verification: all 171 tests passed in the full reactor, including 80 ImpEx tests.
+ Tests cover hover/outline ranges, quote origins, surrogate pairs, notification
+ lifecycle, rapid edits/reopening, and real JSON-RPC hover/symbol/diagnostic exchange.
+- Next: interactive UI/upgrade checks and CSV/header compatibility refinements.
+ TextMate continuation highlighting still needs refinement; the approved cutover
+ proceeds with these limitations documented rather than retaining the old source.
+
+## Goal and scope
+
+Replace the custom `com.hybris.hyeclipse.impexed` editor with Eclipse's Generic
+Editor, TM4E syntax highlighting, and LSP4E-backed language services. Formatting,
+type-system completion, and the new-file wizard are mandatory replacement
+features. The original plan used opt-in previews before cutover; the user has now
+approved retirement while the remaining manual checks and compatibility work are tracked.
+
+Inputs:
+
+- [ImpEx behavior notes](impex-docs.md): reference for lexical edge cases, not a
+ complete formal language specification. Runtime-dependent claims require
+ verification against the supported Commerce version.
+- TextMate grammar at the repository-relative path
+ `com.hybris.hyeclipse.impex/syntaxes/impex.tmLanguage.json`, the canonical packaged
+ grammar still under migration.
+- Legacy editor, wizard, formatter, completion processors, and hyperlink classes,
+ available in Git history before the cutover commit.
+
+## Architecture
+
+```text
+.impex file -> ImpEx content type -> Eclipse Generic Editor
+ |-> TM4E: TextMate scopes and theme colors
+ |-> LSP4E: document synchronization/services
+ |-> ImpEx language server
+```
+
+TextMate grammars are not LSP servers. TM4E provides immediate lexical
+highlighting; LSP4E is the client for a separately implemented server. LSP
+semantic tokens can enrich highlighting later, but are unnecessary for the
+first milestone. Do not create an empty server just to enable coloring.
+
+Proposed modules:
+
+- `com.hybris.hyeclipse.impex`: Eclipse content-type/editor registration,
+ packaged grammar, language configuration, wizard, and eventual LSP4E binding.
+- `com.hybris.hyeclipse.impex.ls`: non-UI Java language server using LSP4J,
+ introduced when useful language services are implemented.
+- `com.hybris.hyeclipse.impex.tests`: grammar, protocol, and Eclipse integration
+ tests; not a fragment of the importer bundle.
+
+Start with an in-process server connection, provided the target LSP4E APIs
+support it cleanly. Keep Eclipse UI/resource adapters outside the server's
+language logic. Defer a standalone server distribution and external process
+management unless required by other clients.
+
+Use dependencies from p2 and manifest declarations. Verify Generic Editor,
+TM4E, LSP4E, and LSP4J versions available in Eclipse 2026-09 before choosing
+exact APIs. If additional repositories are needed, use compatible versioned
+release sites rather than floating snapshots/latest sites. Ensure the delivered
+p2 feature resolves these dependencies, not just the development target.
+
+## Grammar corrections
+
+The original supplied grammar started a string on any quote, treated `\\.` as
+an escape, recognized only unquoted `#` comments, and could not distinguish
+scripts from comments. The replacement fixes initial cases; the remaining grammar
+review findings and the following behavior require follow-up after the approved cutover:
+
+- Model cell boundaries and quoted multiline cells; quoting starts at the
+ beginning of a cell, allowing leading whitespace as verified by fixtures.
+- Use doubled `""` for escaped quotes. A backslash does not escape a quote.
+- Separate trailing-backslash continuation from quoted multiline values.
+- Recognize first-cell comments, including quoted first cells starting with
+ `#`; keep `#` in later cells as ordinary data.
+- Match quoted/unquoted `#%` script directives before general comments;
+ distinguish engine tags and hooks such as `if:`, `endif:`, and `beforeEach:`.
+ Do not execute scripts or promise full embedded-language validation.
+- Highlight operation headers, type names, column attributes, nested reference
+ paths, header/column modifiers, macro definitions/references, document IDs,
+ special columns, ``, ``, and collection prefixes `(+)/(-)/(+?)`.
+- Treat `` as a token, not a universal null assignment. Do not label
+ unknown macros or configurable header shorthands as errors by default.
+- Use standard theme scopes, preserving `text.tabular.impex` unless compatibility
+ testing identifies a reason to change it. Color booleans/numbers contextually,
+ avoiding false matches inside identifiers or arbitrary data.
+
+TextMate is a lexical approximation, not the import parser. Document unsupported
+contexts instead of using increasingly fragile regexes to simulate execution.
+Choose one canonical grammar location when packaging; do not maintain two
+independently edited copies in documentation and the bundle.
+
+## Delivery phases
+
+### 1. Dependency and migration spike
+
+- Resolve target bundles and inspect their extension schemas.
+- Register an ImpEx content type derived from text and map `.impex` files to it.
+- Prove Generic Editor + TM4E highlighting in a minimal installable feature.
+- Verify light/dark themes and opening files outside a Commerce project.
+- Audit all references to the old bundle, editor ID, command IDs, and preferences.
+ The existing new-file wizard explicitly targets the old editor ID via a marker.
+- Capture representative fixtures from the supplied notes and real project files.
+
+Exit: a working editor integration and a documented dependency/migration matrix.
+
+### 2. Highlighting release (opt-in)
+
+- Implement and test the grammar corrections above with TM4E token-scope tests.
+- Package grammar/configuration resources via `build.properties`.
+- Add the new bundle to root `pom.xml` and the installable feature.
+- Keep the old editor available through **Open With**; avoid competing default
+ registrations and global formatter shortcuts.
+- Implement the new-file wizard described below. New files must open in the
+ Generic Editor, not target the old editor ID.
+
+Exit: reliable highlighting with no server, no required Commerce installation,
+and an explicit user-visible list of remaining legacy-only features.
+
+### 3. Required language services and formatting
+
+- Implement server initialization/shutdown and open/change/close synchronization.
+ Start with full document synchronization; optimize only after measurement.
+- Add macro/header document symbols and macro completion/hover as initial services.
+- Add conservative lexical diagnostics (for example, unmatched cell quotes) using
+ source ranges from a dedicated cell-aware scanner, not TextMate scopes alone.
+- Ignore stale results after edits; bound background work and clean up documents
+ and connections on close/shutdown. Advertise only implemented capabilities.
+- Implement type-system completion and navigation using the shared
+ `TypeSystemSnapshot`, as specified below.
+- Implement document/range formatting using the same cell-aware scanner and
+ the safety rules below; wire the Eclipse formatting action through LSP4E.
+
+Exit: formatting, type-system completion, and navigation pass acceptance tests.
+Highlighting still works if language services fail or the Commerce type index
+is unavailable; the wizard remains usable without a server.
+
+### 4. Cutover and legacy retirement
+
+Require the three features below and resolve the remaining migration decisions
+before changing the default editor:
+
+| Legacy behavior | Replacement policy |
+| --- | --- |
+| Syntax coloring and color preferences | TM4E grammar and theme preferences |
+| New ImpEx wizard/shortcut | Required: validated creation and Generic Editor routing |
+| Type/attribute completion | Required: context-sensitive LSP completion using the shared type index |
+| Type hyperlinks | LSP definition locations |
+| Formatting (`M1+Shift+F`) | Required: safe document/range formatting and undo/redo |
+| Custom auto-edit/comment behavior | TM4E language configuration where safe; verify against data cells |
+| Old editor IDs/preferences | Document reassociation and preference changes; migrate only with explicit policy |
+
+The approved cutover removes the old source and bundle from the main feature/reactor.
+Still test upgrades from existing installations: dropping a bundle from a feature
+does not prove old associations or independently installed bundles disappear.
+Preserve user workspace preferences and published update-site history; document
+manual reassociation/uninstallation rather than silently changing them.
+
+## Required feature specifications
+
+### Formatting
+
+- Provide LSP `textDocument/formatting` and `textDocument/rangeFormatting`.
+ Preserve the existing **Format ImpEx** workflow, context-menu entry, and
+ `M1+Shift+F`, scoped to the ImpEx editor without conflicting with other editors.
+- Align semicolon-separated header/data columns within each header block using
+ whitespace only at verified safe cell boundaries. Honor supported LSP
+ formatting options and document any fixed alignment policy.
+- Use a scanner that preserves raw cell text, quoting, physical line boundaries,
+ and continuation state. The old `Formatter`/`LineData` behavior is a comparison
+ baseline, not a parser to copy unchanged.
+- Never reorder rows/columns, add/remove cells, expand macros, normalize values,
+ rewrite scripts, or change ``, ``, collection prefixes, or modifiers.
+ Preserve empty/trailing cells, quote doubling, line endings, final-newline state,
+ comments, script lines, and macro definitions.
+- Leave multiline quoted records and backslash-continuation records unchanged
+ unless a tested transformation proves their values are preserved. For malformed
+ or ambiguous input, return no edits for affected blocks rather than guessing.
+- Range formatting changes only complete, safely parseable blocks contained in
+ the selection; otherwise return no edits. Width calculations must not cause
+ changes outside the selected range.
+- Return non-overlapping `TextEdit`s against the analyzed document version.
+ Applying formatting must be one undoable editor operation and be idempotent.
+
+Acceptance: golden-output tests for aligned blocks; parse-before/after checks for
+equivalent cell values and structure; explicit unchanged-output tests for scripts,
+multiline/continued records, and invalid input; range isolation, Unicode, CRLF/LF,
+idempotence, and editor undo/redo. Use the documented ImpEx lexical rules, not an
+RFC 4180 CSV parser, for equivalence checks.
+
+### Type-system completion and navigation
+
+- Provide context-sensitive LSP `textDocument/completion` for type names after
+ operation keywords, attributes after header separators, and reference attributes
+ inside nested paths such as `catalogVersion(catalog(id),version)`.
+- Reuse the shared type-system index exposed through the commons bundle and
+ `TypeSystemSnapshot`; avoid duplicate indexing and dependencies on the legacy
+ editor's `Activator`. Include inherited attributes when exposed by the index.
+- Add modifier-name/value proposals in the correct header/column context, alongside
+ macro and operation proposals. Filter by the typed prefix and replace only the
+ current token using precise edit ranges, including partially typed headers.
+- Supply useful type/attribute details from indexed metadata, without promising
+ runtime database validation. Add type definition navigation and attribute
+ navigation where source locations are available.
+- Bridge workspace/project-scoped immutable metadata into server services through
+ an adapter. Verify whether the existing index supports project isolation; if it
+ does not, address that before enabling completion across multiple Commerce roots.
+- Refresh proposals after index rebuilds without blocking the UI. With a missing
+ index or unknown type, retain syntax/macro/modifier proposals and return no
+ speculative attributes; do not mark valid project-dependent names as errors.
+
+Acceptance: type, inherited attribute, nested-reference, modifier, and macro
+proposals; prefix filtering and replacement ranges; partial documents; no attribute
+proposals in ordinary data/comments; index refresh; missing index; two projects with
+different types; definition locations and no legacy-editor dependencies.
+
+### New-file wizard
+
+- Register **File > New > Other > SAP > New ImpEx File** in the new Eclipse bundle,
+ retaining the existing `M1+Shift+Y` workflow. Reuse standard Eclipse new-file
+ wizard/page APIs rather than rebuilding generic container/file validation.
+- Preselect the project/folder from the current selection, including adaptable
+ Java package selections; allow browsing and use `test.impex` as the initial
+ filename for compatibility. Create the file in a writable workspace container.
+- Validate names, accessible containers, and existing files. Never silently
+ overwrite an existing file (the old wizard currently does so).
+- Create a minimal starter comment explaining content assist, with explicit
+ encoding and the project's line-ending convention; reveal the file and open it
+ in the Generic Editor so highlighting and language services attach normally.
+- Work without a Commerce installation, type index, or running language server.
+ Perform file operations with workspace scheduling/progress support and open the
+ editor on the display thread. External-file creation is outside wizard scope.
+- Localize labels/errors and preserve or alias the old wizard command ID only
+ when its registration is removed from the old bundle: avoid duplicate commands
+ and shortcuts during coexistence.
+- The old page also accepts `.csv`. Preserve explicit `.csv` creation, but do not
+ globally associate all CSV files with ImpEx. Open wizard-created ImpEx CSV files
+ explicitly in the Generic Editor with the ImpEx content-type override, if the
+ target APIs support it; otherwise document that compatibility gap for approval.
+
+Acceptance: project/folder/Java selection, browsing, filename and duplicate-file
+validation, read-only/closed projects, cancellation, encoding, starter content,
+editor opening, shortcut/command routing, and operation without language services.
+
+## Validation and release gates
+
+- Token fixtures: doubled and mid-cell quotes, quoted multiline cells, malformed
+ quotes, backslash continuation, CRLF/LF, quoted comments/scripts, later-cell
+ `#`, macros, nested references, modifiers, special values, and collection prefixes.
+- Editor tests: content-type registration, new/open/save/save-as, wizard routing,
+ Unicode, external files, themes, and old workspace/file associations.
+- LSP tests: lifecycle, edits/positions (UTF-16), stale diagnostics, completion,
+ cancellation where supported, and multiple projects with different type systems.
+- Required feature gates: continue validating formatting, completion/navigation,
+ and wizard acceptance cases above; distinguish automated checks from pending manual ones.
+- Performance: benchmark large generated `.impex` files and long unterminated
+ quoted cells; set latency/memory budgets from baseline measurements.
+- Run `make test` and `make package`; install the produced p2 ZIP in a clean
+ Eclipse 2026-09 instance and an upgraded existing installation.
+- Never execute ImpEx scripts, import data, resolve server files, or access a
+ database as part of highlighting or language analysis.
+
+## Decisions needed
+
+1. Should the opt-in highlighting preview be published before feature completion?
+2. Which additional legacy behaviors must be preserved beyond the required features?
+3. Is a reusable standalone language server required, or only Eclipse integration?
+
+Recommended defaults: opt-in highlighting preview first; wizard, formatting,
+type-system completion, and navigation before retirement; defer standalone
+distribution. Implementation effort should be estimated after the dependency
+spike and any additional parity requirements are agreed.
+
+References: [TM4E](https://github.com/eclipse-tm4e/tm4e),
+[LSP4E](https://github.com/eclipse-lsp4e/lsp4e).
diff --git a/docs/dev/impex/impex-docs.md b/docs/dev/impex/impex-docs.md
new file mode 100644
index 00000000..8b17abe6
--- /dev/null
+++ b/docs/dev/impex/impex-docs.md
@@ -0,0 +1,1122 @@
+## The ImpEx CSV parser
+ImpEx reads a file with its own CSVReader. In 2016 I referred to RFC 4180 as the specification. That was a mistake: this parser has its own rules.
+
+Quotes don't protect spaces
+A quoted value is trimmed at the edges exactly like an unquoted one:
+
+
+Example.
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+;ih-a1;" padded "
+```
+
+```
+[ih-a1] bar=[padded]
+```
+There is no way to import a value with leading or trailing spaces through ImpEx, except with a cell decorator or a translator that adds them back. Spaces inside a multiline value are preserved: only the edges of the whole value are trimmed.
+
+### A quote starts quoting only at the beginning of a cell
+In the middle of a value, a quote is an ordinary character:
+```impex
+;ih-a2;abc"def
+```
+
+```
+[ih-a2] bar=[abc"def]
+```
+
+But a non-whitespace character after the closing quote is an error:
+```impex
+;ih-a3;"abc"def
+```
+result
+```
+unexpected char d after cell end at 12 in line 1 : ';ih-a3;"abc"def'
+```
+
+People often trip over this with inches. A backslash in ImpEx does not escape a quote, so `"5\" monitor"` is the cell 5\, closed by a quote and followed by monitor:
+```
+unexpected char m after cell end at 12 in line 2 : ';ih-b2;"5\" monitor'
+```
+
+A quote inside quotes is doubled: `"5"" monitor"`.
+
+### An unmatched quote and an error on the wrong line
+If a line ends "inside quotes," the parser assumes the value continues and appends the next line. Then another one, until the quotes balance or the file ends.
+
+```groovy
+// illustration
+boolean isWrappedLine(String line, boolean alreadyQuoted) {
+ boolean quoted = alreadyQuoted, cellStarted = alreadyQuoted, cellEnded = false;
+ for (char c : line) {
+ if (quoted) {
+ if (c == '"') { if (next == '"') skip(); else { quoted = false; cellEnded = true; } }
+ } else if (c == '"') {
+ if (cellEnded) throw new IllegalStateException("unexpected text separator ...");
+ if (!cellStarted) { quoted = true; cellStarted = true; } // only at the start of a cell
+ } else if (c == ';') {
+ cellStarted = cellEnded = false;
+ } else if (!isWhitespace(c)) {
+ if (cellEnded) throw new IllegalStateException("unexpected char " + c + " after cell end ...");
+ cellStarted = true;
+ }
+ }
+ return quoted; // true → glue the next line
+}
+```
+
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+Example. Here the second data line is to blame, with an opening quote and no closing one:
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+;ih-e1;ok
+;ih-e2;"27 inch monitor
+;ih-e3;fine
+;ih-e4;"bold";x
+;ih-e5;last
+```
+
+Result:
+```
+[ih-e1] bar=[ok]
+[ih-e5] bar=[last]
+```
+
+Three lines are gone, and the log says:
+```
+unexpected char b after cell end at 8 in line 2 : ';ih-e4;"bold";x'
+```
+
+The line in the message, ;ih-e4;"bold";x, is correct. The error happened when the parser, gluing lines after ih-e2, reached the quote in ih-e4 and took it for a closing one. The number line 2 points to the real cause (ih-e2 is line 2 if you count from zero and include the header), while the text points to ih-e4. And ih-e3, which doesn't appear in the message at all, wasn't imported either.
+
+If there are no more quotes until the end of the file, the message is more accurate:
+
+```
+reached EOF and got odd number of '"'! File is corrupt. Error starts in line:
+";ih-c2;"27 inch monitor" and occurs somewhere in the following lines.
+```
+
+If more than csv.maxmultilines lines get glued together (10,000 by default), the parser stops with a separate message.
+
+None of these errors are visible in HAC. The result block says "Import has encountered problems." and there is nothing below it. The error text is only in the server console log.
+
+### Line breaks and backslashes are two different mechanisms
+Quotes preserve a line break inside a value:
+
+```
+;ih-a4;"line1
+line2"
+```
+```
+[ih-a4] bar=[line1\nline2]
+```
+A backslash at the end of a line joins it with the next one directly, with no space and no line break:
+
+```
+;ih-a5;part1\
+part2
+```
+
+```
+[ih-a5] bar=[part1part2]
+```
+
+
+This is a correction to the 2016 article. Back then I wrote that \ cannot be used as a multiline separator in a data block. On 2211 that is not true: in the example above, \ is in a data line, and the joining works.
+
+### A comment is determined by the first cell
+A line is a comment if its first cell starts with #. So # in the middle of a line is ordinary data:
+
+```
+;ih-a7;value # not a comment
+```
+
+```
+[ih-a7] bar=[value # not a comment]
+
+```
+
+But this is a comment, even though it looks like data:
+```
+"# quoted comment?";ih-a7b;x
+```
+
+The check runs after the cell has been extracted from its quotes. So a quoted first cell that starts with # is also a comment. This is exactly why quoted code lines like "#% ...", described below, work.
+
+## An empty cell, , and
+
+How the three options behave on 2211:
+
+| In the cell | String attribute | Reference
+|-----|--------|--------|
+| empty | `null` is written | `null` is written |
+| ``| the attribute is left untouched | the attribute is left untouched |
+| `` | the string `` is written | it looks for an item whose key is `null` |
+
+
+Example.
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+;ih-m1;start
+;ih-m2;start
+;ih-m3;start
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+;ih-m1;
+;ih-m2;
+;ih-m3;
+```
+
+```
+[ih-m1] bar=[null]
+[ih-m2] bar=[start]
+[ih-m3] bar=[]
+```
+
+`` does what you expect. But `` is used for lookups in a reference. Try clearing a reference:
+
+```impex
+INSERT_UPDATE Employee;uid[unique=true];sessionLanguage(isocode)
+;ih-emp2;
+```
+```
+column 2: cannot resolve value '' for attribute 'sessionLanguage'
+```
+ImpEx looked for a language with isocode IS NULL and didn't find one. To clear a reference, you need an empty cell.
+
+`` is meant for composite keys where one of the parts is empty. For example, an address with no town:
+
+```impex
+INSERT Address;owner(Employee.uid);streetname;town
+;ih-emp1;ih-street;
+;ih-emp1;ih-street;Berlin
+
+INSERT_UPDATE Employee;uid[unique=true];defaultShipmentAddress(streetname,town)
+;ih-emp1;ih-street:
+;ih-emp2;ih-street:Berlin
+```
+
+```
+ih-emp1 -> ih-street/null
+ih-emp2 -> ih-street/Berlin
+```
+
+
+Under the hood, the engine simply rewrites the query text: every =?parameter whose value turns out to be null is replaced with IS NULL.
+
+```groovy
+// illustration
+for (Map.Entry e : values.entrySet()) {
+ if (e.getValue() == null) {
+ query = query.replaceAll("=\\?" + e.getKey(), " IS NULL ");
+ }
+}
+```
+
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+Case doesn't matter: `` works the same way.
+
+### Resolving references with one UNION ALL for the whole line
+
+If a line has more than one reference column (catalogVersion(...), unit(code), supercategories(code)), ImpEx resolves them all with one query. Here is what the JDBC log shows for such a line:
+
+```impex
+INSERT_UPDATE Employee;uid[unique=true];sessionLanguage(isocode);sessionCurrency(isocode);defaultShipmentAddress(streetname,town)
+;ih-emp6;fr;USD;ih-street-q3:Paris
+```
+
+```sql
+SELECT x.a, x.b FROM (
+ SELECT item_t0.PK AS a, 0 AS b FROM languages item_t0
+ WHERE ( item_t0.p_isocode =?) AND (item_t0.TypePkString=? )
+ UNION ALL
+ SELECT item_t1.PK AS a, 1 AS b FROM currencies item_t1
+ WHERE ( item_t1.p_isocode =?) AND (item_t1.TypePkString=? )
+ UNION ALL
+ SELECT item_t2.PK AS a, 2 AS b FROM addresses item_t2
+ WHERE ( item_t2.p_streetname =? AND item_t2.p_town =?) AND (item_t2.TypePkString=? )
+) x
+```
+
+Column b is the translator number. It is used to distribute the results back to the columns. The parameters of each subquery are renamed (?v0 → ?t0v0, ?t1v0, …) so they don't collide.
+
+```groovy
+// illustration
+sb.append("SELECT x.a, x.b FROM (");
+for (int i = 0; i < translators.size(); i++) {
+ if (i > 0) sb.append(" UNION ALL ");
+ sb.append("{{").append(t.select()).append(" AS a, ").append(i).append(" AS b ")
+ .append(t.body().replaceAll("\\?v", "?t" + i + "v")).append("}}");
+}
+sb.append(") x");
+```
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+The same mechanism works for collection elements in a single cell. Three groups in groups(uid) are also one query:
+
+```sql
+SELECT x.a, x.b FROM (
+ SELECT item_t0.PK AS a, 0 AS b FROM usergroups item_t0 WHERE ( item_t0.p_uid =?) AND (...)
+ UNION ALL
+ SELECT item_t1.PK AS a, 1 AS b FROM usergroups item_t1 WHERE ( item_t1.p_uid =?) AND (...)
+ UNION ALL
+ SELECT item_t2.PK AS a, 2 AS b FROM usergroups item_t2 WHERE ( item_t2.p_uid =?) AND (...)
+) x
+```
+
+### The query goes through the FlexibleSearch cache
+This is a regular FlexibleSearch query with a regular cache key. When I repeated the import with the same combination of language, currency, and address but a different uid, the query was not in the JDBC log: the result came from the cache. If thousands of lines reference the same catalog version and the same unit, this saves queries. If the combination of values is unique in every line, the cache fills up with single-use entries. And this is one more reason why the NOW() problem from the FlexibleSearch article applies to ImpEx too.
+
+### Chunks
+The combined query is split into chunks, but not on every database. The default chunk size depends on the database:
+```groovy
+// illustration
+int defaultChunkSize() {
+ boolean bigQueriesAreAProblem = isHana() || isOracle() || isSqlServer() || isMySQL8();
+ return config.getInt("impex.query.chunk.size", bigQueriesAreAProblem ? 400 : 0);
+}
+```
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+0 means "don't split." On HANA, Oracle, SQL Server, and MySQL 8, the query is split into chunks of 400 subqueries; on the rest, which in practice means local HSQLDB, it is built in one piece. So locally on HSQLDB you are testing a different query from the one that will run in production in SAP Commerce Cloud on SQL Server. The query-chunk-size column modifier overrides this value, but only for collection elements in that column. The combined query across the columns of a line always uses the global value. If an import fails with "too many tables in query" on a line with a large collection, the modifier helps. If it fails on a line with many reference columns, only impex.query.chunk.size helps.
+
+### Turning it off
+impex.query.combined=false (default true) brings back one query per cell. Sometimes this is the only way to get an import working on a database that chokes on long UNIONs.
+
+### Multi-pass import and the stop condition
+Lines whose references didn't resolve are not treated as errors right away. They are written to a dump, and the dump is imported again. The classic case is a forward reference:
+
+```impex
+INSERT_UPDATE Category;code[unique=true];catalogVersion(catalog(id),version)[unique=true]
+;ih-cat-root;ih-catalog:Staged
+INSERT_UPDATE CatalogVersion;catalog(id)[unique=true];version[unique=true]
+;ih-catalog;Staged
+INSERT_UPDATE Catalog;id[unique=true]
+;ih-catalog
+```
+
+The category references a catalog version, which references a catalog, which is declared last. In the log:
+
+```
+Finished 1 pass ... - processed: 3, dumped: 2 (last pass: 0)
+Starting pass 2
+Finished 2 pass ... - processed: 2, dumped: 1 (last pass: 2)
+Starting pass 3
+Finished 3 pass ... - processed: 1, no lines dumped (last pass 1)
+```
+
+The import took three passes, one per link in the chain.
+
+Now a reference that will never resolve:
+
+```impex
+INSERT_UPDATE Employee;uid[unique=true];sessionLanguage(isocode)
+;ih-emp9;no_such_lang
+```
+
+```
+Finished 1 pass ... - processed: 1, dumped: 1 (last pass: 0)
+Starting pass 2
+Finished 2 pass ... - processed: 1, dumped: 1 (last pass: 1)
+Can not resolve any more lines ... Aborting further passes (at pass 2).
+Finally could not import 1 lines!
+```
+
+
+The condition for continuing looks like this:
+```groovy
+// illustration
+boolean anotherPass =
+ (maxPass < 0 || currentPass <= maxPass) // maxPass defaults to -1: no limit
+ && (currentPass == 1 || dumpedNow < dumpedLastPass); // strictly fewer than last time
+```
+
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+The second pass always runs if anything is left after the first. The third and later passes run only if the number of deferred lines has strictly decreased. What follows from this in practice:
+
+A circular dependency in which neither item can be created without the other will never resolve. The import will stop at the second pass.
+The Aborting further passes message means the number of deferred lines stopped decreasing. There is no limit on attempts by default at all.
+A long dependency chain in a file costs a pass per link, and each pass rereads the whole dump. So the order of blocks affects import speed too.
+
+
+### A line that wasn't imported can leave an item in the database
+Let's look at what is in the dump for an unresolvable line (HAC shows it in the result block):
+
+```impex
+INSERT_UPDATE Employee;uid[unique=true];sessionLanguage(isocode)
+Employee,8809954312196,,,column 2: cannot resolve value 'no_such_lang' for attribute 'sessionLanguage';ih-emp9;no_such_lang
+```
+
+
+The first cell contains the type and the PK. The key column is marked . This means the employee ih-emp9 was already created in the first pass with all the attributes that could be resolved. Only the unresolved part is deferred, to be written later by PK. And if the import ultimately "failed," the item stays in the database, without a language, but it exists:
+
+```
+userService.getUserForUID("ih-emp9") → EmployeeModel (8809954312196@1)
+```
+
+The import is not rolled back: after "Finally could not import 1 lines!" an incomplete item may remain in the database.
+
+### Validation errors also go to the second pass
+If a save failed with a ModelSavingException (a validator, an interceptor, a uniqueness violation), the line is not considered finally failed. It goes to the dump with the message Failed to process item creation due to ModelSavingException. Retrying in the next turn. and runs again on the next pass. That's why validation error messages in ImpEx often look like this, with two line numbers:
+
+```
+Exception : line 4: cannot create Title ... found 1 item(s) using the same keys,
+Exception : line 3: cannot create Title ... found 1 item(s) using the same keys
+```
+
+It is the same line: the number from the main file and the number from the second-pass dump. Interceptors with side effects will run twice on such a line.
+
+There is an undocumented key impex.retry.on.interceptorexceptions.only (default false, not present in any shipped .properties file) that narrows the retry to cases where the cause was specifically an InterceptorException.
+
+## Modifiers
+The documentation describes about fifteen modifiers. The platform has 29 in a single list of constants, the header reads three more separately, and there is testMode, which is read directly in the code and declared nowhere.
+
+| Modifier | Where What it does |
+|----|----|
+| unique | column | part of the key used to find an existing item |
+| allownull | column | allow null for a mandatory attribute|
+| ignorenull | column | skip null collection elements|
+| default | column | value for an empty cell|
+| virtual | column | the column is absent from the data, only default|
+| lang | column | language of a localized attribute|
+| translator | column | custom value translator|
+| cellDecorator | column | custom cell decorator|
+| dateformat, numberformat | column | parsing formats|
+| collection-delimiter | column | , by default|
+| path-delimiter | column | : by default|
+| key2value-delimiter | column | -> by default|
+| map-delimiter | column | ; by default|
+| mode | column | append / remove / merge for collections|
+| query-chunk-size | column | chunk of the combined query, only for collection elements|
+| forceWrite | column | write to a non-writable attribute|
+| pos | column | explicit column position|
+| alias | column | column name on export|
+| sourceSystemId, pkFromExternalImportKey | column | external import keys|
+| batchmode | header | UPDATE/REMOVE by a non-unique key, many items|
+| cacheUnique | header | key → PK cache for the whole type|
+| processor | header | custom ImportProcessor|
+| parallel | header | false runs this block in one thread|
+| ignoreKeyCase | header | case-insensitive key lookup|
+| unlessExisting | header | skip existing items in INSERT|
+| impex.legacy.mode | header | Jalo instead of ServiceLayer for this block|
+| sld.enabled | header | read only by distributed ImpEx|
+| disable.interceptor.types | header | disable interceptors by type (validate, prepare, …)|
+| disable.interceptor.beans | header | disable interceptors by bean name|
+| disable.UniqueAttributesValidator.for.types | header | disable the uniqueness check|
+| testMode | header | with cacheUnique: check the cache against the database on every line|
+
+The last one, testMode, is a debug mode for cacheUnique. It rechecks every cache answer with a regular query and fails on a mismatch. It is not in the list of constants.
+
+Below are the ones that behave in non-obvious ways.
+
+### Without forceWrite the write is skipped with no error
+
+Every item has the sealed attribute, and it is not writable. Let's try writing it with and without the modifier:
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+;ih-s1;x
+;ih-s2;x
+UPDATE TestItemType2;foo[unique=true];sealed
+;ih-s1;true
+UPDATE TestItemType2;foo[unique=true];sealed[forceWrite=true]
+;ih-s2;true
+```
+
+```
+[ih-s1, null, ...]
+[ih-s2, true, ...]
+```
+
+
+HAC says "Import finished successfully." The ih-s1 line didn't change, and the only trace of this is a WARN in the console log:
+```
+column sealed of type TestItemType2 is not writable, but you want to update it.
+If you want to write this non writable attribute explicit, you have to use the
+forceWrite=true modifier. This warning is printed only once for header.
+Please check subsequent lines for similar problem.
+```
+
+"Printed only once for header" explains why in a large import you see one warning and think the problem is a one-off.
+
+An attribute that can only be set on creation (initial) can't be updated even with forceWrite:
+
+```impex
+UPDATE TestItemType2;foo[unique=true];creationtime[dateformat=yyyy-MM-dd,forceWrite=true]
+;ih-a4;2001-01-01
+```
+
+```
+attribute de.hybris.platform.jalo.test.TestItem.creationtime cannot be changed except during item creation
+```
+
+
+### unlessExisting works only in INSERT and only with the value true
+
+```impex
+INSERT TestItemType2[unlessExisting=true];foo[unique=true];bar
+;ih-a1;overwritten?
+;ih-u1;new
+INSERT TestItemType2[unlessExisting=yes];foo[unique=true];bar
+;ih-a2;overwritten?
+INSERT_UPDATE TestItemType2[unlessExisting=true];foo[unique=true];bar
+;ih-a4;overwritten-by-insert-update
+```
+
+
+Result:
+
+ih-a1 is untouched, ih-u1 is created, so the modifier works.
+unlessExisting=yes is false: Cannot insert. Item exists: [8796093153305]. The value is parsed with Boolean.valueOf, so anything other than true in any case counts as false, and nothing is written to the log.
+In INSERT_UPDATE the modifier is ignored with no warning: ih-a4 is overwritten.
+
+### ignoreKeyCase works only on the header
+
+The modifier looks like a column modifier, since it is about comparing the key value. But the lookup of an existing item reads it from the header:
+
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true,ignoreKeyCase=true];bar
+;IH-A2;matched-case-insensitively?
+INSERT_UPDATE TestItemType2[ignoreKeyCase=true];foo[unique=true];bar
+;IH-A4;header-level
+```
+
+```
+ih-a2 -> abc"def ← not found
+IH-A2 -> matched-case-insensitively? ← new item created
+ih-a4 -> header-level ← found and updated
+```
+
+On a column the modifier is ignored, with no warning.
+
+Since we're talking about case: attribute names in the header are case-insensitive. INSERT_UPDATE TestItemType2;foo[unique=true];BAR writes to bar.
+
+### cacheUnique loads the keys of the whole type
+
+When the header starts, the engine fetches the keys of all items of the type:
+
+```impex
+INSERT_UPDATE Employee[cacheUnique=true];uid[unique=true];name
+;ih-emp6;Cached
+```
+
+```
+SELECT item_t0.PK, item_t0.p_uid FROM users item_t0 WHERE (item_t0.TypePkString=? )
+```
+
+
+No WHERE on the values. For a large update that touches most of the table, this pays off: one query instead of thousands. For a ten-line file against a ten-million-row table, it means reading ten million rows for the sake of ten.
+
+In an INSERT without a unique column, the modifier is not allowed:
+
+```
+You can not use cacheUnique modifier in INSERT mode when no column is unique,
+use UPDATE / INSERT_UPDATE mode or declare at least one column as unique
+```
+
+And if the database already has two items with the same key value, the whole header fails: found more than one item for unique key values .... So cacheUnique also finds key duplicates that already exist in the database.
+
+### Collection prefixes (+), (-), and the undocumented (+?)
+
+The 2016 article had (+) and (-). There is a third prefix:
+
+| Prefix | Action |
+|----|-----|
+| (+) | add the element, always
+| (-) | remove the element
+| (+?) | add it if it isn't there yet
+
+
+The difference between (+) and (+?) shows on a list attribute. fallbackLanguages on Language is a list:
+
+```impex
+UPDATE Language;isocode[unique=true];fallbackLanguages(isocode)
+;xx_test;en
+;xx_test;(+) de
+;xx_test;(+) de
+;xx_test;(+?) en
+;xx_test;(+?) fr
+```
+
+```
+[en, de, de, fr]
+```
+
+
+(+) added `de` twice. (+?) didn't add the existing `en`. Sets (Set, for example groups on a user) won't have duplicates, so the difference only shows on lists.
+
+Prefixes can't be mixed with "bare" values in the same cell:
+
+```
+;ih-emp7;ih-g2,(+) ih-g3
+```
+
+```
+Invalid syntax! The assigned collectionvalues must either have one of the prefixes
+'(+)' or '(-)' or modifier mode must be set
+```
+
+
+The mode=append|remove|merge modifier on a column sets the action for all values in the column at once. Without it, every value in the cell needs a prefix, not just the first one.
+
+### A header that turns off business logic
+
+Three header modifiers are not in the common list, but are read separately and put into the parameters of the session in which the save runs:
+
+```
+disable.interceptor.types=validate,prepare
+disable.interceptor.beans='beanName1,beanName2'
+disable.UniqueAttributesValidator.for.types='Title,Product'
+```
+
+
+These modifiers turn off validation and business logic for one block of the file. An example is the interceptor that disables login for users.
+
+### ImpEx disables login for users
+
+The impex extension registers the disableLoginForImportedUserInterceptor interceptor. It fires on any User that ImpEx creates or modifies and sets loginDisabled=true if the user has no password.
+
+```impex
+INSERT_UPDATE Employee;uid[unique=true];name
+;ih-emp10;plain
+INSERT_UPDATE Employee[disable.interceptor.beans='disableLoginForImportedUserInterceptor'];uid[unique=true];name
+;ih-emp11;interceptor off
+UPDATE Employee;uid[unique=true];name
+;ih-emp-sl;just renamed
+```
+
+
+The user ih-emp-sl had been created beforehand through ServiceLayer, with no password and loginDisabled=false. Result:
+
+```
+ih-emp10 loginDisabled=true name=plain
+ih-emp11 loginDisabled=false name=interceptor off
+ih-emp-sl loginDisabled=true name=just renamed
+```
+
+
+### A plain UPDATE of the name through ImpEx blocked the user's login. If you have users without a local password (SSO, technical accounts), any ImpEx that touches them will disable their login without any error.
+
+The log shows:
+
+```
+Disabling login for 'null' because of empty password.
+```
+
+null, because the message prints the PK, and on creation there isn't one yet.
+
+How does the interceptor know ImpEx is running? From the session attributes that ImpEx sets for the duration of the save: impex.creation and impex.modification together with impex.modification.pk. Your own interceptor can check these attributes too, to behave differently during import.
+
+The interceptor is marked @Deprecated(since = "2211", forRemoval = true) but is enabled by default. It is turned off globally by the property disable.login.for.imported.user.interceptor.enabled=false, which appears in the shipped project.properties only in commented-out form.
+
+disable.UniqueAttributesValidator.for.types
+The modifier does turn off the validator, which you can see from how the error changes:
+
+```impex
+INSERT Title;code
+;ih-title
+INSERT Title[disable.UniqueAttributesValidator.for.types='Title'];code
+;ih-title
+```
+
+```
+... due to [UniqueAttributesInterceptor]:ambiguous unique keys {code=ih-title} ... found 1 item(s) using the same keys
+... due to Duplicate code 'ih-title' for type Title
+```
+
+
+The first line was stopped by the uniqueness validator, the second by a check further down the stack. Title has one. When you disable the validator, you are relying on your type having one too. Check this on the specific type before leaving the modifier in the file.
+
+A practical rule: run grep -rn "disable\.\(interceptor\|UniqueAttributesValidator\)" --include=*.impex . across the whole project. These modifiers usually show up "temporarily."
+
+### Rewriting headers with impex.header.replacement
+The documentation doesn't describe this mechanism, although the shorthands E1p, E1t, E1d, and C@ are used in every project with prices and classification. They are not ImpEx syntax but rules from advanced.properties:
+
+```impex
+impex.header.replacement.1=C@(\\w+) ... @$1[system='\\$systemName',version='\\$systemVersion',translator='...ClassificationAttributeTranslator']
+impex.header.replacement.2=E1p ... europe1Prices[translator='de.hybris.platform.europe1.jalo.impex.Europe1PricesTranslator']
+impex.header.replacement.3=E1t ... europe1Taxes[translator='...Europe1TaxesTranslator']
+impex.header.replacement.4=E1d ... europe1Discounts[translator='...Europe1DiscountsTranslator']
+```
+
+
+Format: impex.header.replacement. = ... , with three dots as the separator. The rules are applied like this:
+
+```groovy
+// illustration
+for (int i = 1; i < columns.size(); i++) { // column 0 (mode and type) is not touched
+ for (Rule r : rulesByPriorityDesc) {
+ String replaced = columns.get(i).replaceAll(r.pattern, r.replacement);
+ if (!replaced.equals(columns.get(i))) {
+ columns.set(i, expandMacros(replaced)); // macros are expanded after the replacement
+ break; // the first rule that matches is the last one
+ }
+ }
+}
+```
+
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+The properties are read every time a reader is created, so a rule can be added without a restart. I added one from the Groovy console:
+
+```impex
+de.hybris.platform.util.Config.setParameter(
+ "impex.header.replacement.10", "barD ... bar[default='from-rule']")
+
+```
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];barD
+;ih-h3;
+;ih-h4;explicit
+```
+
+```
+[ih-h3] bar=[from-rule]
+[ih-h4] bar=[explicit]
+```
+
+
+This is why the rule for C@ has \\$systemName: the replacement inserts a macro reference into the column, and the macro is expanded in the next step.
+
+The regex is not anchored: replaceAll looks for a match anywhere in the column name:
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];oldbarD
+```
+
+```
+INSERT_UPDATE TestItemType2;foo[unique=true];oldbar[default='from-rule']
+# unknown attribute 'oldbar' in header 'INSERT_UPDATE TestItemType2'
+```
+
+
+The oldbarD column turned into oldbar[...]. With the standard rules, this means an attribute whose name contains E1p, E1t, or E1d will be mangled before the header is even parsed. Write your own rules with anchors: ^MyAttr$ ... myRealAttribute[...].
+
+Programmatically, reader.addHeaderReplacementRule(src, tgt, prio) does the same.
+
+### Code inside ImpEx
+
+Lines starting with #% are code. By default (impex.legacy.scripting=true) it is executed by BeanShell. Half of the 2016 article was devoted to this. Almost all of it works, but there are a few differences I didn't write about back then.
+
+Without Enable code execution an if: block is always true
+In the HAC import form, the Enable code execution checkbox is unchecked by default. In that case code is skipped with a WARN in the log. With an if: block it gets more interesting:
+
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+"#% if: ""a"".equals(""b"")"
+;ih-nocode-inside-false-if;imported anyway?
+#% endif:
+```
+
+
+Without Enable code execution:
+
+```
+[ih-nocode-inside-false-if] bar=[imported anyway?]
+```
+
+
+HAC: "Import finished successfully." The line was imported even though the condition is false: when code execution is off, the condition is not evaluated, and the engine treats it as true:
+
+
+```groovy
+// illustration
+if (!(ifLine.getResult() instanceof Boolean)) {
+ result = codeExecutionEnabled
+ ? Boolean.FALSE // invalid expression: "false", with a WARN
+ : Boolean.TRUE; // code disabled: everything inside if: is imported
+}
+```
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+If you use if: for "this block is dev only" or "only if the extension is installed," a file imported without the checkbox imports everything.
+
+### A semicolon inside code disappears
+
+A code line is also a CSV line. A ; in it is a cell separator. In the default BeanShell mode, the engine assembles the code by concatenating all cells with no separator:
+
+```impex
+#% impex.info("IH1 a;b;c");
+"#% impex.info(""IH2 a;b;c"");"
+```
+
+```
+IH1 abc
+IH2 a;b;c
+```
+
+If there are two statements, you get a syntax error whose cause is hard to figure out:
+
+```impex
+#% counter = counter + 1; impex.info("counter=" + counter);
+```
+
+```
+inline evaluation of: ``counter = counter + 1impex.info("IH3 counter=" + counter);''
+Encountered "impex" at line 1, column 22.
+```
+
+Hence the rule I followed in 2016 without explaining it: code in ImpEx is always written in quotes, and quotes inside are doubled.
+
+### One interpreter per file
+
+One BeanShell interpreter is created per reader and lives until the end of the file. Variables survive headers:
+
+```impex
+#% counter = 1;
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+;ih-bsh1;x
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+"#% impex.info(""counter still visible="" + counter);"
+```
+
+```
+counter still visible=1
+```
+
+The context always contains:
+
+| Variable | What it is |
+|-----|------|
+| impex | the reader itself (ImpExImportJob$MyImpExImportReader when importing from HAC) |
+| jaloSession | the current Jalo session |
+| line | Map of the current data line |
+| currentLineNumber, currentLocation | position in the file |
+
+Plus the pre-imported packages de.hybris.platform.core, ...core.model.user, ...util, ...impex.jalo, ...jalo, ...jalo.c2l, ...jalo.user, ...jalo.flexiblesearch. That's why you can write Config.getBoolean(...) in code without an import.
+
+### beforeEach: can rewrite or drop a line
+
+The mechanism from the 2016 example with languages still works:
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+"#% beforeEach: if (line.get(Integer.valueOf(2)).startsWith(""skip"")) line.clear(); else line.put(Integer.valueOf(2), line.get(Integer.valueOf(2)).toUpperCase());"
+;ih-be1;make me loud
+;ih-be2;skip me
+#% beforeEach:end
+;ih-be3;untouched
+```
+
+```
+[ih-be1] bar=[MAKE ME LOUD]
+[ih-be3] bar=[untouched]
+```
+
+line.clear() is an undocumented way to filter out a line by a condition: an empty line is simply not imported. afterEach: works the same way, but after the item is saved, and it is called on every line (forEach: is its deprecated name and logs a WARN when used).
+
+### getLastImportedItem() returns a Jalo item
+
+Even in ServiceLayer Direct mode:
+
+```impex
+"#% impex.info(""IH-LAST "" + impex.getLastImportedItem().getClass().getName());"
+```
+
+```
+IH-LAST de.hybris.platform.jalo.test.TestItem
+```
+
+
+This is exactly why impex.getLastImportedItem().calculate() worked in the 2016 order example: it is a Jalo method of a Jalo object. To work with the model, you need modelService.get(impex.getLastImportedItem()).
+
+### Two 2016 recipes that no longer work
+addDefinition from code. In 2016 you could define a macro from BeanShell. Now the method is protected, and BeanShell can't see it:
+
+```impex
+#% impex.addDefinition("$dyn=from-code");
+```
+
+```
+Error in method invocation: Method addDefinition ...
+```
+
+
+Meanwhile, the unknown macro $dyn further down the file doesn't cause an error but stays in the data literally: bar=[$dyn]. A working workaround is to insert a definition line into the stream:
+
+
+```impex
+"#% m = new HashMap(); m.put(Integer.valueOf(0), ""$dyn=from-code-"" + (6 * 7)); impex.insertLine(m);"
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+;ih-def3;$dyn
+```
+
+```
+[ih-def3] bar=[from-code-42]
+```
+
+
+includeSQLData with three arguments. The includeSQLData(url, driver, sql) signature from the 2016 article doesn't exist. There is (url, user, password, driverClass, sql), described below.
+
+$config- still works, though, if commerceservices is installed:
+
+```impex
+UPDATE GenericItem[processor=de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor];pk[unique=true]
+$workers=$config-impex.import.workers
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+;ih-cfg1;$workers
+;ih-cfg2;$config-impex.legacy.scripting
+```
+
+```
+[ih-cfg1] bar=[4]
+[ih-cfg2] bar=[true]
+```
+
+### #%groovy% with impex.legacy.scripting=true
+
+There is also a "modern" syntax that names the engine: #%groovy% ..., #%javascript% .... But it works only with impex.legacy.scripting=false. With the default value, the whole line, groovy% included, goes to BeanShell:
+
+```impex
+#%groovy% impex.info("IH-GROOVY engine=" + this.getClass().getName())
+```
+
+```
+IH-GROOVY engine=bsh.XThis
+... inline evaluation of: ``groovy% impex.info(...)'' : illegal use of undefined variable, class, or 'void' literal
+```
+
+
+The log message appeared before the error. BeanShell read groovy% impex.info(...) as the expression "groovy modulo impex.info(...)," evaluated the right operand, which means it called the method, and failed on the left one. If such a line contains something with a side effect, the side effect will happen, and the import will report an error.
+
+With impex.legacy.scripting=false, the same line is executed by Groovy (engine=Script73). But this mode has its own differences: the code is taken only from the first cell, that is, it is cut off at the first unquoted ; rather than concatenated. Old files with BeanShell code that has semicolons inside will break in a new way after the switch.
+
+### A code line stops parallel processing
+Import is multithreaded by default: the reader distributes data lines into a queue, and workers save them. If the file has a code line, it has to see the result of all lines above it. So before each standalone #% line and before each new header, the reader waits for the queue to empty:
+
+```groovy
+// illustration
+@Override
+protected void execute(CodeLine line, Map csvLine, boolean perLineHook) {
+ if (!perLineHook) {
+ waitForEmptyValueLineQueue(); // barrier: all workers must finish their work
+ }
+ super.execute(line, csvLine, perLineHook);
+}
+```
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+A #% impex.info("progress") line after every hundred data lines turns a multithreaded import into a sequence of short parallel stretches. The interpreter itself is guarded by synchronized, so beforeEach: / afterEach: also run strictly one at a time.
+
+The parallel=false header modifier switches a specific block to one thread without touching the others.
+
+## Files, the classpath, and other databases
+
+### Reading server files with file:, zip:, and jar:
+A @media column with MediaDataTranslator accepts a path with a prefix:
+
+```impex
+INSERT_UPDATE Media;code[unique=true];catalogVersion(catalog(id),version)[unique=true];mime;@media[translator=de.hybris.platform.impex.jalo.media.MediaDataTranslator]
+;ih-m-file;ih-catalog:Staged;text/plain;file:/path/on/server/srvfile.txt
+;ih-m-zip;ih-catalog:Staged;text/plain;zip:/path/on/server/arch.zip&inner/note.txt
+;ih-m-jar;ih-catalog:Staged;application/octet-stream;jar:de.hybris.platform.impex.jalo.ImpExManager&ImpExManager.class
+```
+
+```
+ih-m-file size=37 data=hello from the app server filesystem
+ih-m-zip size=24 data=hello from inside a zip
+ih-m-jar size=29123 data=����...de/hybris/platform/impex/jalo/GeneratedImpExMan...
+```
+
+
+file: reads any file accessible to the application server process.
+zip: reads an entry from an archive on the server. The separator between the archive and the entry is &.
+jar:Class&resource loads the class whose name is given in the cell and reads the resource through its class loader. In the example above, the bytecode of ImpExManager itself ended up in the media.
+
+### http: is broken and https: is not supported
+
+The http: prefix doesn't download the file; it writes the URL to the media. Or rather, it is supposed to:
+
+```
+;ih-m-http;ih-catalog:Staged;image/png;http://example.com/x.png
+;ih-m-https;ih-catalog:Staged;image/png;https://example.com/x.png
+```
+
+```
+Exception : Error while setting URL to media
+Path 'https://example.com/x.png' couldn't be resolved!
+```
+
+There is no https: prefix. And http: breaks because the engine cuts off the prefix before writing the URL:
+
+```groovy
+// illustration
+if (path.toLowerCase().startsWith("http:")) {
+ media.setURL(path.substring("http:".length())); // → "//example.com/x.png"
+}
+```
+
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+What remains is //example.com/x.png, and it is rejected by MediaExternalUrlSourcesValidator, which doesn't appear in the ImpEx messages. If you repeat the write from Groovy, you see the real cause:
+
+Access protocol is not allowed for media URL //example.com/y.png.
+Only: [https, http, fromjar] are allowed.
+The same happens in legacy (Jalo) mode. The workaround is to duplicate the prefix:
+
+```impex
+;ih-m-http3;ih-catalog:Staged;image/png;http:http://example.com/z.png
+;ih-m-https3;ih-catalog:Staged;image/png;http:https://example.com/z.png
+```
+
+```
+ih-m-http3 url=http://example.com/z.png
+ih-m-https3 url=https://example.com/z.png
+```
+
+In the failed case, the Media item is created anyway, with no URL and no data. This is the same "created but not imported" effect as in the section on passes.
+
+### Lines from another database with includeSQLData
+
+The impex variable is the reader with all its public methods. One of them opens a JDBC connection and substitutes the query result as data lines of the current header:
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+"#% impex.includeSQLData(""jdbc:hsqldb:mem:ihdemo"", ""SA"", """", ""org.hsqldb.jdbcDriver"", ""SELECT 'ih-sql-' || TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'INFORMATION_SCHEMA' ORDER BY TABLE_NAME LIMIT 3"");"
+```
+
+```
+[ih-sql-ADMINISTRABLE_ROLE_AUTHORIZATIONS] bar=[VIEW]
+[ih-sql-APPLICABLE_ROLES] bar=[VIEW]
+[ih-sql-ASSERTIONS] bar=[VIEW]
+```
+
+The first column of the result goes to the first header column after the empty cell, the second to the second. For ETL this is a perfectly workable tool. Alongside it there is the includeExternalData(...) family for files and streams, and initDatabase(...) for several queries against the same database.
+
+### Security
+
+#% is arbitrary code on the server, file: and zip: are file system reads, jar: loads any class by name, and includeSQLData connects to any database the server can reach. The right to run an ImpEx import with code execution enabled is equivalent to the right to execute code on the server. Without code execution, server files can still be read through file:, zip:, and jar:.
+
+In HAC this is an administrator operation anyway. But ImpEx is often given to content managers through Backoffice, to integrations through ImportService, and to data loading pipelines. That's where this access is worth reviewing.
+
+The thread count is a SpEL expression
+The number of workers comes from a property, and its value is a SpEL expression:
+
+```properties
+impex.import.workers=#cores * 2 # project.properties
+impex.import.workers.hsqldb=1 # advanced.properties: override by database name
+```
+
+```groovy
+// illustration
+int defaultMaxThreads(Tenant t) {
+ String expr = config("impex.import.workers." + t.databaseName().toLowerCase());
+ if (isBlank(expr)) expr = config("impex.import.workers");
+ return numberOfThreadsFromExpression(expr, 2); // #cores variable, fallback value 2
+}
+```
+
+
+Illustrative reconstruction, not platform source code. See the note above.
+
+I ran several expressions through the same function on a machine with 14 cores:
+
+| Expression | Result
+|-----|-----|
+| #cores * 2 | 28
+| #cores + 2 | 16
+|4 | 4
+| #core * 2 (typo)| 2, with a WARN |
+| cores * 2 (no #) | 2, with a WARN |
+| #cores / 0 | 2, with a WARN |
+| T(java.lang.Runtime).getRuntime().availableProcessors() | 2, with a WARN|
+| #cores * 2,5 | exception SpelParseException |
+
+The evaluation context is restricted: arithmetic on #cores is available, but class access is not, so T(...) doesn't work. A typo drops you back to two threads with no error, and all that's left is the WARN Exception has been thrown during evaluation of '...'. Null will be returned. A syntax error, on the other hand, is not caught and is thrown out.
+
+On HSQLDB this setting has no effect: impex.import.workers.hsqldb=1 overrides the general value, and getDefaultMaxThreads returns 1. If you measure import speed locally on HSQLDB, you are measuring a single-threaded import.
+
+### Distributed ImpEx runs on a different engine
+
+The HAC import form has a Distributed mode checkbox. It is a separate implementation on top of the task engine: the file is cut into batches (impex.distributed.batch.size=100), the batches are stored in the database as ImportBatch / ImportBatchContent, and they are processed by tasks that can run on any node of the cluster.
+
+I ran a file with two ordinary lines, a code line, and an unresolvable reference through it:
+
+```impex
+INSERT_UPDATE TestItemType2;foo[unique=true];bar
+;ih-dist1;d1
+;ih-dist2;d2
+#% impex.info("IH-DIST code line");
+INSERT_UPDATE Employee;uid[unique=true];sessionLanguage(isocode)
+;ih-dist-emp;no_such_lang
+```
+
+
+The log shows that the code line ran once, when the file was being cut: IH-DIST code line appeared in the HTTP thread before the first batch processing task started. So anything that depends on order (getLastImportedItem(), counters, afterEach:) works differently in distributed mode than in regular mode.
+
+Models are saved in bulk: Number of models saved in bulk: 1.
+
+Retries happen in "turns" on a timer. The unresolvable line was processed four times: at 20:33:33, 20:34:03, 20:34:34, and 20:35:04, about 30 seconds apart on my installation. The stop condition is impex.distributed.noProgressionLimit=3 turns without progress. An import that would have failed in a fraction of a second in regular mode took more than three minutes in distributed mode.
+
+After a failure, the batches remain in the database. Before the run, ImportBatch and ImportBatchContent each had zero rows; after, 12 and 3. They are deleted only on success (impex.distributed.importbatchcontent.removeonsuccess=true). If your ImportBatchContent table keeps growing, those are traces of failed distributed imports.
+
+Distributed mode has its own combined query for resolving references, with its own switch: impex.distributed.query.for.each.line=false.
+
+## Reference of properties documented only in comments
+Most of the keys documented only in comments are in ext/impex/project.properties. Together with the keys from advanced.properties and those read only by code:
+
+| Property | Default | What it does |
+|------|-----|-----|
+ | impex.legacy.mode | false | Jalo instead of ServiceLayer for all operations
+ | | impex.legacy.scripting | true | BeanShell with cell concatenation; false enables engines via #%groovy%, etc.
+ | impex.query.combined | true | one UNION ALL per line
+ | impex.query.chunk.size | 400 / 0 | 400 for HANA, Oracle, SQL Server, MySQL 8; 0 for the rest (in practice, HSQLDB)
+ | impex.import.workers | #cores * 2 | SpEL; .hsqldb=1 and the like override per database
+ | impex.header.replacement.N | E1p, E1t, E1d, C@ | header rewriting rules
+ | impex.log.unresolved.lines | true | log deferred lines
+ | impex.retry.on.interceptorexceptions.only | false | retry on the next pass only for InterceptorException
+ | impex.clearing.model.context.after.processing.each.item.enabled | true | clear the model context after each item
+ | disable.login.for.imported.user.interceptor.enabled | true (in code) | loginDisabled for imported users without a password
+ | documentidregistry.disallow.ignored.values | true | disallow values in & references
+ | csv.maxmultilines | 10000 | how many lines can be glued together on an unmatched quote
+ | impex.distributed.batch.size | 100 | batch size
+ | impex.distributed.noProgressionLimit | 3 | turns without progress before stopping
+ | impex.distributed.importbatchcontent.removeonsuccess | true | delete batches only on success
+ | impex.distributed.query.for.each.line | false | separate switch for the combined query
+ | impex.import.service.distributed.enabled | false | distributed mode for all of ImportService
+
+
+ For impex.clearing.model.context.after.processing.each.item.enabled, the shipped comment itself admits that the enabled value can cause "significant performance degradation." If an import slowed down noticeably after an upgrade, this is the first candidate to check. But disabling it is a deliberate trade-off: validators will no longer be guaranteed to see fresh data.
+
+## Checklist
+Without the Enable code execution checkbox, if: blocks are imported in full. Check how your files are imported in each of the paths: HAC, Backoffice, ImportService, system setup.
+CSV errors are visible only in the console log, not in HAC. With an unmatched quote, the line number in the message is correct, but the text comes from a different line, and the lines in between disappear.
+ does not clear a reference. You can clear it only with an empty cell.
+"Could not import N lines" doesn't mean the items don't exist. The line is created in the first pass, and the deferred part may never be written.
+Aborting further passes (at pass 2): the number of deferred lines stopped decreasing; look for cycles and typos in keys. There is no pass limit.
+forceWrite, unlessExisting=yes, ignoreKeyCase on a column, (+) on a list, and an unknown $macro don't produce an error, but the result differs from what is written.
+cacheUnique on a small file against a large table fetches the keys of the whole type.
+An ImpEx UPDATE of a user without a password disables their login (disableLoginForImportedUserInterceptor). SSO and technical accounts are hit first.
+Find disable.interceptor.* and disable.UniqueAttributesValidator.for.types by grepping all the .impex files in the project.
+Code in ImpEx is written in quotes, otherwise ; disappears. #%groovy% with default settings runs BeanShell.
+#% lines in the middle of data put barriers into a multithreaded import.
+http: for media works only with a double prefix; https: is not supported.
+Access to import with code equals the right to execute code on the server; without code, server files can still be read through file:, zip:, and jar:.
+A growing ImportBatchContent holds traces of failed distributed imports.
+Import speed on HSQLDB is single-threaded; comparing it with production is meaningless.
+
+## Changes since 2016
+
+Two of the 2016 recipes don't work: addDefinition from code (the method became protected) and the three-argument includeSQLData (that signature doesn't exist). One statement was wrong from the start: the backslash works in data lines too. Everything else (deletion via batchmode, if:, beforeEach: with line, $config-, (+) and (-)) works as before. Still, under every recipe there turned out to be a detail I should have mentioned back then.
+
+What surprised me most is how many failures in ImpEx HAC doesn't report: "Import finished successfully," and the database doesn't contain what the file does. And the errors ImpEx does produce often point to the wrong place: to a different line, to the second pass instead of the first, to null instead of the user ID.
+
+As with FlexibleSearch, for a component designed in the early 2000s and compatible with every file ever imported, this is understandable. There is one practical rule to take from this: verify the ImpEx result against the database, for example with a FlexibleSearch query on the imported keys and a comparison of item counts.
diff --git a/docs/dev/versioning.md b/docs/dev/versioning.md
new file mode 100644
index 00000000..fda2a65f
--- /dev/null
+++ b/docs/dev/versioning.md
@@ -0,0 +1,126 @@
+# Documentation and plugin versioning
+
+Documentation follows the plugin's Git history and release tags. MkDocs/Material
+uses Mike to provide a version selector. There is no independent documentation
+version counter: release directories use the full plugin version, such as `22.11.0`.
+
+## Published documentation versions
+
+| URL suffix | Content |
+| --- | --- |
+| `/` | Redirect to the latest working documentation |
+| `/latest/` | Redirect alias for Development |
+| `/development/` | Latest successful `master` documentation build |
+| `/X.Y.Z/` | Immutable documentation snapshot from release tag `vX.Y.Z` |
+| `/updates/latest/` | Canonical Eclipse installer repository, always copied from committed `master` p2 files |
+
+The selector lists archived releases and **Development**. Development may describe
+unreleased changes; it is not a claim that the installer repository offers those
+features. Each release remains canonical to its own version directory.
+
+Generated HTML and `versions.json` are retained on the reserved `docs-versions`
+branch. The existing Pages workflow publishes versioned documentation and the
+canonical p2 repository together; do not publish a docs-only artifact separately.
+
+## Archive a release
+
+- Publishing a GitHub release runs the documentation workflow against current
+ trusted `master` tooling and archives the release tag's Markdown, README, and navigation.
+- To backfill an existing release, run **Documentation and Eclipse update site**
+ from the Actions tab with `master` selected and `release_tag` set to `vX.Y.Z`.
+ Leave the input blank to update Development only.
+- Eligible tags must contain MkDocs sources and `pom.xml` version `X.Y.Z.RELEASE`.
+ Some older tags predate MkDocs; inspect their source documentation through Git instead.
+- Existing release snapshots are not rebuilt. If a tag has been moved to another
+ commit, the workflow refuses to replace its recorded snapshot.
+- Tag builds never publish that tag's p2 files over `/updates/latest/`. The installer
+ bytes still come from `master`, even when release documentation is added.
+
+Only the trusted Pages deployment job has permission to push generated history.
+Pull requests and manual runs on other branches validate without publishing.
+For a fork, configure `mkdocs.yml`'s `site_url` and `repo_url` for the actual
+publishing repository so canonical and tagged source links point to the correct site.
+
+## Version sources
+
+| Item | Source of truth | Example |
+| --- | --- | --- |
+| Development version | Root and module `pom.xml` files | `22.11.1-SNAPSHOT` |
+| Development bundle/feature version | `META-INF/MANIFEST.MF` and `feature.xml` | `22.11.1.qualifier` |
+| Release version | Synchronized Maven, bundle, and feature metadata | `22.11.1.RELEASE` |
+| Release tag | Git tag identifying the release source and documentation | `v22.11.1` |
+| Installed/distributed version | p2 metadata and release assets | Consult the installed feature or release notes |
+| Development documentation | Latest successful deployment from `master` | May include unreleased changes |
+| Archived documentation | Recorded release-tag source commit | `/22.11.0/` after that tag is archived |
+
+Examples illustrate the naming convention; they do not assign the next release.
+Maintain the existing three-component version sequence. Do not derive a plugin
+version automatically from today's date, the Java version, or the Eclipse target.
+
+Use the Tycho Versions plugin described in
+[the release procedure](development.md#2-set-the-new-release-version) to update
+Maven, bundle, and feature versions together. Do not change individual versions
+with manual search-and-replace. Build qualifiers are not separate documentation
+releases.
+
+## When to update documentation
+
+- Update behavior, setup, and migration documentation in the same change as the
+ implementation. Include user-visible changes in `CHANGELOG.md`.
+- Mark features not yet present in a published artifact as **Unreleased**. State
+ **Available since X.Y.Z** only after that release has been published.
+- Documentation corrections alone do not require a plugin version bump or a new
+ p2 repository. They can be published from `master` through the existing Pages workflow.
+- For compatibility-affecting changes, document removed APIs/bundles, replacement
+ behavior, user actions, and known limitations. The maintainer chooses the next
+ plugin version; the numeric version alone is not a compatibility guarantee.
+
+For example, retiring the legacy ImpEx editor requires release notes explaining
+the new default editor, possible reassociation/manual uninstallation, and any
+remaining grammar or indexing limitations. Do not describe manual checks as
+completed unless they were actually performed.
+
+## Release documentation checklist
+
+Before creating the release tag:
+
+1. Apply the selected plugin release version using the release procedure.
+2. Review `README.md`, installation requirements, changed feature guides, and
+ migration notes against the actual release candidate—not just current source.
+3. Convert applicable **Unreleased** changelog entries into the release section;
+ retain genuinely unreleased work under **Unreleased**.
+4. Validate documentation using the commands in
+ [Documentation website](development.md#documentation-website), including the
+ strict MkDocs build and published-resource tests.
+5. Include matching documentation and changelog changes in the source commit
+ referenced by the release tag. Publish the artifacts using the
+ [release procedure](development.md#releasing-a-new-version).
+
+After publication, prepare the next development `-SNAPSHOT` in a separate change.
+Do not move or recreate an existing release tag to incorporate later documentation
+fixes. Put corrections on the development branch and, when necessary, a dedicated
+release-maintenance branch or a new release.
+
+## Read documentation for an installed release
+
+The root/latest MkDocs pages represent the latest deployed `master` documentation,
+not necessarily the version offered by `updates/latest/`. Choose the installed
+version from the selector for an archived snapshot. Documentation deployment
+does not build or release Java bundles; p2 publication uses the committed repository.
+See [What is published](../installation.md#what-is-published).
+
+For releases not yet archived, or version-specific source documentation, select the release tag on GitHub and
+browse `README.md` and `docs/` in the repository that published the release. A fork's
+tag may not exist in the upstream repository. Locally, inspect tagged files without
+changing the working tree:
+
+```bash
+VERSION=22.11.0 # replace with the installed release's tag version
+git show "v${VERSION}:README.md"
+git show "v${VERSION}:docs/installation.md"
+```
+
+Some older tags predate particular documentation pages. Use the README, changelog,
+and documentation files that exist at that tag. Check the current site's corrections
+and migration notes separately; do not treat newer instructions as evidence that an
+older binary supports the same features.
diff --git a/docs/installation.md b/docs/installation.md
index f4c20820..2042e4ec 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -5,7 +5,7 @@ Install the plugin through the
or use the hosted Eclipse p2 repository:
```text
-https://sap.github.io/hybris-commerce-eclipse-plugin/updates/latest/
+https://mikolayek.github.io/hybris-commerce-eclipse-plugin/updates/latest/
```
## Install from the update site
@@ -21,6 +21,9 @@ To update an existing installation, use **Help → Check for Updates** with this
## What is published
+The documentation version selector changes documentation pages only. The installer
+URL above remains stable and is independent of selected documentation releases.
+
The hosted repository mirrors the committed `updatesite/latest` repository on `master`.
That path currently points to `updatesite/neon`; the directory name is historical and
does not by itself determine Eclipse compatibility. Consult the release notes and
@@ -33,7 +36,7 @@ The repository metadata determines the available plugin version.
GitHub Pages serves the p2 metadata, feature JARs, and plugin JARs without modifying
their bytes. Hosting does not sign artifacts or change their existing signatures.
-See the [release process](dev/development.md#4-sign-deliverable-eclipse-artifacts)
+See the [release process](dev/development.md#releasing-a-new-version)
for signing requirements.
The update URL is for Eclipse's installer, not a browsable documentation page.
diff --git a/docs/internal/type-system-repository.md b/docs/internal/type-system-repository.md
index 74b78457..602082c2 100644
--- a/docs/internal/type-system-repository.md
+++ b/docs/internal/type-system-repository.md
@@ -13,9 +13,8 @@ The previous SAP `YTypeSystem` usages were:
| `ytypesystem/Activator.java` | Runtime type loading, type/name caches, attributes and loader locations | Delegates to shared snapshots; caches/runtime loading removed |
| `ytypesystem/YTypeSystemBuilder.java` | Loaded platform classes and parsed items XML | Removed |
| `ytypesystem/ExtendedYTypeSystem.java` | Subclassed SAP type system and reflected into private fields | Removed |
-| `impexed/Activator.java` | Delegated completion and hyperlink data to the old Activator | Uses commons index directly |
-| ImpEx completion processors | Requested types and qualifiers through the Activator | Retain their API, now backed by generated models |
-| ImpEx hyperlink detector/link | Cached type names and decoded items.xml loader strings | Reads current names and opens the generated model source |
+| Legacy ImpEx Activator/completion processors | Requested types and qualifiers through the Activator | Removed; the LSP workspace adapter supplies document-scoped shared snapshots |
+| Legacy ImpEx hyperlink detector/link | Cached type names and decoded items.xml loader strings | Removed; LSP definitions resolve accessible generated-model source locations |
| Beans type selection/label provider/generator | Used SAP composed types and attributes | Uses shared types and accessor Java types |
| `tsv.extended/.../PlatformServiceImplHyeclipse.java` | Returns SAP `YTypeSystem` to the TSV library | Removed in the source-built TSV migration |
| `tsv.extended/.../TSVExtendedYTypeSystem.java` | SAP subclass with private-field reflection | Removed in the source-built TSV migration |
diff --git a/mkdocs.yml b/mkdocs.yml
deleted file mode 100644
index dd248165..00000000
--- a/mkdocs.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-site_name: Eclipse Plugin for SAP Commerce
-site_description: User and developer documentation for the SAP Commerce Eclipse plugin.
-site_url: https://sap.github.io/hybris-commerce-eclipse-plugin/
-repo_url: https://github.com/SAP/hybris-commerce-eclipse-plugin
-repo_name: SAP/hybris-commerce-eclipse-plugin
-edit_uri: edit/master/docs/
-docs_dir: docs
-site_dir: site
-
-theme:
- name: material
- font: false
- features:
- - navigation.sections
- - navigation.top
- - content.action.edit
- - content.code.copy
- - search.highlight
-
-plugins:
- - search
-
-hooks:
- - tools/docs/hooks.py
-
-watch:
- - README.md
- - tools/docs
- - updatesite
-
-exclude_docs: |
- docker-compose.yml
- start-sonar.sh
- dev/eclipse-code-style.xml
- internal/*.*
-
-validation:
- nav:
- omitted_files: warn
- not_found: warn
- links:
- not_found: warn
- anchors: warn
- unrecognized_links: warn
-
-markdown_extensions:
- - admonition
- - toc:
- permalink: true
- - pymdownx.highlight
- - pymdownx.superfences
-
-nav:
- - Home: index.md
- - User guide:
- - Installation and update site: installation.md
- - Project importer: importer/importer.md
- - Beans generation: beangen/beangen.md
- - JDK selection: import-jdk.md
- - Troubleshooting:
- - Knowledge database: kb/info.md
- - Developer guide:
- - Development and releases: dev/development.md
- - Regression verification: dev/import-and-junit-verification.md
- - Project information:
- - Deprecations: deprecation/deprecation.md
- - Contributing: https://github.com/SAP/hybris-commerce-eclipse-plugin/blob/master/CONTRIBUTING.md
- - Code of conduct: https://github.com/SAP/hybris-commerce-eclipse-plugin/blob/master/CODE_OF_CONDUCT.md
- - License: https://github.com/SAP/hybris-commerce-eclipse-plugin/blob/master/LICENSE
diff --git a/pom.xml b/pom.xml
index 43efc463..07b6fc3c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,9 @@
com.hybris.hyeclipse.commons
com.hybris.hyeclipse.hac
- com.hybris.hyeclipse.impexed
+ com.hybris.hyeclipse.impex
+ com.hybris.hyeclipse.impex.ls
+ com.hybris.hyeclipse.impex.tests
com.hybris.hyeclipse.importer
com.hybris.hyeclipse.ytypesystem
com.hybris.hyeclipse.platform
diff --git a/tools/docs/hooks.py b/tools/docs/hooks.py
index c24fe86e..a5287d40 100644
--- a/tools/docs/hooks.py
+++ b/tools/docs/hooks.py
@@ -4,6 +4,7 @@
import hashlib
import lzma
+import os
import re
import shutil
import xml.etree.ElementTree as ET
@@ -14,26 +15,27 @@
from mkdocs.structure.files import File
-def homepage_markdown(markdown, repo_url):
+def homepage_markdown(markdown, repo_url, source_ref="master"):
"""Rebase the README's inline links from the repository root to docs/."""
# Keep the directory browser on GitHub; it is not a documentation page.
- markdown = markdown.replace("](docs/)", f"]({repo_url}/tree/master/docs/)")
+ markdown = markdown.replace("](docs/)", f"]({repo_url}/tree/{source_ref}/docs/)")
# Rebase inline Markdown destinations without changing absolute URLs.
markdown = markdown.replace("](docs/", "](")
for filename in ("CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "LICENSE"):
markdown = markdown.replace(
- f"]({filename})", f"]({repo_url}/blob/master/{filename})"
+ f"]({filename})", f"]({repo_url}/blob/{source_ref}/{filename})"
)
return markdown
def on_files(files, config):
- root = Path(config.config_file_path).parent
+ root = Path(os.environ.get("COMMERCE_DOCS_SOURCE_ROOT", Path(config.config_file_path).parent))
+ source_ref = os.environ.get("COMMERCE_DOCS_SOURCE_REF", "master")
markdown = homepage_markdown(
- (root / "README.md").read_text(encoding="utf-8"), config.repo_url.rstrip("/")
+ (root / "README.md").read_text(encoding="utf-8"), config.repo_url.rstrip("/"), source_ref
)
homepage = File.generated(config, "index.md", content=markdown)
- homepage.edit_uri = f"{config.repo_url.rstrip('/')}/edit/master/README.md"
+ homepage.edit_uri = f"{config.repo_url.rstrip('/')}/edit/master/README.md" if source_ref == "master" else None
files.append(homepage)
return files
@@ -100,6 +102,9 @@ def publish_update_site(source, destination):
def on_post_build(config):
+ # Version snapshots contain docs only; the final Pages artifact adds one canonical p2 repository.
+ if os.environ.get("COMMERCE_DOCS_VERSION_BUILD") == "1":
+ return
root = Path(config.config_file_path).parent
try:
publish_update_site(root / "updatesite/latest", Path(config.site_dir) / "updates/latest")
diff --git a/tools/docs/requirements.txt b/tools/docs/requirements.txt
index b9689135..654ff4a2 100644
--- a/tools/docs/requirements.txt
+++ b/tools/docs/requirements.txt
@@ -2,3 +2,4 @@
# SPDX-License-Identifier: Apache-2.0
mkdocs==1.6.1
mkdocs-material==9.8.1
+mike==2.2.0
diff --git a/tools/docs/resources.py b/tools/docs/resources.py
new file mode 100644
index 00000000..db16b896
--- /dev/null
+++ b/tools/docs/resources.py
@@ -0,0 +1,41 @@
+# SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and contributors
+# SPDX-License-Identifier: Apache-2.0
+"""Validate local links and assets in the final Pages artifact, including redirects."""
+
+from html.parser import HTMLParser
+from pathlib import Path
+from urllib.parse import unquote, urlsplit
+
+
+class ResourceParser(HTMLParser):
+ def __init__(self):
+ super().__init__()
+ self.urls = []
+
+ def handle_starttag(self, tag, attrs):
+ for name, value in attrs:
+ if name in ("src", "href") and value:
+ self.urls.append(value)
+
+
+def validate_site_resources(site, site_url):
+ site = Path(site).resolve()
+ prefix = urlsplit(site_url).path
+ for page in site.rglob("*.html"):
+ parser = ResourceParser()
+ parser.feed(page.read_text(encoding="utf-8"))
+ for url in parser.urls:
+ parsed = urlsplit(url)
+ if parsed.scheme or parsed.netloc or not parsed.path:
+ continue
+ path = unquote(parsed.path)
+ if path.startswith("/"):
+ if not path.startswith(prefix):
+ raise ValueError(f"URL escapes project prefix in {page.relative_to(site)}: {url}")
+ target = site / path[len(prefix):]
+ else:
+ target = page.parent / path
+ if target.is_dir():
+ target /= "index.html"
+ if not target.resolve().is_relative_to(site) or not target.is_file():
+ raise ValueError(f"Missing published resource in {page.relative_to(site)}: {url}")
diff --git a/tools/docs/test_hooks.py b/tools/docs/test_hooks.py
index a85667be..f0286ce0 100644
--- a/tools/docs/test_hooks.py
+++ b/tools/docs/test_hooks.py
@@ -3,15 +3,28 @@
"""Regression tests for the generated documentation homepage."""
import unittest
+from unittest.mock import patch
from pathlib import Path
from mkdocs.config import load_config
from mkdocs.structure.files import Files
-from hooks import homepage_markdown
+from hooks import homepage_markdown, on_post_build
class HomepageTest(unittest.TestCase):
+ def test_release_source_links_use_the_tag(self):
+ self.assertEqual(
+ "[Sources](https://example.com/repo/tree/v1.2.3/docs/) [License](https://example.com/repo/blob/v1.2.3/LICENSE)",
+ homepage_markdown("[Sources](docs/) [License](LICENSE)", "https://example.com/repo", "v1.2.3"),
+ )
+
+ def test_version_snapshot_does_not_copy_the_installer_repository(self):
+ with patch.dict("os.environ", {"COMMERCE_DOCS_VERSION_BUILD": "1"}):
+ with patch("hooks.publish_update_site") as publish:
+ on_post_build(None)
+ publish.assert_not_called()
+
def test_document_links_preserve_fragments(self):
self.assertEqual(
"[Import](importer/importer.md#features)",
diff --git a/tools/docs/test_site.py b/tools/docs/test_site.py
index 3fe7ffcb..b4801103 100644
--- a/tools/docs/test_site.py
+++ b/tools/docs/test_site.py
@@ -5,23 +5,11 @@
import json
import tempfile
import unittest
-from html.parser import HTMLParser
from pathlib import Path
-from urllib.parse import unquote, urlsplit
from mkdocs.commands.build import build
from mkdocs.config import load_config
-
-
-class ResourceParser(HTMLParser):
- def __init__(self):
- super().__init__()
- self.urls = []
-
- def handle_starttag(self, tag, attrs):
- for name, value in attrs:
- if name in ("src", "href") and value:
- self.urls.append(value)
+from resources import validate_site_resources
class SiteTest(unittest.TestCase):
@@ -31,24 +19,7 @@ def test_published_resources(self):
site = Path(directory) / "site"
config = load_config(str(root / "mkdocs.yml"), site_dir=str(site), strict=True)
build(config)
- prefix = urlsplit(config.site_url).path
- for page in site.rglob("*.html"):
- parser = ResourceParser()
- parser.feed(page.read_text(encoding="utf-8"))
- for url in parser.urls:
- with self.subTest(page=str(page.relative_to(site)), url=url):
- parsed = urlsplit(url)
- if parsed.scheme or parsed.netloc or not parsed.path:
- continue
- path = unquote(parsed.path)
- if path.startswith("/"):
- self.assertTrue(path.startswith(prefix), "URL escapes project prefix")
- target = site / path[len(prefix):]
- else:
- target = page.parent / path
- if target.is_dir():
- target = target / "index.html"
- self.assertTrue(target.is_file(), f"Missing published resource: {target}")
+ validate_site_resources(site, config.site_url)
for image in (root / "docs").rglob("*"):
if image.suffix in (".gif", ".png"):
diff --git a/tools/docs/test_versioning.py b/tools/docs/test_versioning.py
new file mode 100644
index 00000000..1f5cf746
--- /dev/null
+++ b/tools/docs/test_versioning.py
@@ -0,0 +1,185 @@
+# SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and contributors
+# SPDX-License-Identifier: Apache-2.0
+"""Exercise actual Mike builds in an isolated Git repository, never the user's branches."""
+
+import hashlib
+import json
+import shutil
+import tempfile
+import unittest
+import xml.etree.ElementTree as ET
+from pathlib import Path
+from urllib.parse import unquote, urlsplit
+
+import yaml
+
+from resources import ResourceParser, validate_site_resources
+from versioned_site import HISTORY_BRANCH, build_site, deployment_config, git, history_versions
+
+
+class VersioningTest(unittest.TestCase):
+ def setUp(self):
+ self.temporary = tempfile.TemporaryDirectory(prefix="commerce-versioning-")
+ self.addCleanup(self.temporary.cleanup)
+ self.root = Path(self.temporary.name)
+ git(self.root, "init", "-b", "master")
+ git(self.root, "config", "user.name", "Documentation test")
+ git(self.root, "config", "user.email", "docs-test@example.invalid")
+ (self.root / "docs").mkdir()
+ (self.root / "tools/docs").mkdir(parents=True)
+ original = Path(__file__).resolve().parents[2]
+ shutil.copyfile(original / "tools/docs/hooks.py", self.root / "tools/docs/hooks.py")
+ (self.root / ".gitignore").write_text("site/\ndocs-history.bundle\n", encoding="utf-8")
+ self.config = {
+ "site_name": "Versioning test", "site_url": "https://example.com/project/",
+ "repo_url": "https://github.com/example/repository", "docs_dir": "docs", "site_dir": "site",
+ "theme": {"name": "material", "font": False, "features": ["content.action.edit"]},
+ "hooks": ["tools/docs/hooks.py"], "plugins": ["search"],
+ "watch": ["README.md", "tools/docs", "updatesite"],
+ "nav": [{"Home": "index.md"}, {"Install": "installation.md"}],
+ "validation": {"nav": {"omitted_files": "warn"}, "links": {"not_found": "warn"}},
+ }
+ (self.root / "mkdocs.yml").write_text(yaml.safe_dump(self.config), encoding="utf-8")
+ self.write_source("Released documentation", "1.2.3.RELEASE")
+ self.write_repository(b"release artifact")
+ self.commit()
+ git(self.root, "tag", "v1.2.3")
+ self.release_sha = git(self.root, "rev-parse", "HEAD").stdout.decode().strip()
+ self.write_source("Development documentation", "1.2.4-SNAPSHOT")
+ self.write_repository(b"current master artifact")
+ self.commit()
+
+ def write_source(self, title, version):
+ (self.root / "README.md").write_text(f"# {title}\n[Install](docs/installation.md)\n[License](LICENSE)\n", encoding="utf-8")
+ (self.root / "docs/installation.md").write_text(f"# Installation\n{title}\n", encoding="utf-8")
+ (self.root / "pom.xml").write_text(
+ f'{version}', encoding="utf-8"
+ )
+
+ def write_repository(self, artifact):
+ source = self.root / "updatesite/latest"
+ (source / "plugins").mkdir(parents=True, exist_ok=True)
+ (source / "plugins/example.bundle_1.2.3.jar").write_bytes(artifact)
+ content = ET.fromstring('')
+ artifacts = ET.fromstring('')
+ props = artifacts.find("./artifacts/artifact/properties")
+ ET.SubElement(props, "property", name="download.size", value=str(len(artifact)))
+ ET.SubElement(props, "property", name="download.checksum.sha-256", value=hashlib.sha256(artifact).hexdigest())
+ (source / "content.xml").write_bytes(ET.tostring(content))
+ (source / "artifacts.xml").write_bytes(ET.tostring(artifacts))
+ (source / "p2.index").write_text("version=1\n", encoding="utf-8")
+
+ def commit(self):
+ git(self.root, "add", ".")
+ git(self.root, "commit", "-m", "Documentation fixture")
+
+ def test_version_archives_selector_redirects_p2_and_history_round_trip(self):
+ source_head = git(self.root, "rev-parse", "HEAD").stdout
+ output = build_site(self.root, "v1.2.3", export_history=True)
+ versions = json.loads((output / "versions.json").read_text())
+ release = next(item for item in versions if item["version"] == "1.2.3")
+ development = next(item for item in versions if item["version"] == "development")
+ self.assertEqual(self.release_sha, release["properties"]["source_commit"])
+ self.assertEqual(["latest"], development["aliases"])
+ released_html = (output / "1.2.3/index.html").read_bytes()
+ self.assertIn(b"Released documentation", released_html)
+ self.assertIn(b"/blob/v1.2.3/LICENSE", released_html)
+ self.assertIn(b"Development documentation", (output / "development/index.html").read_bytes())
+ self.assertIn(b'"version"', (output / "development/index.html").read_bytes())
+ self.assertTrue((output / "latest/installation/index.html").exists())
+ self.assertIn("latest", (output / "index.html").read_text())
+ self.assertIn("latest/installation/index.html", (output / "installation/index.html").read_text())
+ self.assertEqual(b"current master artifact", (output / "updates/latest/plugins/example.bundle_1.2.3.jar").read_bytes())
+ self.assertFalse((output / "1.2.3/updates").exists())
+ self.assertFalse((output / "development/updates").exists())
+ self.assertFalse(any(path.is_symlink() for path in output.rglob("*")))
+ for page in output.rglob("*.html"):
+ parser = ResourceParser()
+ parser.feed(page.read_text(encoding="utf-8"))
+ for url in parser.urls:
+ parsed = urlsplit(url)
+ if parsed.scheme or parsed.netloc or not parsed.path:
+ continue
+ path = unquote(parsed.path)
+ if path.startswith("/"):
+ self.assertTrue(path.startswith("/project/"), (page, url))
+ target = output / path[len("/project/"):]
+ else:
+ target = page.parent / path
+ if target.is_dir():
+ target /= "index.html"
+ self.assertTrue(target.is_file(), (page, url))
+ self.assertEqual(source_head, git(self.root, "rev-parse", "HEAD").stdout)
+ self.assertEqual("master", git(self.root, "branch", "--show-current").stdout.decode().strip())
+ self.assertTrue((self.root / "docs-history.bundle").is_file())
+ restored = self.root / "restored"
+ restored.mkdir()
+ git(restored, "init")
+ git(restored, "fetch", str(self.root / "docs-history.bundle"), f"{HISTORY_BRANCH}:refs/heads/{HISTORY_BRANCH}")
+ self.assertEqual(history_versions(self.root), history_versions(restored))
+ shutil.rmtree(restored)
+ self.write_source("New development documentation", "1.2.4-SNAPSHOT")
+ self.commit()
+ build_site(self.root, "v1.2.3")
+ self.assertEqual(released_html, (output / "1.2.3/index.html").read_bytes())
+ self.assertIn(b"New development documentation", (output / "development/index.html").read_bytes())
+
+ def test_invalid_release_and_dirty_export_do_not_modify_history(self):
+ with self.assertRaisesRegex(ValueError, "vX.Y.Z"):
+ build_site(self.root, "../master")
+ git(self.root, "tag", "v1.2.4")
+ with self.assertRaisesRegex(ValueError, "does not identify"):
+ build_site(self.root, "v1.2.4")
+ self.assertNotEqual(0, git(self.root, "rev-parse", "--verify", HISTORY_BRANCH, check=False).returncode)
+ (self.root / "docs/uncommitted.md").write_text("Unreviewed content")
+ with self.assertRaisesRegex(ValueError, "Commit documentation"):
+ build_site(self.root, export_history=True)
+
+ def test_archived_release_cannot_be_overwritten_by_a_moved_tag(self):
+ build_site(self.root, "v1.2.3")
+ before = git(self.root, "rev-parse", HISTORY_BRANCH).stdout
+ self.write_source("Moved release source", "1.2.3.RELEASE")
+ self.commit()
+ git(self.root, "tag", "-f", "v1.2.3")
+ with self.assertRaisesRegex(ValueError, "Immutable"):
+ build_site(self.root, "v1.2.3")
+ self.assertEqual(before, git(self.root, "rev-parse", HISTORY_BRANCH).stdout)
+
+ def test_artifact_validation_rejects_missing_and_prefix_escaping_resources(self):
+ site = self.root / "site"
+ site.mkdir()
+ page = site / "index.html"
+ page.write_text('
', encoding="utf-8")
+ with self.assertRaisesRegex(ValueError, "escapes project prefix"):
+ validate_site_resources(site, self.config["site_url"])
+ page.write_text('
', encoding="utf-8")
+ with self.assertRaisesRegex(ValueError, "Missing published resource"):
+ validate_site_resources(site, self.config["site_url"])
+
+ def test_snapshot_config_rejects_outside_sources_and_untrusted_hooks(self):
+ source = dict(self.config, docs_dir="../outside")
+ with self.assertRaisesRegex(ValueError, "inside"):
+ deployment_config(self.config, source, self.root, self.root / "tools/docs/hooks.py", self.root / "build", "v1.2.3")
+ source = dict(self.config, hooks=["unsafe.py"], plugins=["unsafe"])
+ config = deployment_config(self.config, source, self.root, self.root / "tools/docs/hooks.py", self.root / "build", "v1.2.3")
+ self.assertEqual([str(self.root / "tools/docs/hooks.py")], config["hooks"])
+ self.assertEqual("search", config["plugins"][0])
+ self.assertNotIn("unsafe", str(config["plugins"]))
+ self.assertEqual("", config["edit_uri"])
+
+ def test_workflow_only_pushes_history_from_the_trusted_deployment_job(self):
+ root = Path(__file__).resolve().parents[2]
+ workflow = yaml.load((root / ".github/workflows/docs.yml").read_text(), Loader=yaml.BaseLoader)
+ self.assertEqual("read", workflow["jobs"]["build"]["permissions"]["contents"])
+ self.assertEqual("write", workflow["jobs"]["deploy"]["permissions"]["contents"])
+ self.assertIn("github.ref == 'refs/heads/master'", workflow["jobs"]["deploy"]["if"])
+ self.assertIn("github.event_name == 'release'", workflow["jobs"]["deploy"]["if"])
+ build_commands = "\n".join(step.get("run", "") for step in workflow["jobs"]["build"]["steps"])
+ self.assertNotIn("git push", build_commands)
+ deploy_commands = "\n".join(step.get("run", "") for step in workflow["jobs"]["deploy"]["steps"])
+ self.assertIn("refs/heads/docs-versions:refs/heads/docs-versions", deploy_commands)
+ self.assertNotIn("--force", deploy_commands)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/docs/versioned_site.py b/tools/docs/versioned_site.py
new file mode 100644
index 00000000..a37a7386
--- /dev/null
+++ b/tools/docs/versioned_site.py
@@ -0,0 +1,220 @@
+# SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and contributors
+# SPDX-License-Identifier: Apache-2.0
+"""Build Mike documentation history plus one canonical, byte-preserved p2 repository.
+
+Only the generated docs-versions branch is changed. This tool never pushes Git
+branches; CI exports a bundle and pushes it from the trusted deployment job.
+"""
+
+import argparse
+import copy
+import html
+import io
+import json
+import os
+import posixpath
+import re
+import shutil
+import subprocess
+import sys
+import tarfile
+import tempfile
+import xml.etree.ElementTree as ET
+from pathlib import Path
+
+import yaml
+
+from hooks import publish_update_site
+from resources import validate_site_resources
+
+
+HISTORY_BRANCH = "docs-versions"
+DEVELOPMENT_VERSION = "development"
+LATEST_ALIAS = "latest"
+RELEASE_TAG = re.compile(r"v(\d+\.\d+\.\d+)\Z")
+
+
+def git(root, *args, check=True):
+ return subprocess.run(
+ ["git", *args], cwd=root, check=check, stdout=subprocess.PIPE, stderr=subprocess.PIPE
+ )
+
+
+def history_versions(root):
+ for ref in (HISTORY_BRANCH, f"origin/{HISTORY_BRANCH}"):
+ if git(root, "rev-parse", "--verify", ref, check=False).returncode:
+ continue
+ result = git(root, "show", f"{ref}:versions.json", check=False)
+ if result.returncode:
+ raise ValueError(f"{ref} exists but is not a Mike documentation-history branch")
+ versions = json.loads(result.stdout)
+ if not isinstance(versions, list):
+ raise ValueError("Invalid documentation version metadata")
+ return versions
+ return []
+
+
+def source_links(value, source_ref):
+ if isinstance(value, str):
+ return value.replace("/blob/master/", f"/blob/{source_ref}/").replace(
+ "/tree/master/", f"/tree/{source_ref}/"
+ )
+ if isinstance(value, list):
+ return [source_links(item, source_ref) for item in value]
+ if isinstance(value, dict):
+ return {key: source_links(item, source_ref) for key, item in value.items()}
+ return value
+
+
+def deployment_config(base, source, source_root, trusted_hook, build_directory, source_ref):
+ config = copy.deepcopy(source)
+ docs = Path(config.get("docs_dir", "docs"))
+ if docs.is_absolute() or not (source_root / docs).resolve().is_relative_to(source_root.resolve()):
+ raise ValueError("Documentation sources must stay inside the source snapshot")
+ if not (source_root / docs).is_dir():
+ raise ValueError("Source snapshot has no documentation directory")
+ config["docs_dir"] = str((source_root / docs).resolve())
+ config["site_dir"] = str(build_directory)
+ # Snapshot configurations live in a temporary directory, not the live-preview project root.
+ config["watch"] = []
+ config["site_url"] = base["site_url"]
+ config["repo_url"] = base["repo_url"]
+ config["theme"] = copy.deepcopy(base["theme"])
+ config["plugins"] = ["search", {"mike": {"alias_type": "redirect"}}]
+ config["hooks"] = [str(trusted_hook)]
+ config["markdown_extensions"] = copy.deepcopy(base.get("markdown_extensions", []))
+ config["validation"] = copy.deepcopy(base.get("validation", {}))
+ config["strict"] = True
+ config["remote_branch"] = HISTORY_BRANCH
+ config.setdefault("extra", {})["version"] = {"provider": "mike"}
+ if source_ref != "master":
+ config["edit_uri"] = ""
+ config["theme"]["features"] = [
+ item for item in config["theme"].get("features", []) if item != "content.action.edit"
+ ]
+ config = source_links(config, source_ref)
+ return config
+
+
+def mike(root, config_path, source_root, source_ref, *args):
+ env = os.environ.copy()
+ # Mike launches the mkdocs console script; keep both commands in this Python environment.
+ env["PATH"] = str(Path(sys.executable).parent) + os.pathsep + env.get("PATH", "")
+ env.update(
+ COMMERCE_DOCS_VERSION_BUILD="1",
+ COMMERCE_DOCS_SOURCE_ROOT=str(source_root),
+ COMMERCE_DOCS_SOURCE_REF=source_ref,
+ )
+ subprocess.run(
+ [sys.executable, "-c", "from mike.driver import main\nmain()", *args,
+ "--branch", HISTORY_BRANCH, "--config-file", str(config_path)],
+ cwd=root, env=env, check=True,
+ )
+
+
+def release_source(root, tag, destination):
+ match = RELEASE_TAG.fullmatch(tag)
+ if not match:
+ raise ValueError("Release documentation requires a tag named vX.Y.Z")
+ sha = git(root, "rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}").stdout.decode().strip()
+ archive = git(root, "archive", "--format=tar", tag, "README.md", "docs", "mkdocs.yml", "pom.xml")
+ with tarfile.open(fileobj=io.BytesIO(archive.stdout)) as files:
+ files.extractall(destination, filter="data")
+ version = match.group(1)
+ pom = ET.parse(destination / "pom.xml").getroot()
+ actual = pom.findtext("{http://maven.apache.org/POM/4.0.0}version")
+ if actual != f"{version}.RELEASE":
+ raise ValueError(f"Tag {tag} does not identify plugin version {version}.RELEASE")
+ return version, sha
+
+
+def write_legacy_redirects(output):
+ """Keep previous unversioned page URLs working without touching archived files."""
+ for page in (output / DEVELOPMENT_VERSION).rglob("*.html"):
+ relative = page.relative_to(output / DEVELOPMENT_VERSION)
+ destination = output / relative
+ if destination.exists():
+ continue
+ target = posixpath.relpath(f"{LATEST_ALIAS}/{relative.as_posix()}", relative.parent.as_posix())
+ destination.parent.mkdir(parents=True, exist_ok=True)
+ destination.write_text(
+ ''
+ f''
+ f'Latest documentation'
+ '',
+ encoding="utf-8",
+ )
+
+
+def build_site(root, release_tag="", export_history=False):
+ root = Path(root).resolve()
+ if export_history:
+ changed = git(root, "status", "--porcelain", "--", "README.md", "docs", "mkdocs.yml",
+ "tools/docs", "updatesite").stdout
+ if changed:
+ raise ValueError("Commit documentation and tooling changes before exporting publication history")
+ base = yaml.safe_load((root / "mkdocs.yml").read_text(encoding="utf-8"))
+ hook = (root / "tools/docs/hooks.py").resolve()
+ versions = history_versions(root)
+ with tempfile.TemporaryDirectory(prefix="commerce-versioned-docs-") as temporary:
+ directory = Path(temporary)
+ release = None
+ # Validate release input before modifying documentation history.
+ if release_tag:
+ source_root = directory / "release"
+ source_root.mkdir()
+ version, sha = release_source(root, release_tag, source_root)
+ existing = next((item for item in versions if item["version"] == version), None)
+ if existing and existing.get("properties", {}).get("source_commit") != sha:
+ raise ValueError(f"Immutable documentation snapshot {version} has different source provenance")
+ release = (source_root, version, sha, existing)
+ development = deployment_config(base, base, root, hook, directory / "development-build", "master")
+ development_config = directory / "development.yml"
+ development_config.write_text(yaml.safe_dump(development, sort_keys=False), encoding="utf-8")
+ sha = git(root, "rev-parse", "HEAD").stdout.decode().strip()
+ mike(root, development_config, root, "master", "deploy", "--update-aliases", "--alias-type", "redirect",
+ "--title", "Development", "--prop-set-string", f"source_commit={sha}",
+ "--prop-set-string", "source_ref=master", DEVELOPMENT_VERSION, LATEST_ALIAS)
+ if release and not release[3]:
+ source_root, version, sha, unused_existing = release
+ source = yaml.safe_load((source_root / "mkdocs.yml").read_text(encoding="utf-8"))
+ config = deployment_config(base, source, source_root, hook, directory / "release-build", release_tag)
+ config_path = directory / "release.yml"
+ config_path.write_text(yaml.safe_dump(config, sort_keys=False), encoding="utf-8")
+ mike(root, config_path, source_root, release_tag, "deploy", "--alias-type", "redirect",
+ "--prop-set-string", f"source_commit={sha}", "--prop-set-string", f"source_ref={release_tag}", version)
+ mike(root, development_config, root, "master", "set-default", LATEST_ALIAS)
+ output = root / "site"
+ if output.exists():
+ shutil.rmtree(output)
+ output.mkdir()
+ archive = git(root, "archive", "--format=tar", HISTORY_BRANCH)
+ with tarfile.open(fileobj=io.BytesIO(archive.stdout)) as files:
+ files.extractall(output, filter="data")
+ if any(path.is_symlink() for path in output.rglob("*")):
+ raise ValueError("Documentation history must use redirect aliases, not symlinks")
+ write_legacy_redirects(output)
+ # Always use the checked-out master repository, never a release snapshot's p2 bytes.
+ publish_update_site(root / "updatesite/latest", output / "updates/latest")
+ validate_site_resources(output, base["site_url"])
+ if export_history:
+ bundle = root / "docs-history.bundle"
+ if bundle.exists():
+ bundle.unlink()
+ git(root, "bundle", "create", str(bundle), HISTORY_BRANCH)
+ return output
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--release-tag", default="", help="Optional immutable vX.Y.Z release snapshot")
+ parser.add_argument("--export-history", action="store_true", help="Write docs-history.bundle for trusted CI publication")
+ args = parser.parse_args()
+ build_site(Path(__file__).resolve().parents[2], args.release_tag, args.export_history)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/updatesite/index.html b/updatesite/index.html
new file mode 100644
index 00000000..aa7c47a2
--- /dev/null
+++ b/updatesite/index.html
@@ -0,0 +1,102 @@
+
+
+
+
+
+ Eclipse p2 Repository — hybris commerce eclipse plugin
+
+
+
+
+ Eclipse p2 Repository
+
+ This directory hosts the Eclipse p2 update site for the
+ hybris commerce eclipse plugin (Eclipse Plugin for SAP Commerce).
+
+
+
+ Available Update Sites
+
+ -
+
latest/ — Latest published Eclipse p2 repository
+
+ -
+
neon/ — Eclipse p2 repository (neon)
+
+
+
+
+
+ How to Install in Eclipse
+
+ - Open Eclipse and select Help → Install New Software…
+ - Click Add… and enter the
latest/ or neon/ URL as the Location.
+ - Select SAP Commerce, development tools for Eclipse and follow the installation wizard.
+
+
+ Note: p2 repository directories contain Eclipse metadata (content.jar,
+ artifacts.jar, p2.index) for Eclipse’s installer rather than browsable HTML pages.
+
+
+
+
+
diff --git a/updatesite/neon/index.html b/updatesite/neon/index.html
new file mode 100644
index 00000000..aa7c47a2
--- /dev/null
+++ b/updatesite/neon/index.html
@@ -0,0 +1,102 @@
+
+
+
+
+
+ Eclipse p2 Repository — hybris commerce eclipse plugin
+
+
+
+
+ Eclipse p2 Repository
+
+ This directory hosts the Eclipse p2 update site for the
+ hybris commerce eclipse plugin (Eclipse Plugin for SAP Commerce).
+
+
+
+ Available Update Sites
+
+ -
+
latest/ — Latest published Eclipse p2 repository
+
+ -
+
neon/ — Eclipse p2 repository (neon)
+
+
+
+
+
+ How to Install in Eclipse
+
+ - Open Eclipse and select Help → Install New Software…
+ - Click Add… and enter the
latest/ or neon/ URL as the Location.
+ - Select SAP Commerce, development tools for Eclipse and follow the installation wizard.
+
+
+ Note: p2 repository directories contain Eclipse metadata (content.jar,
+ artifacts.jar, p2.index) for Eclipse’s installer rather than browsable HTML pages.
+
+
+
+
+