本文整理汇总了Java中org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java CDONet4jSessionConfiguration类的具体用法?Java CDONet4jSessionConfiguration怎么用?Java CDONet4jSessionConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CDONet4jSessionConfiguration类属于org.eclipse.emf.cdo.net4j包,在下文中一共展示了CDONet4jSessionConfiguration类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSession
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; //导入依赖的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;
}
示例2: openSession
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; //导入依赖的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;
}
示例3: openSession
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; //导入依赖的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;
}
示例4: getSessionConfiguration
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; //导入依赖的package包/类
public CDOSessionConfiguration getSessionConfiguration() {
CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
configuration.setConnector(getConnector());
configuration.setRepositoryName(getName());
return configuration;
}
示例5: openSession
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; //导入依赖的package包/类
public CDOSession openSession() {
CDONet4jSessionConfiguration config = CDONet4jUtil.createNet4jSessionConfiguration();
config.setConnector(connector);
config.setRepositoryName(repositoryName);
return config.openNet4jSession();
}
示例6: openSession
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; //导入依赖的package包/类
public static CDONet4jSession openSession(String description, String repository) {
// org.eclipse.emf.cdo.util.CDOUtil.setLegacyModeDefault(true);
// Create connector
IConnector connector = TCPUtil.getConnector(createClientContainer(), description);
// Create configuration
CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
// configuration.setSignalTimeout(60000);
configuration.setConnector(connector);
configuration.setRepositoryName(repository);
/* configuration.setIDGenerator(new CDOIDGenerator() {
@Override
public void reset() {
// TODO Auto-generated method stub
}
@Override
public CDOID generateCDOID(EObject object) {
// QTypedObject
if(object instanceof QTypedObject) {
QTypedObject typedObject = (QTypedObject)object;
String id = typedObject.eClass().getClassifierID()+"/"+typedObject.getLibrary()+"/"+typedObject.getName();
return CDOIDUtil.createString(id);
}
//QSystem
else if(object instanceof QSystem) {
QSystem qSystem = (QSystem)object;
String id = qSystem.eClass().getClassifierID()+"/"+qSystem.getName();
return CDOIDUtil.createString(id);
}
else
return UUID.generateCDOID(object);
}
});*/
// Open session
CDONet4jSession session = configuration.openNet4jSession();
for(Entry<String, Object> key: EPackage.Registry.INSTANCE.entrySet()) {
session.getPackageRegistry().put(key.getKey(), key.getValue());
}
// System.out.println(session.options().isPassiveUpdateEnabled());
// CDOCollectionLoadingPolicy policy = CDOUtil.createCollectionLoadingPolicy(10000, 10000);
// session.options().setCollectionLoadingPolicy(policy);
return session;
}
示例7: createCDOSession
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; //导入依赖的package包/类
/**
* Opens a CDOSession with the given connection information.
*
* @param cdoHost
* URL of the CDO repository.
* @param cdoPort
* Port of the CDO repository.
* @param cdoRepo
* Name of the CDO repository.
* @return CdoSession for given connection info.
*/
public static CDOSession createCDOSession(String cdoHost, Integer cdoPort, String cdoRepo) {
String cdoServerURI = "tcp://" + cdoHost + ":" + cdoPort;
IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, cdoServerURI);
CDONet4jSessionConfiguration sessionConfiguration = CDONet4jUtil.createNet4jSessionConfiguration();
sessionConfiguration.setConnector(connector);
sessionConfiguration.setRepositoryName(cdoRepo);
return sessionConfiguration.openNet4jSession();
}