Search in sources :

Example 1 with ConfigManagerProjectsDocument

use of com.centurylink.mdw.workflow.ConfigManagerProjectsDocument in project mdw-designer by CenturyLinkCloud.

the class WorkflowProjectManager method discoverWorkflowApps.

public List<WorkflowApplication> discoverWorkflowApps() throws DiscoveryException {
    String urlBase = MdwPlugin.getSettings().getProjectDiscoveryUrl();
    if (!urlBase.endsWith("/"))
        urlBase += "/";
    String ctxRoot = urlBase.endsWith("Discovery/") ? "" : "MDWWeb/";
    if (urlBase.indexOf("lxdnd696") >= 0)
        // old discovery server
        ctxRoot = "MDWExampleWeb/";
    String path = urlBase.endsWith("Discovery/") ? "ConfigManagerProjects.xml" : "Services/GetConfigFile?name=ConfigManagerProjects.xml";
    String cfgMgrUrl = urlBase + ctxRoot + path;
    try {
        URL url = new URL(cfgMgrUrl);
        HttpHelper httpHelper = new HttpHelper(url);
        httpHelper.setConnectTimeout(MdwPlugin.getSettings().getHttpConnectTimeout());
        httpHelper.setReadTimeout(MdwPlugin.getSettings().getHttpReadTimeout());
        String xml = httpHelper.get();
        ConfigManagerProjectsDocument doc = ConfigManagerProjectsDocument.Factory.parse(xml, Compatibility.namespaceOptions());
        return doc.getConfigManagerProjects().getWorkflowAppList();
    } catch (XmlException ex) {
        PluginMessages.log(ex);
        throw new DiscoveryException("Unable to obtain/parse Config Manager info from " + cfgMgrUrl);
    } catch (Exception ex) {
        throw new DiscoveryException(ex.getMessage(), ex);
    }
}
Also used : ConfigManagerProjectsDocument(com.centurylink.mdw.workflow.ConfigManagerProjectsDocument) XmlException(org.apache.xmlbeans.XmlException) HttpHelper(com.centurylink.mdw.common.utilities.HttpHelper) DiscoveryException(com.centurylink.mdw.plugin.designer.DiscoveryException) URL(java.net.URL) ResourceException(org.eclipse.core.internal.resources.ResourceException) CoreException(org.eclipse.core.runtime.CoreException) JavaModelException(org.eclipse.jdt.core.JavaModelException) MdwSecurityException(com.centurylink.mdw.auth.MdwSecurityException) DiscoveryException(com.centurylink.mdw.plugin.designer.DiscoveryException) XmlException(org.apache.xmlbeans.XmlException)

Aggregations

MdwSecurityException (com.centurylink.mdw.auth.MdwSecurityException)1 HttpHelper (com.centurylink.mdw.common.utilities.HttpHelper)1 DiscoveryException (com.centurylink.mdw.plugin.designer.DiscoveryException)1 ConfigManagerProjectsDocument (com.centurylink.mdw.workflow.ConfigManagerProjectsDocument)1 URL (java.net.URL)1 XmlException (org.apache.xmlbeans.XmlException)1 ResourceException (org.eclipse.core.internal.resources.ResourceException)1 CoreException (org.eclipse.core.runtime.CoreException)1 JavaModelException (org.eclipse.jdt.core.JavaModelException)1