Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-06-10 11:46:26 +0000
committerEike Stepper2012-06-10 11:46:26 +0000
commit18397e5d7cee96d44b4972fe6f032b589a323a38 (patch)
tree927879c0aa15b569f631d4b7de09637a361f10e3 /plugins
parentc1706d17c98cb14df6c59b8fa5d87ee84e421177 (diff)
downloadcdo-18397e5d7cee96d44b4972fe6f032b589a323a38.tar.gz
cdo-18397e5d7cee96d44b4972fe6f032b589a323a38.tar.xz
cdo-18397e5d7cee96d44b4972fe6f032b589a323a38.zip
[381472] Design a repository administration API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=381472
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java45
4 files changed, 95 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java
index 2302a7e3b1..57bb8de945 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.admin;
import org.eclipse.emf.cdo.common.admin.CDOAdminRepository;
import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
/**
* A client-side {@link CDOAdminRepository administrative interface} to a remote repository.
@@ -23,4 +24,17 @@ public interface CDOAdminClientRepository extends CDOAdminRepository
public CDOAdminClient getAdmin();
public CDONet4jSession openSession();
+
+ public CDONet4jSession openSession(SessionConfigurator configurator);
+
+ /**
+ * Provides access to the {@link CDONet4jSessionConfiguration session configuration}
+ * used in calls to {@link CDOAdminClientRepository#openSession()}.
+ *
+ * @author Eike Stepper
+ */
+ public interface SessionConfigurator
+ {
+ public void prepare(CDONet4jSessionConfiguration configuration);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java
index e17dee4208..cace33398b 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java
@@ -171,6 +171,11 @@ public class CDOAdminClientRepositoryImpl extends Notifier implements CDOAdminCl
public CDONet4jSession openSession()
{
+ return openSession(null);
+ }
+
+ public CDONet4jSession openSession(SessionConfigurator configurator)
+ {
IConnector connector = admin.getConnector();
if (connector == null)
{
@@ -181,6 +186,11 @@ public class CDOAdminClientRepositoryImpl extends Notifier implements CDOAdminCl
configuration.setConnector(connector);
configuration.setRepositoryName(name);
+ if (configurator != null)
+ {
+ configurator.prepare(configuration);
+ }
+
return configuration.openNet4jSession();
}
diff --git a/plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java b/plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java
index 9b6ce0f82e..0e6d7b60e2 100644
--- a/plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java
+++ b/plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.admin.CDOAdminClientManager;
import org.eclipse.emf.cdo.admin.CDOAdminClientRepository;
import org.eclipse.emf.cdo.common.admin.CDOAdminRepository;
import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
import org.eclipse.emf.cdo.ui.internal.admin.bundle.OM;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
@@ -23,6 +24,9 @@ import org.eclipse.emf.internal.cdo.session.CDOSessionFactory;
import org.eclipse.net4j.ui.Net4jItemProvider.RemoveAction;
import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.security.CredentialsProviderFactory;
+import org.eclipse.net4j.util.security.IPasswordCredentialsProvider;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.actions.LongRunningAction;
import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
import org.eclipse.net4j.util.ui.views.ContainerView;
@@ -193,6 +197,22 @@ public class CDOAdminView extends ContainerView
super.fillLocalToolBar(manager);
}
+ protected IPasswordCredentialsProvider getCredentialsProvider()
+ {
+ IManagedContainer container = adminManager.getContainer();
+ String productGroup = CredentialsProviderFactory.PRODUCT_GROUP;
+ String factoryType = "interactive";
+ IPasswordCredentialsProvider credentialsProvider = (IPasswordCredentialsProvider)container.getElement(productGroup,
+ factoryType, null);
+
+ if (credentialsProvider == null)
+ {
+ credentialsProvider = UIUtil.createInteractiveCredentialsProvider();
+ }
+
+ return credentialsProvider;
+ }
+
public static int getNextSessionNumber()
{
return ++lastSessionNumber;
@@ -232,7 +252,7 @@ public class CDOAdminView extends ContainerView
/**
* @author Eike Stepper
*/
- public class OpenSessionAction extends LongRunningAction
+ public class OpenSessionAction extends LongRunningAction implements CDOAdminClientRepository.SessionConfigurator
{
private CDOAdminClientRepository repository;
@@ -251,7 +271,7 @@ public class CDOAdminView extends ContainerView
@Override
protected void doRun(IProgressMonitor progressMonitor) throws Exception
{
- CDONet4jSession session = repository.openSession();
+ CDONet4jSession session = repository.openSession(this);
if (session != null)
{
IManagedContainer container = adminManager.getContainer();
@@ -259,5 +279,11 @@ public class CDOAdminView extends ContainerView
container.putElement(CDOSessionFactory.PRODUCT_GROUP, "admin", description, session);
}
}
+
+ public void prepare(CDONet4jSessionConfiguration configuration)
+ {
+ IPasswordCredentialsProvider credentialsProvider = getCredentialsProvider();
+ configuration.getAuthenticator().setCredentialsProvider(credentialsProvider);
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index 4d8a9c3d54..ce1bc0fcad 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -168,9 +168,11 @@ import org.eclipse.ui.part.MultiPageEditorPart;
import org.eclipse.ui.views.contentoutline.ContentOutline;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.eclipse.ui.views.properties.IPropertySheetEntry;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.PropertySheet;
import org.eclipse.ui.views.properties.PropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheetSorter;
import java.io.IOException;
import java.io.InputStream;
@@ -1719,10 +1721,9 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
/**
* This accesses a cached version of the property sheet. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
- public IPropertySheetPage getPropertySheetPage()
+ public IPropertySheetPage getPropertySheetPageGen()
{
if (propertySheetPage == null)
{
@@ -1744,7 +1745,47 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
};
propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
}
+ return propertySheetPage;
+ }
+
+ /**
+ * This accesses a cached version of the property sheet. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public IPropertySheetPage getPropertySheetPage()
+ {
+ if (propertySheetPage == null)
+ {
+ propertySheetPage = new ExtendedPropertySheetPage(editingDomain)
+ {
+ {
+ setSorter(new PropertySheetSorter()
+ {
+ @Override
+ public void sort(IPropertySheetEntry[] entries)
+ {
+ // Intentionally left empty
+ }
+ });
+ }
+
+ @Override
+ public void setSelectionToViewer(List<?> selection)
+ {
+ CDOEditor.this.setSelectionToViewer(selection);
+ CDOEditor.this.setFocus();
+ }
+ @Override
+ public void setActionBars(IActionBars actionBars)
+ {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ };
+ propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ }
return propertySheetPage;
}

Back to the top