cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Mon, 8 Jun 2020 12:49:08 +0000 (14:49 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Mon, 8 Jun 2020 14:25:11 +0000 (16:25 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ShowRemotingLoginWindowHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/SwitchUserHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/security/AuthenticationSourceProvider.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStoreConnector.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/LoginManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/StoreUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java

index e4fd2a41d60b23b339e01563775650274e2694ce..0a0c9cb15cef05bc81b6fb91712d610fc192f965 100644 (file)
@@ -6,7 +6,6 @@
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
-
 package eu.etaxonomy.taxeditor.handler.e4;
 
 import javax.inject.Named;
@@ -23,10 +22,8 @@ import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
 import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
 
 /**
- *
  * @author pplitzner
  * @date 10.10.2017
- *
  */
 public class ShowRemotingLoginWindowHandlerE4 {
 
index 73ef68125e6390107634a400a5914ddfa5403c8c..bc6d4b660fccb7fd09aa38730f6272f3c62f167e 100644 (file)
@@ -6,7 +6,6 @@
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
-
 package eu.etaxonomy.taxeditor.handler.e4;
 
 import java.util.Collection;
@@ -33,10 +32,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
 
 /**
- *
  * @author pplitzner
  * @date 10.10.2017
- *
  */
 public class SwitchUserHandlerE4 {
 
@@ -50,19 +47,17 @@ public class SwitchUserHandlerE4 {
 
         }
 
-
                RemotingLoginDialog loginDialog = new RemotingLoginDialog(shell,
                        SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
 
                loginDialog.open((CdmRemoteSource) CdmStore.getActiveCdmSource(), false, false);
 
-                IWorkbench workbench = PlatformUI.getWorkbench();
-         IWorkbenchWindow window = workbench
+               IWorkbench workbench = PlatformUI.getWorkbench();
+        IWorkbenchWindow window = workbench
                  .getActiveWorkbenchWindow();
 
-         IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
-         IWorkbenchPage page = window.getActivePage();
-         page.resetPerspective();
+        IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
+        IWorkbenchPage page = window.getActivePage();
+        page.resetPerspective();
        }
 }
-
index 1e8a952a44040e6ec72b1e32a8616e670d0302db..4700491bd84dbf1df92b529585e9c0aaa725274a 100644 (file)
@@ -16,8 +16,8 @@ import org.eclipse.osgi.util.NLS;
  *
  */
 public class Messages extends NLS {
-    private static final String BUNDLE_NAME = "src/main/java/eu.etaxonomy.taxeditor.l10n.messages"; //$NON-NLS-1$
 
+    private static final String BUNDLE_NAME = "src/main/java/eu.etaxonomy.taxeditor.l10n.messages"; //$NON-NLS-1$
 
     public static String AuthenticatedUserBar_LOGGED_IN_AS;
     public static String AuthenticatedUserBar_NOT_LOGGED_IN;
@@ -26,7 +26,6 @@ public class Messages extends NLS {
     public static String LanguageEditorPreferencePage_PleaseRestart;
     public static String LanguageEditorPreferencePage_RestartRequired;
 
-
     public static String LanguageMenuPreferences_configure;
     public static String CommonNameLanguageMenuPreferences_configure;
 
@@ -745,13 +744,9 @@ public class Messages extends NLS {
     public static String CommonNameVocabularyPreferencePage_description;
     public static String CommonNameLanguagePreferencePage_description;
 
-
     public static String AggregationWizardPage_WITHOUT_CHILDREN;
 
 
-
-
-
     static {
         // initialize resource bundle
         NLS.initializeMessages(BUNDLE_NAME, Messages.class);
index 808994f3d7b9e432043d03fb20548387870a1ff4..1ca969ccd38b3be33c1064839d250260d7fb2ee2 100644 (file)
@@ -22,7 +22,6 @@ import eu.etaxonomy.taxeditor.store.LoginManager;
  * variable {@code eu.etaxonomy.taxeditor.security.userRoles}
  *
  * @author a.kohlbecker
- *
  */
 public class AuthenticationSourceProvider extends AbstractSourceProvider implements Observer {
 
@@ -68,9 +67,6 @@ public class AuthenticationSourceProvider extends AbstractSourceProvider impleme
                return stateMap;
        }
 
-       /**
-     * @return
-     */
     private String getCurrentAutheticationName() {
         Authentication authentication = CdmStore.getCurrentAuthentiation();
         if (authentication != null) {
@@ -96,7 +92,7 @@ public class AuthenticationSourceProvider extends AbstractSourceProvider impleme
         */
        private List<Role> getCurrentAuthenticationsRoles() {
 
-               List<Role> roles = new ArrayList<Role>();
+               List<Role> roles = new ArrayList<>();
                Authentication authentication = CdmStore.getCurrentAuthentiation();
                if (authentication == null) {
                        return roles;
index 17765bdc6506188a61f4b584fca7ce8abdb2a708..807e8df098bc47cc1cd9798620f175b3bae00526 100644 (file)
@@ -17,7 +17,6 @@ import org.eclipse.swt.widgets.Display;
 import org.slf4j.Marker;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
-import org.springframework.security.access.PermissionEvaluator;
 import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
@@ -113,13 +112,13 @@ import eu.etaxonomy.taxeditor.webapp.CdmServer;
  *
  * @author n.hoffmann
  * @created 17.03.2009
- * @version 1.0
  */
 public class CdmStore {
 
     private static final Resource DEFAULT_APPLICATION_CONTEXT = new ClassPathResource(
             "/eu/etaxonomy/cdm/editorApplicationContext.xml",
             TaxeditorStorePlugin.class);
+
     private static final DbSchemaValidation DEFAULT_DB_SCHEMA_VALIDATION = DbSchemaValidation.VALIDATE;
 
     private static CdmStore instance;
@@ -151,10 +150,6 @@ public class CdmStore {
 
 
     /**
-     * <p>
-     * getDefault
-     * </p>
-     *
      * @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object.
      */
     protected static CdmStore getDefault(boolean connecting){
@@ -166,11 +161,10 @@ public class CdmStore {
             }else{
                 MessagingUtils.noDataSourceWarningDialog(instance);
             }
-
-
             return null;
         }
     }
+
     /**
      * <p>
      * getDefault
@@ -423,30 +417,12 @@ public class CdmStore {
      */
     public static ICommonService getCommonService() {
         return CdmApplicationState.getCommonService();
-
     }
 
-    /**
-     * <p>
-     * getAuthenticationManager
-     * </p>
-     *
-     * @return a
-     *         {@link org.springframework.security.authentication.ProviderManager}
-     *         object.
-     */
     public static AuthenticationManager getAuthenticationManager() {
         return getCurrentApplicationConfiguration().getAuthenticationManager();
     }
 
-    /**
-     * <p>
-     * getAuthenticationManager
-     * </p>
-     *
-     * @return a
-     *         {@link ICdmPermissionEvaluator} object.
-     */
     public static ICdmPermissionEvaluator getPermissionEvaluator() {
         return getCurrentApplicationConfiguration().getPermissionEvaluator();
     }
@@ -466,7 +442,6 @@ public class CdmStore {
     public static boolean currentAuthentiationHasPermission(CdmBase targetDomainObject, EnumSet<CRUD> permission){
         //TODO use getCurrentApplicationConfiguration().currentAuthentiationHasPermission(CdmBase targetDomainObject, Operation permission) instead
         SecurityContext context = SecurityContextHolder.getContext();
-        PermissionEvaluator pe = getPermissionEvaluator();
         boolean hasPermission = false;
         try {
             hasPermission = getPermissionEvaluator().hasPermission(context.getAuthentication(), targetDomainObject,
@@ -656,6 +631,7 @@ public class CdmStore {
     }
 
 
+    @SuppressWarnings("unchecked")
     public static <T extends CdmBase> IService<T> getService(T cdmBase){
         IService<T> service = null;
         if(cdmBase!=null){
index f7bc9ca057af9d19ec4c85a9e1196c4a277663b5..a43e6fc609b0d3a9aba70d6d4eb5948c1cb6d643 100644 (file)
@@ -36,6 +36,7 @@ import eu.etaxonomy.cdm.model.term.DefinedTermBase;
 import eu.etaxonomy.taxeditor.event.EventUtility;
 import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
 import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
@@ -53,11 +54,6 @@ class CdmStoreConnector extends Job {
     private DbSchemaValidation dbSchemaValidation;
     private final Resource applicationContextBean;
 
-    /**
-     * @param datasource
-     * @param dbSchemaValidation
-     * @param applicationContextBean
-     */
     public CdmStoreConnector(Display display,
             ICdmSource cdmSource,
             DbSchemaValidation dbSchemaValidation,
@@ -134,7 +130,7 @@ class CdmStoreConnector extends Job {
         loginDialog.setMessage(null);
         loginDialog.hide(true);
 
-        ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
+        ProgressMonitorDialog dialog = new ProgressMonitorDialog(AbstractUtility.getShell());
 
         try {
             dialog.run(true, true, new IRunnableWithProgress() {
@@ -159,11 +155,6 @@ class CdmStoreConnector extends Job {
                         cdmSource.closeOpenConnections();
 
                         display.syncExec(new Runnable() {
-                            /*
-                             * (non-Javadoc)
-                             *
-                             * @see java.lang.Runnable#run()
-                             */
                             @Override
                             public void run() {
                                 // close the current context
index 0aa2747f90ea00ec9be5a3c41323741883b2fba5..538b0121b8e5a05a3a6a614fd3dc289521246595 100644 (file)
@@ -6,7 +6,6 @@
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
-
 package eu.etaxonomy.taxeditor.store;
 
 import java.util.Observable;
index 5d0d05d4c7ed07f5e949dd35c5af3fb1dc5ef353..028b1cc7c7362a0a367795a8456e54aff77e03eb 100644 (file)
@@ -9,8 +9,6 @@
 
 package eu.etaxonomy.taxeditor.store;
 
-import java.util.UUID;
-
 import org.eclipse.core.commands.operations.IOperationHistory;
 import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.NullProgressMonitor;
@@ -43,22 +41,9 @@ import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
  *
  * @author n.hoffmann
  * @created 11.05.2009
- * @version 1.0
  */
 public class StoreUtil extends AbstractUtility {
 
-       /**
-        * <p>checktaxonExists</p>
-        *
-        * @param fromString a {@link java.util.UUID} object.
-        */
-       public static void checktaxonExists(UUID fromString) {
-//        if (CdmStore.getTaxonService().getTaxonByUuid(UUID.fromString(uuid)) == null) {
-//             logger.warn("Couldn't find taxon with UUID " + uuid);
-//             return null;
-//        }
-       }
-
        /**
         * If the object given is already a {@link CdmBase} then it is returned.<br>
         * If it is a kind of "container" for CDM objects then it is asked for its "responsible" CdmBase entity.<br>
@@ -83,21 +68,11 @@ public class StoreUtil extends AbstractUtility {
         throw new IllegalArgumentException("Object " + object.toString() + " is neither a CdmBase nor a CDM \"container\"");
        }
 
-       /**
-        * <p>getOperationHistory</p>
-        *
-        * @return a {@link org.eclipse.core.commands.operations.IOperationHistory} object.
-        */
        public static IOperationHistory getOperationHistory() {
                return TaxeditorStorePlugin.getDefault().getWorkbench().
                                        getOperationSupport().getOperationHistory();
        }
 
-       /**
-        * <p>setStatusLineManager</p>
-        *
-        * @param manager a {@link org.eclipse.jface.action.IStatusLineManager} object.
-        */
        public static void setStatusLineManager(IStatusLineManager manager) {
                statusLineManager = manager;
        }
@@ -115,21 +90,10 @@ public class StoreUtil extends AbstractUtility {
         }
     }
 
-
-       /**
-        * <p>getUndoContext</p>
-        *
-        * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
-        */
        public static IUndoContext getUndoContext(){
                return IOperationHistory.GLOBAL_UNDO_CONTEXT;
        }
 
-       /**
-        * <p>getPluginId</p>
-        *
-        * @return a {@link java.lang.String} object.
-        */
        public static String getPluginId(){
                return TaxeditorStorePlugin.PLUGIN_ID;
        }
@@ -240,9 +204,9 @@ public class StoreUtil extends AbstractUtility {
         return style;
     }
 
-    public static String getPath(TermNode node){
+    public static String getPath(TermNode<?> node){
         String path = node.getTerm().getLabel();
-        TermNode parent = node.getParent();
+        TermNode<?> parent = node.getParent();
         while(parent != null && parent.getTerm()!=null){
             path = parent.getTerm().getLabel() + "/" + path;
             parent = parent.getParent();
index 245d6a557d104399b5fd6fbaaf7dd66b69a4dbd4..72e8d27480993ea5c41c46572e7cbf225b874adb 100644 (file)
@@ -60,6 +60,8 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.config.CdmSourceException;
 import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
 import eu.etaxonomy.cdm.persistence.permission.Role;
 import eu.etaxonomy.taxeditor.l10n.Messages;
@@ -111,6 +113,13 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
 
     private final static String MESG_COMPATIBLE_EDITOR_OLD = Messages.RemotingLoginDialog_UPDATE_EDITOR;
     private final static String MESG_COMPATIBLE_SERVER_OLD = Messages.RemotingLoginDialog_CHOOSE_COMPATIBLE_CDM_SERVER;
+    private final static String MESG_SCHEMA_MISSING = Messages.RemotingLoginDialog_SCHEMA_MISSING;
+    private final static String MESG_NO_SCHEMA = Messages.RemotingLoginDialog_NO_SCHEMA;
+
+    private final static String LABEL_CONNECT = Messages.RemotingLoginDialog_LABEL_CONNECT;
+    private final static String LABEL_CREATE_SCHEMA = Messages.RemotingLoginDialog_LABEL_CREATE_SCHEMA;
+    private final static String LABEL_UPDATE_SCHEMA_VERSION = Messages.RemotingLoginDialog_LABEL_UPDATE_SCHEMA_VERSION;
+    private final static String MESG_UPDATE_SCHEMA_VERSION = Messages.RemotingLoginDialog_MSG_UPDATE_SCHEMA_VERSION;
 
     private final static String STORE_PREFERENCES_NODE = "eu.etaxonomy.taxeditor.store"; //$NON-NLS-1$
 
@@ -123,7 +132,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private final static String LAST_INSTANCE_KEY = "lastInstanceKey"; //$NON-NLS-1$
 
     private Composite remotingComposite;
-    private CdmServerInfo selectedCsii;
+    private CdmServerInfo selectedServerInfo;
     private CdmInstanceInfo selectedCdmInstance;
     private Button btnCdmServerRefresh;
     private Button btnCdmInstanceRefresh;
@@ -139,7 +148,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private Text txtPort;
     private Label lblServerVersion;
     private Text txtServerVersion;
-    private ExpandableComposite xpndblcmpstAdvanced;
+    private ExpandableComposite expandableCompositeAdvanced;
     private StyledText styledTxtMessage;
 
 //    private final int MIN_WIDTH = 530;
@@ -149,10 +158,10 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private final int MESSAGE_HEIGHT = 50;
     private Label lblEditorVersion;
     private Text txtEditorVersion;
-    private Label lblServerCDMVersion;
-    private Text txtServerCDMVersion;
-    private Label lblEditorCDMVersion;
-    private Text txtEditorCDMVersion;
+    private Label lblServerCdmVersion;
+    private Text txtServerCdmVersion;
+    private Label lblEditorCdmVersion;
+    private Text txtEditorCdmVersion;
 
     private String serverName, instanceName;
     private boolean autoConnect = false;
@@ -178,7 +187,6 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         return open(serverName, instanceName, loadLoginPrefs, autoConnect);
     }
 
-
     public Object open(String serverName, String instanceName, boolean loadLoginPrefs, boolean autoConnect) {
         this.serverName = serverName;
         this.instanceName = instanceName;
@@ -203,7 +211,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         shlConnect.pack(true);
         shlConnect.open();
 
-        xpndblcmpstAdvanced.setExpanded(false);
+        expandableCompositeAdvanced.setExpanded(false);
 
         Display display = getParent().getDisplay();
 
@@ -223,12 +231,13 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
      */
     private void createContents() {
         shlConnect = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
-        shlConnect.setText(Messages.RemotingLoginDialog_LABEL_CONNECT);
+        shlConnect.setText(LABEL_CONNECT);
         shlConnect.setLayout(new FillLayout(SWT.HORIZONTAL));
 
         remotingComposite = new Composite(shlConnect, SWT.NONE);
         remotingComposite.setLayout(new GridLayout(1, false));
 
+        //server
         Composite cdmServerComposite = new Composite(remotingComposite, SWT.NONE);
         GridData gd_cdmServerComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
         cdmServerComposite.setLayoutData(gd_cdmServerComposite);
@@ -267,6 +276,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         btnCdmServerRefresh.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
         btnCdmServerRefresh.setText(Messages.RemotingLoginDialog_LABEL_REFRESH);
 
+        //instance
         Label lblCdmInstance = new Label(cdmServerComposite, SWT.NONE);
         GridData gd_lblCdmInstance = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
         //gd_lblCdmInstance.heightHint = 30;
@@ -302,6 +312,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         btnCdmInstanceRefresh.setLayoutData(gd_btnCdmInstanceRefresh);
         btnCdmInstanceRefresh.setText(Messages.RemotingLoginDialog_LABEL_REFRESH);
 
+        //login
         loginComposite = new Composite(remotingComposite, SWT.NONE);
         GridData gd_loginComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
         loginComposite.setLayoutData(gd_loginComposite);
@@ -329,7 +340,8 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         GridData gd_txtPassword = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
         gd_txtPassword.minimumWidth = 80;
         txtPassword.setLayoutData(gd_txtPassword);
-        new Label(loginComposite, SWT.NONE);
+        @SuppressWarnings("unused")
+        Label nope = new Label(loginComposite, SWT.NONE);
         txtPassword.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
@@ -347,7 +359,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
                                connectButtonPressed();
                        }
                });
-        btnConnect.setText(Messages.RemotingLoginDialog_LABEL_CONNECT);
+        btnConnect.setText(LABEL_CONNECT);
 
         btnRememberMe = new Button(loginComposite, SWT.CHECK);
         btnRememberMe.setSelection(true);
@@ -375,10 +387,11 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
 
         styledTxtMessage.setLayoutData(gd_styledTxtMessage);
 
-        xpndblcmpstAdvanced = new ExpandableComposite(remotingComposite, SWT.NONE, ExpandableComposite.TWISTIE);
+        //Advanced
+        expandableCompositeAdvanced = new ExpandableComposite(remotingComposite, SWT.NONE, ExpandableComposite.TWISTIE);
         GridData gd_xpndblcmpstAdvanced = new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1);
-        xpndblcmpstAdvanced.setLayoutData(gd_xpndblcmpstAdvanced);
-        xpndblcmpstAdvanced.addExpansionListener(new IExpansionListener() {
+        expandableCompositeAdvanced.setLayoutData(gd_xpndblcmpstAdvanced);
+        expandableCompositeAdvanced.addExpansionListener(new IExpansionListener() {
             @Override
             public void expansionStateChanged(ExpansionEvent e) {
                 shlConnect.pack(true);
@@ -387,11 +400,11 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
             public void expansionStateChanging(ExpansionEvent e) {
             }
         });
-        xpndblcmpstAdvanced.setText(Messages.RemotingLoginDialog_LABEL_ADVANCED);
-        xpndblcmpstAdvanced.setExpanded(true);
+        expandableCompositeAdvanced.setText(Messages.RemotingLoginDialog_LABEL_ADVANCED);
+        expandableCompositeAdvanced.setExpanded(true);
 
-        compAdvanced = new Composite(xpndblcmpstAdvanced, SWT.NONE);
-        xpndblcmpstAdvanced.setClient(compAdvanced);
+        compAdvanced = new Composite(expandableCompositeAdvanced, SWT.NONE);
+        expandableCompositeAdvanced.setClient(compAdvanced);
         compAdvanced.setLayout(new GridLayout(4, false));
 
         lblPort = new Label(compAdvanced, SWT.CENTER);
@@ -432,24 +445,24 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         txtEditorVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
         addEmptyCells(2);
 
-        lblServerCDMVersion = new Label(compAdvanced, SWT.CENTER);
-        lblServerCDMVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-        lblServerCDMVersion.setText(Messages.RemotingLoginDialog_LABEL_SERVER_CDM_VERSION);
-        lblServerCDMVersion.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
+        lblServerCdmVersion = new Label(compAdvanced, SWT.CENTER);
+        lblServerCdmVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+        lblServerCdmVersion.setText(Messages.RemotingLoginDialog_LABEL_SERVER_CDM_VERSION);
+        lblServerCdmVersion.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
 
-        txtServerCDMVersion = new Text(compAdvanced, SWT.BORDER);
-        txtServerCDMVersion.setEditable(false);
-        txtServerCDMVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER , true, false, 1, 1));
+        txtServerCdmVersion = new Text(compAdvanced, SWT.BORDER);
+        txtServerCdmVersion.setEditable(false);
+        txtServerCdmVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
         addEmptyCells(2);
 
-        lblEditorCDMVersion = new Label(compAdvanced, SWT.CENTER);
-        lblEditorCDMVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-        lblEditorCDMVersion.setText(Messages.RemotingLoginDialog_LABEL_EDITOR_CDM_VERSION);
-        lblEditorCDMVersion.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
+        lblEditorCdmVersion = new Label(compAdvanced, SWT.CENTER);
+        lblEditorCdmVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+        lblEditorCdmVersion.setText(Messages.RemotingLoginDialog_LABEL_EDITOR_CDM_VERSION);
+        lblEditorCdmVersion.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
 
-        txtEditorCDMVersion = new Text(compAdvanced, SWT.BORDER);
-        txtEditorCDMVersion.setEditable(false);
-        txtEditorCDMVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+        txtEditorCdmVersion = new Text(compAdvanced, SWT.BORDER);
+        txtEditorCdmVersion.setEditable(false);
+        txtEditorCdmVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
     }
 
     @SuppressWarnings("unused")
@@ -460,7 +473,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     }
 
        private void connectButtonPressed() {
-               if(selectedCsii.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) {
+               if(selectedServerInfo.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) {
                        startManagedServer();
                } else {
                        connect();
@@ -534,14 +547,14 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private void updateSelectedCdmServer() {
         int selIndex = comboCdmServer.getSelectionIndex();
         if(selIndex != -1) {
-            selectedCsii = csiiMap.get(comboCdmServer.getItem(selIndex));
+            selectedServerInfo = csiiMap.get(comboCdmServer.getItem(selIndex));
         }
     }
 
     private void updatePort() {
         txtPort.setText(""); //$NON-NLS-1$
-        if(selectedCsii != null) {
-            int port = selectedCsii.getPort();
+        if(selectedServerInfo != null) {
+            int port = selectedServerInfo.getPort();
             if(port == CdmServerInfo.NULL_PORT) {
                 txtPort.setText(CdmServerInfo.NULL_PORT_STRING);
             } else {
@@ -564,17 +577,17 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
 
     private void checkSelectedCdmServer() {
         try{
-            if(selectedCsii != null) {
-                if(selectedCsii.isLocalhost()) {
+            if(selectedServerInfo != null) {
+                if(selectedServerInfo.isLocalhost()) {
                     txtPort.setEditable(true);
                     txtPort.setEnabled(true);
                 }
                 try {
-                    if(selectedCsii.pingServer()) {
+                    if(selectedServerInfo.pingServer()) {
                         txtCdmServerStatus.setText(STATUS_AVAILABLE);
                         populateCdmInstanceCombo(true);
-                        String serverVersionTimestamp = generateLastModifiedTooltip(selectedCsii.getCdmlibLastModified());
-                        txtServerVersion.setText(selectedCsii.getCdmlibServicesVersion() + ":" + serverVersionTimestamp); //$NON-NLS-1$
+                        String serverVersionTimestamp = generateLastModifiedTooltip(selectedServerInfo.getCdmlibLastModified());
+                        txtServerVersion.setText(selectedServerInfo.getCdmlibServicesVersion() + ":" + serverVersionTimestamp); //$NON-NLS-1$
                     } else {
                         txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE);
                         comboCdmInstance.removeAll();
@@ -615,11 +628,11 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
             @Override
             protected IStatus run(IProgressMonitor monitor) {
                 try {
-                    if(selectedCsii != null) {
+                    if(selectedServerInfo != null) {
                         if(forceRefresh) {
-                            selectedCsii.refreshInstances();
+                            selectedServerInfo.refreshInstances();
                         }
-                        final List<CdmInstanceInfo> instances = selectedCsii.getInstances();
+                        final List<CdmInstanceInfo> instances = selectedServerInfo.getInstances();
                         Display.getDefault().asyncExec(new Runnable() {
                             @Override
                             public void run() {
@@ -688,8 +701,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private void updateSelectedCdmInstance() {
         int selIndex = comboCdmInstance.getSelectionIndex();
         if(selIndex != -1) {
-            selectedCdmInstance = selectedCsii.getInstanceFromName(comboCdmInstance.getItem(selIndex));
-
+            selectedCdmInstance = selectedServerInfo.getInstanceFromName(comboCdmInstance.getItem(selIndex));
             if(loadLoginPrefs) {
                 readPrefCredentials();
             }
@@ -697,14 +709,14 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     }
 
     private void updateManagedServerControls() {
-        if(selectedCsii.isLocalhostMgd()) {
+        if(selectedServerInfo.isLocalhostMgd()) {
             if(isSelectedCdmInstanceRunningInManagedServer()) {
                 txtCdmInstanceStatus.setText(STATUS_STARTED);
             } else {
                 txtCdmInstanceStatus.setText(STATUS_NOT_STARTED);
             }
             btnConnect.setEnabled(true);
-            selectedCsii.setPort(getManagedServerPort());
+            selectedServerInfo.setPort(getManagedServerPort());
             updatePort();
         }
 
@@ -722,7 +734,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private boolean isSelectedCdmInstanceRunningInManagedServer() {
         return CdmStore.getManagedServer() != null &&
                 CdmStore.getManagedServer().isAlive() &&
-                selectedCsii.isLocalhostMgd() &&
+                selectedServerInfo.isLocalhostMgd() &&
                 CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName());
     }
 
@@ -740,6 +752,9 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
             }
         }
 
+        boolean forceSchemaCreate = !schemaExists(selectedCdmInstance);
+        boolean forceSchemaUpdate = LABEL_UPDATE_SCHEMA_VERSION.equals(btnConnect.getText());
+
         Job job = new Job(Messages.RemotingLoginDialog_JOB_SERVER_LAUNCH) {
 
             @Override
@@ -752,13 +767,15 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
                     monitor.subTask(String.format(Messages.RemotingLoginDialog_GENERATING_CONFIG_FILE, selectedCdmInstance.getName()));
                     File managedServerConfigFile = CdmServerUtils.writeManagedServerConfig(config, mgdServerConfigFileName);
                     monitor.worked(1);
-                    boolean forceSchemaCreate = CdmStore.getManagedServer() != null
-                            && CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName())
-                            && CdmStore.getManagedServer().isForceSchemaCreate();
-                    CdmStore.setManagedServer(new CdmServer(selectedCdmInstance.getName(), managedServerConfigFile));
-                    CdmStore.getManagedServer().setForceSchemaCreate(forceSchemaCreate);
+                    CdmServer cdmServer = new CdmServer(selectedCdmInstance.getName(), managedServerConfigFile);
+//                    boolean forceSchemaCreate = CdmStore.getManagedServer() != null
+//                            && CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName())
+//                            && CdmStore.getManagedServer().isForceSchemaCreate();
+                    cdmServer.setForceSchemaCreate(forceSchemaCreate);
+                    cdmServer.setForceSchemaUpdate(forceSchemaUpdate);
+                    CdmStore.setManagedServer(cdmServer);
                     monitor.subTask(Messages.RemotingLoginDialog_STARTING_MGD_SERVER);
-                    CdmStore.getManagedServer().start(false, RemotingLoginDialog.this);
+                    cdmServer.start(false, RemotingLoginDialog.this);
                     int serverUnits = 0;
 
                     // the following loop is a 'fake' progress monitoring where the progress
@@ -803,7 +820,8 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
 
                 return Status.OK_STATUS;
             }
-        };
+
+       };
 
         // configure the job
         job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
@@ -813,21 +831,38 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         job.schedule();
     }
 
+    private boolean schemaExists(CdmInstanceInfo instanceInfo) {
+        if (instanceInfo.getDataSource() != null){
+            try {
+                //TODO we need a new method in cdmlib to check for existing schema
+                String schemaVersion = instanceInfo.getDataSource().getDbSchemaVersion();
+                return schemaVersion != null;
+            } catch (CdmSourceException e) {
+                return false;
+            }
+        }else{
+            return true;
+        }
+    }
+
+    private String managedSchemaVersion(CdmInstanceInfo instanceInfo) throws CdmSourceException{
+        if (instanceInfo.getDataSource() != null){
+            return instanceInfo.getDataSource().getDbSchemaVersion();
+        }else{
+            throw new RuntimeException("ManagedSchemaVersion only available for managed server instances.");
+        }
+    }
+    private int compareSchemaVersion(CdmInstanceInfo instanceInfo) throws CdmSourceException {
+        return CdmMetaData.compareVersion(managedSchemaVersion(instanceInfo), CdmMetaData.getDbSchemaVersion(), 3, null);
+    }
+
     @Override
     public void handleError(final Throwable t) {
 
         if(CdmStore.getManagedServer().isFailed() && CdmStore.getManagedServer().isPotentiallyMissingSchema()) {
             CdmStore.getManagedServer().setForceSchemaCreate(true);
             // we are in a separate thread here, thus update the screen via
-            Display.getDefault().asyncExec(new Runnable() {
-                @Override
-                public void run() {
-                    btnConnect.setEnabled(true);
-                    btnConnect.setText("Create Schema");
-                    btnConnect.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
-                    btnConnect.requestLayout();
-                }
-             });
+            checkManagedSelectedInstance();
         } else {
             Display.getDefault().syncExec(new Runnable() {
                 @Override
@@ -868,39 +903,44 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     }
 
     private void checkSelectedCdmInstance() {
-        boolean available = false;
-        String status = STATUS_NOT_AVAILABLE;
-        String message = null;
 
-        if(txtCdmServerStatus.getText().equals(STATUS_AVAILABLE)) {
+        if (selectedServerInfo.isLocalhostMgd()){
+            checkManagedSelectedInstance();
+        }else if (txtCdmServerStatus.getText().equals(STATUS_AVAILABLE)) {
+            boolean available = false;
+            String instanceStatus = STATUS_NOT_AVAILABLE;
+            String message = null;
             try {
-                if(selectedCsii.pingInstance(selectedCdmInstance, getPort())) {
-                    status = STATUS_AVAILABLE;
+                if(selectedServerInfo.pingInstance(selectedCdmInstance, getPort())) {
+                    instanceStatus = STATUS_AVAILABLE;
                     available = true;
                 } else {
-                    status = STATUS_NOT_AVAILABLE;
+                    instanceStatus = STATUS_NOT_AVAILABLE;
                     available = false;
                 }
 
                 if(available) {
-                    txtServerCDMVersion.setText(selectedCsii.getCdmRemoteSource(selectedCdmInstance, getPort()).getDbSchemaVersion());
-                    int compareDbSchemaVersion = selectedCsii.compareDbSchemaVersion(selectedCdmInstance, getPort());
+                    txtServerCdmVersion.setText(selectedServerInfo.getCdmRemoteSource(selectedCdmInstance, getPort()).getDbSchemaVersion());
+
+                    int compareDbSchemaVersion = selectedServerInfo.compareDbSchemaVersion(selectedCdmInstance, getPort());
+
                     int compareCdmlibServicesVersion = 0;
                     boolean disableServicesApiTimestampCheck =
                             PreferencesUtil.getBooleanValue((IPreferenceKeys.DISABLE_SERVICES_API_TIMESTAMP_CHECK));
                     if(!disableServicesApiTimestampCheck) {
-                        compareCdmlibServicesVersion = selectedCsii.compareCdmlibServicesVersion();
+                        compareCdmlibServicesVersion = selectedServerInfo.compareCdmlibServicesVersion();
                     }
+
                     if(compareDbSchemaVersion > 0 || compareCdmlibServicesVersion > 0) {
-                        status =  STATUS_NOT_COMPATIBLE;
+                        instanceStatus = STATUS_NOT_COMPATIBLE;
                         available = false;
                         message = MESG_COMPATIBLE_EDITOR_OLD;
                     } else if(compareDbSchemaVersion < 0 || compareCdmlibServicesVersion < 0) {
-                        status = STATUS_NOT_COMPATIBLE;
+                        instanceStatus = STATUS_NOT_COMPATIBLE;
                         available = false;
                         message = MESG_COMPATIBLE_SERVER_OLD;
                     } else {
-                        status =  STATUS_AVAILABLE;
+                        instanceStatus =  STATUS_AVAILABLE;
                         available = true;
                         message = ""; //$NON-NLS-1$
                     }
@@ -909,7 +949,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
                 txtCdmInstanceStatus.setToolTipText(e.getMessage());
             } finally {
                 btnConnect.setEnabled(available);
-                txtCdmInstanceStatus.setText(status);
+                txtCdmInstanceStatus.setText(instanceStatus);
                 if(!StringUtils.isBlank(message)) {
                     setMessage(message);
                 }
@@ -917,6 +957,57 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         }
     }
 
+    private void checkManagedSelectedInstance() {
+        boolean available = false;
+        String instanceStatus = STATUS_NOT_AVAILABLE;
+        String message = null;
+        String connect = LABEL_CONNECT;
+        int color = SWT.COLOR_BLACK;
+        String schemaVersion = CdmMetaData.getDbSchemaVersion();
+
+        if (!schemaExists(selectedCdmInstance)){
+            message = MESG_SCHEMA_MISSING;
+            connect = LABEL_CREATE_SCHEMA;
+            color = SWT.COLOR_RED;
+            schemaVersion = MESG_NO_SCHEMA;
+        } else {
+            int compare;
+            try {
+                schemaVersion = managedSchemaVersion(selectedCdmInstance);
+                compare = compareSchemaVersion(selectedCdmInstance);
+                if (compare > 0){
+                    instanceStatus = STATUS_NOT_COMPATIBLE;
+                    message = MESG_COMPATIBLE_EDITOR_OLD;
+                    available = false;
+                }else if (compare < 0){
+                    instanceStatus = STATUS_NOT_COMPATIBLE;
+                    message = MESG_UPDATE_SCHEMA_VERSION;
+                    available = true;
+                    connect = LABEL_UPDATE_SCHEMA_VERSION;
+                    color = SWT.COLOR_RED;
+                }else{
+                    available = true;
+                }
+            } catch (CdmSourceException e) {
+                available = false;
+            }
+        }
+
+//        Display.getDefault().asyncExec(()->{
+            btnConnect.setEnabled(available);
+            btnConnect.setText(connect);
+            btnConnect.setBackground(Display.getCurrent().getSystemColor(color));
+            btnConnect.requestLayout();
+            txtCdmInstanceStatus.setText(instanceStatus);
+            txtServerCdmVersion.setText(schemaVersion);
+
+//         });
+
+//        if(!StringUtils.isBlank(message)) {
+            setMessage(message);
+//        }
+    }
+
     private void connect() {
         checkSelectedCdmInstance();
 
@@ -924,7 +1015,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
             return;
         }
 
-        ICdmRemoteSource source = selectedCsii.getCdmRemoteSource(selectedCdmInstance, getPort());
+        ICdmRemoteSource source = selectedServerInfo.getCdmRemoteSource(selectedCdmInstance, getPort());
 
         if(!validateLogin(source)) {
             return;
@@ -947,7 +1038,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
         Preferences lastServerInstancePrefs = preferences.node(LAST_SERVER_INSTANCE_NODE);
 
-        lastServerInstancePrefs.put(LAST_SERVER_KEY, selectedCsii.getName());
+        lastServerInstancePrefs.put(LAST_SERVER_KEY, selectedServerInfo.getName());
         lastServerInstancePrefs.put(LAST_INSTANCE_KEY, selectedCdmInstance.getName());
 
         flushPreferences(lastServerInstancePrefs);
@@ -1012,11 +1103,11 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     }
 
     private String getUsernamePrefKey() {
-        return selectedCsii.toString(selectedCdmInstance.getName(), isDevRemoteSource?getPort():-1) + USERNAME_SUFFIX;
+        return selectedServerInfo.toString(selectedCdmInstance.getName(), isDevRemoteSource?getPort():-1) + USERNAME_SUFFIX;
     }
 
     private String getPasswordPrefKey() {
-        return selectedCsii.toString(selectedCdmInstance.getName(), isDevRemoteSource?getPort():-1) + PASSWORD_SUFFIX;
+        return selectedServerInfo.toString(selectedCdmInstance.getName(), isDevRemoteSource?getPort():-1) + PASSWORD_SUFFIX;
     }
 
     private boolean validateLogin(ICdmRemoteSource remoteSource) {
@@ -1055,7 +1146,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     }
 
     public void setMessage(String message) {
-        if(message != null && !message.isEmpty()) {
+        if(CdmUtils.isNotBlank(message)) {
 //            if(message.length() > 50) {
 //                styledTxtMessage.setToolTipText(message);
 //                message = message.substring(0,50) + "..."; //$NON-NLS-1$
@@ -1136,17 +1227,17 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     }
 
     private void setEditorInfo() {
-        txtEditorCDMVersion.setText(CdmMetaData.getDbSchemaVersion());
+        txtEditorCdmVersion.setText(CdmMetaData.getDbSchemaVersion());
         String editorVersionTimestamp = generateLastModifiedTooltip(CdmApplicationState.getCdmlibLastModified());
         txtEditorVersion.setText(CdmApplicationState.getCdmlibVersion() + ":" + editorVersionTimestamp); //$NON-NLS-1$
     }
 
     private void clearOnServerChange() {
         setMessage(""); //$NON-NLS-1$
-        txtServerCDMVersion.setText(""); //$NON-NLS-1$
+        txtServerCdmVersion.setText(""); //$NON-NLS-1$
         txtServerVersion.setText(""); //$NON-NLS-1$
         txtServerVersion.setToolTipText(""); //$NON-NLS-1$
-        txtServerCDMVersion.setText(""); //$NON-NLS-1$
+        txtServerCdmVersion.setText(""); //$NON-NLS-1$
         comboCdmInstance.removeAll();
         txtCdmInstanceStatus.setText(""); //$NON-NLS-1$
         txtPort.setEditable(false);
@@ -1155,6 +1246,6 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
 
     private void clearOnInstanceChange() {
         setMessage(""); //$NON-NLS-1$
-        txtServerCDMVersion.setText(""); //$NON-NLS-1$
+        txtServerCdmVersion.setText(""); //$NON-NLS-1$
     }
 }