private void initialize(Map<String, Boolean> parserFeatures) { DatabaseSession session = xmlContext.getSession(0); XMLPlatform xmlPlatform = (XMLPlatform)session.getDatasourceLogin().getDatasourcePlatform(); platformUnmarshaller = xmlPlatform.newPlatformUnmarshaller(this, parserFeatures); platformUnmarshaller.setWhitespacePreserving(false); unmarshalProperties = new Properties(); // Waiting on XDK to fix bug #3697940 to enable this code //initializeSchemas(); setValidationMode(NONVALIDATING); }
public XMLConversionManager getXmlConversionManager() { return (XMLConversionManager) getXmlContext().getSession().getDatasourceLogin().getDatasourcePlatform().getConversionManager(); }
/** * INTERNAL: * Clears statement cache of the wrapper connection. * Required by Oracle proxy authentication: currently connection statement cache * becomes invalid on switching to/from proxy session. * This method is called by OracleJDBC_10_1_0_2ProxyConnectionCustomizer * before opening proxy session and before closing it. */ public void clearStatementCache(java.sql.Connection connection) { Platform platform = getDatabaseSession().getDatasourceLogin().getDatasourcePlatform(); if(platform.isOracle()) { ((OraclePlatform)platform).clearOracleConnectionCache(connection); } } }
/** * INTERNAL: * Clears statement cache of the wrapper connection. * Required by Oracle proxy authentication: currently connection statement cache * becomes invalid on switching to/from proxy session. * This method is called by OracleJDBC_10_1_0_2ProxyConnectionCustomizer * before opening proxy session and before closing it. */ public void clearStatementCache(java.sql.Connection connection) { Platform platform = getDatabaseSession().getDatasourceLogin().getDatasourcePlatform(); if(platform.isOracle()) { ((OraclePlatform)platform).clearOracleConnectionCache(connection); } } }
public XMLConversionManager getXmlConversionManager() { return (XMLConversionManager) getXmlContext().getSession().getDatasourceLogin().getDatasourcePlatform().getConversionManager(); }
/** * INTERNAL: * Clears statement cache of the wrapper connection. * Required by Oracle proxy authentication: currently connection statement cache * becomes invalid on switching to/from proxy session. * This method is called by OracleJDBC_10_1_0_2ProxyConnectionCustomizer * before opening proxy session and before closing it. */ public void clearStatementCache(java.sql.Connection connection) { Platform platform = getDatabaseSession().getDatasourceLogin().getDatasourcePlatform(); if(platform.isOracle()) { ((OraclePlatform)platform).clearOracleConnectionCache(connection); } } }
/** * INTERNAL: This method is used to unwrap the oracle connection wrapped by * the application server. TopLink needs this unwrapped connection for certain * Oracle Specific support. (ie TIMESTAMPTZ) */ public java.sql.Connection unwrapConnection(java.sql.Connection connection){ Platform platform = getDatabaseSession().getDatasourceLogin().getDatasourcePlatform(); if(platform.isOracle() && ((OraclePlatform)platform).canUnwrapOracleConnection()) { return ((OraclePlatform)platform).unwrapOracleConnection(connection); } else { return super.unwrapConnection(connection); } }
/** * INTERNAL: This method is used to unwrap the oracle connection wrapped by * the application server. TopLink needs this unwrapped connection for certain * Oracle Specific support. (ie TIMESTAMPTZ) */ public java.sql.Connection unwrapConnection(java.sql.Connection connection){ Platform platform = getDatabaseSession().getDatasourceLogin().getDatasourcePlatform(); if(platform.isOracle() && ((OraclePlatform)platform).canUnwrapOracleConnection()) { return ((OraclePlatform)platform).unwrapOracleConnection(connection); } else { return super.unwrapConnection(connection); } }
/** * INTERNAL: This method is used to unwrap the oracle connection wrapped by * the application server. TopLink needs this unwrapped connection for certain * Oracle Specific support. (ie TIMESTAMPTZ) */ public java.sql.Connection unwrapConnection(java.sql.Connection connection){ Platform platform = getDatabaseSession().getDatasourceLogin().getDatasourcePlatform(); if(platform.isOracle() && ((OraclePlatform)platform).canUnwrapOracleConnection()) { return ((OraclePlatform)platform).unwrapOracleConnection(connection); } else { return super.unwrapConnection(connection); } }
/** * INTERNAL: Add and initialize a new session to the list of sessions * associated with this XMLContext. */ private 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<SessionEventListener> listeners = sessionToAdd.getEventManager().getListeners(); int listenersSize = listeners.size(); for (int x = 0; x < listenersSize; x++) { session.getEventManager().addListener(listeners.get(x)); } } session.setExceptionHandler(sessionToAdd.getExceptionHandler()); session.setLogLevel(SessionLog.OFF); setupSession(session); if(null == sessions) { sessions = new ArrayList<DatabaseSession>(); } if(null != this.session) { sessions.add(this.session); } sessions.add(session); storeDescriptorsByQName(session); }
/** * INTERNAL: Add and initialize a new session to the list of sessions * associated with this XMLContext. */ private 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<SessionEventListener> listeners = sessionToAdd.getEventManager().getListeners(); int listenersSize = listeners.size(); for (int x = 0; x < listenersSize; x++) { session.getEventManager().addListener(listeners.get(x)); } } session.setExceptionHandler(sessionToAdd.getExceptionHandler()); session.setLogLevel(SessionLog.OFF); setupSession(session); if(null == sessions) { sessions = new ArrayList<DatabaseSession>(); } if(null != this.session) { sessions.add(this.session); } sessions.add(session); storeDescriptorsByQName(session); }
private void setupDocumentPreservationPolicy(DatabaseSession session) { XMLLogin login = (XMLLogin) session.getDatasourceLogin(); if (login.getDocumentPreservationPolicy() == null) { Iterator iterator = session.getProject().getOrderedDescriptors().iterator(); while (iterator.hasNext()) { Descriptor xmlDescriptor = (Descriptor) iterator.next(); if (xmlDescriptor.shouldPreserveDocument()) { login.setDocumentPreservationPolicy(new DescriptorLevelDocumentPreservationPolicy()); break; } } } if (login.getDocumentPreservationPolicy() == null) { login.setDocumentPreservationPolicy(new NoDocumentPreservationPolicy()); } login.getDocumentPreservationPolicy().initialize(context); if (login.getDocumentPreservationPolicy().shouldPreserveDocument() && !hasDocumentPreservation) { hasDocumentPreservation = true; } }
public void setupDocumentPreservationPolicy(DatabaseSession session) { XMLLogin login = (XMLLogin) session.getDatasourceLogin(); if (login.getDocumentPreservationPolicy() == null) { Iterator iterator = session.getProject().getOrderedDescriptors().iterator(); while (iterator.hasNext()) { XMLDescriptor xmlDescriptor = (XMLDescriptor) iterator.next(); if (xmlDescriptor.shouldPreserveDocument()) { login.setDocumentPreservationPolicy(new DescriptorLevelDocumentPreservationPolicy()); break; } } } if (login.getDocumentPreservationPolicy() == null) { login.setDocumentPreservationPolicy(new NoDocumentPreservationPolicy()); } login.getDocumentPreservationPolicy().initialize(this); if (login.getDocumentPreservationPolicy().shouldPreserveDocument() && !hasDocumentPreservation) { hasDocumentPreservation = true; } }
private void setupDocumentPreservationPolicy(DatabaseSession session) { XMLLogin login = (XMLLogin) session.getDatasourceLogin(); if (login.getDocumentPreservationPolicy() == null) { Iterator iterator = session.getProject().getOrderedDescriptors().iterator(); while (iterator.hasNext()) { Descriptor xmlDescriptor = (Descriptor) iterator.next(); if (xmlDescriptor.shouldPreserveDocument()) { login.setDocumentPreservationPolicy(new DescriptorLevelDocumentPreservationPolicy()); break; } } } if (login.getDocumentPreservationPolicy() == null) { login.setDocumentPreservationPolicy(new NoDocumentPreservationPolicy()); } login.getDocumentPreservationPolicy().initialize(context); if (login.getDocumentPreservationPolicy().shouldPreserveDocument() && !hasDocumentPreservation) { hasDocumentPreservation = true; } }
/** * 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; }
private JAXBContextState createContextState(Generator generator, JaxbClassLoader loader, Type[] typesToBeBound, Map properties) throws Exception { CoreProject proj = generator.generateProject(); ConversionManager conversionManager = null; if (classLoader != null) { conversionManager = new ConversionManager(); conversionManager.setLoader(loader); } else { conversionManager = ConversionManager.getDefaultManager(); } proj.convertClassNamesToClasses(conversionManager.getLoader()); // need to make sure that the java class is set properly on each // descriptor when using java classname - req'd for JOT api implementation for (Iterator<ClassDescriptor> descriptorIt = proj.getOrderedDescriptors().iterator(); descriptorIt.hasNext();) { ClassDescriptor descriptor = descriptorIt.next(); if (descriptor.getJavaClass() == null) { descriptor.setJavaClass(conversionManager.convertClassNameToClass(descriptor.getJavaClassName())); } } XMLPlatform platform = new SAXPlatform(); platform.getConversionManager().setLoader(loader); XMLContext xmlContext = new XMLContext((Project) proj, loader, sessionEventListeners()); ((XMLLogin) xmlContext.getSession().getDatasourceLogin()).setEqualNamespaceResolvers(true); return new JAXBContextState(xmlContext, generator, typesToBeBound, properties); }
private JAXBContextState createContextState(Generator generator, JaxbClassLoader loader, Type[] typesToBeBound, Map properties) throws Exception { CoreProject proj = generator.generateProject(); ConversionManager conversionManager = null; if (classLoader != null) { conversionManager = new ConversionManager(); conversionManager.setLoader(loader); } else { conversionManager = ConversionManager.getDefaultManager(); } proj.convertClassNamesToClasses(conversionManager.getLoader()); // need to make sure that the java class is set properly on each // descriptor when using java classname - req'd for JOT api implementation for (Iterator<ClassDescriptor> descriptorIt = proj.getOrderedDescriptors().iterator(); descriptorIt.hasNext();) { ClassDescriptor descriptor = descriptorIt.next(); if (descriptor.getJavaClass() == null) { descriptor.setJavaClass(conversionManager.convertClassNameToClass(descriptor.getJavaClassName())); } } XMLPlatform platform = new SAXPlatform(); platform.getConversionManager().setLoader(loader); XMLContext xmlContext = new XMLContext((Project) proj, loader, sessionEventListeners()); ((XMLLogin) xmlContext.getSession().getDatasourceLogin()).setEqualNamespaceResolvers(true); return new JAXBContextState(xmlContext, generator, typesToBeBound, properties); }