Skip to content

Package: CDORepositoryData

CDORepositoryData

nameinstructionbranchcomplexitylinemethod
CDORepositoryData(InternalRepository)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
createSessionConfiguration()
M: 31 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
getRepository()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
toString()
M: 31 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011 Eike Stepper (Berlin, Germany) and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eike Stepper - initial API and implementation
13: *******************************************************************************/
14: package org.eclipse.emf.ecp.cdo.internal.core;
15:
16: import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
17: import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
18: import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
19: import org.eclipse.emf.ecp.core.util.ECPProperties;
20: import org.eclipse.emf.ecp.spi.core.InternalRepository;
21: import org.eclipse.net4j.Net4jUtil;
22: import org.eclipse.net4j.connector.IConnector;
23: import org.eclipse.net4j.util.container.IPluginContainer;
24:
25: /**
26: * Provider-specific wrapper for an ECO {@link InternalRepository}.
27: *
28: * @author Eike Stepper
29: */
30: public final class CDORepositoryData implements CDOSessionConfigurationFactory {
31:         private final InternalRepository repository;
32:
33:         /**
34:          * Constructor.
35:          *
36:          * @param repository the {@link InternalRepository}
37:          */
38:         public CDORepositoryData(InternalRepository repository) {
39:                 this.repository = repository;
40:         }
41:
42:         /**
43:          * Get the {@link InternalRepository}.
44:          *
45:          * @return the {@link InternalRepository}
46:          */
47:         public InternalRepository getRepository() {
48:                 return repository;
49:         }
50:
51:         /**
52:          * {@inheritDoc}
53:          *
54:          * @see org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory#createSessionConfiguration()
55:          */
56:         @Override
57:         public CDONet4jSessionConfiguration createSessionConfiguration() {
58:                 final ECPProperties properties = repository.getProperties();
59:                 final String connectorType = properties.getValue(CDOProvider.PROP_CONNECTOR_TYPE);
60:                 final String connectorDescription = properties.getValue(CDOProvider.PROP_CONNECTOR_DESCRIPTION);
61:                 final String repositoryName = properties.getValue(CDOProvider.PROP_REPOSITORY_NAME);
62:
63:                 final IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, connectorType,
64:                         connectorDescription);
65:
66:                 final CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
67:                 configuration.setConnector(connector);
68:                 configuration.setRepositoryName(repositoryName);
69:                 return configuration;
70:         }
71:
72:         @Override
73:         public String toString() {
74:                 final ECPProperties properties = repository.getProperties();
75:                 final String connectorType = properties.getValue(CDOProvider.PROP_CONNECTOR_TYPE);
76:                 final String connectorDescription = properties.getValue(CDOProvider.PROP_CONNECTOR_DESCRIPTION);
77:                 final String repositoryName = properties.getValue(CDOProvider.PROP_REPOSITORY_NAME);
78:                 return connectorType + "://" + connectorDescription + "/" + repositoryName; //$NON-NLS-1$ //$NON-NLS-2$
79:         }
80: }