/** * TopLink generated method. <b>WARNING</b>: This code was generated by an automated tool. Any * changes will be lost when the code is re-generated */ protected void applyLOGIN() { org.eclipse.persistence.sessions.DatabaseLogin login = new org.eclipse.persistence.sessions.DatabaseLogin(); login.setDriverClassName("sun.jdbc.odbc.JdbcOdbcDriver"); login.setConnectionString("jdbc:odbc:MSACCESS"); login.setPlatformClassName("org.eclipse.persistence.platform.database.AccessPlatform"); }
@Override public void customize(Session session) throws Exception { DatabaseLogin databaseLogin = session.getLogin(); // Original Sequence databaseLogin.addSequence(new ElinkUuidGenerator("OPERATOR_ID")); // Original converter // databaseLogin.addStructConverter(); // Other Setting. 様々な機能ON/OFF // databaseLogin.cacheAllStatements(); // databaseLogin.setDefaultNullValue(type, value); }
/** * Allows to override the session login. * * @return the DatabaseLogin to use for the session */ protected DatabaseLogin buildLogin() { DatabaseLogin login = null; if (this.loginSpec != null) { login = new DatabaseLogin(); String url = this.loginSpec.getUrl(this.getProject()); String driverclass = this.loginSpec.getDriverClass(this.getProject()); String user = this.loginSpec.getUser(this.getProject()); String password = this.loginSpec.getPassword(this.getProject()); if (url != "") login.setDatabaseURL(url); if (driverclass != "") login.setDriverClassName(driverclass); if (user != "") login.setUserName(user); if (password != "") login.setPassword(password); } return login; }
public void applyLogin() { DatabaseLogin login = new DatabaseLogin(); login.usePlatform(OracleDBPlatformHelper.getInstance().getOracle9Platform()); login.setDriverClassName("oracle.jdbc.OracleDriver"); login.setConnectionString("jdbc:oracle:thin:@tlsvrdb5.ca.oracle.com:TOPLINK"); login.setUserName("qa9"); login.setEncryptedPassword("BB742416276274A46959A54867978929"); // Configuration Properties. setDatasourceLogin(login); }
public void setup() { oldSession = getSession(); DatabaseLogin login = (DatabaseLogin) oldSession.getLogin().clone(); if (login.getConnector() instanceof JNDIConnector) { login.setConnector(new JNDIConnector("jdbc/OracleCoreAQ")); } else { login.setUserName("aquser"); login.setPassword("aquser"); } DatabaseSession session = new Project(login).createDatabaseSession(); session.setSessionLog(getSession().getSessionLog()); try { session.login(); } catch (Exception exception) { throw new TestProblemException( "Database needs to be setup for AQ, with the aquser", exception); } /** * to setup aquser, need to execute, 1 - login as sys (default password is password) - login as * scott tiger connect sys/password@james as sysdba * * <p>2 - might need to install aq procesures? - in sqlplus * - @@<orahome>\ora92\rdbms\admin\catproc.sql * * <p>3 - create a aq user (i.e aquser) grant connect, resource , aq_administrator_role to * aquser identified by aquser grant execute on dbms_aq to aquser grant execute on dbms_aqadm to * aquser grant execute on dbms_lock to aquser connect aquser/aquser */ try { session.executeNonSelectingCall( new SQLCall("begin DBMS_AQADM.STOP_QUEUE (queue_name => 'order_queue'); end;")); } catch (Exception notThere) { } try { session.executeNonSelectingCall( new SQLCall("begin DBMS_AQADM.DROP_QUEUE (queue_name => 'order_queue'); end;")); } catch (Exception notThere) { } try { session.executeNonSelectingCall( new SQLCall( "begin DBMS_AQADM.DROP_QUEUE_TABLE (queue_table => 'order_queue_table'); end;")); } catch (Exception notThere) { } try { session.executeNonSelectingCall( new SQLCall("begin DBMS_AQADM.STOP_QUEUE (queue_name => 'order_topic'); end;")); } catch (Exception notThere) { } try { session.executeNonSelectingCall( new SQLCall("begin DBMS_AQADM.DROP_QUEUE (queue_name => 'order_topic'); end;")); } catch (Exception notThere) { } try { session.executeNonSelectingCall( new SQLCall( "begin DBMS_AQADM.DROP_QUEUE_TABLE (queue_table => 'order_topic_table'); end;")); } catch (Exception notThere) { } try { session.executeNonSelectingCall( new SQLCall("begin DBMS_AQADM.STOP_QUEUE (queue_name => 'raw_order_queue'); end;")); } catch (Exception notThere) { } try { session.executeNonSelectingCall( new SQLCall("begin DBMS_AQADM.DROP_QUEUE (queue_name => 'raw_order_queue'); end;")); } catch (Exception notThere) { } try { session.executeNonSelectingCall( new SQLCall( "begin DBMS_AQADM.DROP_QUEUE_TABLE (queue_table => 'raw_order_queue_table'); end;")); } catch (Exception notThere) { } session.executeNonSelectingCall( new SQLCall( "begin DBMS_AQADM.CREATE_QUEUE_TABLE (queue_table => 'order_queue_table', multiple_consumers => FALSE, queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE'); end;")); session.executeNonSelectingCall( new SQLCall( "begin DBMS_AQADM.CREATE_QUEUE (queue_name => 'order_queue', queue_table => 'order_queue_table'); end;")); session.executeNonSelectingCall( new SQLCall("begin DBMS_AQADM.START_QUEUE (queue_name => 'order_queue'); end;")); session.executeNonSelectingCall( new SQLCall( "begin DBMS_AQADM.CREATE_QUEUE_TABLE (queue_table => 'order_topic_table', multiple_consumers => TRUE, queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE'); end;")); session.executeNonSelectingCall( new SQLCall( "begin DBMS_AQADM.CREATE_QUEUE (queue_name => 'order_topic', queue_table => 'order_topic_table'); end;")); session.executeNonSelectingCall( new SQLCall("begin DBMS_AQADM.START_QUEUE (queue_name => 'order_topic'); end;")); session.executeNonSelectingCall( new SQLCall( "begin DBMS_AQADM.CREATE_QUEUE_TABLE (queue_table => 'raw_order_queue_table', multiple_consumers => FALSE, queue_payload_type => 'RAW'); end;")); session.executeNonSelectingCall( new SQLCall( "begin DBMS_AQADM.CREATE_QUEUE (queue_name => 'raw_order_queue', queue_table => 'raw_order_queue_table'); end;")); session.executeNonSelectingCall( new SQLCall("begin DBMS_AQADM.START_QUEUE (queue_name => 'raw_order_queue'); end;")); session = XMLProjectReader.read( "org/eclipse/persistence/testing/models/order/eis/aq/order-project.xml", getClass().getClassLoader()) .createDatabaseSession(); session.setSessionLog(getSession().getSessionLog()); // String url = oldSession.getLogin().getConnectionString(); String url; try { url = ((AbstractSession) getSession()).getAccessor().getConnection().getMetaData().getURL(); } catch (java.sql.SQLException se) { se.printStackTrace(); throw new TestErrorException("There is SQLException"); } EISLogin eisLogin = (EISLogin) session.getDatasourceLogin(); eisLogin.setConnectionSpec(new AQEISConnectionSpec()); eisLogin.setProperty(AQEISConnectionSpec.URL, url); eisLogin.setUserName("aquser"); eisLogin.setPassword("aquser"); session.login(); getExecutor().setSession(session); }
@Override public void buildSessions() { XRDynamicClassLoader xrdecl = new XRDynamicClassLoader(parentClassLoader); DatasourceLogin login = new DatabaseLogin(); login.setUserName(username); login.setPassword(password); ((DatabaseLogin) login).setConnectionString(url); ((DatabaseLogin) login).setDriverClassName(DATABASE_PLATFORM); Platform platform = builder.getDatabasePlatform(); ConversionManager conversionManager = platform.getConversionManager(); if (conversionManager != null) { conversionManager.setLoader(xrdecl); } login.setDatasourcePlatform(platform); ((DatabaseLogin) login).bindAllParameters(); ((DatabaseLogin) login).setUsesStreamsForBinding(true); Project orProject = null; if (DBWS_OR_STREAM.size() != 0) { MetadataProcessor processor = new MetadataProcessor( new XRPersistenceUnitInfo(xrdecl), new DatabaseSessionImpl(login), xrdecl, false, true, false, false, false, null, null); processor.setMetadataSource( new JPAMetadataSource(xrdecl, new StringReader(DBWS_OR_STREAM.toString()))); PersistenceUnitProcessor.processORMetadata( processor, true, PersistenceUnitProcessor.Mode.ALL); processor.addNamedQueries(); orProject = processor.getProject().getProject(); } else { orProject = new Project(); } orProject.setName(builder.getProjectName().concat(OR_PRJ_SUFFIX)); orProject.setDatasourceLogin(login); DatabaseSession databaseSession = orProject.createDatabaseSession(); if ("off".equalsIgnoreCase(builder.getLogLevel())) { databaseSession.dontLogMessages(); } else { databaseSession.setLogLevel( AbstractSessionLog.translateStringToLoggingLevel(builder.getLogLevel())); } xrService.setORSession(databaseSession); orProject.convertClassNamesToClasses(xrdecl); Project oxProject = null; Map<String, OXMMetadataSource> metadataMap = new HashMap<String, OXMMetadataSource>(); StreamSource xml = new StreamSource(new StringReader(DBWS_OX_STREAM.toString())); try { JAXBContext jc = JAXBContext.newInstance(XmlBindingsModel.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); JAXBElement<XmlBindingsModel> jaxbElt = unmarshaller.unmarshal(xml, XmlBindingsModel.class); XmlBindingsModel model = jaxbElt.getValue(); for (XmlBindings xmlBindings : model.getBindingsList()) { metadataMap.put(xmlBindings.getPackageName(), new OXMMetadataSource(xmlBindings)); } } catch (JAXBException jaxbex) { jaxbex.printStackTrace(); } Map<String, Map<String, OXMMetadataSource>> properties = new HashMap<String, Map<String, OXMMetadataSource>>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataMap); try { org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext jCtx = org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory.createContextFromOXM( parentClassLoader, properties); oxProject = jCtx.getXMLContext().getSession(0).getProject(); } catch (JAXBException e) { e.printStackTrace(); } ((XMLLogin) oxProject.getDatasourceLogin()).setPlatformClassName(DOM_PLATFORM_CLASSNAME); ((XMLLogin) oxProject.getDatasourceLogin()).setEqualNamespaceResolvers(false); prepareDescriptors(oxProject, orProject, xrdecl); ProjectHelper.fixOROXAccessors(orProject, oxProject); xrService.setORSession(databaseSession); xrService.setXMLContext(new XMLContext(oxProject)); xrService.setOXSession(xrService.getXMLContext().getSession(0)); }