Skip to content

Commit

Permalink
Rename org.apache.hop.server.HopServer to HopServerMeta apache#4150
Browse files Browse the repository at this point in the history
  • Loading branch information
nadment authored and hansva committed Jul 31, 2024
1 parent 9bff6ff commit 3fb73cc
Show file tree
Hide file tree
Showing 20 changed files with 123 additions and 116 deletions.
8 changes: 4 additions & 4 deletions engine/src/main/java/org/apache/hop/base/AbstractMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.server.HopServer;
import org.apache.hop.server.HopServerMeta;

public abstract class AbstractMeta
implements IChanged, IUndo, IEngineMeta, INamedParameterDefinitions, IAttributes {
Expand Down Expand Up @@ -477,12 +477,12 @@ protected void fireCurrentDirectoryChanged(String previous, String current) {
* @param serverString the name of the hop server
* @return the hop server or null if we couldn't spot an approriate entry.
*/
public HopServer findHopServer(String serverString) {
public HopServerMeta findHopServer(String serverString) {
if (metadataProvider == null || StringUtils.isEmpty(getName())) {
return null;
}
try {
return metadataProvider.getSerializer(HopServer.class).load(getName());
return metadataProvider.getSerializer(HopServerMeta.class).load(getName());
} catch (HopException e) {
throw new RuntimeException(
"Unable to load hop server with name '" + getName() + CONST_FROM_METADATA, e);
Expand All @@ -496,7 +496,7 @@ public HopServer findHopServer(String serverString) {
*/
public String[] getHopServerNames() {
try {
List<String> names = metadataProvider.getSerializer(HopServer.class).listObjectNames();
List<String> names = metadataProvider.getSerializer(HopServerMeta.class).listObjectNames();
Collections.sort(names);
return names.toArray(new String[0]);
} catch (HopException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,23 @@

import java.util.ArrayList;
import java.util.List;
import org.apache.hop.server.HopServer;
import org.apache.hop.server.HopServerMeta;

@SearchableAnalyserPlugin(
id = "HopServerSearchableAnalyser",
name = "Search in hop server metadata")
public class HopServerSearchableAnalyser extends BaseMetadataSearchableAnalyser<HopServer>
implements ISearchableAnalyser<HopServer> {
public class HopServerSearchableAnalyser extends BaseMetadataSearchableAnalyser<HopServerMeta>
implements ISearchableAnalyser<HopServerMeta> {

@Override
public Class<HopServer> getSearchableClass() {
return HopServer.class;
public Class<HopServerMeta> getSearchableClass() {
return HopServerMeta.class;
}

@Override
public List<ISearchResult> search(ISearchable<HopServer> searchable, ISearchQuery searchQuery) {
HopServer hopServer = searchable.getSearchableObject();
public List<ISearchResult> search(
ISearchable<HopServerMeta> searchable, ISearchQuery searchQuery) {
HopServerMeta hopServer = searchable.getSearchableObject();
String component = getMetadataComponent();
List<ISearchResult> results = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.pipeline.engines.remote.HopServerTypeMetadata;
import org.apache.hop.server.HopServer;
import org.apache.hop.server.HopServerMeta;
import org.apache.hop.www.GetExecutionInfoServlet;
import org.apache.hop.www.RegisterExecutionInfoServlet;
import org.apache.http.client.utils.URIBuilder;
Expand Down Expand Up @@ -81,7 +81,7 @@ public class RemoteExecutionInfoLocation implements IExecutionInfoLocation {
@HopMetadataProperty(key = "location")
protected String locationName;

private HopServer server;
private HopServerMeta server;
private ExecutionInfoLocation location;
private IVariables variables;

Expand All @@ -106,7 +106,7 @@ public void initialize(IVariables variables, IHopMetadataProvider metadataProvid
try {
if (StringUtils.isNotEmpty(serverName)) {
server =
metadataProvider.getSerializer(HopServer.class).load(variables.resolve(serverName));
metadataProvider.getSerializer(HopServerMeta.class).load(variables.resolve(serverName));
}
if (StringUtils.isNotEmpty(locationName)) {
location =
Expand Down Expand Up @@ -493,7 +493,7 @@ public void setPluginName(String pluginName) {
*
* @return value of server
*/
public HopServer getServer() {
public HopServerMeta getServer() {
return server;
}

Expand Down Expand Up @@ -556,7 +556,7 @@ public void setVariables(IVariables variables) {
*
* @param server value of server
*/
public void setServer(HopServer server) {
public void setServer(HopServerMeta server) {
this.server = server;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

import org.apache.hop.core.gui.plugin.ITypeMetadata;
import org.apache.hop.metadata.api.IHopMetadata;
import org.apache.hop.server.HopServer;
import org.apache.hop.server.HopServerMeta;

public class HopServerTypeMetadata implements ITypeMetadata {
@Override
public Class<? extends IHopMetadata> getMetadataClass() {
return HopServer.class;
return HopServerMeta.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
import org.apache.hop.pipeline.transform.TransformStatus;
import org.apache.hop.resource.ResourceUtil;
import org.apache.hop.resource.TopLevelResource;
import org.apache.hop.server.HopServer;
import org.apache.hop.server.HopServerMeta;
import org.apache.hop.workflow.WorkflowMeta;
import org.apache.hop.workflow.engine.IWorkflowEngine;
import org.apache.hop.www.HopServerPipelineStatus;
Expand Down Expand Up @@ -126,7 +126,7 @@ public class RemotePipelineEngine extends Variables implements IPipelineEngine<P
protected EngineMetrics engineMetrics;
protected Result previousResult;

protected HopServer hopServer;
protected HopServerMeta hopServer;

protected ILoggingObject parent;
protected IPipelineEngine<PipelineMeta> parentPipeline;
Expand Down Expand Up @@ -242,7 +242,7 @@ public void prepareExecution() throws HopException {
serverPollInterval =
Const.toLong(resolve(remotePipelineRunConfiguration.getServerPollInterval()), 2000L);

hopServer = metadataProvider.getSerializer(HopServer.class).load(hopServerName);
hopServer = metadataProvider.getSerializer(HopServerMeta.class).load(hopServerName);
if (hopServer == null) {
throw new HopException("Hop server '" + hopServerName + "' could not be found");
}
Expand Down Expand Up @@ -1317,18 +1317,18 @@ public void setLogChannel(ILogChannel log) {
}

/**
* Gets hopServer
* Gets Hop server metadata
*
* @return value of hopServer
* @return value of Hop server
*/
public HopServer getHopServer() {
public HopServerMeta getHopServer() {
return hopServer;
}

/**
* @param hopServer The hopServer to set
*/
public void setHopServer(HopServer hopServer) {
public void setHopServer(HopServerMeta hopServer) {
this.hopServer = hopServer;
}

Expand Down
7 changes: 4 additions & 3 deletions engine/src/main/java/org/apache/hop/run/HopRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
import org.apache.hop.pipeline.config.PipelineRunConfiguration;
import org.apache.hop.pipeline.engine.IPipelineEngine;
import org.apache.hop.pipeline.engine.PipelineEngineFactory;
import org.apache.hop.server.HopServer;
import org.apache.hop.server.HopServerMeta;
import org.apache.hop.workflow.WorkflowExecutionConfiguration;
import org.apache.hop.workflow.WorkflowMeta;
import org.apache.hop.workflow.action.ActionMeta;
Expand Down Expand Up @@ -464,8 +464,9 @@ private LogLevel determineLogLevel() {
private void configureHopServer(IExecutionConfiguration configuration, String name)
throws HopException {

IHopMetadataSerializer<HopServer> serializer = metadataProvider.getSerializer(HopServer.class);
HopServer hopServer = serializer.load(name);
IHopMetadataSerializer<HopServerMeta> serializer =
metadataProvider.getSerializer(HopServerMeta.class);
HopServerMeta hopServer = serializer.load(name);
if (hopServer == null) {
throw new ParameterException(cmd, "Unable to find hop server '" + name + "' in the metadata");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
description = "Defines a Hop Hop Server",
image = "ui/images/server.svg",
documentationUrl = "/metadata-types/hop-server.html")
public class HopServer extends HopMetadataBase implements Cloneable, IXml, IHopMetadata {
public class HopServerMeta extends HopMetadataBase implements Cloneable, IXml, IHopMetadata {
private static final Class<?> PKG = HopServer.class;
public static final String STRING_HOP_SERVER = "Hop Server";
private static final Random RANDOM = new Random();
Expand Down Expand Up @@ -167,12 +167,12 @@ public static int getBackoffIncrements() {

@HopMetadataProperty private SslConfiguration sslConfig;

public HopServer() {
public HopServerMeta() {
this.log = new LogChannel(STRING_HOP_SERVER);
this.changedDate = new Date();
}

public HopServer(
public HopServerMeta(
String name,
String hostname,
String port,
Expand All @@ -182,7 +182,7 @@ public HopServer(
this(name, hostname, port, shutdownPort, username, password, null, null, null, false);
}

public HopServer(
public HopServerMeta(
String name,
String hostname,
String port,
Expand All @@ -205,7 +205,7 @@ public HopServer(
false);
}

public HopServer(
public HopServerMeta(
String name,
String hostname,
String port,
Expand All @@ -231,7 +231,7 @@ public HopServer(
this.log = new LogChannel(this);
}

public HopServer(Node node) {
public HopServerMeta(Node node) {
this();
this.name = XmlHandler.getTagValue(node, "name");
this.hostname = XmlHandler.getTagValue(node, "hostname");
Expand Down Expand Up @@ -290,16 +290,16 @@ public String getXml(IVariables variables) {
}

@Override
public HopServer clone() {
return new HopServer(this);
public HopServerMeta clone() {
return new HopServerMeta(this);
}

public HopServer(HopServer server) {
public HopServerMeta(HopServerMeta server) {
this();
replaceMeta(server);
}

public void replaceMeta(HopServer hopServer) {
public void replaceMeta(HopServerMeta hopServer) {
this.name = hopServer.name;
this.hostname = hopServer.hostname;
this.port = hopServer.port;
Expand Down Expand Up @@ -329,7 +329,7 @@ public String getServerAndPort(IVariables variables) {

@Override
public boolean equals(Object obj) {
if (!(obj instanceof HopServer server)) {
if (!(obj instanceof HopServerMeta server)) {
return false;
}
return name.equalsIgnoreCase(server.getName());
Expand Down Expand Up @@ -1033,8 +1033,8 @@ public WebResult startWorkflow(IVariables variables, String workflowName, String
return WebResult.fromXmlString(xml);
}

public static HopServer findHopServer(List<HopServer> hopServers, String name) {
for (HopServer hopServer : hopServers) {
public static HopServerMeta findHopServer(List<HopServerMeta> hopServers, String name) {
for (HopServerMeta hopServer : hopServers) {
if (hopServer.getName() != null && hopServer.getName().equalsIgnoreCase(name)) {
return hopServer;
}
Expand All @@ -1044,7 +1044,7 @@ public static HopServer findHopServer(List<HopServer> hopServers, String name) {

public static String[] getHopServerNames(IHopMetadataProvider metadataProvider)
throws HopException {
List<String> names = metadataProvider.getSerializer(HopServer.class).listObjectNames();
List<String> names = metadataProvider.getSerializer(HopServerMeta.class).listObjectNames();
return names.toArray(new String[0]);
}

Expand All @@ -1065,14 +1065,14 @@ public void setDescription(String description) {
* @param oldname the old name of the hop server
* @return the new hop server name
*/
public String verifyAndModifyHopServerName(List<HopServer> hopServers, String oldname) {
public String verifyAndModifyHopServerName(List<HopServerMeta> hopServers, String oldname) {
String name = getName();
if (name.equalsIgnoreCase(oldname)) {
return name; // nothing to see here: move along!
}

int nr = 2;
while (HopServer.findHopServer(hopServers, getName()) != null) {
while (HopServerMeta.findHopServer(hopServers, getName()) != null) {
setName(name + " " + nr);
nr++;
}
Expand Down Expand Up @@ -1118,13 +1118,13 @@ public String sniffTransform(
+ CONST_XML);
}

public HopServer getClient() {
public HopServerMeta getClient() {
String pHostName = getHostname();
String pPort = getPort();
String shutdownPort = getShutdownPort();
String name = MessageFormat.format("Dynamic server [{0}:{1}]", pHostName, pPort);
HopServer client =
new HopServer(name, pHostName, pPort, shutdownPort, getUsername(), getPassword());
HopServerMeta client =
new HopServerMeta(name, pHostName, pPort, shutdownPort, getUsername(), getPassword());
client.setSslMode(isSslMode());
return client;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

import org.apache.hop.core.gui.plugin.ITypeMetadata;
import org.apache.hop.metadata.api.IHopMetadata;
import org.apache.hop.server.HopServer;
import org.apache.hop.server.HopServerMeta;

public class HopServerTypeMetadata implements ITypeMetadata {
@Override
public Class<? extends IHopMetadata> getMetadataClass() {
return HopServer.class;
return HopServerMeta.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import org.apache.hop.pipeline.engines.remote.RemotePipelineEngine;
import org.apache.hop.resource.ResourceUtil;
import org.apache.hop.resource.TopLevelResource;
import org.apache.hop.server.HopServer;
import org.apache.hop.server.HopServerMeta;
import org.apache.hop.workflow.ActionResult;
import org.apache.hop.workflow.IActionListener;
import org.apache.hop.workflow.IDelegationListener;
Expand Down Expand Up @@ -103,7 +103,7 @@ public class RemoteWorkflowEngine extends Variables implements IWorkflowEngine<W
protected LogLevel logLevel;
protected long serverPollDelay;
protected long serverPollInterval;
protected HopServer hopServer;
protected HopServerMeta hopServer;
protected String containerId;
protected int lastLogLineNr;
protected boolean stopped;
Expand Down Expand Up @@ -260,7 +260,7 @@ public Result startExecution() {
serverPollInterval =
Const.toLong(resolve(remoteWorkflowRunConfiguration.getServerPollInterval()), 2000L);

hopServer = metadataProvider.getSerializer(HopServer.class).load(hopServerName);
hopServer = metadataProvider.getSerializer(HopServerMeta.class).load(hopServerName);
if (hopServer == null) {
throw new HopException("Hop server '" + hopServerName + "' could not be found");
}
Expand Down Expand Up @@ -956,14 +956,14 @@ public void setServerPollInterval(long serverPollInterval) {
*
* @return value of hopServer
*/
public HopServer getHopServer() {
public HopServerMeta getHopServer() {
return hopServer;
}

/**
* @param hopServer The hopServer to set
*/
public void setHopServer(HopServer hopServer) {
public void setHopServer(HopServerMeta hopServer) {
this.hopServer = hopServer;
}

Expand Down
Loading

0 comments on commit 3fb73cc

Please sign in to comment.