use of com.centurylink.mdw.dataaccess.RemoteAccess in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method createRemoteAccess.
private RemoteAccess createRemoteAccess(String logicalServerName) throws DataAccessException, RemoteException {
// and hence requires the remote server to be running
for (Server s : serverList) {
if (logicalServerName.equals(s.getApplicationName())) {
String curenv = currentServer.getEnvironment();
String senv = s.getEnvironment();
if (curenv == null)
curenv = "";
if (senv == null)
senv = "";
if (curenv.equals(senv)) {
String remoteDbInfo = s.getDatabaseUrl();
if (remoteDbInfo == null)
remoteDbInfo = getDatabaseCredentialFromServer(s.getServerUrl());
return new RemoteAccess(logicalServerName, remoteDbInfo);
}
}
}
if (currentServer.getServerUrl() != null) {
String remoteServerUrl = this.getStringProperty(PropertyNames.MDW_REMOTE_SERVER + "." + logicalServerName);
if (remoteServerUrl == null)
throw new DataAccessException("Cannot find translation for logical server name " + logicalServerName);
String remoteDbInfo = this.getDatabaseCredentialFromServer(remoteServerUrl);
return new RemoteAccess(logicalServerName, remoteDbInfo);
}
throw new DataAccessException("Cannot find translation for logical server name " + logicalServerName);
}
use of com.centurylink.mdw.dataaccess.RemoteAccess in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getDocumentContent.
public String getDocumentContent(DocumentReference docref, String type) throws RemoteException, DataAccessException {
if (type.equals(Object.class.getName())) {
if (currentServer.getServerUrl() != null) {
StringBuilder sb = new StringBuilder();
sb.append("<_mdw_document_content>");
sb.append("<document_id>").append(docref.getDocumentId().toString()).append("</document_id>");
sb.append("<type>").append(type).append("</type>");
sb.append("</_mdw_document_content>");
String result = this.engineCall(sb.toString());
if (result.startsWith(ERROR))
throw new DataAccessException(result);
return result;
} else {
return rtinfo.getDocument(docref.getDocumentId()).getContent();
}
} else {
if (docref.getServer() != null) {
RemoteAccess rao = remoteAccess.get(docref.getServer());
if (rao == null) {
rao = createRemoteAccess(docref.getServer());
remoteAccess.put(docref.getServer(), rao);
}
return rao.getRuntimeDataAccess().getDocument(docref.getDocumentId()).getContent();
} else {
return rtinfo.getDocument(docref.getDocumentId()).getContent();
}
}
}
use of com.centurylink.mdw.dataaccess.RemoteAccess in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getProcessDefinition.
public ProcessVO getProcessDefinition(String procname, int version) throws RemoteException, DataAccessException {
if (procname.indexOf(RemoteAccess.REMOTE_NAME_DELIMITER) > -1) {
int k = procname.indexOf(RemoteAccess.REMOTE_NAME_DELIMITER);
String properProcname = procname.substring(0, k);
String logicalServerName = procname.substring(k + 1);
RemoteAccess rao = remoteAccess.get(logicalServerName);
if (rao == null) {
rao = createRemoteAccess(logicalServerName);
remoteAccess.put(logicalServerName, rao);
}
ProcessLoader procLoader = rao.getLoader();
ProcessVO procdef = procLoader.getProcessBase(properProcname, version);
procdef.setRemoteServer(logicalServerName);
return procdef;
} else {
return loader.getProcessBase(procname, version);
}
}
Aggregations