本文整理匯總了Java中org.eclipse.net4j.util.container.IPluginContainer類的典型用法代碼示例。如果您正苦於以下問題:Java IPluginContainer類的具體用法?Java IPluginContainer怎麽用?Java IPluginContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IPluginContainer類屬於org.eclipse.net4j.util.container包,在下文中一共展示了IPluginContainer類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import org.eclipse.net4j.util.container.IPluginContainer; //導入依賴的package包/類
/**
* Starts the CDO server.
*/
public void start() {
if (repository == null) {
OMPlatform.INSTANCE.setDebugging(false);
OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
Net4jUtil.prepareContainer(IPluginContainer.INSTANCE); // Prepare the Net4j kernel
TCPUtil.prepareContainer(IPluginContainer.INSTANCE); // Prepare the TCP support
CDONet4jServerUtil.prepareContainer(IPluginContainer.INSTANCE); // Prepare the CDO server
// OCLQueryHandler.prepareContainer(IPluginContainer.INSTANCE); // Prepare OCL queries
repository = createRepository();
if (withAuth) {
InternalSessionManager sessionManager = (InternalSessionManager)CDOServerUtil
.createSessionManager();
IUserManager userManager = new UserManager();
userManager.addUser(USER_NAME, PASSWORD.toCharArray());
sessionManager.setUserManager(userManager);
((Repository)repository).setSessionManager(sessionManager);
}
CDOServerUtil.addRepository(IPluginContainer.INSTANCE, repository);
Net4jUtil.getAcceptor(IPluginContainer.INSTANCE, PROTOCOL, IP + ":" + PORT);
}
}
示例2: stop
import org.eclipse.net4j.util.container.IPluginContainer; //導入依賴的package包/類
/**
* Stops the CDO server.
*/
public void stop() {
LifecycleUtil.deactivate(repository);
LifecycleUtil.deactivate(IPluginContainer.INSTANCE);
repository = null;
}
示例3: start
import org.eclipse.net4j.util.container.IPluginContainer; //導入依賴的package包/類
@LevelStarted
public void start(DataSourceFactory dataSourceFactory) throws SQLException {
try {
OMPlatform.INSTANCE.setDebugging(true);
OMPlatform.INSTANCE.addLogHandler(org.eclipse.net4j.util.om.log.PrintLogHandler.CONSOLE);
OMPlatform.INSTANCE.addTraceHandler(org.eclipse.net4j.util.om.trace.PrintTraceHandler.CONSOLE);
Net4jUtil.prepareContainer(IPluginContainer.INSTANCE); // Prepare the Net4j kernel
TCPUtil.prepareContainer(IPluginContainer.INSTANCE); // Prepare the TCP support
CDONet4jServerUtil.prepareContainer(IPluginContainer.INSTANCE); // Prepare the CDO server
CDOStoreConfig storeConfig = (CDOStoreConfig) getConfig();
// adapter -> Adapter definito in db-core-cdo.xmi (per es. MySQLAdapter)
IDBAdapter adapter = DBUtil.getDBAdapter(storeConfig.getAdapter());
// provider
Properties dataSourceProps = new Properties();
dataSourceProps.put("class", storeConfig.getDriver());
dataSourceProps.put("url", storeConfig.getUrl());
dataSourceProps.put("user", storeConfig.getCredentials().getUser());
dataSourceProps.put("password", storeConfig.getCredentials().getPassword());
// TODO retrieve dataFactory by adapter
DataSource dataSource = dataSourceFactory.createDataSource(dataSourceProps);
IDBConnectionProvider provider = DBUtil.createConnectionProvider(dataSource);
// store
Map<String, String> databaseProps = new HashMap<String, String>();
databaseProps.put("readerPoolCapacity", "10");
databaseProps.put("writerPoolCapacity", "10");
// strategy
IMappingStrategy strategy = createMappingStrategy();
Map<String, String> mappingProps = new HashMap<String, String>();
mappingProps.put("toManyReferences", "ONE_TABLE_PER_CLASS");
mappingProps.put("qualifiedNames", "false");
strategy.setProperties(mappingProps);
IDBStore store = CDODBUtil.createStore(strategy, adapter, provider, databaseProps);
strategy.setStore(store);
// repository
Map<String, String> repositoryProps = new HashMap<String, String>();
repositoryProps.put("overrideUUID", "");
repositoryProps.put("supportingAudits", "false");
repositoryProps.put("supportingBranches", "false");
IRepository repository = CDOServerUtil.createRepository(storeConfig.getRepository(), store, repositoryProps);
CDOServerUtil.addRepository(IPluginContainer.INSTANCE, repository);
QServerSocketConfig socketConfig = storeConfig.getSocketConfig();
Net4jUtil.getAcceptor(IPluginContainer.INSTANCE, "tcp", socketConfig.getAddress()+":"+socketConfig.getPort());
System.out.println("CDO activated");
}
catch(Exception e) {
e.printStackTrace();
}
}
示例4: createCDOSession
import org.eclipse.net4j.util.container.IPluginContainer; //導入依賴的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();
}