/** * INTERNAL: * Return the database platform currently connected to. * The platform is used for database specific behavior. */ public Platform getDatasourcePlatform() { // PERF: Cache the platform. if (platform == null) { platform = getDatasourceLogin().getDatasourcePlatform(); } return platform; }
/** * PUBLIC: * Connect to the database using the given user name and password. * The additional login information must have been preset in the session's login attribute. * This is the login that should be used if each user has their own id, * but all users share the same database configuration. */ public void login(String userName, String password) throws DatabaseException { getDatasourceLogin().setUserName(userName); getDatasourceLogin().setPassword(password); login(); }
DatabaseSessionConnectionHandler(DatabaseSessionImpl ownerSession, Login login) { this.ownerSession = ownerSession; this.login = login; accessor = login.buildAccessor(); }
Login obj = new Login(); obj.setUsername("user"); obj.setPassword("pw")// what if someone commented this out, or you forget to call it and otherway, Login obj = new Login("user", "pw");
@InitBinder public void initBinder(WebDataBinder binder) { // You can register your validator for bean Login here } @RequestMapping(value = "/log",method = RequestMethod.GET) public String addPersonLogin(@ModelAttribute Login login, HttpServletRequest request) { // To make it work your form fields should have names equals to bean fields names login.getUserName(); login.getPassword(); }
public class Registration{ public Login l; public void doEdit(){ l = new Login(); l.setUserName(""); // setUserName is the Method in Login class to set Username. } }
/** * Shows if native SQL is being used */ public Boolean getUsesNativeSQL() { if (!(getSession().getDatasourceLogin().getDatasourcePlatform() instanceof DatabasePlatform)) { return Boolean.FALSE; } return Boolean.valueOf(getSession().getDatasourceLogin().getPlatform().usesNativeSQL()); }
public ParameterizedSQLBatchWritingMechanism(DatabaseAccessor databaseAccessor) { this.databaseAccessor = databaseAccessor; this.parameters = new ArrayList(); this.maxBatchSize = this.databaseAccessor.getLogin().getPlatform().getMaxBatchWritingSize(); if (this.maxBatchSize == 0) { // the max size was not set on the platform - use default this.maxBatchSize = DatabasePlatform.DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE; } }
@Controller @RequestMapping(value="/login") public class LoginFormController { @ModelAttribute("loginForm") public Login loginForm() { return new Login(); userLogin.setUsername("Admin"); return userLogin; } @RequestMapping(method=RequestMethod.POST) public String submit(@ModelAttribute Login loginForm, BindingResult model) { LoginValidator validator = new LoginValidator(); validator.validate(loginForm, model); if(errors.hasErrors()){ loginForm.setUsername(""); loginForm.setPassword(""); System.out.println("Ne"); return "login"; } else{ System.out.println(loginForm); System.out.println(loginForm.getUsername() + " " + loginForm.getPassword()); return "success"; } } }
login = getOwnerSession().getDatasourceLogin(); setLogin((Login)login.clone()); if (getLogin().shouldUseExternalTransactionController()) { throw ValidationException.invalidSequencingLogin(); ConnectionPool pool = null; if (this.connectionPool == null) { if (getLogin().shouldUseExternalConnectionPooling()) { pool = new ExternalConnectionPool("sequencing", getLogin(), (ServerSession)getOwnerSession()); } else {
Login login = new Login(); login.setUsername("test"); login.setPassword("12345"); login.setLanguage("english");
/** * Connect to the database. * Exceptions are caught and re-thrown as EclipseLink exceptions. */ protected void connectInternal(Login login, AbstractSession session) throws DatabaseException { try{ this.datasourceConnection = login.connectToDatasource(this, session); this.isConnected = true; if(this.customizer != null) { customizer.customize(); } }catch (DatabaseException ex){ //Set the accessor to ensure the retry code has an opportunity to retry. ex.setAccessor(this); throw ex; } }
/** * INTERNAL: * Create a new connection, accessors are used as connections. */ protected Accessor buildConnection() { Login localLogin = (Login)getLogin().clone(); Accessor connection = localLogin.buildAccessor(); connection.connect(localLogin, getOwner()); return connection; }
if (this.session.getDatasourceLogin().shouldUseExternalConnectionPooling()) { pool = new ExternalConnectionPool(poolName, serverSession.getDatasourceLogin(), serverSession); } else { pool = getDatabaseSession().getSequencingControl().getConnectionPool(); if (pool == null) { if (this.session.getDatasourceLogin().shouldUseExternalConnectionPooling()) { pool = new ExternalConnectionPool(poolName, serverSession.getDatasourceLogin(), serverSession); } else { pool = serverSession.getConnectionPool(poolName); if (pool == null) { if (this.session.getDatasourceLogin().shouldUseExternalConnectionPooling()) { pool = new ExternalConnectionPool(poolName, serverSession.getDatasourceLogin(), serverSession); } else { pool.setMaxNumberOfConnections(Integer.parseInt((String)entry.getValue())); } else if (attribute.equals(PersistenceUnitProperties.CONNECTION_POOL_URL)) { pool.setLogin(pool.getLogin().clone()); ((DatabaseLogin)pool.getLogin()).setURL((String)entry.getValue()); } else if (attribute.equals(PersistenceUnitProperties.CONNECTION_POOL_NON_JTA_DATA_SOURCE)) { pool.setLogin(pool.getLogin().clone()); ((DatabaseLogin)pool.getLogin()).useDataSource((String)entry.getValue()); } else if (attribute.equals(PersistenceUnitProperties.CONNECTION_POOL_JTA_DATA_SOURCE)) { pool.setLogin(pool.getLogin().clone()); ((DatabaseLogin)pool.getLogin()).useDataSource((String)entry.getValue()); } else if (attribute.equals(PersistenceUnitProperties.CONNECTION_POOL_USER)) { pool.setLogin(pool.getLogin().clone()); ((DatabaseLogin)pool.getLogin()).setUserName((String)entry.getValue());
@Controller public class LoginController { @RequestMapping(value = "/showLoginForm", method = RequestMethod.GET) public ModelAndView showLoginForm() { System.out.println("In login form..."); ModelAndView mv = new ModelAndView("login"); mv.addObject("loginEntity", new Login()); return mv; } @RequestMapping(value = "/doLogin", method = RequestMethod.POST) public ModelAndView doLogin(@ModelAttribute Login login, BindingResult result) { String userName = login.getUserName(); String password = login.getPassword(); if ("OO7".equals(userName) && "OO7".equals(password)) { return new ModelAndView("forward:success.html"); } else { return new ModelAndView("forward:failure.html"); } } }
/** * INTERNAL: * Return an Oracle defined VPD identifier policy. Used for DDL generation. */ @Override public String getVPDCreationPolicyString(String tableName, AbstractSession session) { String functionName = tableName + "_ident_func"; String schemaName = session.getDatasourceLogin().getUserName(); String policyName = tableName + "_todo_list_policy"; return "\nCALL DBMS_RLS.ADD_POLICY ('" + schemaName + "', '" + tableName + "', '" + policyName + "', '" + schemaName + "', '" + functionName +"', 'select, update, delete')\n"; }
/** * INTERNAL: * Normalize the expression into a printable structure. * Any joins must be added to form a new root. */ public Expression normalize(ExpressionNormalizer normalizer) { //Bug4736461 Only setTableQualifier if getDatasourceLogin().getTableQualifier() is an empty string to make the window much smaller when //DatabaseTable.qualifiedName is reset if (getTable().getTableQualifier().length() == 0 && (normalizer.getSession().getDatasourceLogin().getTableQualifier().length() != 0)) { getTable().setTableQualifier(normalizer.getSession().getDatasourceLogin().getTableQualifier()); } return super.normalize(normalizer); }
/** * INTERNAL: * Clone the query */ public Object clone() { try { ConnectionPolicy clone = (ConnectionPolicy)super.clone(); if (clone.hasLogin()) { clone.setLogin((Login)clone.getLogin().clone()); } return clone; } catch (CloneNotSupportedException e) { return null; } }
this.parent.getEventManager().preMergeUnitOfWorkChangeSet(uowChangeSet); if (!isNestedUnitOfWork && getDatasourceLogin().shouldSynchronizeObjectLevelReadWrite()) {
import javax.swing.JFrame; public class OtherClass extends JFrame { final Login loginClass; private String userName; private String userPassword; public OtherClass(Login e) { loginClass = e; userName = loginClass.getUserName(); userPassword = loginClass.getUserPassword(); System.out.println("Your User Name is: " + userName); System.out.println("Your Password is: " + userPassword); } }