本文整理汇总了Java中org.eclipse.net4j.connector.IConnector类的典型用法代码示例。如果您正苦于以下问题:Java IConnector类的具体用法?Java IConnector怎么用?Java IConnector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IConnector类属于org.eclipse.net4j.connector包,在下文中一共展示了IConnector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startCDOServer
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@BeforeClass
public static void startCDOServer() throws IOException, CommitException {
server = new CDOServer(false);
server.start();
IConnector connector = M2DocCDOUtils
.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":" + CDOServer.PORT);
CDOSession session = M2DocCDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME, CDOServer.USER_NAME,
CDOServer.PASSWORD);
final CDOTransaction transaction = M2DocCDOUtils.openTransaction(session);
final CDOResource resource = transaction.createResource("anydsl.ecore");
final ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
final Resource anyDSLResource = resourceSet.getResource(URI.createFileURI("resources/anydsl.ecore"), true);
resource.getContents().addAll(anyDSLResource.getContents());
resource.save(null);
transaction.commit();
transaction.close();
session.close();
connector.close();
if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
ConfigurationProviderService.getInstance().register(CONFIGURATION_PROVIDER);
M2DocUtils.registerServicesConfigurator(SERVICES_CONFIGURATOR_DESCRIPTOR);
}
}
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:26,代码来源:ServerWithoutAuthentication.java
示例2: startCDOServer
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@BeforeClass
public static void startCDOServer() throws IOException, CommitException {
server = new CDOServer(true);
server.start();
IConnector connector = M2DocCDOUtils
.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":" + CDOServer.PORT);
CDOSession session = M2DocCDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME, CDOServer.USER_NAME,
CDOServer.PASSWORD);
final CDOTransaction transaction = M2DocCDOUtils.openTransaction(session);
final CDOResource resource = transaction.createResource("anydsl.ecore");
final ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
final Resource anyDSLResource = resourceSet.getResource(URI.createFileURI("resources/anydsl.ecore"), true);
resource.getContents().addAll(anyDSLResource.getContents());
resource.save(null);
transaction.commit();
transaction.close();
session.close();
connector.close();
if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
ConfigurationProviderService.getInstance().register(CONFIGURATION_PROVIDER);
M2DocUtils.registerServicesConfigurator(SERVICES_CONFIGURATOR_DESCRIPTOR);
}
}
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:26,代码来源:ServerWithAuthentication.java
示例3: createResourceSetForModels
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@Override
public ResourceSet createResourceSetForModels(Generation generation) {
final ResourceSet res;
final Map<String, String> options = GenconfUtils.getOptions(generation);
final String cdoServer = options.get(M2DocCDOUtils.CDO_SERVER_OPTION);
if (cdoServer != null) {
final String repository = options.get(M2DocCDOUtils.CDO_REPOSITORY_OPTION);
final String branch = options.get(M2DocCDOUtils.CDO_BRANCH_OPTION);
final String login = options.get(M2DocCDOUtils.CDO_LOGIN_OPTION);
final String password = options.get(M2DocCDOUtils.CDO_PASSWORD_OPTION);
final IConnector connector = M2DocCDOUtils.getConnector(cdoServer);
connectors.put(generation, connector);
final CDOSession session = M2DocCDOUtils.openSession(connector, repository, login, password);
final CDOTransaction transaction = M2DocCDOUtils.openTransaction(session, branch);
transactions.put(generation, transaction);
res = transaction.getResourceSet();
res.getURIConverter().getURIHandlers().add(0, new M2DocCDOURIHandler((InternalCDOView) transaction));
} else {
res = null;
}
return res;
}
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:25,代码来源:CDOConfigurationProvider.java
示例4: openSession
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
/**
* Open a new {@link CDOSession}. Caller is responsible of {@link CDOSession#close() closing} the
* resulting session.
*
* @param connector
* the {@link IConnector} to use to open the {@link CDOSession}
* @param repository
* the repository name
* @param login
* the user login if any, if <code>null</code> otherwise no authentication will by used
* @param password
* the user password if an, if <code>null</code> empty {@link String} will be used
* @return a new {@link CDOSession}
*/
public static CDOSession openSession(IConnector connector, String repository, String login,
String password) {
CDOSessionConfiguration sessionConfiguration = CDONet4jUtil.createSessionConfiguration();
sessionConfiguration.setConnector(connector);
sessionConfiguration.setRepositoryName(repository);
if (login != null) {
final String pass;
if (password != null) {
pass = password;
} else {
pass = "";
}
sessionConfiguration.getAuthenticator().setCredentialsProvider(new PasswordCredentialsProvider(
login, pass.toCharArray()));
}
CDOSession res = sessionConfiguration.openSession();
return res;
}
开发者ID:ModelWriter,项目名称:Source,代码行数:35,代码来源:CDOUtils.java
示例5: beforeClass
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
AllTests.startCDOServer();
IConnector connector = CDOUtils.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":"
+ CDOServer.PORT);
CDOSession session = CDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME);
transaction = CDOUtils.openTransaction(session);
viewConnector.addSessionToCache(transaction);
folder = transaction.createResourceFolder(CDOResourceNodeConnectorTests.class.getCanonicalName()
+ "/test/");
textResource = transaction.createTextResource(CDOResourceNodeConnectorTests.class.getCanonicalName()
+ "/test/test.txt");
binaryResource = transaction.createBinaryResource(CDOResourceNodeConnectorTests.class
.getCanonicalName() + "/test/test.bin");
resource = transaction.createResource(CDOResourceNodeConnectorTests.class.getCanonicalName()
+ "/test/test.resource");
transaction.commit();
viewConnector.addSessionToCache(transaction);
MappingUtils.getConnectorRegistry().register(viewConnector);
}
开发者ID:ModelWriter,项目名称:Source,代码行数:23,代码来源:CDOResourceNodeConnectorTests.java
示例6: enableProtocol
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
protected void enableProtocol(IFocusTransferHandlerConcrete handler) {
Optional<IConnector> connector = extractConnector(handler.getAssociatedCDOView());
if (connector.map(IConnector::getChannels).map(channels -> !findFocusTransferChannels(channels).isEmpty())
.orElse(false)) {
// there is already a channel open for this one
return;
}
FocusTransferProtocol protocol = new FocusTransferProtocol();
protocol.setInfraStructure(new FocusTransferProtocolInfrastructure(handler::handleFocusRequest));
Optional<IChannel> channel = connector.map(protocol::open);
if (!channel.isPresent()) {
// exception
return;
}
openConnections.put(handler, channel.get());
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:19,代码来源:FocusTransferManager.java
示例7: createSession
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
protected CDOSession createSession() {
// Create connector
IConnector connector = createConnector(getManagedContainer());
// Create configuration
CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
configuration.setRepositoryName(getRepositoryName());
configuration.setConnector(connector);
// Open session
CDONet4jSession session = configuration.openNet4jSession();
session.options().setPassiveUpdateEnabled(true);
session.options().setGeneratedPackageEmulationEnabled(true);
// load persisted EPackages in the session (EPackage emulation must be enabled)
for (CDOPackageInfo info : session.getPackageRegistry() .getPackageInfos()) {
session.getPackageRegistry().put(info.getPackageURI(), info.getEPackage());
}
session.options().getNet4jProtocol().setTimeout(-1L);
session.options().setCommitTimeout(Integer.MAX_VALUE);
session.options().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(0, 300));
return session;
}
开发者ID:opencanarias,项目名称:model-repository-benchmark,代码行数:26,代码来源:AbstractCDOModelRepository.java
示例8: openSession
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
public CDONet4jSession openSession(String description, String repository) {
// Create connector
IConnector connector = TCPUtil.getConnector(createClientContainer(), description);
// Create configuration
CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
// configuration.setSignalTimeout(60000);
configuration.setConnector(connector);
configuration.setRepositoryName(repository);
// Open session
CDONet4jSession session = configuration.openNet4jSession();
for(Entry<String, Object> key: EPackage.Registry.INSTANCE.entrySet()) {
session.getPackageRegistry().put(key.getKey(), key.getValue());
}
return session;
}
开发者ID:asupdev,项目名称:asup,代码行数:20,代码来源:TestCommands.java
示例9: getConnector
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
/**
* Gets a {@link IConnector} from the given description. Caller is responsible of
* {@link IConnector#close() closing} the resulting connector.
*
* @param description
* the description of the protocol host and port to use for the connection
* @return a new {@link IConnector}
*/
public static IConnector getConnector(String description) {
final IManagedContainer container = getContainer(description);
IConnector res = null;
try {
res = Net4jUtil.getConnector(container, description);
} catch (ConnectorException e) {
LifecycleUtil.deactivate(container);
throw e;
}
return res;
}
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:20,代码来源:M2DocCDOUtils.java
示例10: openSession
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
/**
* Open a new {@link CDOSession}. Caller is responsible of {@link CDOSession#close() closing} the
* resulting session.
*
* @param connector
* the {@link IConnector} to use to open the {@link CDOSession}
* @param repository
* the repository name
* @param login
* the user login if any, if <code>null</code> otherwise no authentication will by used
* @param password
* the user password if an, if <code>null</code> empty {@link String} will be used
* @return a new {@link CDOSession}
*/
public static CDOSession openSession(IConnector connector, String repository, String login, String password) {
final CDONet4jSessionConfiguration sessionConfiguration = CDONet4jUtil.createNet4jSessionConfiguration();
sessionConfiguration.setConnector(connector);
sessionConfiguration.setRepositoryName(repository);
if (login != null) {
final String pass;
if (password != null) {
pass = password;
} else {
pass = "";
}
sessionConfiguration.setCredentialsProvider(new PasswordCredentialsProvider(login, pass.toCharArray()));
} else {
final IPasswordCredentialsProvider credentialsProvider;
if (SWT.isLoadable()) {
credentialsProvider = new InteractiveCredentialsProvider();
} else {
credentialsProvider = new ShellCredentialsProvider();
}
sessionConfiguration.setCredentialsProvider(credentialsProvider);
}
CDOSession res = sessionConfiguration.openNet4jSession();
return res;
}
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:41,代码来源:M2DocCDOUtils.java
示例11: getConnector
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
/**
* Gets a {@link IConnector} from the given description. Caller is responsible of
* {@link IConnector#close() closing} the resulting connector.
*
* @param description
* the description of the protocol host and port to use for the connection
* @return a new {@link IConnector}
*/
public static IConnector getConnector(String description) {
final IManagedContainer container = getContainer(description);
IConnector res = null;
try {
res = Net4jUtil.getConnector(container, description);
} catch (ConnectorException e) {
LifecycleUtil.deactivate(container);
throw e;
}
return res;
}
开发者ID:ModelWriter,项目名称:Source,代码行数:20,代码来源:CDOUtils.java
示例12: beforeClass
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
AllTests.startCDOServer();
IConnector connector = CDOUtils.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":"
+ CDOServer.PORT);
CDOSession session = CDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME);
transaction = CDOUtils.openTransaction(session);
}
开发者ID:ModelWriter,项目名称:Source,代码行数:9,代码来源:EObjectConnectorCDOTests.java
示例13: beforeClass
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
AllTests.startCDOServer();
EObjectConnectorParametrizedTests.beforeClass();
IConnector connector = CDOUtils.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":"
+ CDOServer.PORT);
CDOSession session = CDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME);
transaction = CDOUtils.openTransaction(session);
}
开发者ID:ModelWriter,项目名称:Source,代码行数:10,代码来源:EObjectConnectorParametrizedCDOTests.java
示例14: beforeClass
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
AllTests.startCDOServer();
IConnector connector = CDOUtils.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":"
+ CDOServer.PORT);
CDOSession session = CDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME);
transaction = CDOUtils.openTransaction(session);
otherTransaction = CDOUtils.openTransaction(session);
viewConnector.addSessionToCache(transaction);
MappingUtils.getConnectorRegistry().register(viewConnector);
MappingUtils.getConnectorRegistry().register(resourceConnector);
MappingUtils.getConnectorRegistry().register(eObjectConnector);
}
开发者ID:ModelWriter,项目名称:Source,代码行数:16,代码来源:MappingCDOListenerTest.java
示例15: beforeClass
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws ConcurrentAccessException, CommitException {
AllTests.startCDOServer();
IConnector connector = CDOUtils.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":"
+ CDOServer.PORT);
CDOSession session = CDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME);
transaction = CDOUtils.openTransaction(session);
resource = transaction.createResource(CDOContainerProviderTests.class.getCanonicalName());
eObject = MappingPackage.eINSTANCE.getMappingFactory().createBase();
resource.getContents().add(eObject);
transaction.commit();
}
开发者ID:ModelWriter,项目名称:Source,代码行数:13,代码来源:CDOContainerProviderTests.java
示例16: beforeClass
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
AllTests.startCDOServer();
IConnector c = CDOUtils.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":"
+ CDOServer.PORT);
CDOSession session = CDOUtils.openSession(c, CDOServer.REPOSITORY_NAME);
transaction = CDOUtils.openTransaction(session);
connector.addSessionToCache(transaction);
}
开发者ID:ModelWriter,项目名称:Source,代码行数:10,代码来源:CDOViewConnectorTests.java
示例17: beforeClass
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
AllTests.startCDOServer();
IConnector c = CDOUtils.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":"
+ CDOServer.PORT);
CDOSession session = CDOUtils.openSession(c, CDOServer.REPOSITORY_NAME);
transaction = CDOUtils.openTransaction(session);
}
开发者ID:ModelWriter,项目名称:Source,代码行数:9,代码来源:CDOMappingBaseListenerTests.java
示例18: getConnector
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
public IConnector getConnector() {
if (connector == null && container.isActive()) {
connector = JVMUtil.getConnector(container, getName());
}
return connector;
}
开发者ID:emfjson,项目名称:emfjson-samples,代码行数:7,代码来源:CDOServer.java
示例19: extractConnector
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
default Optional<IConnector> extractConnector(CDOView view) {
return Optional.of(view).map(CDOView::getSession).filter(CDONet4jSessionImpl.class::isInstance)
.map(CDONet4jSessionImpl.class::cast).map(CDONet4jSessionImpl::getConnector);
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:5,代码来源:ConnectorExtractorMixin.java
示例20: performFinish
import org.eclipse.net4j.connector.IConnector; //导入依赖的package包/类
@Override
public boolean performFinish() {
String server = remoteHistoryPage.getServer();
String repository = remoteHistoryPage.getRepository();
String languageName = remoteHistoryPage.getLanguageName();
// Enable logging and tracing
OMPlatform.INSTANCE.setDebugging(true);
OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
// Set legacy
CDOUtil.setLegacyModeDefault(true);
// Prepare container
IManagedContainer container = ContainerUtil.createContainer();
Net4jUtil.prepareContainer(container); // Register Net4j factories
TCPUtil.prepareContainer(container); // Register TCP factories
CDONet4jUtil.prepareContainer(container); // Register CDO factories
container.activate();
// Create connector
IConnector connector = TCPUtil.getConnector(container, server); //$NON-NLS-1$
// Create configuration
CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration();
configuration.setConnector(connector);
configuration.setRepositoryName(repository); //$NON-NLS-1$
// Open session
CDOSession session = configuration.openSession();
session.getPackageRegistry().putEPackage(NotationPackage.eINSTANCE);
session.getPackageRegistry().putEPackage(HistoryPackage.eINSTANCE);
// Open transaction
CDOTransaction transaction = session.openTransaction();
// Get or create resource
CDOResource resource = transaction.getOrCreateResource("/" + languageName + ".history"); //$NON-NLS-1$
History initialHistory = createInitialHistoryModel();
resource.getContents().add(initialHistory);
resource = transaction.getOrCreateResource("/" + languageName + ".ecore"); //$NON-NLS-1$
EPackage initialEPackage = EcoreFactory.eINSTANCE.createEPackage();
initialEPackage.setName(languageName);
resource.getContents().add(initialEPackage);
resource = transaction.getOrCreateResource("/" + languageName + ".notation"); //$NON-NLS-1$
Definition initialNotationDefinition = NotationFactory.eINSTANCE.createDefinition();
resource.getContents().add(initialNotationDefinition);
try {
transaction.commit();
} catch (CommitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
session.close();
connector.close();
container.deactivate();
return true;
}
开发者ID:SOM-Research,项目名称:collaboro,代码行数:66,代码来源:NewRemoteHistoryWizard.java
注:本文中的org.eclipse.net4j.connector.IConnector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论