use of com.twinsoft.convertigo.beans.connectors.SapJcoConnector in project convertigo by convertigo.
the class SapJcoTransaction method addSchemaResponseDataType.
@Override
protected XmlSchemaComplexType addSchemaResponseDataType(XmlSchema xmlSchema) {
XmlSchemaComplexType xmlSchemaComplexType = super.addSchemaResponseDataType(xmlSchema);
XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) xmlSchemaComplexType.getParticle();
if (xmlSchemaSequence == null)
xmlSchemaSequence = new XmlSchemaSequence();
try {
connector = ((SapJcoConnector) parent);
SapJcoProviderImpl provider = connector.getSapJCoProvider();
XmlSchemaElement sap_output = provider.addJCoFunctionResponseSchema(this, xmlSchema);
xmlSchemaSequence.getItems().add(sap_output);
} catch (Exception e) {
Engine.logBeans.error("Unable to generate response schema for SapJcoTransaction named '" + getName() + "'", e);
}
xmlSchemaComplexType.setParticle(xmlSchemaSequence);
return xmlSchemaComplexType;
}
use of com.twinsoft.convertigo.beans.connectors.SapJcoConnector in project convertigo by convertigo.
the class ConnectorEditorPart method createCompositeDesign.
/**
* This method initializes compositeDesign
*/
private void createCompositeDesign() {
if (Engine.hasXulRunner() && connector instanceof HtmlConnector) {
try {
compositeDesign = new HtmlConnectorDesignComposite(connector, tabFolderOutputDesign, SWT.NONE);
} catch (MaxCvsExceededException e) {
String message = "You have reached the maximum allowed number of simultaneous HTML connectors; check your license keys.\n\n" + "Notice: according to your license key, the maximum allowed number of simultaneous HTML connectors is 2. " + "As you have more than 2 HTML connectors open, you will not be able to open another one nor run any transaction on this connector.\n\n" + "Please close unnecessary connectors.";
ConvertigoPlugin.logError(message, true);
compositeDesign = new Composite(tabFolderOutputDesign, SWT.NONE);
labelNoDesign = new Label(compositeDesign, SWT.NONE | SWT.WRAP);
labelNoDesign.setBounds(new org.eclipse.swt.graphics.Rectangle(10, 10, 300, 200));
labelNoDesign.setFont(new Font(null, "Tahoma", 10, 0));
labelNoDesign.setText("\n" + message);
Control[] children = tabFolderOutputDesign.getChildren();
if ((children.length >= 2) && (children[1] instanceof HtmlConnectorDesignComposite))
children[1].moveBelow(null);
} catch (KeyExpiredException e) {
String message = "Your HTML license key has expired; check your license keys.\n\n" + "Notice: according to your license key, your trial period has expired. " + "You will not be able to open an HTML connector nor run any transaction on this connector.\n\n";
ConvertigoPlugin.logError(message, true);
compositeDesign = new Composite(tabFolderOutputDesign, SWT.NONE);
labelNoDesign = new Label(compositeDesign, SWT.NONE | SWT.WRAP);
labelNoDesign.setBounds(new org.eclipse.swt.graphics.Rectangle(10, 10, 300, 200));
labelNoDesign.setFont(new Font(null, "Tahoma", 10, 0));
labelNoDesign.setText("\n" + message);
Control[] children = tabFolderOutputDesign.getChildren();
if ((children.length >= 2) && (children[1] instanceof HtmlConnectorDesignComposite))
children[1].moveBelow(null);
}
} else if (connector instanceof SapJcoConnector) {
try {
compositeDesign = new SapJcoConnectorDesignComposite(connector, tabFolderOutputDesign, SWT.NONE);
} catch (Exception e) {
e.printStackTrace();
}
} else if (connector instanceof SqlConnector) {
try {
compositeDesign = new SqlConnectorDesignComposite(connector, tabFolderOutputDesign, SWT.NONE);
} catch (Exception e) {
e.printStackTrace();
}
} else {
compositeDesign = new Composite(tabFolderOutputDesign, SWT.NONE);
labelNoDesign = new Label(compositeDesign, SWT.NONE | SWT.WRAP);
labelNoDesign.setFont(new Font(null, "Tahoma", 10, 0));
labelNoDesign.setBounds(new org.eclipse.swt.graphics.Rectangle(10, 10, 300, 200));
labelNoDesign.setText("This connector does not provide any design tool");
}
}
use of com.twinsoft.convertigo.beans.connectors.SapJcoConnector in project convertigo by convertigo.
the class ConnectorTreeObject method treeObjectPropertyChanged.
@Override
public void treeObjectPropertyChanged(TreeObjectEvent treeObjectEvent) {
super.treeObjectPropertyChanged(treeObjectEvent);
String propertyName = (String) treeObjectEvent.propertyName;
propertyName = ((propertyName == null) ? "" : propertyName);
TreeObject treeObject = (TreeObject) treeObjectEvent.getSource();
Connector connector = getObject();
if (treeObject instanceof DatabaseObjectTreeObject) {
// If a bean name has changed
if (propertyName.equals("name")) {
handlesBeanNameChanged(treeObjectEvent);
} else if (treeObject.equals(this)) {
// if this connector has changed
if (connector instanceof SapJcoConnector) {
try {
((SapJcoConnector) connector).getSapJCoProvider().updateDestination();
} catch (Exception e) {
ConvertigoPlugin.logWarning(e, "Could not update SAP destination !");
}
} else if (connector instanceof CouchDbConnector) {
if (propertyName.equals("https") || propertyName.equals("port") || propertyName.equals("server") || propertyName.equals("couchUsername") || propertyName.equals("couchPassword")) {
((CouchDbConnector) connector).release();
CouchDbManager.syncDocument(connector);
try {
ConvertigoPlugin.getDefault().getProjectExplorerView().reloadTreeObject(this);
} catch (Exception e) {
ConvertigoPlugin.logWarning(e, "Could not reload connector \"" + connector.getName() + "\" in tree !");
}
} else if (propertyName.equals("databaseName")) {
CouchDbManager.syncDocument(connector);
try {
ConvertigoPlugin.getDefault().getProjectExplorerView().reloadTreeObject(this);
} catch (Exception e) {
ConvertigoPlugin.logWarning(e, "Could not reload connector \"" + connector.getName() + "\" in tree !");
}
}
}
} else if (connector instanceof CouchDbConnector) {
DatabaseObject dbo = ((DatabaseObjectTreeObject) treeObject).getObject();
if (dbo instanceof JsonIndex && connector.equals(dbo.getParent()) && (propertyName.equals("fields") || propertyName.equals("ascending") || propertyName.equals("name"))) {
CouchDbManager.syncDocument(getObject());
}
}
}
}
use of com.twinsoft.convertigo.beans.connectors.SapJcoConnector in project convertigo by convertigo.
the class NewProjectWizard method createFromBlankProject.
private Project createFromBlankProject(IProgressMonitor monitor) throws Exception {
String newProjectName = projectName;
String oldProjectName = projectUrlParser.getProjectName();
monitor.setTaskName("Creating new project");
monitor.worked(1);
if (Engine.theApp.databaseObjectsManager.existsProject(newProjectName)) {
throw new EngineException("Unable to create new project ! A project with the same name (\"" + newProjectName + "\") already exists.");
}
monitor.setTaskName("Loading the projet");
monitor.worked(1);
projectUrlParser.setProjectName(projectName);
Project newProject = Engine.theApp.referencedProjectManager.importProject(projectUrlParser, true);
monitor.worked(1);
try {
// set values of elements to configure on the new project
String newEmulatorTechnology = "";
String emulatorTechnologyName = "";
String newIbmTerminalType = "";
switch(wizardId) {
case "com.twinsoft.convertigo.eclipse.wizards.New3270ConnectorWizard":
case "com.twinsoft.convertigo.eclipse.wizards.New3270WebWizard":
newEmulatorTechnology = Session.SNA;
newIbmTerminalType = "IBM-3279";
emulatorTechnologyName = "IBM3270";
break;
case "com.twinsoft.convertigo.eclipse.wizards.New5250ConnectorWizard":
case "com.twinsoft.convertigo.eclipse.wizards.New5250WebWizard":
newEmulatorTechnology = Session.AS400;
newIbmTerminalType = "IBM-3179";
emulatorTechnologyName = "IBM5250";
break;
case "com.twinsoft.convertigo.eclipse.wizards.NewDKUConnectorWizard":
case "com.twinsoft.convertigo.eclipse.wizards.NewDKUWebWizard":
newEmulatorTechnology = Session.DKU;
emulatorTechnologyName = "BullDKU7107";
break;
case "com.twinsoft.convertigo.eclipse.wizards.NewVT220ConnectorWizard":
newEmulatorTechnology = Session.VT;
emulatorTechnologyName = "UnixVT220";
break;
}
monitor.setTaskName("Reset project version");
monitor.worked(1);
newProject.setVersion("");
monitor.setTaskName("Change connector name");
monitor.worked(1);
String oldConnectorName = "void";
String newConnectorName = "void";
boolean connectorChanged = false;
if (page2 != null) {
newConnectorName = page2.getConnectorName();
monitor.setTaskName("Connector renamed");
monitor.worked(1);
oldConnectorName = newProject.getDefaultConnector().getName();
newProject.getDefaultConnector().setName(newConnectorName);
connectorChanged = true;
}
if (page5 != null) {
CicsConnector cicsConnector = (CicsConnector) newProject.getDefaultConnector();
monitor.setTaskName("Update connector mainframe name");
monitor.worked(1);
cicsConnector.setMainframeName(page5.getCtgName());
monitor.setTaskName("Update connector server");
monitor.worked(1);
cicsConnector.setServer(page5.getCtgServer());
monitor.setTaskName("Update connector port");
monitor.worked(1);
try {
cicsConnector.setPort(Integer.parseInt(page5.getCtgPort()));
} catch (Exception e) {
}
}
if (page6 != null) {
monitor.setTaskName("Update connector server");
monitor.worked(1);
// change connector server and port,
// change https mode
// and change proxy server and proxy port
HttpConnector httpConnector = (HttpConnector) newProject.getDefaultConnector();
httpConnector.setServer(page6.getHttpServer());
monitor.setTaskName("Update connector port");
monitor.worked(1);
try {
httpConnector.setPort(Integer.parseInt(page6.getHttpPort()));
} catch (Exception e) {
}
monitor.setTaskName("Update connector https mode");
monitor.worked(1);
httpConnector.setHttps(page6.isBSSL());
}
if (page7 != null) {
// change emulator technology
// and change service code
monitor.setTaskName("Set connector service code");
monitor.worked(1);
JavelinConnector javelinConnector = (JavelinConnector) newProject.getDefaultConnector();
javelinConnector.setServiceCode(page7.getServiceCode());
monitor.setTaskName("Set connector emulator technology");
monitor.worked(1);
javelinConnector.setEmulatorTechnology(newEmulatorTechnology);
monitor.setTaskName("Set terminal type");
monitor.worked(1);
javelinConnector.setIbmTerminalType(newIbmTerminalType);
// rename emulatorTechnology criteria
monitor.setTaskName("Rename emulator technology criteria");
monitor.worked(1);
javelinConnector.getDefaultScreenClass().getLocalCriterias().get(0).setName(emulatorTechnologyName);
}
if (page11 != null) {
SiteClipperConnector scConnector = (SiteClipperConnector) newProject.getDefaultConnector();
monitor.setTaskName("Update connector certificates policy");
monitor.worked(1);
scConnector.setTrustAllServerCertificates(page11.isTrustAllServerCertificates());
monitor.setTaskName("Update host url");
monitor.worked(1);
scConnector.getDefaultTransaction().setTargetURL(page11.getTargetURL());
}
if (configureSQLConnectorPage != null) {
SqlConnector sqlConnector = (SqlConnector) newProject.getDefaultConnector();
monitor.setTaskName("Update JDBC URL");
monitor.worked(1);
sqlConnector.setJdbcURL(configureSQLConnectorPage.getJdbcURL());
monitor.setTaskName("Update JDBC driver");
monitor.worked(1);
sqlConnector.setJdbcDriverClassName(configureSQLConnectorPage.getJdbcDriver());
monitor.setTaskName("Update Username");
monitor.worked(1);
sqlConnector.setJdbcUserName(configureSQLConnectorPage.getUsername());
monitor.setTaskName("Update Password");
monitor.worked(1);
sqlConnector.setJdbcUserPassword(configureSQLConnectorPage.getPassword());
}
if (configureSAPConnectorPage != null) {
SapJcoConnector sapConnector = (SapJcoConnector) newProject.getDefaultConnector();
// Application Server Host
monitor.setTaskName("Update application Server Host");
monitor.worked(1);
sapConnector.setAsHost(configureSAPConnectorPage.getAsHost());
// System Number
monitor.setTaskName("Update system number");
monitor.worked(1);
sapConnector.setSystemNumber(configureSAPConnectorPage.getSystemNumber());
// Client
monitor.setTaskName("Update client");
monitor.worked(1);
sapConnector.setClient(configureSAPConnectorPage.getClient());
// User
monitor.setTaskName("Update user");
monitor.worked(1);
sapConnector.setUser(configureSAPConnectorPage.getUser());
// Password
monitor.setTaskName("Update password");
monitor.worked(1);
sapConnector.setPassword(configureSAPConnectorPage.getPassword());
// Language
monitor.setTaskName("Update language");
monitor.worked(1);
sapConnector.setLanguage(configureSAPConnectorPage.getLanguage());
}
monitor.setTaskName("Saving updated project");
monitor.worked(1);
Engine.theApp.databaseObjectsManager.exportProject(newProject);
monitor.setTaskName("New project saved");
monitor.worked(1);
try {
File eProject = new File(newProject.getDirPath(), ".project");
if (eProject.exists()) {
String txt = FileUtils.readFileToString(eProject, StandardCharsets.UTF_8);
txt = txt.replaceFirst("(<name>)(.*?)(</name>)", "$1" + newProjectName + "$3");
FileUtils.writeStringToFile(eProject, txt, StandardCharsets.UTF_8);
}
String xsdInternalPath = newProject.getDirPath() + "/" + Project.XSD_FOLDER_NAME + "/" + Project.XSD_INTERNAL_FOLDER_NAME;
File xsdInternalDir = new File(xsdInternalPath).getCanonicalFile();
if (xsdInternalDir.exists() && connectorChanged) {
boolean needConnectorRename = !oldConnectorName.equals(newConnectorName);
if (needConnectorRename) {
File srcDir = new File(xsdInternalDir, oldConnectorName);
File destDir = new File(xsdInternalDir, newConnectorName);
if (oldConnectorName.equalsIgnoreCase(newConnectorName)) {
File destDirTmp = new File(xsdInternalDir, "tmp" + oldConnectorName).getCanonicalFile();
FileUtils.moveDirectory(srcDir, destDirTmp);
srcDir = destDirTmp;
}
FileUtils.moveDirectory(srcDir, destDir);
}
for (File connectorDir : xsdInternalDir.listFiles()) {
if (connectorDir.isDirectory()) {
String connectorName = connectorDir.getName();
for (File transactionXsdFile : connectorDir.listFiles()) {
String xsdFilePath = transactionXsdFile.getCanonicalPath();
ProjectUtils.xsdRenameProject(xsdFilePath, oldProjectName, newProjectName);
if (needConnectorRename && connectorName.equals(newConnectorName)) {
ProjectUtils.xsdRenameConnector(xsdFilePath, oldConnectorName, newConnectorName);
}
}
}
}
}
monitor.setTaskName("Schemas updated");
monitor.worked(1);
updateProjectTreeView();
} catch (Exception e) {
Engine.logDatabaseObjectManager.error("An error occured while updating transaction schemas", e);
}
} catch (Exception e) {
// Delete everything
try {
Engine.logBeans.error("An error occured while creating project, everything will be deleted. Please see Studio logs for more informations.", null);
// TODO : see if we can delete oldProjectName : a real project
// could exist with this oldProjectName ?
// Engine.theApp.databaseObjectsManager.deleteProject(oldProjectName,
// false, false);
Engine.theApp.databaseObjectsManager.deleteProject(newProjectName, false, false);
projectName = null;
} catch (Exception ex) {
}
throw new Exception("Unable to create project from template", e);
}
return newProject;
}
use of com.twinsoft.convertigo.beans.connectors.SapJcoConnector in project convertigo by convertigo.
the class Connector method setupConnector.
public static void setupConnector(DatabaseObject connector) throws EngineException {
if (connector instanceof JavelinConnector) {
JavelinConnector javelinConnector = (JavelinConnector) connector;
JavelinScreenClass defaultScreenClass = new JavelinScreenClass();
defaultScreenClass.setName("Default_screen_class");
defaultScreenClass.hasChanged = true;
defaultScreenClass.bNew = true;
javelinConnector.setDefaultScreenClass(defaultScreenClass);
DefaultBlockFactory blockFactory = new DefaultBlockFactory();
blockFactory.setName("Block_factory");
blockFactory.hasChanged = true;
blockFactory.bNew = true;
defaultScreenClass.setBlockFactory(blockFactory);
EmulatorTechnology emulatorTechnology = new EmulatorTechnology();
emulatorTechnology.hasChanged = true;
emulatorTechnology.bNew = true;
emulatorTechnology.setName("Emulator_technology");
defaultScreenClass.add(emulatorTechnology);
JavelinTransaction transaction = new JavelinTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("XMLize");
javelinConnector.add(transaction);
javelinConnector.setDefaultTransaction(transaction);
} else if (connector instanceof HtmlConnector) {
HtmlConnector htmlConnector = (HtmlConnector) connector;
htmlConnector.setServer("www.convertigo.com");
HtmlScreenClass defaultScreenClass = new HtmlScreenClass();
defaultScreenClass.setName("Default_screen_class");
defaultScreenClass.hasChanged = true;
defaultScreenClass.bNew = true;
htmlConnector.setDefaultScreenClass(defaultScreenClass);
HtmlTransaction transaction = new HtmlTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("XMLize");
htmlConnector.add(transaction);
htmlConnector.setDefaultTransaction(transaction);
} else if (connector instanceof HttpConnector) {
HttpConnector httpConnector = (HttpConnector) connector;
HttpTransaction transaction = new HttpTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("Default_transaction");
httpConnector.add(transaction);
httpConnector.setDefaultTransaction(transaction);
} else if (connector instanceof SapJcoConnector) {
SapJcoConnector sapConnector = (SapJcoConnector) connector;
SapJcoLogonTransaction sapLogon = new SapJcoLogonTransaction();
sapLogon.hasChanged = true;
sapLogon.bNew = true;
sapLogon.setName("Logon");
sapLogon.addCredentialsVariables();
sapConnector.add(sapLogon);
sapConnector.setDefaultTransaction(sapLogon);
SapJcoTransaction transaction = new SapJcoTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("RFC_FUNCTION_SEARCH");
transaction.setBapiName("RFC_FUNCTION_SEARCH");
RequestableVariable variable = new RequestableVariable();
variable.hasChanged = true;
variable.bNew = true;
variable.setName("FUNCNAME");
variable.setValueOrNull("BAPI_*");
transaction.add(variable);
sapConnector.add(transaction);
} else if (connector instanceof SqlConnector) {
SqlConnector sqlConnector = (SqlConnector) connector;
sqlConnector.setJdbcDriverClassName("org.hsqldb.jdbcDriver");
SqlTransaction transaction = new SqlTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("Default_transaction");
sqlConnector.add(transaction);
sqlConnector.setDefaultTransaction(transaction);
} else if (connector instanceof CicsConnector) {
CicsConnector cicsConnector = (CicsConnector) connector;
CicsTransaction transaction = new CicsTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("Default_transaction");
cicsConnector.add(transaction);
cicsConnector.setDefaultTransaction(transaction);
} else if (connector instanceof SiteClipperConnector) {
SiteClipperConnector siteClipperConnector = (SiteClipperConnector) connector;
SiteClipperScreenClass defaultScreenClass = new SiteClipperScreenClass();
defaultScreenClass.setName("Default_screen_class");
defaultScreenClass.hasChanged = true;
defaultScreenClass.bNew = true;
siteClipperConnector.setDefaultScreenClass(defaultScreenClass);
SiteClipperTransaction transaction = new SiteClipperTransaction();
transaction.hasChanged = true;
transaction.bNew = true;
transaction.setName("Default_transaction");
siteClipperConnector.add(transaction);
siteClipperConnector.setDefaultTransaction(transaction);
} else if (connector instanceof CouchDbConnector) {
CouchDbConnector couchDbConnector = (CouchDbConnector) connector;
String couchDbXsdPath = AbstractCouchDbTransaction.COUCHDB_XSD_LOCATION;
boolean existReference = false;
for (Reference reference : couchDbConnector.getProject().getReferenceList()) {
if (reference instanceof XsdSchemaReference) {
String urlPath = ((XsdSchemaReference) reference).getUrlpath();
if (urlPath.equals(couchDbXsdPath)) {
existReference = true;
break;
}
}
}
if (!existReference) {
ImportXsdSchemaReference reference = new ImportXsdSchemaReference();
reference.setName("CouchDb_schema");
reference.setUrlpath(couchDbXsdPath);
couchDbConnector.getProject().add(reference);
}
GetServerInfoTransaction transaction = new GetServerInfoTransaction();
couchDbConnector.add(transaction);
couchDbConnector.setDefaultTransaction(transaction);
}
}
Aggregations