本文整理匯總了Java中org.seasar.framework.container.factory.S2ContainerFactory類的典型用法代碼示例。如果您正苦於以下問題:Java S2ContainerFactory類的具體用法?Java S2ContainerFactory怎麽用?Java S2ContainerFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
S2ContainerFactory類屬於org.seasar.framework.container.factory包,在下文中一共展示了S2ContainerFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
public static void main(String[] args) {
S2Container container = S2ContainerFactory.create(PATH);
container.init();
try {
DepartmentDao dao = (DepartmentDao) container
.getComponent(DepartmentDao.class);
Department dept = new Department();
dept.setDeptno(99);
dept.setDname("foo");
dao.insert(dept);
dept.setDname("bar");
System.out
.println("before update versionNo:" + dept.getVersionNo());
dao.update(dept);
System.out.println("after update versionNo:" + dept.getVersionNo());
dao.delete(dept);
} finally {
container.destroy();
}
}
示例2: getProtocolsTaker
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
/**
* fetch protocol's WebSocket event handler.
* @param protocol protocol name
* @return WebSocket event handler
*/
public static Optional<WebSocketTaker> getProtocolsTaker(final String protocol) {
try {
for (GsolWebsocketTaker conf : ConfigurationLoader.loadAll(GsolWebsocketTaker.class)) {
if (conf.getProtocol().equals(protocol)) {
final S2Container cont = S2ContainerFactory.create(conf.getTaker().getDiconPath());
final Object taker = cont.getComponent(conf.getTaker().getComponentName());
if (taker instanceof WebSocketTaker)
return Optional.of((WebSocketTaker) taker);
}
}
} catch (
final ComponentNotFoundRuntimeException
| TooManyRegistrationRuntimeException
| CyclicReferenceRuntimeException
| ConfigurationException
| ClassNotFoundRuntimeException e) {
Logger.getLogger().error("some configurations are wrong", e);
}
return Optional.absent();
}
示例3: setUpTestContext
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
/**
* テストコンテキストをセットアップします.
*
* @return テストコンテキスト
*/
protected InternalTestContext setUpTestContext() {
if (needsWarmDeploy()) {
S2ContainerFactory.configure("warmdeploy.dicon");
}
InternalTestContext testContext = createTestContext(_testClass);
testContext.setTestMethod(_method);
if (testContext.hasComponentDef(NamingConvention.class)) {
;
} else if (isRegisterNamingConvention(_testClass, _method)) {
NamingConvention namingConvention = new NamingConventionImpl();
testContext.register(namingConvention);
testContext.setNamingConvention(namingConvention);
}
bindTestContext(_testClass, testContext);
return testContext;
}
示例4: configure
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
/**
* このクラスを設定します.
*
* @param configFile
* 設定ファイルのパス
*/
private void configure(final String configFile) {
Env.setFilePath(Seasar2.ENV_PATH);
Env.setValueIfAbsent(Seasar2.ENV_VALUE);
if (!ResourceUtil.isExist(configFile)) {
return;
}
_configurationContainer = S2ContainerFactory.create(configFile);
Configurator configurator;
if (_configurationContainer.hasComponentDef(Configurator.class)) {
configurator =
(Configurator)
_configurationContainer.getComponent(Configurator.class);
} else {
configurator = new Seasar2.DefaultConfigurator();
}
configurator.configure(_configurationContainer);
}
示例5: main
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
public static void main(String[] args) {
S2Container container = S2ContainerFactory.create(PATH);
container.init();
try {
StoredProcedureTestDao dao = (StoredProcedureTestDao) container
.getComponent(StoredProcedureTestDao.class);
System.out.println("SALES_TAX(1000) =" + dao.getSalesTax(1000));
// System.out.println("SALES_TAX2(1000) =" +
// dao.getSalesTax2(1000));
System.out.println("SALES_TAX3(1000) =" + dao.getSalesTax3(1000));
System.out.println("SALES_TAX4(1000) =" + dao.getSalesTax4(1000));
} finally {
container.destroy();
}
}
示例6: main
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
public static void main(String[] args) {
S2Container container = S2ContainerFactory.create(PATH);
container.init();
try {
EmployeeDao dao = (EmployeeDao) container
.getComponent(EmployeeDao.class);
EmployeeSearchCondition dto = new EmployeeSearchCondition();
dto.setJob("CLERK");
List employees = dao.getEmps(dto);
for (int i = 0; i < employees.size(); ++i) {
System.out.println(employees.get(i));
}
} finally {
container.destroy();
}
}
示例7: main
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
public static void main(String[] args) {
S2Container container = S2ContainerFactory.create(PATH);
container.init();
try {
DepartmentManager dao = (DepartmentManager) container
.getComponent(DepartmentManager.class);
Department dept = new Department();
dept.setDeptno(99);
dept.setDname("foo");
dao.generate(dept);
dept.setDname("bar");
System.out
.println("before update versionNo:" + dept.getVersionNo());
dao.change(dept);
System.out.println("after update versionNo:" + dept.getVersionNo());
dao.destory(dept);
} finally {
container.destroy();
}
}
示例8: main
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
/**
* @param args
*/
public static void main(String[] args) {
S2Container container = S2ContainerFactory.create(PATH);
container.init();
try {
TruncateTableDao dao = (TruncateTableDao) container
.getComponent(TruncateTableDao.class);
dao.updateDrop();
dao.updateCreate();
dao.updateTrancate();
} finally {
container.destroy();
}
}
示例9: main
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
public static void main(String[] args) {
S2Container container = S2ContainerFactory.create(PATH);
container.init();
try {
Employee2Dao dao = (Employee2Dao) container
.getComponent(Employee2Dao.class);
List employees = dao.getEmployees("CO");
for (int i = 0; i < employees.size(); ++i) {
System.out.println(employees.get(i));
}
Employee employee = dao.getEmployee(7788);
System.out.println(employee);
} finally {
container.destroy();
}
}
示例10: testCallFunctionDirectory
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
public void testCallFunctionDirectory() throws Exception {
final S2Container container = S2ContainerFactory
.create("dao-derby.dicon");
DataSource dataSource = (DataSource) container
.getComponent(DataSource.class);
Connection conn = dataSource.getConnection();
CallableStatement cstmt = conn
.prepareCall("{? = call FUNCTION_TEST_MAX(?, ?)}");
cstmt.registerOutParameter(1, Types.DOUBLE);
cstmt.setDouble(2, 2.5);
cstmt.setDouble(3, 10.3);
cstmt.execute();
double result = cstmt.getDouble(1);
assertEquals(10.3d, result, 0);
}
示例11: createRootContainer
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
/**
* ルートのコンテナを返します.
*
* @return ルートのコンテナ
*/
protected S2Container createRootContainer() {
S2Container container = null;
ConventionTestIntrospector introspector =
ConventionIntrospectorRepository.get();
String rootDicon = introspector.getRootDicon(_testClass, _method);
if (StringUtil.isEmpty(rootDicon)) {
container = S2ContainerFactory.create(_s2junit4Path);
} else {
container = S2ContainerFactory.create(rootDicon);
S2ContainerFactory.include(container, _s2junit4Path);
}
SingletonS2ContainerFactory.setContainer(container);
return container;
}
示例12: getOriginalClassLoader
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
/**
* オリジナルのクラスローダーを返します.
*
* @return オリジナルのクラスローダー
*/
protected ClassLoader getOriginalClassLoader() {
S2Container container =
S2ContainerFactory.getConfigurationContainer();
if (container == null) {
;
} else if (container.hasComponentDef(ClassLoader.class)) {
return ClassLoader.class.cast(
container.getComponent(ClassLoader.class));
}
return Thread.currentThread().getContextClassLoader();
}
示例13: main
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
public static void main(String[] args) {
S2Container container = S2ContainerFactory.create(PATH);
container.init();
try {
EmployeeDao dao = (EmployeeDao) container
.getComponent(EmployeeDao.class);
List employees = dao.getAllEmployees();
for (int i = 0; i < employees.size(); ++i) {
System.out.println(employees.get(i));
}
Employee employee = dao.getEmployee(7788);
System.out.println(employee);
int count = dao.getCount();
System.out.println("count:" + count);
dao.getEmployeeByJobDeptno(null, null);
dao.getEmployeeByJobDeptno("CLERK", null);
dao.getEmployeeByJobDeptno(null, new Integer(20));
dao.getEmployeeByJobDeptno("CLERK", new Integer(20));
dao.getEmployeeByDeptno(new Integer(20));
dao.getEmployeeByDeptno(null);
System.out.println("updatedRows:" + dao.update(employee));
int[] numbers = dao.getAllEmployeeNumbers();
for (int i = 0; i < numbers.length; i++) {
System.out.println(numbers[i]);
}
} finally {
container.destroy();
}
}
示例14: main
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
public static void main(String[] args) {
S2Container container = S2ContainerFactory.create(PATH);
container.init();
try {
EmployeeAutoDao dao = (EmployeeAutoDao) container
.getComponent(EmployeeAutoDao.class);
dao.getEmployeeByJobDeptno(null, null);
dao.getEmployeeByJobDeptno("CLERK", null);
dao.getEmployeeByJobDeptno(null, new Integer(20));
dao.getEmployeeByJobDeptno("CLERK", new Integer(20));
List employees = dao.getEmployeesBySal(0, 1000);
for (int i = 0; i < employees.size(); ++i) {
System.out.println(employees.get(i));
}
employees = dao.getEmployeeByDname("SALES");
for (int i = 0; i < employees.size(); ++i) {
System.out.println(employees.get(i));
}
EmployeeSearchCondition dto = new EmployeeSearchCondition();
dto.setDname("RESEARCH");
employees = dao.getEmployeesBySearchCondition(dto);
for (int i = 0; i < employees.size(); ++i) {
System.out.println(employees.get(i));
}
Employee employee = dao.getEmployeeByEmpno(7788);
System.out.println("before timestamp:" + employee.getTimestamp());
dao.update(employee);
System.out.println("after timestamp:" + employee.getTimestamp());
} finally {
container.destroy();
}
}
示例15: main
import org.seasar.framework.container.factory.S2ContainerFactory; //導入依賴的package包/類
public static void main(String[] args) {
S2Container container = S2ContainerFactory.create(PATH);
container.init();
try {
NoPkTableDao dao = (NoPkTableDao) container
.getComponent(NoPkTableDao.class);
NoPkTable[] beans = dao.selectAll();
for (int i = 0; i < beans.length; i++) {
System.out.println(beans[i]);
}
} finally {
container.destroy();
}
}