Package org.eclipse.persistence.sessions

Examples of org.eclipse.persistence.sessions.DefaultConnector


            if(isNewUserRequired != null && !isNewUserRequired) {
                isNewPasswordRequired = Boolean.FALSE;
            } else {
                isNewPasswordRequired = isPropertyValueToBeUpdated(login.getPassword(), password);
            }
            DefaultConnector oldDefaultConnector = null;
            if(login.getConnector() instanceof DefaultConnector) {
                oldDefaultConnector = (DefaultConnector)login.getConnector();
            }
            boolean isNewDefaultConnectorRequired = oldDefaultConnector==null && isDefaultConnectorRequired;
            JNDIConnector oldJNDIConnector = null;
            if(login.getConnector() instanceof JNDIConnector) {
                oldJNDIConnector = (JNDIConnector)login.getConnector();
            }
            boolean isNewJNDIConnectorRequired = oldJNDIConnector==null && isJNDIConnectorRequired;
            Boolean isNewDriverRequired = null;
            Boolean isNewConnectionStringRequired = null;
            if(isNewDefaultConnectorRequired) {
                isNewDriverRequired = isPropertyValueToBeUpdated(null, driver);
                isNewConnectionStringRequired = isPropertyValueToBeUpdated(null, connectionString);
            } else {
                if(oldDefaultConnector != null) {
                    isNewDriverRequired = isPropertyValueToBeUpdated(oldDefaultConnector.getDriverClassName(), driver);
                    isNewConnectionStringRequired = isPropertyValueToBeUpdated(oldDefaultConnector.getConnectionString(), connectionString);
                }
            }
            Boolean isNewDataSourceRequired = null;
            if(isNewJNDIConnectorRequired) {
                isNewDataSourceRequired = Boolean.TRUE;
            } else {
                if(oldJNDIConnector != null) {
                    if(dataSource != null) {
                        if(!dataSource.equals(oldJNDIConnector.getDataSource())) {
                            isNewDataSourceRequired = Boolean.TRUE;
                        }
                    } else if(dataSourceName != null) {
                        if(!dataSourceName.equals(oldJNDIConnector.getName())) {
                            isNewDataSourceRequired = Boolean.TRUE;
                        }
                    }
                }
            }
           
            if(isNewUserRequired!=null || isNewPasswordRequired!=null || isNewDriverRequired!=null || isNewConnectionStringRequired!=null || isNewDataSourceRequired) {
                // a new login required - so a new policy required, too.
                if(newPolicy == null) {
                    newPolicy = (ConnectionPolicy)policy.clone();
                }
                // the new policy must have a new login - not to override the existing one in the original ConnectionPolicy that is likely shared.
                DatasourceLogin newLogin = (DatasourceLogin)newPolicy.getLogin();
                // sometimes ConnectionPolicy.clone clones the login , too - sometimes it doesn't.
                if(newPolicy.getLogin() == null || newPolicy.getLogin() == policy.getLogin()) {
                    newLogin = (DatasourceLogin)login.clone();
                    newPolicy.setLogin(newLogin);
                }
                // because it uses a new login the connection policy should not be pooled.
                newPolicy.setPoolName(null);
               
                if(isNewUserRequired!=null) {
                    if(isNewUserRequired) {
                        newLogin.setProperty("user", user);
                    } else {
                        newLogin.getProperties().remove("user");
                    }
                }
                if(isNewPasswordRequired!=null) {
                    if(isNewPasswordRequired) {
                        newLogin.setProperty("password", password);
                    } else {
                        newLogin.getProperties().remove("password");
                    }
                }
                if(isNewDefaultConnectorRequired) {
                    newLogin.setConnector(new DefaultConnector());
                    newLogin.setUsesExternalConnectionPooling(false);
                } else if(isNewJNDIConnectorRequired) {
                    newLogin.setConnector(new JNDIConnector());
                    newLogin.setUsesExternalConnectionPooling(true);
                }
                if(isDefaultConnectorRequired) {
                    DefaultConnector defaultConnector = (DefaultConnector)newLogin.getConnector();
                    if(isNewDriverRequired!=null) {
                        if(isNewDriverRequired) {
                            defaultConnector.setDriverClassName(driver);
                        } else {
                            defaultConnector.setDriverClassName(null);
                        }
                    }
                    if(isNewConnectionStringRequired!=null) {
                        if(isNewConnectionStringRequired) {
                            defaultConnector.setDatabaseURL(connectionString);
                        } else {
                            defaultConnector.setDatabaseURL(null);
                        }
                    }
                } else if(isNewDataSourceRequired != null) {
                    JNDIConnector jndiConnector = (JNDIConnector)newLogin.getConnector();
                    if(isNewDataSourceRequired) {
View Full Code Here


            if(isNewUserRequired != null && !isNewUserRequired) {
                isNewPasswordRequired = Boolean.FALSE;
            } else {
                isNewPasswordRequired = isPropertyValueToBeUpdated(login.getPassword(), password);
            }
            DefaultConnector oldDefaultConnector = null;
            if(login.getConnector() instanceof DefaultConnector) {
                oldDefaultConnector = (DefaultConnector)login.getConnector();
            }
            boolean isNewDefaultConnectorRequired = oldDefaultConnector==null && isDefaultConnectorRequired;
            JNDIConnector oldJNDIConnector = null;
            if(login.getConnector() instanceof JNDIConnector) {
                oldJNDIConnector = (JNDIConnector)login.getConnector();
            }
            boolean isNewJNDIConnectorRequired = oldJNDIConnector==null && isJNDIConnectorRequired;
            Boolean isNewDriverRequired = null;
            Boolean isNewConnectionStringRequired = null;
            if(isNewDefaultConnectorRequired) {
                isNewDriverRequired = isPropertyValueToBeUpdated(null, driver);
                isNewConnectionStringRequired = isPropertyValueToBeUpdated(null, connectionString);
            } else {
                if(oldDefaultConnector != null) {
                    isNewDriverRequired = isPropertyValueToBeUpdated(oldDefaultConnector.getDriverClassName(), driver);
                    isNewConnectionStringRequired = isPropertyValueToBeUpdated(oldDefaultConnector.getConnectionString(), connectionString);
                }
            }
            Boolean isNewDataSourceRequired = null;
            if(isNewJNDIConnectorRequired) {
                isNewDataSourceRequired = Boolean.TRUE;
            } else {
                if(oldJNDIConnector != null) {
                    if(dataSource != null) {
                        if(!dataSource.equals(oldJNDIConnector.getDataSource())) {
                            isNewDataSourceRequired = Boolean.TRUE;
                        }
                    } else if(dataSourceName != null) {
                        if(!dataSourceName.equals(oldJNDIConnector.getName())) {
                            isNewDataSourceRequired = Boolean.TRUE;
                        }
                    }
                }
            }
           
            if(isNewUserRequired!=null || isNewPasswordRequired!=null || isNewDriverRequired!=null || isNewConnectionStringRequired!=null || isNewDataSourceRequired) {
                // a new login required - so a new policy required, too.
                if(newPolicy == null) {
                    newPolicy = (ConnectionPolicy)policy.clone();
                }
                // the new policy must have a new login - not to override the existing one in the original ConnectionPolicy that is likely shared.
                DatasourceLogin newLogin = (DatasourceLogin)newPolicy.getLogin();
                // sometimes ConnectionPolicy.clone clones the login , too - sometimes it doesn't.
                if(newPolicy.getLogin() == null || newPolicy.getLogin() == policy.getLogin()) {
                    newLogin = (DatasourceLogin)login.clone();
                    newPolicy.setLogin(newLogin);
                }
                // because it uses a new login the connection policy should not be pooled.
                newPolicy.setPoolName(null);
               
                if(isNewUserRequired!=null) {
                    if(isNewUserRequired) {
                        newLogin.setProperty("user", user);
                    } else {
                        newLogin.getProperties().remove("user");
                    }
                }
                if(isNewPasswordRequired!=null) {
                    if(isNewPasswordRequired) {
                        newLogin.setProperty("password", password);
                    } else {
                        newLogin.getProperties().remove("password");
                    }
                }
                if(isNewDefaultConnectorRequired) {
                    newLogin.setConnector(new DefaultConnector());
                    newLogin.setUsesExternalConnectionPooling(false);
                } else if(isNewJNDIConnectorRequired) {
                    newLogin.setConnector(new JNDIConnector());
                    newLogin.setUsesExternalConnectionPooling(true);
                }
                if(isDefaultConnectorRequired) {
                    DefaultConnector defaultConnector = (DefaultConnector)newLogin.getConnector();
                    if(isNewDriverRequired!=null) {
                        if(isNewDriverRequired) {
                            defaultConnector.setDriverClassName(driver);
                        } else {
                            defaultConnector.setDriverClassName(null);
                        }
                    }
                    if(isNewConnectionStringRequired!=null) {
                        if(isNewConnectionStringRequired) {
                            defaultConnector.setDatabaseURL(connectionString);
                        } else {
                            defaultConnector.setDatabaseURL(null);
                        }
                    }
                } else if(isNewDataSourceRequired != null) {
                    JNDIConnector jndiConnector = (JNDIConnector)newLogin.getConnector();
                    if(isNewDataSourceRequired) {
View Full Code Here

            if(isNewUserRequired != null && !isNewUserRequired) {
                isNewPasswordRequired = Boolean.FALSE;
            } else {
                isNewPasswordRequired = isPropertyValueToBeUpdated(login.getPassword(), password);
            }
            DefaultConnector oldDefaultConnector = null;
            if(login.getConnector() instanceof DefaultConnector) {
                oldDefaultConnector = (DefaultConnector)login.getConnector();
            }
            boolean isNewDefaultConnectorRequired = oldDefaultConnector==null && isDefaultConnectorRequired;
            JNDIConnector oldJNDIConnector = null;
            if(login.getConnector() instanceof JNDIConnector) {
                oldJNDIConnector = (JNDIConnector)login.getConnector();
            }
            boolean isNewJNDIConnectorRequired = oldJNDIConnector==null && isJNDIConnectorRequired;
            Boolean isNewDriverRequired = null;
            Boolean isNewConnectionStringRequired = null;
            if(isNewDefaultConnectorRequired) {
                isNewDriverRequired = isPropertyValueToBeUpdated(null, driver);
                isNewConnectionStringRequired = isPropertyValueToBeUpdated(null, connectionString);
            } else {
                if(oldDefaultConnector != null) {
                    isNewDriverRequired = isPropertyValueToBeUpdated(oldDefaultConnector.getDriverClassName(), driver);
                    isNewConnectionStringRequired = isPropertyValueToBeUpdated(oldDefaultConnector.getConnectionString(), connectionString);
                }
            }
            Boolean isNewDataSourceRequired = null;
            if(isNewJNDIConnectorRequired) {
                isNewDataSourceRequired = Boolean.TRUE;
            } else {
                if(oldJNDIConnector != null) {
                    if(dataSource != null) {
                        if(!dataSource.equals(oldJNDIConnector.getDataSource())) {
                            isNewDataSourceRequired = Boolean.TRUE;
                        }
                    } else if(dataSourceName != null) {
                        if(!dataSourceName.equals(oldJNDIConnector.getName())) {
                            isNewDataSourceRequired = Boolean.TRUE;
                        }
                    }
                }
            }
           
            if(isNewUserRequired!=null || isNewPasswordRequired!=null || isNewDriverRequired!=null || isNewConnectionStringRequired!=null || isNewDataSourceRequired!=null) {
                // a new login required - so a new policy required, too.
                if(newPolicy == null) {
                    newPolicy = (ConnectionPolicy)policy.clone();
                }
                // the new policy must have a new login - not to override the existing one in the original ConnectionPolicy that is likely shared.
                DatasourceLogin newLogin = (DatasourceLogin)newPolicy.getLogin();
                // sometimes ConnectionPolicy.clone clones the login , too - sometimes it doesn't.
                if(newPolicy.getLogin() == null || newPolicy.getLogin() == policy.getLogin()) {
                    newLogin = (DatasourceLogin)login.clone();
                    newPolicy.setLogin(newLogin);
                }
                // because it uses a new login the connection policy should not be pooled.
                newPolicy.setPoolName(null);
               
                if(isNewUserRequired!=null) {
                    if(isNewUserRequired) {
                        newLogin.setProperty("user", user);
                    } else {
                        newLogin.getProperties().remove("user");
                    }
                }
                if(isNewPasswordRequired!=null) {
                    if(isNewPasswordRequired) {
                        newLogin.setProperty("password", password);
                    } else {
                        newLogin.getProperties().remove("password");
                    }
                }
                if(isNewDefaultConnectorRequired) {
                    newLogin.setConnector(new DefaultConnector());
                    newLogin.setUsesExternalConnectionPooling(false);
                } else if(isNewJNDIConnectorRequired) {
                    newLogin.setConnector(new JNDIConnector());
                    newLogin.setUsesExternalConnectionPooling(true);
                }
                if(isDefaultConnectorRequired) {
                    DefaultConnector defaultConnector = (DefaultConnector)newLogin.getConnector();
                    if(isNewDriverRequired!=null) {
                        if(isNewDriverRequired) {
                            defaultConnector.setDriverClassName(driver);
                        } else {
                            defaultConnector.setDriverClassName(null);
                        }
                    }
                    if(isNewConnectionStringRequired!=null) {
                        if(isNewConnectionStringRequired) {
                            defaultConnector.setDatabaseURL(connectionString);
                        } else {
                            defaultConnector.setDatabaseURL(null);
                        }
                    }
                } else if(isNewDataSourceRequired != null) {
                    JNDIConnector jndiConnector = (JNDIConnector)newLogin.getConnector();
                    if(isNewDataSourceRequired) {
View Full Code Here

            if(isNewUserRequired != null && !isNewUserRequired) {
                isNewPasswordRequired = Boolean.FALSE;
            } else {
                isNewPasswordRequired = isPropertyValueToBeUpdated(login.getPassword(), password);
            }
            DefaultConnector oldDefaultConnector = null;
            if(login.getConnector() instanceof DefaultConnector) {
                oldDefaultConnector = (DefaultConnector)login.getConnector();
            }
            boolean isNewDefaultConnectorRequired = oldDefaultConnector==null && isDefaultConnectorRequired;
            JNDIConnector oldJNDIConnector = null;
            if(login.getConnector() instanceof JNDIConnector) {
                oldJNDIConnector = (JNDIConnector)login.getConnector();
            }
            boolean isNewJNDIConnectorRequired = oldJNDIConnector==null && isJNDIConnectorRequired;
            Boolean isNewDriverRequired = null;
            Boolean isNewConnectionStringRequired = null;
            if(isNewDefaultConnectorRequired) {
                isNewDriverRequired = isPropertyValueToBeUpdated(null, driver);
                isNewConnectionStringRequired = isPropertyValueToBeUpdated(null, connectionString);
            } else {
                if(oldDefaultConnector != null) {
                    isNewDriverRequired = isPropertyValueToBeUpdated(oldDefaultConnector.getDriverClassName(), driver);
                    isNewConnectionStringRequired = isPropertyValueToBeUpdated(oldDefaultConnector.getConnectionString(), connectionString);
                }
            }
            Boolean isNewDataSourceRequired = null;
            if(isNewJNDIConnectorRequired) {
                isNewDataSourceRequired = Boolean.TRUE;
            } else {
                if(oldJNDIConnector != null) {
                    if(dataSource != null) {
                        if(!dataSource.equals(oldJNDIConnector.getDataSource())) {
                            isNewDataSourceRequired = Boolean.TRUE;
                        }
                    } else if(dataSourceName != null) {
                        if(!dataSourceName.equals(oldJNDIConnector.getName())) {
                            isNewDataSourceRequired = Boolean.TRUE;
                        }
                    }
                }
            }
           
            if(isNewUserRequired!=null || isNewPasswordRequired!=null || isNewDriverRequired!=null || isNewConnectionStringRequired!=null || isNewDataSourceRequired!=null) {
                // a new login required - so a new policy required, too.
                if(newPolicy == null) {
                    newPolicy = (ConnectionPolicy)policy.clone();
                }
                // the new policy must have a new login - not to override the existing one in the original ConnectionPolicy that is likely shared.
                DatasourceLogin newLogin = (DatasourceLogin)newPolicy.getLogin();
                // sometimes ConnectionPolicy.clone clones the login , too - sometimes it doesn't.
                if(newPolicy.getLogin() == null || newPolicy.getLogin() == policy.getLogin()) {
                    newLogin = (DatasourceLogin)login.clone();
                    newPolicy.setLogin(newLogin);
                }
                // because it uses a new login the connection policy should not be pooled.
                newPolicy.setPoolName(null);
               
                if(isNewUserRequired!=null) {
                    if(isNewUserRequired) {
                        newLogin.setProperty("user", user);
                    } else {
                        newLogin.getProperties().remove("user");
                    }
                }
                if(isNewPasswordRequired!=null) {
                    if(isNewPasswordRequired) {
                        newLogin.setProperty("password", password);
                    } else {
                        newLogin.getProperties().remove("password");
                    }
                }
                if(isNewDefaultConnectorRequired) {
                    newLogin.setConnector(new DefaultConnector());
                    newLogin.setUsesExternalConnectionPooling(false);
                } else if(isNewJNDIConnectorRequired) {
                    newLogin.setConnector(new JNDIConnector());
                    newLogin.setUsesExternalConnectionPooling(true);
                }
                if(isDefaultConnectorRequired) {
                    DefaultConnector defaultConnector = (DefaultConnector)newLogin.getConnector();
                    if(isNewDriverRequired!=null) {
                        if(isNewDriverRequired) {
                            defaultConnector.setDriverClassName(driver);
                        } else {
                            defaultConnector.setDriverClassName(null);
                        }
                    }
                    if(isNewConnectionStringRequired!=null) {
                        if(isNewConnectionStringRequired) {
                            defaultConnector.setDatabaseURL(connectionString);
                        } else {
                            defaultConnector.setDatabaseURL(null);
                        }
                    }
                } else if(isNewDataSourceRequired != null) {
                    JNDIConnector jndiConnector = (JNDIConnector)newLogin.getConnector();
                    if(isNewDataSourceRequired) {
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.sessions.DefaultConnector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.