/** * Return the descriptor from the list whose java class matches * javaClass. If none exists null will be returned. * * @param javaClass * @param descriptors * @return */ protected XMLDescriptor getDescriptorByClass(Class javaClass, List<XMLDescriptor> descriptors) { for (XMLDescriptor xDesc : descriptors) { if (xDesc.getJavaClass() != null && xDesc.getJavaClass() == javaClass) { return xDesc; } } return null; }
public Class<?> getTypeClass(QName type) { XMLDescriptor xdesc = descriptorsByQName.get(type); if (xdesc != null) { return xdesc.getJavaClass(); } else { return null; } } }
public Class<?> getTypeClass(QName type) { XMLDescriptor xdesc = descriptorsByQName.get(type); if (xdesc != null) { return xdesc.getJavaClass(); } else { return null; } } }
/** * Return the wrapped class corresponding to the SDO type. * <pre> * Type customerType = jaxbHelperContext.getTypeHelper().getType("urn:customer", "customer"); * Class customerClass = jaxbHelperContext.getClass(customerType); * </pre> */ public Class getClass(Type type) { if(null == type) { return null; } return getObjectDescriptor((SDOType) type).getJavaClass(); }
/** * Return the wrapped class corresponding to the SDO type. * <pre> * Type customerType = jaxbHelperContext.getTypeHelper().getType("urn:customer", "customer"); * Class customerClass = jaxbHelperContext.getClass(customerType); * </pre> */ public Class getClass(Type type) { if(null == type) { return null; } return getObjectDescriptor((SDOType) type).getJavaClass(); }
/** * INTERNAL: Return the session corresponding to this XMLDescriptor. Since * the class may be mapped by more that one of the projects used to create * the XML Context, this method will return the first match. */ public AbstractSession getSession(XMLDescriptor xmlDescriptor) { if (null == xmlDescriptor) { return null; } int numberOfSessions = sessions.size(); for (int x = 0; x < numberOfSessions; x++) { AbstractSession next = ((AbstractSession) sessions.get(x)); if (next.getProject().getOrderedDescriptors().contains(xmlDescriptor)) { return next; } } throw XMLMarshalException.descriptorNotFoundInProject(xmlDescriptor.getJavaClass().getName()); }
/** * INTERNAL: Find the Descriptor corresponding to the context node of the * XMLRecord, and then convert the XMLRecord to an instance of the * corresponding object. * * @param xmlRecord * The XMLRecord to unmarshal from * @return the object which resulted from unmarshalling the given XMLRecord * @throws XMLMarshalException * if an error occurred during unmarshalling */ public Object xmlToObject(DOMRecord xmlRecord) throws XMLMarshalException { XMLDescriptor xmlDescriptor = getDescriptor(xmlRecord); return xmlToObject(xmlRecord, xmlDescriptor.getJavaClass()); }
/** * INTERNAL: Return the session corresponding to this XMLDescriptor. Since * the class may be mapped by more that one of the projects used to create * the XML Context, this method will return the first match. */ @Override protected AbstractSession getSession(XMLDescriptor xmlDescriptor) { if (null == xmlDescriptor) { return null; } if(null == sessions) { return super.getSession(xmlDescriptor); } for (int x = 0, numberOfSessions = sessions.size(); x < numberOfSessions; x++) { AbstractSession next = ((AbstractSession) sessions.get(x)); if (next.getProject().getOrderedDescriptors().contains(xmlDescriptor)) { return next; } } throw XMLMarshalException.descriptorNotFoundInProject(xmlDescriptor.getJavaClass().getName()); }
/** * INTERNAL: Return the session corresponding to this XMLDescriptor. Since * the class may be mapped by more that one of the projects used to create * the XML Context, this method will return the first match. */ @Override protected AbstractSession getSession(XMLDescriptor xmlDescriptor) { if (null == xmlDescriptor) { return null; } if(null == sessions) { return super.getSession(xmlDescriptor); } for (int x = 0, numberOfSessions = sessions.size(); x < numberOfSessions; x++) { AbstractSession next = ((AbstractSession) sessions.get(x)); if (next.getProject().getOrderedDescriptors().contains(xmlDescriptor)) { return next; } } throw XMLMarshalException.descriptorNotFoundInProject(xmlDescriptor.getJavaClass().getName()); }
/** * INTERNAL: * Return the session corresponding to this XMLDescriptor. Since * the class may be mapped by more that one of the projects used to create * the XML Context, this method will return the first match. * * The session will be a unit of work if document preservation is not * enabled. This method will typically be used for unmarshalling * when a non-shared cache is desired. */ public AbstractSession getReadSession(XMLDescriptor xmlDescriptor) { if (null == xmlDescriptor) { return null; } int numberOfSessions = sessions.size(); for (int x = 0; x < numberOfSessions; x++) { AbstractSession next = ((AbstractSession) sessions.get(x)); if (next.getProject().getOrderedDescriptors().contains(xmlDescriptor)) { // we don't currently support document preservation // and non-shared cache (via unit of work) //if (!documentPreservationPolicy.shouldPreserveDocument()) { next = next.acquireUnitOfWork(); //} return next; } } throw XMLMarshalException.descriptorNotFoundInProject(xmlDescriptor.getJavaClass().getName()); }
public Node getNodeForObject(Object obj) { AbstractSession session = context.getSession(obj); XMLDescriptor xmlDescriptor = (XMLDescriptor)session.getDescriptor(obj); if(xmlDescriptor.shouldPreserveDocument()) { Vector pk = xmlDescriptor.getObjectBuilder().extractPrimaryKeyFromObject(obj, session); if ((pk == null) || (pk.size() == 0)) { pk = new Vector(); pk.addElement(new WeakObjectWrapper(obj)); } CacheKey cacheKey = session.getIdentityMapAccessorInstance().getCacheKeyForObject(pk, xmlDescriptor.getJavaClass(), xmlDescriptor); if(cacheKey != null && cacheKey.getRecord() != null) { return ((DOMRecord)cacheKey.getRecord()).getDOM(); } } return null; }
public void addObjectToCache(Object obj, Node node, XMLMapping selfRecordMapping) { // Can't process non-element nodes if (node.getNodeType() != Node.ELEMENT_NODE) { return; } AbstractSession session = context.getSession(obj); XMLDescriptor xmlDescriptor = (XMLDescriptor)session.getDescriptor(obj); DOMRecord row = new DOMRecord((Element)node); row.setSession(session); Vector pk = xmlDescriptor.getObjectBuilder().extractPrimaryKeyFromRow(row, session); if (xmlDescriptor.shouldPreserveDocument() || xmlDescriptor.getPrimaryKeyFieldNames().size() > 0) { if ((pk == null) || (pk.size() == 0)) { pk = new Vector(); pk.addElement(new WeakObjectWrapper(obj)); } CacheKey key = session.getIdentityMapAccessorInstance().acquireDeferredLock(pk, xmlDescriptor.getJavaClass(), xmlDescriptor); if ((xmlDescriptor).shouldPreserveDocument()) { key.setRecord(row); } key.setObject(obj); key.releaseDeferredLock(); } }
if (null == xmlDescriptor.getDefaultRootElement()) { xmlDescriptor.setDefaultRootElement(xmlNameTransformer.transformRootElementName(xmlDescriptor.getJavaClass().getName()));
if (null == xmlDescriptor.getDefaultRootElement()) { xmlDescriptor.setDefaultRootElement(xmlNameTransformer.transformRootElementName(xmlDescriptor.getJavaClass().getName()));
typeHelper.getImplClassesToSDOType().put(wrapperType.getXmlDescriptor().getJavaClass(), wrapperType);
typeHelper.getImplClassesToSDOType().put(wrapperType.getXmlDescriptor().getJavaClass(), wrapperType);
return null; String className = referenceDescriptor.getJavaClass().getSimpleName(); String referenceName = DEFINITION_PATH + "/" + className; if(referenceDescriptor.getJavaClass() == this.rootClass && !generateRoot) { String ref = "#"; if(this.rootProperty != null) {
return null; String className = referenceDescriptor.getJavaClass().getSimpleName(); String referenceName = DEFINITION_PATH + "/" + className; if(referenceDescriptor.getJavaClass() == this.rootClass && !generateRoot) { String ref = "#"; if(this.rootProperty != null) {
SOAPResponse response = null; try { response = (SOAPResponse) descriptor.getJavaClass().newInstance(); } catch (InstantiationException ie) { throw new SOAPException(ie);
SOAPResponse response = null; try { response = (SOAPResponse) descriptor.getJavaClass().newInstance(); } catch (InstantiationException ie) { throw new SOAPException(ie);