Search in sources :

Example 6 with SessionLog

use of org.eclipse.persistence.logging.SessionLog in project eclipselink by eclipse-ee4j.

the class XMLMarshaller method marshal.

/**
 * Convert the given object to XML and update the given marshal record with
 * that XML Document.
 * @param object the object to marshal
 * @param marshalRecord the marshalRecord to marshal the object to
 * @param descriptor the XMLDescriptor for the object being marshalled
 */
protected void marshal(Object object, MarshalRecord marshalRecord, ABSTRACT_SESSION session, DESCRIPTOR descriptor, boolean isXMLRoot) {
    SessionLog logger = AbstractSessionLog.getLog();
    if (logger.shouldLog(SessionLog.FINE, SessionLog.MOXY)) {
        logger.log(SessionLog.FINE, SessionLog.MOXY, "moxy_start_marshalling", new Object[] { (object != null) ? object.getClass().getName() : "N/A", this.mediaType });
    }
    if (object != null && logPayload != null && this.isLogPayload()) {
        AbstractSessionLog.getLog().log(SessionLog.FINEST, SessionLog.MOXY, object.toString(), new Object[0], false);
    }
    if (null != schema) {
        marshalRecord = new ValidatingMarshalRecord(marshalRecord, this);
    }
    if (this.attachmentMarshaller != null) {
        marshalRecord.setXOPPackage(this.attachmentMarshaller.isXOPPackage());
    }
    marshalRecord.setMarshaller(this);
    Root root = null;
    if (isXMLRoot) {
        root = (Root) object;
    }
    Node node = getNode(object, marshalRecord.getDOM(), session, descriptor, isXMLRoot);
    if (this.mapper == null) {
        if (null == node) {
            addDescriptorNamespacesToXMLRecord(descriptor, marshalRecord);
        }
    } else {
        if (descriptor == null || null != node) {
            marshalRecord.setNamespaceResolver(new PrefixMapperNamespaceResolver(mapper, null));
        } else {
            marshalRecord.setNamespaceResolver(new PrefixMapperNamespaceResolver(mapper, descriptor.getNamespaceResolver()));
        }
        marshalRecord.setCustomNamespaceMapper(true);
    }
    if (this.getMarshalAttributeGroup() != null) {
        if (marshalAttributeGroup.getClass() == CoreClassConstants.STRING) {
            CoreAttributeGroup group = descriptor.getAttributeGroup((String) marshalAttributeGroup);
            if (group != null) {
                marshalRecord.pushAttributeGroup(group);
            } else {
                throw XMLMarshalException.invalidAttributeGroupName((String) marshalAttributeGroup, descriptor.getJavaClassName());
            }
        } else if (marshalAttributeGroup instanceof CoreAttributeGroup) {
            marshalRecord.pushAttributeGroup((CoreAttributeGroup) marshalAttributeGroup);
        } else {
        // Error case
        }
    }
    NamespaceResolver nr = marshalRecord.getNamespaceResolver();
    if (node != null) {
        if (isXMLRoot) {
            if (isFragment()) {
                marshalRecord.node(node, null, root.getNamespaceURI(), root.getLocalName());
            } else {
                String encoding = root.getEncoding();
                if (null == encoding) {
                    encoding = Constants.DEFAULT_XML_ENCODING;
                }
                String version = root.getXMLVersion();
                if (null == version) {
                    version = DEFAULT_XML_VERSION;
                }
                marshalRecord.startDocument(encoding, version);
                marshalRecord.node(node, marshalRecord.getNamespaceResolver(), root.getNamespaceURI(), root.getLocalName());
                marshalRecord.endDocument();
            }
        } else {
            marshalRecord.node(node, nr);
        }
        marshalRecord.flush();
        return;
    }
    if (isXMLRoot) {
        if (descriptor != null) {
            marshalRecord.beforeContainmentMarshal(root.getObject());
        }
    } else {
        marshalRecord.beforeContainmentMarshal(object);
    }
    if (!isFragment()) {
        String encoding = getEncoding();
        String version = DEFAULT_XML_VERSION;
        if (!isXMLRoot && descriptor != null) {
            marshalRecord.setLeafElementType(descriptor.getDefaultRootElementType());
        } else {
            if (root.getEncoding() != null) {
                encoding = root.getEncoding();
            }
            if (root.getXMLVersion() != null) {
                version = root.getXMLVersion();
            }
        }
        marshalRecord.startDocument(encoding, version);
    }
    if (getXmlHeader() != null) {
        marshalRecord.writeHeader();
    }
    if (isXMLRoot) {
        if (root.getObject() instanceof Node) {
            marshalRecord.node((Node) root.getObject(), new NamespaceResolver(), root.getNamespaceURI(), root.getLocalName());
            marshalRecord.endDocument();
            return;
        }
    }
    XPathFragment rootFragment = buildRootFragment(object, descriptor, isXMLRoot, marshalRecord);
    String schemaLocation = getSchemaLocation();
    String noNsSchemaLocation = getNoNamespaceSchemaLocation();
    boolean isNil = false;
    if (isXMLRoot) {
        object = root.getObject();
        if (root.getSchemaLocation() != null) {
            schemaLocation = root.getSchemaLocation();
        }
        if (root.getNoNamespaceSchemaLocation() != null) {
            noNsSchemaLocation = root.getNoNamespaceSchemaLocation();
        }
        marshalRecord.setLeafElementType(root.getSchemaType());
        isNil = root.isNil();
    }
    String xsiPrefix = null;
    if ((null != getSchemaLocation()) || (null != getNoNamespaceSchemaLocation()) || (isNil)) {
        xsiPrefix = nr.resolveNamespaceURI(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
        if (null == xsiPrefix) {
            xsiPrefix = Constants.SCHEMA_INSTANCE_PREFIX;
            nr.put(Constants.SCHEMA_INSTANCE_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
        }
    }
    OBJECT_BUILDER treeObjectBuilder = null;
    if (descriptor != null) {
        treeObjectBuilder = (OBJECT_BUILDER) descriptor.getObjectBuilder();
    }
    if (session == null) {
        session = (ABSTRACT_SESSION) context.getSession();
    }
    marshalRecord.setSession(session);
    if (null != rootFragment && !(rootFragment.getLocalName().equals(Constants.EMPTY_STRING))) {
        marshalRecord.startPrefixMappings(nr);
        if (!isXMLRoot && descriptor != null && descriptor.getNamespaceResolver() == null && rootFragment.hasNamespace()) {
            // throw an exception if the name has a : in it but the namespaceresolver is null
            throw XMLMarshalException.namespaceResolverNotSpecified(rootFragment.getShortName());
        }
        if (isIncludeRoot()) {
            marshalRecord.openStartElement(rootFragment, nr);
        }
        if (null != schemaLocation) {
            marshalRecord.attributeWithoutQName(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, Constants.SCHEMA_LOCATION, xsiPrefix, schemaLocation);
        }
        if (null != noNsSchemaLocation) {
            marshalRecord.attributeWithoutQName(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, Constants.NO_NS_SCHEMA_LOCATION, xsiPrefix, noNsSchemaLocation);
        }
        if (isNil) {
            marshalRecord.nilSimple(nr);
        }
        marshalRecord.namespaceDeclarations(nr);
        if (descriptor != null && !isNil) {
            marshalRecord.addXsiTypeAndClassIndicatorIfRequired(descriptor, null, descriptor.getDefaultRootElementField(), root, object, isXMLRoot, true);
            treeObjectBuilder.marshalAttributes(marshalRecord, object, session);
        }
        if (isIncludeRoot()) {
            marshalRecord.closeStartElement();
        }
    } else {
        // no rootfragment
        marshalRecord.marshalWithoutRootElement(treeObjectBuilder, object, descriptor, root, isXMLRoot);
    }
    if (treeObjectBuilder != null && !isNil) {
        treeObjectBuilder.buildRow(marshalRecord, object, session, this, rootFragment);
    } else if (isXMLRoot) {
        if (object != null && !isNil) {
            if (root.getDeclaredType() != null && root.getObject() != null && root.getDeclaredType() != root.getObject().getClass()) {
                QName type = marshalRecord.getConversionManager().schemaType(object.getClass());
                if (type != null) {
                    xsiPrefix = nr.resolveNamespaceURI(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
                    if (null == xsiPrefix) {
                        xsiPrefix = Constants.SCHEMA_INSTANCE_PREFIX;
                        marshalRecord.namespaceDeclaration(xsiPrefix, javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
                    }
                    marshalRecord.namespaceDeclaration(Constants.SCHEMA_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
                    String typeValue = type.getLocalPart();
                    if (marshalRecord.isNamespaceAware() && (mediaType.isApplicationXML() || getJsonTypeConfiguration().useXsdTypesWithPrefix())) {
                        typeValue = Constants.SCHEMA_PREFIX + marshalRecord.getNamespaceSeparator() + typeValue;
                    }
                    marshalRecord.attribute(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, Constants.SCHEMA_TYPE_ATTRIBUTE, xsiPrefix + Constants.COLON + Constants.SCHEMA_TYPE_ATTRIBUTE, typeValue);
                }
            }
            marshalRecord.characters(root.getSchemaType(), object, null, false);
        }
    }
    if (null != rootFragment && !(rootFragment.getLocalName().equals(Constants.EMPTY_STRING)) && isIncludeRoot()) {
        marshalRecord.endElement(rootFragment, nr);
        marshalRecord.endPrefixMappings(nr);
    }
    if (!isFragment()) {
        marshalRecord.endDocument();
    }
    if (isXMLRoot) {
        if (descriptor != null) {
            marshalRecord.afterContainmentMarshal(null, root.getObject());
        }
    } else {
        marshalRecord.afterContainmentMarshal(null, object);
    }
    marshalRecord.flush();
}
Also used : ValidatingMarshalRecord(org.eclipse.persistence.oxm.record.ValidatingMarshalRecord) SessionLog(org.eclipse.persistence.logging.SessionLog) AbstractSessionLog(org.eclipse.persistence.logging.AbstractSessionLog) CoreAttributeGroup(org.eclipse.persistence.core.queries.CoreAttributeGroup) QName(javax.xml.namespace.QName) Node(org.w3c.dom.Node) PrefixMapperNamespaceResolver(org.eclipse.persistence.internal.oxm.record.namespaces.PrefixMapperNamespaceResolver) PrefixMapperNamespaceResolver(org.eclipse.persistence.internal.oxm.record.namespaces.PrefixMapperNamespaceResolver)

Example 7 with SessionLog

use of org.eclipse.persistence.logging.SessionLog in project eclipselink by eclipse-ee4j.

the class WebSphere_7_Platform method createSessionLog.

protected SessionLog createSessionLog() {
    SessionLog log = null;
    try {
        if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
            log = AccessController.doPrivileged(new PrivilegedExceptionAction<>() {

                @Override
                public SessionLog run() throws Exception {
                    Class<SessionLog> cls = PrivilegedAccessHelper.getClassForName(SERVER_LOG_CLASS);
                    Constructor<SessionLog> ctor = PrivilegedAccessHelper.getConstructorFor(cls, null, false);
                    return ctor.newInstance();
                }
            });
        } else {
            Class<SessionLog> cls = PrivilegedAccessHelper.getClassForName(SERVER_LOG_CLASS);
            Constructor<SessionLog> ctor = PrivilegedAccessHelper.getConstructorFor(cls, null, false);
            log = ctor.newInstance();
        }
    } catch (Exception e) {
        // Blindly catch exception here as there is no recourse for any specific exception. If
        // we can't load the WAS logger just fall back to using the default SessionLog.
        log = super.getServerLog();
        log.log(SessionLog.FINEST, "Unable to create an instance of " + SERVER_LOG_CLASS + ". Falling back to using default logger.", e);
    }
    return log;
}
Also used : SessionLog(org.eclipse.persistence.logging.SessionLog) PrivilegedExceptionAction(java.security.PrivilegedExceptionAction)

Example 8 with SessionLog

use of org.eclipse.persistence.logging.SessionLog in project adeptj-modules by AdeptJ.

the class JpaActivator method disposeEclipseLinkSingletonLog.

static void disposeEclipseLinkSingletonLog() {
    // of SLF4JLogger if this bundle or EntityManagerFactoryLifecycle is going to be stopped.
    try {
        Field field = FieldUtils.getDeclaredField(AbstractSessionLog.class, FIELD_DEFAULT_LOG, true);
        if (field == null) {
            LOGGER.warn("Field defaultLog is not found in EclipseLink AbstractSessionLog!!");
            return;
        }
        Object defaultLog = field.get(null);
        if (defaultLog instanceof SessionLog) {
            ((SessionLog) defaultLog).setSession(null);
            field.set(null, null);
        }
    } catch (IllegalAccessException ex) {
        LOGGER.error(ex.getMessage(), ex);
    }
}
Also used : Field(java.lang.reflect.Field) AbstractSessionLog(org.eclipse.persistence.logging.AbstractSessionLog) SessionLog(org.eclipse.persistence.logging.SessionLog)

Example 9 with SessionLog

use of org.eclipse.persistence.logging.SessionLog in project eclipselink by eclipse-ee4j.

the class QueryOperation method createSimpleXMLFormat.

@SuppressWarnings({ "unchecked" })
public Object createSimpleXMLFormat(XRServiceAdapter xrService, Object value) {
    XMLRoot xmlRoot = new XMLRoot();
    SimpleXMLFormat simpleXMLFormat = result.getSimpleXMLFormat();
    String tempSimpleXMLFormatTag = SimpleXMLFormat.DEFAULT_SIMPLE_XML_FORMAT_TAG;
    String simpleXMLFormatTag = simpleXMLFormat.getSimpleXMLFormatTag();
    if (simpleXMLFormatTag != null && !EMPTY_STR.equals(simpleXMLFormatTag)) {
        tempSimpleXMLFormatTag = simpleXMLFormatTag;
    }
    xmlRoot.setLocalName(tempSimpleXMLFormatTag);
    String tempXMLTag = DEFAULT_SIMPLE_XML_TAG;
    String xmlTag = simpleXMLFormat.getXMLTag();
    if (xmlTag != null && !EMPTY_STR.equals(xmlTag)) {
        tempXMLTag = xmlTag;
    }
    Vector<DatabaseRecord> records = null;
    if (value instanceof ArrayList) {
        // JPA query results in a list of raw values
        // Here we have raw values returned as opposed to DatabaseRecords - this means
        // we need to figure out the tag names based on the call's output parameters.
        // assumes JPAQuery
        JPAQuery jpaQuery = (JPAQuery) queryHandler.getDatabaseQuery();
        // to match field names with results, we need to gather the database fields from each of the Output parameters
        List<DatabaseField> paramFlds = new ArrayList<>();
        DatasourceCall dsCall = (DatasourceCall) jpaQuery.getDatabaseQuery().getDatasourceCall();
        for (Object obj : dsCall.getParameters()) {
            if (obj instanceof OutputParameterForCallableStatement) {
                paramFlds.add(((OutputParameterForCallableStatement) obj).getOutputField());
            } else if (obj instanceof Object[]) {
                Object[] objArray = (Object[]) obj;
                for (int i = 0; i < objArray.length; i++) {
                    Object o = objArray[i];
                    if (o instanceof OutputParameterForCallableStatement) {
                        paramFlds.add(((OutputParameterForCallableStatement) o).getOutputField());
                    }
                }
            }
        }
        // now create a record using DatabaseField/value pairs
        DatabaseRecord dr = new DatabaseRecord();
        if (paramFlds.size() > 0) {
            for (int i = 0; i < ((ArrayList<?>) value).size(); i++) {
                dr.add(paramFlds.get(i), ((ArrayList<?>) value).get(i));
            }
        } else {
            dr.add(new DatabaseField(RESULT_STR), ((ArrayList<?>) value).get(0));
        }
        records = new Vector<>();
        records.add(dr);
    } else if (value instanceof Vector) {
        Class<?> vectorContent = ((Vector<?>) value).firstElement().getClass();
        if (DatabaseRecord.class.isAssignableFrom(vectorContent)) {
            records = (Vector<DatabaseRecord>) value;
        } else {
            records = new Vector<>();
            DatabaseRecord dr = new DatabaseRecord();
            dr.add(new DatabaseField(RESULT_STR), ((Vector<?>) value).firstElement());
            records.add(dr);
        }
    } else {
        records = new Vector<>();
        DatabaseRecord dr = new DatabaseRecord();
        dr.add(new DatabaseField(RESULT_STR), value);
        records.add(dr);
    }
    SimpleXMLFormatModel simpleXMLFormatModel = new SimpleXMLFormatModel();
    XMLConversionManager conversionManager = (XMLConversionManager) xrService.getOXSession().getDatasourcePlatform().getConversionManager();
    SessionLog log = xrService.getOXSession().getSessionLog();
    for (DatabaseRecord dr : records) {
        Element rowElement = TEMP_DOC.createElement(tempXMLTag);
        for (DatabaseField field : dr.getFields()) {
            // handle complex types, i.e. ones we have a descriptor for
            if (field instanceof ObjectRelationalDatabaseField) {
                ObjectRelationalDatabaseField ordtField = (ObjectRelationalDatabaseField) field;
                if (xrService.getOXSession().getDescriptor(ordtField.getType()) != null) {
                    xrService.getXMLContext().createMarshaller().marshal(dr.get(field), rowElement);
                    continue;
                }
            }
            Object fieldValue = dr.get(field);
            if (fieldValue != null) {
                if (fieldValue instanceof Calendar) {
                    Calendar cValue = (Calendar) fieldValue;
                    fieldValue = conversionManager.convertObject(cValue, STRING, DATE_TIME_QNAME);
                }
                if (fieldValue instanceof Date) {
                    Date dValue = (Date) fieldValue;
                    fieldValue = conversionManager.convertObject(dValue, STRING, DATE_QNAME);
                } else if (fieldValue instanceof Time) {
                    Time tValue = (Time) fieldValue;
                    fieldValue = conversionManager.convertObject(tValue, STRING, TIME_QNAME);
                } else if (fieldValue instanceof Timestamp) {
                    Timestamp tsValue = (Timestamp) fieldValue;
                    fieldValue = conversionManager.convertObject(tsValue, STRING, DATE_TIME_QNAME);
                } else if (fieldValue instanceof Blob) {
                    fieldValue = conversionManager.convertObject(fieldValue, ClassConstants.APBYTE);
                } else if (SQLXML.class.isAssignableFrom(fieldValue.getClass())) {
                    // handle XMLType case where an oracle.jdbc.driver.OracleSQLXML instance was returned
                    SQLXML sqlXml = (SQLXML) fieldValue;
                    try {
                        String str = sqlXml.getString();
                        sqlXml.free();
                        // Oracle 12c appends a \n character to the xml string
                        fieldValue = str.endsWith("\n") ? str.substring(0, str.length() - 1) : str;
                    } catch (SQLException e) {
                        log.logThrowable(SessionLog.FINE, SessionLog.DBWS, e);
                    }
                } else if (fieldValue.getClass().getName().equalsIgnoreCase(ORACLEOPAQUE_STR)) {
                    // handle XMLType case where an oracle.sql.OPAQUE instance was returned
                    try {
                        Class<?> oracleOPAQUE;
                        Class<?> xmlTypeFactoryClass;
                        Constructor<?> xmlTypeFactoryConstructor;
                        Object xmlTypeFactory;
                        Method getStringMethod;
                        if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
                            oracleOPAQUE = AccessController.doPrivileged(new PrivilegedClassForName<>(IORACLEOPAQUE_STR, true, this.getClass().getClassLoader()));
                            xmlTypeFactoryClass = AccessController.doPrivileged(new PrivilegedClassForName<>(XMLTYPEFACTORY_STR, true, this.getClass().getClassLoader()));
                            xmlTypeFactoryConstructor = AccessController.doPrivileged(new PrivilegedGetConstructorFor<>(xmlTypeFactoryClass, new Class<?>[0], true));
                            xmlTypeFactory = AccessController.doPrivileged(new PrivilegedInvokeConstructor<>(xmlTypeFactoryConstructor, new Object[0]));
                            getStringMethod = AccessController.doPrivileged(new PrivilegedGetDeclaredMethod(xmlTypeFactoryClass, GETSTRING_METHOD, new Class<?>[] { oracleOPAQUE }));
                            fieldValue = AccessController.doPrivileged(new PrivilegedMethodInvoker<>(getStringMethod, xmlTypeFactory, new Object[] { fieldValue }));
                        } else {
                            oracleOPAQUE = PrivilegedAccessHelper.getClassForName(IORACLEOPAQUE_STR, false, this.getClass().getClassLoader());
                            xmlTypeFactoryClass = PrivilegedAccessHelper.getClassForName(XMLTYPEFACTORY_STR, true, this.getClass().getClassLoader());
                            xmlTypeFactoryConstructor = PrivilegedAccessHelper.getConstructorFor(xmlTypeFactoryClass, new Class<?>[0], true);
                            xmlTypeFactory = PrivilegedAccessHelper.invokeConstructor(xmlTypeFactoryConstructor, new Object[0]);
                            getStringMethod = PrivilegedAccessHelper.getDeclaredMethod(xmlTypeFactoryClass, GETSTRING_METHOD, new Class<?>[] { oracleOPAQUE });
                            fieldValue = PrivilegedAccessHelper.invokeMethod(getStringMethod, xmlTypeFactory, new Object[] { fieldValue });
                        }
                    } catch (ReflectiveOperationException | PrivilegedActionException e) {
                        // if the required resources are not available there's nothing we can do...
                        log.logThrowable(SessionLog.FINE, SessionLog.DBWS, e);
                    }
                }
                String elementName;
                if (field.getName() == null || (elementName = sqlToXmlName(field.getName())).equals(EMPTY_STR)) {
                    // return arg from stored function has no name
                    elementName = RESULT_STR;
                }
                Element columnElement = TEMP_DOC.createElement(elementName);
                rowElement.appendChild(columnElement);
                String fieldValueString = fieldValue.toString();
                // handle binary content - attachments dealt with in invoke() above
                if (result.getType().equals(BASE_64_BINARY_QNAME)) {
                    fieldValueString = Helper.buildHexStringFromBytes(Base64.base64Encode((byte[]) fieldValue));
                    columnElement.setAttributeNS(XMLNS_URL, XSD_STR, SCHEMA_URL);
                    columnElement.setAttributeNS(XMLNS_URL, XSI_STR, SCHEMA_INSTANCE_URL);
                    columnElement.setAttributeNS(SCHEMA_INSTANCE_URL, XSITYPE_STR, BASE64_BINARY_STR);
                }
                columnElement.appendChild(TEMP_DOC.createTextNode(fieldValueString));
            }
        }
        simpleXMLFormatModel.simpleXML.add(rowElement);
    }
    xmlRoot.setObject(simpleXMLFormatModel);
    return xmlRoot;
}
Also used : SQLException(java.sql.SQLException) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) Time(java.sql.Time) SimpleXMLFormat(org.eclipse.persistence.internal.xr.sxf.SimpleXMLFormat) DatasourceCall(org.eclipse.persistence.internal.databaseaccess.DatasourceCall) Timestamp(java.sql.Timestamp) PrivilegedGetDeclaredMethod(org.eclipse.persistence.internal.security.PrivilegedGetDeclaredMethod) Vector(java.util.Vector) ObjectRelationalDatabaseField(org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField) Blob(java.sql.Blob) DatabaseRecord(org.eclipse.persistence.sessions.DatabaseRecord) XMLRoot(org.eclipse.persistence.oxm.XMLRoot) PrivilegedInvokeConstructor(org.eclipse.persistence.internal.security.PrivilegedInvokeConstructor) Constructor(java.lang.reflect.Constructor) Calendar(java.util.Calendar) Method(java.lang.reflect.Method) PrivilegedGetDeclaredMethod(org.eclipse.persistence.internal.security.PrivilegedGetDeclaredMethod) JPAQuery(org.eclipse.persistence.internal.jpa.JPAQuery) SimpleXMLFormatModel(org.eclipse.persistence.internal.xr.sxf.SimpleXMLFormatModel) Date(java.sql.Date) SessionLog(org.eclipse.persistence.logging.SessionLog) SQLXML(java.sql.SQLXML) OutputParameterForCallableStatement(org.eclipse.persistence.internal.databaseaccess.OutputParameterForCallableStatement) ObjectRelationalDatabaseField(org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField) DatabaseField(org.eclipse.persistence.internal.helper.DatabaseField) XMLConversionManager(org.eclipse.persistence.internal.oxm.XMLConversionManager)

Example 10 with SessionLog

use of org.eclipse.persistence.logging.SessionLog in project eclipselink by eclipse-ee4j.

the class SessionManagerTest method setUp.

@Before
public void setUp() {
    originalLogger = (SessionLog) getField(SessionManager.class, "LOG", null);
    SessionLog log = new LogWrapper();
    log.setLevel(originalLogger.getLevel());
    setStaticField(SessionManager.class, "LOG", log);
}
Also used : SessionLog(org.eclipse.persistence.logging.SessionLog) DefaultSessionLog(org.eclipse.persistence.logging.DefaultSessionLog) Before(org.junit.Before)

Aggregations

SessionLog (org.eclipse.persistence.logging.SessionLog)24 AbstractSessionLog (org.eclipse.persistence.logging.AbstractSessionLog)17 DefaultSessionLog (org.eclipse.persistence.logging.DefaultSessionLog)5 PrivilegedActionException (java.security.PrivilegedActionException)3 HashMap (java.util.HashMap)3 ValidationException (org.eclipse.persistence.exceptions.ValidationException)3 PrivilegedNewInstanceFromClass (org.eclipse.persistence.internal.security.PrivilegedNewInstanceFromClass)3 WebApplicationException (jakarta.ws.rs.WebApplicationException)2 JAXBContext (jakarta.xml.bind.JAXBContext)2 JAXBElement (jakarta.xml.bind.JAXBElement)2 JAXBException (jakarta.xml.bind.JAXBException)2 PropertyException (jakarta.xml.bind.PropertyException)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2 ClassReader (org.eclipse.persistence.internal.libraries.asm.ClassReader)2 EclipseLinkClassReader (org.eclipse.persistence.internal.libraries.asm.EclipseLinkClassReader)2 PrefixMapperNamespaceResolver (org.eclipse.persistence.internal.oxm.record.namespaces.PrefixMapperNamespaceResolver)2 AbstractSession (org.eclipse.persistence.internal.sessions.AbstractSession)2 DatabaseSessionImpl (org.eclipse.persistence.internal.sessions.DatabaseSessionImpl)2