/** * <p>INTERNAL: */ public void loginSessions() { ((DatabaseSession)xrService.orSession).login(); // the oxSession is already logged-in... }
/** * <p>INTERNAL: */ public void loginSessions() { ((DatabaseSession)xrService.orSession).login(); // the oxSession is already logged-in... }
@Override protected void setupSession(DatabaseSession session) { session.setLogLevel(SessionLog.OFF); session.login(); setupDocumentPreservationPolicy(session); }
@Override protected void setupSession(DatabaseSession session) { session.setLogLevel(SessionLog.OFF); session.login(); setupDocumentPreservationPolicy(session); }
public XMLContext(Collection projects, ClassLoader classLoader) { Iterator iterator = projects.iterator(); sessions = new ArrayList(projects.size()); descriptorsByQName = new HashMap(); descriptorsByGlobalType = new HashMap(); while(iterator.hasNext()) { Project project = (Project)iterator.next(); if ((project.getDatasourceLogin() == null) || !(project.getDatasourceLogin().getDatasourcePlatform() instanceof XMLPlatform)) { XMLPlatform platform = new SAXPlatform(); platform.getConversionManager().setLoader(classLoader); project.setLogin(new XMLLogin(platform)); } DatabaseSession session = project.createDatabaseSession(); // turn logging for this session off and leave the global session up // Note: setting level to SEVERE or WARNING will printout stacktraces for expected exceptions session.setLogLevel(SessionLog.OFF); // dont turn off global static logging //AbstractSessionLog.getLog().log(AbstractSessionLog.INFO, "ox_turn_global_logging_off", getClass()); //AbstractSessionLog.getLog().setLevel(AbstractSessionLog.OFF); setupDocumentPreservationPolicy(session); session.login(); sessions.add(session); storeXMLDescriptorsByQName(session); } }
/** * Add one or more EntityType instances to a session and optionally generate * needed tables with or without FK constraints. * * @param session * @param createMissingTables * @param generateFKConstraints * @param types */ public void addTypes(boolean createMissingTables, boolean generateFKConstraints, DynamicType... types) { if (types == null || types.length == 0) { throw new IllegalArgumentException("No types provided"); } Collection<ClassDescriptor> descriptors = new ArrayList<ClassDescriptor>(types.length); for (int index = 0; index < types.length; index++) { descriptors.add(types[index].getDescriptor()); if (!types[index].getDescriptor().requiresInitialization()) { types[index].getDescriptor().getInstantiationPolicy().initialize((AbstractSession) session); } } session.addDescriptors(descriptors); if (createMissingTables) { if (!getSession().isConnected()) { getSession().login(); } new DynamicSchemaManager(session).createTables(generateFKConstraints, types); } }
getSession().login();
session.login(); sessions.add(session); descriptorsByQName = new HashMap();
/** * INTERNAL: Add and initialize a new session to the list of sessions * associated with this XMLContext. */ public void addSession(DatabaseSession sessionToAdd) { if ((sessionToAdd.getDatasourceLogin() == null) || !(sessionToAdd.getDatasourceLogin().getDatasourcePlatform() instanceof XMLPlatform)) { XMLPlatform platform = new SAXPlatform(); sessionToAdd.setLogin(new XMLLogin(platform)); } DatabaseSession session = sessionToAdd.getProject().createDatabaseSession(); if (sessionToAdd.getEventManager().hasListeners()) { List listeners = sessionToAdd.getEventManager().getListeners(); int listenersSize = listeners.size(); for (int x = 0; x < listenersSize; x++) { session.getEventManager().addListener((SessionEventListener) listeners.get(x)); } } session.setExceptionHandler(sessionToAdd.getExceptionHandler()); session.setLogLevel(SessionLog.OFF); this.setupDocumentPreservationPolicy(session); session.login(); sessions.add(session); storeXMLDescriptorsByQName(session); }
private DatabaseSession buildSession(String sessionName, ClassLoader classLoader, XMLSessionConfigLoader sessionLoader) throws XMLMarshalException { DatabaseSession dbSession; if (classLoader != null) { dbSession = (DatabaseSession) SessionManager.getManager().getSession(sessionLoader, sessionName, classLoader, false, true); } else { dbSession = (DatabaseSession) SessionManager.getManager().getSession(sessionLoader, sessionName, PrivilegedAccessHelper.privilegedGetClassLoaderForClass(this.getClass()), false, false, false); } if ((dbSession.getDatasourceLogin() == null) || !(dbSession.getDatasourceLogin().getDatasourcePlatform() instanceof XMLPlatform)) { XMLPlatform platform = new SAXPlatform(); dbSession.setLogin(new XMLLogin(platform)); } DatabaseSession session = dbSession.getProject().createDatabaseSession(); if (dbSession.getEventManager().hasListeners()) { List<SessionEventListener> listeners = dbSession.getEventManager().getListeners(); int listenersSize = listeners.size(); for (int x = 0; x < listenersSize; x++) { session.getEventManager().addListener(listeners.get(x)); } } session.setExceptionHandler(dbSession.getExceptionHandler()); session.setLogLevel(SessionLog.OFF); setupDocumentPreservationPolicy(session); session.login(); return session; }
private DatabaseSession buildSession(String sessionName, ClassLoader classLoader, XMLSessionConfigLoader sessionLoader) throws XMLMarshalException { DatabaseSession dbSession; if (classLoader != null) { dbSession = (DatabaseSession) SessionManager.getManager().getSession(sessionLoader, sessionName, classLoader, false, true); } else { dbSession = (DatabaseSession) SessionManager.getManager().getSession(sessionLoader, sessionName, PrivilegedAccessHelper.privilegedGetClassLoaderForClass(this.getClass()), false, false, false); } if ((dbSession.getDatasourceLogin() == null) || !(dbSession.getDatasourceLogin().getDatasourcePlatform() instanceof XMLPlatform)) { XMLPlatform platform = new SAXPlatform(); dbSession.setLogin(new XMLLogin(platform)); } DatabaseSession session = dbSession.getProject().createDatabaseSession(); if (dbSession.getEventManager().hasListeners()) { List<SessionEventListener> listeners = dbSession.getEventManager().getListeners(); int listenersSize = listeners.size(); for (int x = 0; x < listenersSize; x++) { session.getEventManager().addListener(listeners.get(x)); } } session.setExceptionHandler(dbSession.getExceptionHandler()); session.setLogLevel(SessionLog.OFF); setupDocumentPreservationPolicy(session); session.login(); return session; }
private DatabaseSession buildSession(String sessionName, ClassLoader classLoader, XMLSessionConfigLoader sessionLoader) throws XMLMarshalException { DatabaseSession dbSession; if (classLoader != null) { dbSession = (DatabaseSession) SessionManager.getManager().getSession(sessionLoader, sessionName, classLoader, false, true); } else { dbSession = (DatabaseSession) SessionManager.getManager().getSession(sessionLoader, sessionName, PrivilegedAccessHelper.privilegedGetClassLoaderForClass(this.getClass()), false, false, false); } if ((dbSession.getDatasourceLogin() == null) || !(dbSession.getDatasourceLogin().getDatasourcePlatform() instanceof XMLPlatform)) { XMLPlatform platform = new SAXPlatform(); dbSession.setLogin(new XMLLogin(platform)); } DatabaseSession session = dbSession.getProject().createDatabaseSession(); if (dbSession.getEventManager().hasListeners()) { List listeners = dbSession.getEventManager().getListeners(); int listenersSize = listeners.size(); for (int x = 0; x < listenersSize; x++) { session.getEventManager().addListener((SessionEventListener) listeners.get(x)); } } session.setExceptionHandler(dbSession.getExceptionHandler()); session.setLogLevel(SessionLog.OFF); setupDocumentPreservationPolicy(session); session.login(); return session; }
((DatabaseSession)session).login();
((DatabaseSession)session).login();
((DatabaseSession)session).login();