use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class ConnectionEndpoints method createConnection.
@PUT
@Path("/connection")
@Consumes({ APPLICATION_JSON })
public Response createConnection(ConnectionDetails connectionDetails, @QueryParam("name") String name) {
boolean saved = connectionManager.save(connectionDetails);
if (saved) {
if (!connectionDetails.getName().equals(name)) {
connectionManager.delete(name);
}
getSpoon().getShell().getDisplay().asyncExec(() -> getSpoon().refreshTree(ConnectionFolderProvider.STRING_VFS_CONNECTIONS));
EngineMetaInterface engineMetaInterface = getSpoon().getActiveMeta();
if (engineMetaInterface instanceof AbstractMeta) {
((AbstractMeta) engineMetaInterface).setChanged();
}
return Response.ok().build();
} else {
return Response.serverError().build();
}
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class DefaultRunConfigurationExecutor method setSlaveServer.
private void setSlaveServer(ExecutionConfiguration executionConfiguration, AbstractMeta meta, DefaultRunConfiguration defaultRunConfiguration, VariableSpace variableSpace) throws KettleException {
SlaveServer slaveServer = meta.findSlaveServer(defaultRunConfiguration.getServer());
executionConfiguration.setRemoteServer(slaveServer);
if (slaveServer == null) {
String filename = "";
if (variableSpace instanceof AbstractMeta) {
filename = ((AbstractMeta) variableSpace).getFilename();
}
throw new KettleException(BaseMessages.getString(PKG, "DefaultRunConfigurationExecutor.RemoteNotFound.Error", filename, defaultRunConfiguration.getName(), "{0}", defaultRunConfiguration.getServer()));
}
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class RunConfigurationImportExtensionPoint method createSlaveServerRunConfigurations.
private List<RunConfiguration> createSlaveServerRunConfigurations(List<String> existingConfigurationNames, AbstractMeta abstractMeta) {
List<RunConfiguration> runConfigurations = new ArrayList<>();
if (abstractMeta instanceof JobMeta) {
JobMeta jobMeta = (JobMeta) abstractMeta;
Map<String, List<JobEntryTrans>> slaveServerGroups = jobMeta.getJobCopies().stream().map(JobEntryCopy::getEntry).filter(entry -> entry instanceof JobEntryTrans).map(entry -> (JobEntryTrans) entry).filter(entry -> Utils.isEmpty(entry.getRunConfiguration())).filter(entry -> !Utils.isEmpty(entry.getRemoteSlaveServerName())).collect(Collectors.groupingBy(JobEntryTrans::getRemoteSlaveServerName));
slaveServerGroups.forEach((remoteServerName, entries) -> {
String runConfigurationName = createRunConfigurationName(existingConfigurationNames, remoteServerName);
DefaultRunConfiguration runConfiguration = createRunConfiguration(runConfigurationName, remoteServerName);
runConfigurations.add(runConfiguration);
entries.forEach(e -> e.setRunConfiguration(runConfiguration.getName()));
});
}
return runConfigurations;
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class PurRepository_MoveAndRename_IT method rename_FailsIfANameConflictOccurs.
private void rename_FailsIfANameConflictOccurs(Assistant assistant) throws Exception {
final String name = "rename_FailsIfANameConflictOccurs";
AbstractMeta meta = assistant.createNew();
assistant.save(meta, name, getPublicDir());
assistant.rename(meta, name);
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class PurRepository_MoveAndRename_IT method moveAndRename_Successfully.
private void moveAndRename_Successfully(Assistant assistant) throws Exception {
final String fileName = "moveAndRename_Successfully";
final String renamed = fileName + "_renamed";
AbstractMeta meta = assistant.createNew();
assistant.save(meta, fileName, getPublicDir());
RepositoryDirectoryInterface destFolder = getDirInsidePublic(fileName);
assertNotNull(destFolder);
assistant.rename(meta, destFolder, renamed);
}
Aggregations