Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize file name for Workflow and Pipeline #4131 #4134

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assemblies/static/src/main/resources/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ When you have a question you can use our mailing list (http://hop.apache.org/com


Installation Instruction:
- Have a recent Java 8 Runtime
- Have a recent Java 17 Runtime

Windows:
- To start the GUI run hop-gui.bat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.hop.core.file.IHasFilename;
import org.apache.hop.core.gui.plugin.action.GuiAction;
import org.apache.hop.core.gui.plugin.action.GuiActionType;
import org.apache.hop.core.logging.LogChannel;
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.core.xml.XmlHandler;
import org.apache.hop.history.AuditManager;
Expand All @@ -35,8 +36,10 @@
import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.core.gui.HopNamespace;
import org.apache.hop.ui.hopgui.HopGui;
import org.apache.hop.ui.hopgui.HopGuiExtensionPoint;
import org.apache.hop.ui.hopgui.context.GuiContextHandler;
import org.apache.hop.ui.hopgui.context.IGuiContextHandler;
import org.apache.hop.ui.hopgui.delegates.HopGuiFileOpenedExtension;
import org.apache.hop.ui.hopgui.file.HopFileTypeBase;
import org.apache.hop.ui.hopgui.file.HopFileTypePlugin;
import org.apache.hop.ui.hopgui.file.IHopFileType;
Expand Down Expand Up @@ -112,14 +115,21 @@ public Properties getCapabilities() {
}

@Override
public IHopFileTypeHandler openFile(
HopGui hopGui, String filename, IVariables parentVariableSpace) throws HopException {
public IHopFileTypeHandler openFile(HopGui hopGui, String filename, IVariables variables)
throws HopException {
try {
// This file is opened in the data orchestration perspective
//
HopDataOrchestrationPerspective perspective = HopGui.getDataOrchestrationPerspective();
perspective.activate();

// Normalize the filename into a relative path...
//
HopGuiFileOpenedExtension ext = new HopGuiFileOpenedExtension(null, variables, filename);
ExtensionPointHandler.callExtensionPoint(
LogChannel.UI, variables, HopGuiExtensionPoint.HopGuiFileOpenedDialog.id, ext);
filename = variables.resolve(ext.filename);

// See if the same pipeline isn't already open.
// Other file types we might allow to open more than once but not pipelines for now.
//
Expand All @@ -136,7 +146,7 @@ public IHopFileTypeHandler openFile(
// Load the pipeline
//
PipelineMeta pipelineMeta =
new PipelineMeta(filename, hopGui.getMetadataProvider(), parentVariableSpace);
new PipelineMeta(filename, hopGui.getMetadataProvider(), variables);

// Pass the MetaStore for reference lookups
//
Expand All @@ -153,10 +163,7 @@ public IHopFileTypeHandler openFile(
// Inform those that want to know about it that we loaded a pipeline
//
ExtensionPointHandler.callExtensionPoint(
hopGui.getLog(),
parentVariableSpace,
HopExtensionPoint.PipelineAfterOpen.id,
pipelineMeta);
hopGui.getLog(), variables, HopExtensionPoint.PipelineAfterOpen.id, pipelineMeta);

return typeHandler;
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@
import org.apache.hop.core.file.IHasFilename;
import org.apache.hop.core.gui.plugin.action.GuiAction;
import org.apache.hop.core.gui.plugin.action.GuiActionType;
import org.apache.hop.core.logging.LogChannel;
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.core.xml.XmlHandler;
import org.apache.hop.history.AuditManager;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.core.gui.HopNamespace;
import org.apache.hop.ui.hopgui.HopGui;
import org.apache.hop.ui.hopgui.HopGuiExtensionPoint;
import org.apache.hop.ui.hopgui.context.GuiContextHandler;
import org.apache.hop.ui.hopgui.context.IGuiContextHandler;
import org.apache.hop.ui.hopgui.delegates.HopGuiFileOpenedExtension;
import org.apache.hop.ui.hopgui.file.HopFileTypeBase;
import org.apache.hop.ui.hopgui.file.HopFileTypePlugin;
import org.apache.hop.ui.hopgui.file.IHopFileType;
Expand Down Expand Up @@ -114,14 +117,21 @@ public Properties getCapabilities() {
}

@Override
public IHopFileTypeHandler openFile(
HopGui hopGui, String filename, IVariables parentVariableSpace) throws HopException {
public IHopFileTypeHandler openFile(HopGui hopGui, String filename, IVariables variables)
throws HopException {
try {
// This file is opened in the data orchestration perspective
//
HopDataOrchestrationPerspective perspective = HopGui.getDataOrchestrationPerspective();
perspective.activate();

// Normalize the filename into a relative path...
//
HopGuiFileOpenedExtension ext = new HopGuiFileOpenedExtension(null, variables, filename);
ExtensionPointHandler.callExtensionPoint(
LogChannel.UI, variables, HopGuiExtensionPoint.HopGuiFileOpenedDialog.id, ext);
filename = variables.resolve(ext.filename);

// See if the same workflow isn't already open.
// Other file types we might allow to open more than once but not workflows for now.
//
Expand All @@ -138,7 +148,7 @@ public IHopFileTypeHandler openFile(
// Load the workflow from file
//
WorkflowMeta workflowMeta =
new WorkflowMeta(parentVariableSpace, filename, hopGui.getMetadataProvider());
new WorkflowMeta(variables, filename, hopGui.getMetadataProvider());

// Pass the MetaStore for reference lookups
//
Expand All @@ -151,7 +161,7 @@ public IHopFileTypeHandler openFile(
// Inform those that want to know about it that we loaded a pipeline
//
ExtensionPointHandler.callExtensionPoint(
hopGui.getLog(), parentVariableSpace, "WorkflowAfterOpen", workflowMeta);
hopGui.getLog(), variables, "WorkflowAfterOpen", workflowMeta);

// Show it in the perspective
//
Expand Down
Loading