diff options
Diffstat (limited to 'bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl')
36 files changed, 0 insertions, 3370 deletions
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/Fragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/Fragment.java deleted file mode 100644 index 5371e2501..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/Fragment.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IFragment; - -public abstract class Fragment implements IFragment { - private String id_; - private String name_; - private Hashtable params_; - - public Fragment(String id, String name) { - id_ = id; - name_ = name; - params_ = new Hashtable(); - } - - public void setID(String id) { - id_ = id; - } - - public String getID() { - return id_; - } - - public void setName(String name) { - name_ = name; - } - - public String getName() { - return name_; - } - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException { - String[] params = parser.getParameterValues(getID()); - setParameterValues(getID(), params); - return validateAllParameterValues(); - } - - public void setParameterValues(String paramKey, String[] params) { - if (params == null) - params_.remove(paramKey); - else - params_.put(paramKey, params); - } - - public void setParameterValues(String paramKey, Vector params) { - if (params == null) - params_.remove(paramKey); - else { - String[] paramsArray = new String[params.size()]; - for (int i = 0; i < paramsArray.length; i++) { - paramsArray[i] = params.get(i).toString(); - } - setParameterValues(paramKey, paramsArray); - } - } - - public String[] getParameterValues(String paramKey) { - return (String[])params_.get(paramKey); - } - - public String getParameterValue(String paramKey, int paramIndex) { - String[] params = getParameterValues(paramKey); - if (params != null && paramIndex < params.length) - return params[paramIndex]; - else - return null; - } - - public boolean validateAllParameterValues() { - Enumeration paramKeys = params_.keys(); - while (paramKeys != null && paramKeys.hasMoreElements()) { - if (!validateParameterValues((String)paramKeys.nextElement())) - return false; - } - return true; - } - - public boolean validateParameterValues(String paramKey) { - String[] params = getParameterValues(paramKey); - for (int i = 0; params != null && i < params.length; i++) { - if (!validateParameterValue(paramKey, i)) - return false; - } - return true; - } - -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncArrayFixFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncArrayFixFragment.java deleted file mode 100644 index c6459dec5..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncArrayFixFragment.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDModelGroup; - -public class SOAPEncArrayFixFragment extends SOAPEncArrayFragment { - public SOAPEncArrayFixFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller, xsdModelGroup); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/SOAPEncArrayRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/SOAPEncArrayFixWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncArrayFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncArrayFragment.java deleted file mode 100644 index d085dff16..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncArrayFragment.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.emf.common.util.EList; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.ISOAPEncArrayFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDParticleContent; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public abstract class SOAPEncArrayFragment extends XSDGroupSeqFragment implements ISOAPEncArrayFragment -{ - public SOAPEncArrayFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) - { - super(id, name, config, controller, xsdModelGroup); - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) - { - Element[] instanceDocumentsCopy = getInstanceDocumentsByTagName(instanceDocuments, getName()); - removeGroupIDs(); - boolean paramsValid = internalEquals(instanceDocumentsCopy, instanceDocuments); - for (int i = 0; i < instanceDocumentsCopy.length; i++) - { - IXSDFragment soapEncArrayTypeFrag = (getGroupMemberFragments(createSOAPEncArrayInstance()))[0]; - Vector instancesVector = new Vector(); - NodeList nl = instanceDocumentsCopy[i].getChildNodes(); - for (int j = 0; j < nl.getLength(); j++) - { - Node node = nl.item(j); - if (node instanceof Element) - instancesVector.add(node); - else - paramsValid = false; - } - Element[] childInstanceDocuments = new Element[instancesVector.size()]; - instancesVector.copyInto(childInstanceDocuments); - if (!soapEncArrayTypeFrag.setParameterValuesFromInstanceDocuments(setElementsTagName(childInstanceDocuments, soapEncArrayTypeFrag.getName()))) - paramsValid = false; - } - return paramsValid; - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) - { - String[] groupIDs = getGroupIDs(); - Element[] instanceDocument = new Element[groupIDs.length]; - StringBuffer attrName = new StringBuffer(); - StringBuffer attrValue = new StringBuffer(); -// StringBuffer attrArrayTypeName = new StringBuffer(); -// StringBuffer attrArrayTypeValue = new StringBuffer(); - for (int i = 0; i < instanceDocument.length; i++) - { - int numInstances = 0; - instanceDocument[i] = doc.createElement(getInstanceDocumentTagName(namespaceTable)); - IXSDFragment fragment = (getGroupMemberFragments(groupIDs[i]))[0]; - Element[] fragmentInstanceDocuments = fragment.genInstanceDocumentsFromParameterValues(genXSIType, namespaceTable, doc); - for (int j = 0; j < fragmentInstanceDocuments.length; j++) - { - if (fragmentInstanceDocuments[j] != null) - instanceDocument[i].appendChild(fragmentInstanceDocuments[j]); - numInstances++; - } - String soapURI = FragmentConstants.URI_SOAP; - String soapPrefix = getPrefixFromNamespaceURI(soapURI, namespaceTable); - String soapEncArrayTypeURI = getXSDTypeDefinition().getTargetNamespace(); - String soapEncArrayTypePrefix = getPrefixFromNamespaceURI(soapEncArrayTypeURI, namespaceTable); - // Set the arrayType attribute - attrName.setLength(0); - attrName.setLength(0); - attrName.append(soapPrefix); - attrName.append(FragmentConstants.COLON); - attrName.append(FragmentConstants.SOAP_ENC_ARRAY_TYPE); - attrValue.setLength(0); - attrValue.append(soapEncArrayTypePrefix); - attrValue.append(FragmentConstants.COLON); - attrValue.append(getXSDTypeDefinition().getName()); - attrValue.append(FragmentConstants.LEFT_SQUARE_BRACKET); - attrValue.append(numInstances); - attrValue.append(FragmentConstants.RIGHT_SQUARE_BRACKET); - instanceDocument[i].setAttribute(attrName.toString(), attrValue.toString()); - } - if (genXSIType) - { -// TODO: Used to call the plugin's ignoreSchemaForSOAPArrays()method. - boolean ignoreSchemaForSOAPArrays = true; - if (ignoreSchemaForSOAPArrays) - { - for (int i = 0; i < instanceDocument.length; i++) - { - String xsiURI = FragmentConstants.URI_XSI; - String xsiPrefix = getPrefixFromNamespaceURI(xsiURI, namespaceTable); - String xsiTypeURI = FragmentConstants.URI_SOAP; - String xsiTypePrefix = getPrefixFromNamespaceURI(xsiTypeURI, namespaceTable); - attrName.setLength(0); - attrName.append(xsiPrefix).append(FragmentConstants.COLON).append(FragmentConstants.XSI_TYPE); - attrValue.setLength(0); - attrValue.append(xsiTypePrefix).append(FragmentConstants.COLON); - attrValue.append(FragmentConstants.QNAME_LOCAL_NAME_ARRAY); - instanceDocument[i].setAttribute(attrName.toString(), attrValue.toString()); - } - } - else - return addXSIType(instanceDocument, namespaceTable); - } - return instanceDocument; - } - - public String createSOAPEncArrayInstance() - { - if (getXSDTypeDefinition() != null) - { - String groupID = genID(); - String[] groupMemberID = {genID()}; - int minOccurs = 0; - int maxOccurs = FragmentConstants.UNBOUNDED; - XSDElementDeclaration elementDecl = null; - if (getXSDModelGroup() != null) - { - XSDParticle groupOwner = (XSDParticle)getXSDModelGroup().getContainer(); - int groupMin = groupOwner.getMinOccurs(); - int groupMax = groupOwner.getMaxOccurs(); - int elementMin = 0; - int elementMax = FragmentConstants.UNBOUNDED; - EList xsdParticles = getXSDModelGroup().getParticles(); - if (xsdParticles.size() > 0) - { - XSDParticleContent xsdParticleContent = ((XSDParticle)xsdParticles.get(0)).getContent(); - if (xsdParticleContent instanceof XSDElementDeclaration) - { - elementDecl = (XSDElementDeclaration)xsdParticleContent; - XSDParticle elementOwner = (XSDParticle)elementDecl.getContainer(); - elementMin = elementOwner.getMinOccurs(); - elementMax = elementOwner.getMaxOccurs(); - } - } - if (groupMin >= 0 && elementMin >= 0) - minOccurs = groupMin * elementMin; - if (groupMax >= 0 && groupMax != FragmentConstants.UNBOUNDED && elementMax >= 0 && elementMax != FragmentConstants.UNBOUNDED) - maxOccurs = groupMax * elementMax; - } - XSDToFragmentConfiguration thisConfig = getXSDToFragmentConfiguration(); - XSDToFragmentConfiguration xsdConfig = new XSDToFragmentConfiguration(); - xsdConfig.setXSDComponent(getXSDTypeDefinition()); - xsdConfig.setMinOccurs(minOccurs); - xsdConfig.setMaxOccurs(maxOccurs); - xsdConfig.setStyle(thisConfig.getStyle()); - xsdConfig.setPartEncoding(thisConfig.getPartEncoding()); - xsdConfig.setWSDLPartName(thisConfig.getWSDLPartName()); - String name = (elementDecl != null) ? elementDecl.getName() : getXSDTypeDefinition().getName(); - IXSDFragment frag = getXSDToFragmentController().getFragment(xsdConfig, groupMemberID[0], name); - addFragment(groupMemberID[0], frag); - setGroupMemberIDs(groupID, groupMemberID); - return groupID; - } - else - return null; - } - - public String createGroupSeqInstance() - { - return createSOAPEncArrayInstance(); - } - - public String createInstance() - { - return createSOAPEncArrayInstance(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncArrayRangeFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncArrayRangeFragment.java deleted file mode 100644 index f177ee62b..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncArrayRangeFragment.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDModelGroup; - -public class SOAPEncArrayRangeFragment extends SOAPEncArrayFragment { - public SOAPEncArrayRangeFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller, xsdModelGroup); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/SOAPEncArrayRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/SOAPEncArrayRangeWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncodingWrapperFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncodingWrapperFragment.java deleted file mode 100644 index fb8abf22d..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPEncodingWrapperFragment.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.ISOAPEncodingWrapperFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.xsd.XSDTypeDefinition; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public class SOAPEncodingWrapperFragment extends XSDDelegationFragment implements ISOAPEncodingWrapperFragment -{ - private static final String ID = "id"; - private static final String HREF = "href"; - private static final String POUND = "#"; - - private Hashtable uriReferenceTable_; - - public SOAPEncodingWrapperFragment(String id, String name, XSDToFragmentConfiguration config) - { - super(id, name, null); - uriReferenceTable_ = null; - } - - public void setXSDToFragmentConfiguration(XSDToFragmentConfiguration config) - { - getXSDDelegationFragment().setXSDToFragmentConfiguration(config); - } - - public XSDToFragmentConfiguration getXSDToFragmentConfiguration() - { - return getXSDDelegationFragment().getXSDToFragmentConfiguration(); - } - - public void setXSDTypeDefinition(XSDTypeDefinition typeDef) - { - getXSDDelegationFragment().setXSDTypeDefinition(typeDef); - } - - public XSDTypeDefinition getXSDTypeDefinition() - { - return getXSDDelegationFragment().getXSDTypeDefinition(); - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) - { - for (int i = 0; i < instanceDocuments.length; i++) - instanceDocuments[i] = resolveURIReferences(uriReferenceTable_, instanceDocuments[i]); - return getXSDDelegationFragment().setParameterValuesFromInstanceDocuments(instanceDocuments); - } - - public void setURIReferences(Hashtable uriReferences) - { - uriReferenceTable_ = uriReferences; - } - - public static Hashtable parseURIReferences(Element element, boolean overwrites) - { - Hashtable uriReferences = new Hashtable(); - parseURIReferences(uriReferences, element, overwrites); - return uriReferences; - } - - private static boolean parseURIReferences(Hashtable uriReferences, Element element, boolean overwrites) - { - boolean resolved = true; - if (element != null) - { - URIReference ref = null; - String id = element.getAttribute(ID); - resolved = !element.hasAttribute(HREF); - if (id != null && id.length() > 0 && (overwrites || !uriReferences.contains(id))) - { - ref = new URIReference(element, true); - uriReferences.put(id, ref); - } - NodeList nl = element.getChildNodes(); - for (int i = 0; i < nl.getLength(); i++) - { - Node node = nl.item(i); - if (node instanceof Element) - resolved = parseURIReferences(uriReferences, (Element)node, overwrites) && resolved; - } - if (ref != null) - ref.setResolved(resolved); - } - return resolved; - } - - public static Element resolveURIReferences(Hashtable uriReferences, Element element) - { - if (uriReferences != null && !uriReferences.isEmpty()) - return resolveURIReferences(uriReferences, element.getOwnerDocument(), element, new Vector()); - else - return element; - } - - private static Element resolveURIReferences(Hashtable uriReferences, Document doc, Element element, Vector usedIds) - { - String href = element.getAttribute(HREF); - Element resolvedElement = element; - boolean resolved = false; - if (href != null && href.length() > 0) - { - URIReference ref = null; - if (href.indexOf(POUND) != -1) - href = href.substring(1, href.length()); - if (!usedIds.contains(href)) - { - ref = (URIReference)uriReferences.get(href); - if (ref != null) - { - usedIds.add(href); - Element elementRef = ref.getRefElement(); - resolved = ref.getResolved(); - resolvedElement = doc.createElement(element.getTagName()); - NodeList nl = elementRef.getChildNodes(); - for (int i = 0; i < nl.getLength(); i++) - { - Node node = nl.item(i); - if (node != null) - resolvedElement.appendChild(doc.importNode(node, true)); - } - } - } - } - if (!resolved) - { - NodeList nl = resolvedElement.getChildNodes(); - for (int i = 0; i < nl.getLength(); i++) - { - Node node = nl.item(i); - if (node instanceof Element) - { - Element child = resolveURIReferences(uriReferences, resolvedElement.getOwnerDocument(), (Element)node, usedIds); - if (child != node) - resolvedElement.replaceChild(child, node); - } - } - } - if (href != null) - usedIds.remove(href); - return resolvedElement; - } - - private static class URIReference - { - private Element ref_; - private boolean resolved_; - - public URIReference(Element ref, boolean resolved) - { - ref_ = ref; - resolved_ = resolved; - } - - public Element getRefElement() - { - return ref_; - } - - public void setRefElement(Element ref) - { - ref_ = ref; - } - - public boolean getResolved() - { - return resolved_; - } - - public void setResolved(boolean resolved) - { - resolved_ = resolved; - } - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexFixFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexFixFragment.java deleted file mode 100644 index 9b3fd0941..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexFixFragment.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; - -public class XSDComplexFixFragment extends XSDComplexFragment { - public XSDComplexFixFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) { - super(id, name, config, controller); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDComplexRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDComplexFixWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexFragment.java deleted file mode 100644 index 34cba83a5..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexFragment.java +++ /dev/null @@ -1,238 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Hashtable; -import java.util.List; -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDComplexFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.util.XSDTypeDefinitionUtil; -import org.eclipse.xsd.XSDComplexFinal; -import org.eclipse.xsd.XSDComplexTypeContent; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDModelGroupDefinition; -import org.eclipse.xsd.XSDNamedComponent; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDParticleContent; -import org.eclipse.xsd.XSDTypeDefinition; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public abstract class XSDComplexFragment extends XSDMapFragment implements IXSDComplexFragment -{ - public XSDComplexFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) - { - super(id, name, config, controller); - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) - { - Element[] instanceDocumentsCopy = getInstanceDocumentsByTagName(instanceDocuments, getName()); - boolean paramsValid = internalEquals(instanceDocumentsCopy, instanceDocuments); - XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition)getXSDTypeDefinition(); - XSDComplexTypeContent complexTypeContent = XSDTypeDefinitionUtil.getXSDComplexTypeContent(complexType); - if (complexTypeContent instanceof XSDTypeDefinition) - return setParamsForXSDTypeDef(instanceDocumentsCopy) && paramsValid; - else - return setParamsForXSDParticle(instanceDocumentsCopy) && paramsValid; - } - - private boolean setParamsForXSDTypeDef(Element[] instanceDocuments) - { - boolean paramsValid = true; - removeAllFragments(); - for (int i = 0; i < instanceDocuments.length; i++) - { - IXSDFragment childFrag = getFragment(createInstance()); - Element[] childInstanceDocuments = new Element[1]; - childInstanceDocuments[0] = instanceDocuments[i]; - if (!childFrag.setParameterValuesFromInstanceDocuments(setElementsTagName(childInstanceDocuments, childFrag.getName()))) - paramsValid = false; - } - return paramsValid; - } - - private boolean setParamsForXSDParticle(Element[] instanceDocuments) - { - boolean paramsValid = true; - removeAllFragments(); - for (int i = 0; i < instanceDocuments.length; i++) - { - IXSDFragment childFrag = getFragment(createInstance()); - Vector instancesVector = new Vector(); - NodeList nl = instanceDocuments[i].getChildNodes(); - for (int j = 0; j < nl.getLength(); j++) - { - Node node = nl.item(j); - if (node instanceof Element) - instancesVector.add(node); - else - paramsValid = false; - } - Element[] childInstanceDocuments = new Element[instancesVector.size()]; - instancesVector.copyInto(childInstanceDocuments); - if (!childFrag.setParameterValuesFromInstanceDocuments(childInstanceDocuments)) - paramsValid = false; - } - return paramsValid; - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) - { - XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition)getXSDTypeDefinition(); - XSDComplexTypeContent complexTypeContent = XSDTypeDefinitionUtil.getXSDComplexTypeContent(complexType); - Element[] instanceDocuments; - String tagName = getInstanceDocumentTagName(namespaceTable); - if (complexTypeContent instanceof XSDTypeDefinition) - instanceDocuments = genInstancesForXSDTypeDef(genXSIType, namespaceTable, tagName, doc); - else - instanceDocuments = genInstancesForXSDParticle(genXSIType, namespaceTable, tagName, doc); - return (genXSIType ? addXSIType(instanceDocuments, namespaceTable) : instanceDocuments); - } - - private Element[] genInstancesForXSDTypeDef(boolean genXSIType, Hashtable namespaceTable, String tagName, Document doc) - { - IXSDFragment[] fragments = getAllFragments(); - Vector instanceDocumentsCopy = new Vector(); - for (int i = 0; i < fragments.length; i++) - { - Element[] fragmentInstances = fragments[i].genInstanceDocumentsFromParameterValues(genXSIType, namespaceTable, doc); - if (fragmentInstances.length > 0) - instanceDocumentsCopy.add(fragmentInstances[0]); - } - Element[] instanceDocuments = new Element[instanceDocumentsCopy.size()]; - for (int i = 0; i < instanceDocuments.length; i++) - { - instanceDocuments[i] = (Element)instanceDocumentsCopy.get(i); - } - return setElementsTagName(instanceDocuments, tagName); - } - - private Element[] genInstancesForXSDParticle(boolean genXSIType, Hashtable namespaceTable, String tagName, Document doc) - { - IXSDFragment[] childFrags = getAllFragments(); - Element[] instanceDocuments = new Element[childFrags.length]; - for (int i = 0; i < instanceDocuments.length; i++) - { - Element[] childInstances = childFrags[i].genInstanceDocumentsFromParameterValues(genXSIType, namespaceTable, doc); - Element instanceDocument = doc.createElement(tagName); - for (int j = 0; j < childInstances.length; j++) - { - if (childInstances[j] != null) - instanceDocument.appendChild(childInstances[j]); - } - instanceDocuments[i] = instanceDocument; - } - return instanceDocuments; - } - - private XSDModelGroup getXSDModelGroup(XSDParticle xsdParticle) - { - if (xsdParticle != null) - { - XSDParticleContent xsdParticleContent = xsdParticle.getContent(); - if (xsdParticleContent != null) - { - if (xsdParticleContent instanceof XSDModelGroupDefinition) - { - XSDModelGroupDefinition xsdModelGroupDef = (XSDModelGroupDefinition)xsdParticleContent; - if (xsdModelGroupDef.isModelGroupDefinitionReference()) - xsdModelGroupDef = xsdModelGroupDef.getResolvedModelGroupDefinition(); - return xsdModelGroupDef.getModelGroup(); - } - else if (xsdParticleContent instanceof XSDModelGroup) - return (XSDModelGroup)xsdParticleContent; - } - } - return null; - } - - private List getInheritedParticles(XSDComplexTypeDefinition complexType) - { - Vector v = new Vector(); - if (complexType.getDerivationMethod().getValue() == XSDComplexFinal.EXTENSION) - { - XSDTypeDefinition extType = complexType.getBaseType(); - if (extType != null && !(extType instanceof XSDComplexTypeDefinition)) - { - String namespace = extType.getTargetNamespace(); - String localname = extType.getName(); - if (namespace != null && localname != null) - { - XSDNamedComponent xsdNamedComp = getXSDToFragmentController().getWSDLPartsToXSDTypeMapper().getXSDTypeFromSchema(namespace, localname, false); - if (xsdNamedComp instanceof XSDComplexTypeDefinition) - { - extType = (XSDComplexTypeDefinition)xsdNamedComp; - } - } - } - if (extType != null && extType != complexType && extType instanceof XSDComplexTypeDefinition) - { - XSDComplexTypeContent extTypeContent = XSDTypeDefinitionUtil.getXSDComplexTypeContent((XSDComplexTypeDefinition)extType); - if (extTypeContent instanceof XSDParticle) - { - XSDModelGroup xsdModelGroup = getXSDModelGroup((XSDParticle)extTypeContent); - if (xsdModelGroup != null) - { - v.addAll(getInheritedParticles((XSDComplexTypeDefinition)extType)); - v.addAll(xsdModelGroup.getParticles()); - } - } - } - } - return v; - } - - private void gatherInheritedParticles(XSDComplexTypeDefinition complexType) - { - if (complexType.getDerivationMethod().getValue() == XSDComplexFinal.EXTENSION) - { - XSDComplexTypeContent complexTypeContent = XSDTypeDefinitionUtil.getXSDComplexTypeContent(complexType); - if (complexTypeContent instanceof XSDParticle) - { - XSDModelGroup xsdModelGroup = getXSDModelGroup((XSDParticle)complexTypeContent); - if (xsdModelGroup != null) - { - List inheritedParticles = getInheritedParticles(complexType); - List particles = xsdModelGroup.getParticles(); - particles.addAll(0, inheritedParticles); - } - } - } - } - - public String createComplexInstance() - { - XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition)getXSDTypeDefinition(); - gatherInheritedParticles(complexType); - XSDComplexTypeContent complexTypeContent = XSDTypeDefinitionUtil.getXSDComplexTypeContent(complexType); - XSDToFragmentConfiguration thisConfig = getXSDToFragmentConfiguration(); - XSDToFragmentConfiguration xsdConfig = new XSDToFragmentConfiguration(); - xsdConfig.setXSDComponent(complexTypeContent); - xsdConfig.setStyle(thisConfig.getStyle()); - xsdConfig.setPartEncoding(thisConfig.getPartEncoding()); - xsdConfig.setWSDLPartName(thisConfig.getWSDLPartName()); - String newID = genID(); - addFragment(newID, getXSDToFragmentController().getFragment(xsdConfig, newID, newID)); - return newID; - } - - public String createInstance() - { - return createComplexInstance(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexRangeFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexRangeFragment.java deleted file mode 100644 index c3453ce18..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexRangeFragment.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; - -public class XSDComplexRangeFragment extends XSDComplexFragment { - public XSDComplexRangeFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) { - super(id, name, config, controller); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDComplexRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDComplexRangeWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDDefaultFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDDefaultFragment.java deleted file mode 100644 index bdce00449..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDDefaultFragment.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.explorer.platform.util.XMLUtils; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public class XSDDefaultFragment extends XSDFragment { - public XSDDefaultFragment(String id, String name, XSDToFragmentConfiguration config) { - super(id, name, config); - } - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException { - String[] param = new String[1]; - param[0] = parser.getParameter(getID()); - setParameterValues(getID(), param); - return isElement(addRootElement(param[0])); - } - - private String addRootElement(String element) { - StringBuffer sb = new StringBuffer(); - sb.append(FragmentConstants.ROOT_ELEMENT_START_TAG); - sb.append(element); - sb.append(FragmentConstants.ROOT_ELEMENT_END_TAG); - return sb.toString(); - } - - private boolean isElement(String elementString) { - try { - return (XMLUtils.stringToElement(elementString) != null); - } - catch (Throwable t) { - return false; - } - } - - public boolean validateAllParameterValues() { - String param = getParameterValue(getID(), 0); - return (param == null || isElement(addRootElement(param))); - } - - public boolean validateParameterValues(String paramKey) { - String param = getParameterValue(getID(), 0); - return (param == null || isElement(addRootElement(param))); - } - - public boolean validateParameterValue(String paramKey, int paramIndex) { - String param = getParameterValue(getID(), 0); - return (param == null || isElement(addRootElement(param))); - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) { - StringBuffer sb = new StringBuffer(); - boolean paramValid = true; - for (int i = 0; i < instanceDocuments.length; i++) { - String instanceString = XMLUtils.serialize(instanceDocuments[i], true); - if (instanceString != null && instanceString.length() > 0) - sb.append(instanceString); - else - paramValid = false; - } - String[] param = {sb.toString()}; - setParameterValues(getID(), param); - return paramValid; - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) { - String param = getParameterValue(getID(), 0); - if (param == null) - return new Element[0]; - Element root; - try { - root = (Element)doc.importNode(XMLUtils.stringToElement(addRootElement(param)), true); - } - catch (Throwable t) { - return new Element[0]; - } - NodeList nl = root.getChildNodes(); - Vector instanceDocumentVector = new Vector(); - for (int i = 0; i < nl.getLength(); i++) { - Node node = nl.item(i); - if (node instanceof Element) - instanceDocumentVector.add(node); - } - Element[] instanceDocuments = new Element[instanceDocumentVector.size()]; - for (int i = 0; i < instanceDocuments.length; i++) { - instanceDocuments[i] = (Element)instanceDocumentVector.get(i); - } - return instanceDocuments; - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDDefaultRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDDefaultWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDDelegationFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDDelegationFragment.java deleted file mode 100644 index 43b229e53..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDDelegationFragment.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDDelegationFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class XSDDelegationFragment extends XSDFragment implements IXSDDelegationFragment -{ - private IXSDFragment xsdFragment_; - - public XSDDelegationFragment(String id, String name, XSDToFragmentConfiguration config) - { - super(id, name, config); - xsdFragment_ = null; - } - - public void setName(String name) { - super.setName(name); - if (xsdFragment_ != null) - xsdFragment_.setName(name); - } - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException - { - return xsdFragment_.processParameterValues(parser); - } - - public void setParameterValues(String paramKey, String[] params) - { - xsdFragment_.setParameterValues(paramKey, params); - } - - public void setParameterValues(String paramKey, Vector params) - { - xsdFragment_.setParameterValues(paramKey, params); - } - - public String[] getParameterValues(String paramKey) - { - return xsdFragment_.getParameterValues(paramKey); - } - - public String getParameterValue(String paramKey, int paramIndex) - { - return xsdFragment_.getParameterValue(paramKey, paramIndex); - } - - public boolean validateAllParameterValues() - { - return xsdFragment_.validateAllParameterValues(); - } - - public boolean validateParameterValues(String paramKey) - { - return xsdFragment_.validateParameterValues(paramKey); - } - - public boolean validateParameterValue(String paramKey, int paramIndex) - { - return xsdFragment_.validateParameterValue(paramKey, paramIndex); - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) - { - return xsdFragment_.setParameterValuesFromInstanceDocuments(instanceDocuments); - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) - { - return xsdFragment_.genInstanceDocumentsFromParameterValues(genXSIType, namespaceTable, doc); - } - - public String getInformationFragment() - { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() - { - return "/wsdl/fragment/XSDDelegationRFragmentJSP.jsp"; - } - - public String getWriteFragment() - { - return "/wsdl/fragment/XSDDelegationWFragmentJSP.jsp"; - } - - public void setXSDDelegationFragment(IXSDFragment xsdFragment) - { - xsdFragment_ = xsdFragment; - } - - public IXSDFragment getXSDDelegationFragment() - { - return xsdFragment_; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDElementFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDElementFragment.java deleted file mode 100644 index 99590766b..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDElementFragment.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDElementFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDForm; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public class XSDElementFragment extends XSDDelegationFragment implements IXSDElementFragment -{ - private int minOccurs_; - private int maxOccurs_; - - public XSDElementFragment(String id, String name, XSDToFragmentConfiguration config) - { - super(id, name, config); - if (config != null) - { - minOccurs_ = config.getMinOccurs(); - maxOccurs_ = config.getMaxOccurs(); - } - else - { - minOccurs_ = FragmentConstants.DEFAULT_MIN_OCCURS; - maxOccurs_ = FragmentConstants.DEFAULT_MAX_OCCURS; - } - } - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException - { - IXSDFragment elementTypeFragment = getXSDDelegationFragment(); - if (!elementTypeFragment.processParameterValues(parser)) - return false; - String[] params = getParameterValues(elementTypeFragment.getID()); - if (params != null && !withinRange(params.length)) - return false; - return true; - } - - public boolean validateAllParameterValues() - { - IXSDFragment elementTypeFragment = getXSDDelegationFragment(); - String[] params = getParameterValues(elementTypeFragment.getID()); - if (params != null && !withinRange(params.length)) - return false; - if (!elementTypeFragment.validateAllParameterValues()) - return false; - return true; - } - - public boolean validateParameterValues(String paramKey) - { - String[] params = getParameterValues(paramKey); - if (params != null && !withinRange(params.length)) - return false; - if (!getXSDDelegationFragment().validateParameterValues(paramKey)) - return false; - return true; - } - - public boolean validateParameterValue(String paramKey, int paramIndex) - { - if (!withinRange(paramIndex + 1)) - return false; - XSDElementDeclaration xsdElement = (XSDElementDeclaration)getXSDToFragmentConfiguration().getXSDComponent(); - String param = getParameterValue(paramKey, paramIndex); - if (param != null && param.length() <= 0 && !xsdElement.isNillable()) - return false; - if (!getXSDDelegationFragment().validateParameterValue(paramKey, paramIndex)) - return false; - return true; - } - - public void setXSDToFragmentConfiguration(XSDToFragmentConfiguration config) - { - super.setXSDToFragmentConfiguration(config); - minOccurs_ = config.getMinOccurs(); - maxOccurs_ = config.getMaxOccurs(); - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) - { - Element[] instanceDocumentsCopy = instanceDocuments; - XSDToFragmentConfiguration config = getXSDToFragmentConfiguration(); - String wsdlPartName = config.getWSDLPartName(); - if (config.getIsWSDLPart() && config.getStyle() == FragmentConstants.STYLE_RPC && wsdlPartName != null && wsdlPartName.length() > 0 && instanceDocumentsCopy.length == 1 && wsdlPartName.equals(instanceDocumentsCopy[0].getTagName())) - { - NodeList nl = instanceDocumentsCopy[0].getChildNodes(); - Vector childElements = new Vector(); - for (int i = 0; i < nl.getLength(); i++) - { - Node node = nl.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE) - childElements.add(node); - } - instanceDocumentsCopy = (Element[])childElements.toArray(new Element[0]); - } - IXSDFragment elementTypeFragment = getXSDDelegationFragment(); - instanceDocumentsCopy = getInstanceDocumentsByTagName(instanceDocumentsCopy, getName()); - return elementTypeFragment.setParameterValuesFromInstanceDocuments(setElementsTagName(instanceDocumentsCopy, elementTypeFragment.getName())); - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) - { - Element[] instanceDocuments = getXSDDelegationFragment().genInstanceDocumentsFromParameterValues(genXSIType, namespaceTable, doc); - instanceDocuments = setElementsTagName(instanceDocuments, getInstanceDocumentTagName(namespaceTable)); - XSDToFragmentConfiguration config = getXSDToFragmentConfiguration(); - String wsdlPartName = config.getWSDLPartName(); - if (config.getIsWSDLPart() && config.getStyle() == FragmentConstants.STYLE_RPC && wsdlPartName != null && wsdlPartName.length() > 0) - { - Element[] instanceDocumentsCopy = instanceDocuments; - instanceDocuments = new Element[1]; - instanceDocuments[0] = doc.createElement(wsdlPartName); - for (int i = 0; i < instanceDocumentsCopy.length; i++) - { - if (instanceDocumentsCopy[i] != null) - instanceDocuments[0].appendChild(instanceDocumentsCopy[i]); - } - } - return instanceDocuments; - } - - protected boolean isInstanceNamespaceQualified() - { - XSDToFragmentConfiguration config = getXSDToFragmentConfiguration(); - if (config.getPartEncoding() == FragmentConstants.ENCODING_LITERAL) - { - XSDElementDeclaration xsdElement = (XSDElementDeclaration)config.getXSDComponent(); - if (xsdElement.isGlobal()) - return true; - else - { - if (xsdElement.isSetForm()) - return (xsdElement.getForm().getValue() == XSDForm.QUALIFIED); - else - return (xsdElement.getSchema().getElementFormDefault().getValue() == XSDForm.QUALIFIED); - } - } - else - return false; - } - - protected String getInstanceDocumentTagName(Hashtable namespaceTable) - { - XSDToFragmentConfiguration config = getXSDToFragmentConfiguration(); - XSDElementDeclaration xsdElement = (XSDElementDeclaration)config.getXSDComponent(); - StringBuffer tagName = new StringBuffer(); - if (isInstanceNamespaceQualified()) - { - String nsURI = null; - // port to org.eclipse.xsd - if (xsdElement.getResolvedElementDeclaration() != null) - nsURI = xsdElement.getResolvedElementDeclaration().getTargetNamespace(); - else - nsURI = xsdElement.getTargetNamespace(); - if (nsURI != null && nsURI.length() > 0) - { - String prefix = getPrefixFromNamespaceURI(nsURI, namespaceTable); - tagName.append(prefix); - tagName.append(FragmentConstants.COLON); - } - } - String xsdElementName = xsdElement.getName(); - if (xsdElementName == null || xsdElementName.length() <= 0) - { - // port to org.eclipse.xsd - if (xsdElement.getResolvedElementDeclaration() != null) - xsdElementName = xsdElement.getResolvedElementDeclaration().getName(); - else - xsdElementName = getName(); - } - tagName.append(xsdElementName); - return tagName.toString(); - } - - private boolean withinRange(int size) - { - if (size < minOccurs_) - return false; - if (maxOccurs_ != FragmentConstants.UNBOUNDED && size > maxOccurs_) - return false; - return true; - } - - public void setMinOccurs(int minOccurs) - { - minOccurs_ = minOccurs; - } - - public int getMinOccurs() - { - return minOccurs_; - } - - public void setMaxOccurs(int maxOccurs) - { - maxOccurs_ = maxOccurs; - } - - public int getMaxOccurs() - { - return maxOccurs_; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDEmptyFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDEmptyFragment.java deleted file mode 100644 index 67abf8bf3..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDEmptyFragment.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public class XSDEmptyFragment extends XSDFragment { - private int occurance_; - - public XSDEmptyFragment(String id, String name, XSDToFragmentConfiguration config) { - super(id, name, config); - occurance_ = 0; - } - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException { - String occurance = parser.getParameter(getID()); - try { - occurance_ = Integer.parseInt(occurance); - return validateAllParameterValues(); - } - catch (Throwable t) { - occurance_ = -1; - return false; - } - } - - public void setParameterValues(String paramKey, String[] params) { - } - - public void setParameterValues(String paramKey, Vector params) { - } - - public String[] getParameterValues(String paramKey) { - if (occurance_ < 0) - return null; - else { - String[] params = new String[occurance_]; - for (int i = 0; i < params.length; i++) { - params[i] = ""; - } - return params; - } - } - - public String getParameterValue(String paramKey, int paramIndex) { - if (paramIndex >= 0 && paramIndex < occurance_) - return ""; - else - return null; - } - - public boolean validateAllParameterValues() { - XSDToFragmentConfiguration xsdConfig = getXSDToFragmentConfiguration(); - int min = xsdConfig.getMinOccurs(); - int max = xsdConfig.getMaxOccurs(); - return (occurance_ >= 0 && occurance_ >= min && (max == FragmentConstants.UNBOUNDED || occurance_ <= max)); - } - - public boolean validateParameterValues(String paramKey) { - return validateAllParameterValues(); - } - - public boolean validateParameterValue(String paramKey, int paramIndex) { - return validateAllParameterValues(); - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) { - Element[] instanceDocumentsCopy = getInstanceDocumentsByTagName(instanceDocuments, getName()); - boolean paramsValid = true; - for (int i = 0; i < instanceDocumentsCopy.length; i++) { - NodeList nodeList = instanceDocumentsCopy[i].getChildNodes(); - if (nodeList.getLength() > 1) - paramsValid = false; - else if (nodeList.getLength() != 0) { - Node node = nodeList.item(0); - if (node.getNodeType() != Node.TEXT_NODE || !isWhitespace(node.getNodeValue())) - paramsValid = false; - } - } - occurance_ = instanceDocumentsCopy.length; - return paramsValid && validateAllParameterValues(); - } - - private boolean isWhitespace(String s) { - char[] chars = s.toCharArray(); - for (int i = 0; i < chars.length; i++) { - if (!Character.isWhitespace(chars[i]) || !Character.isSpaceChar(chars[i])) - return false; - } - return true; - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDEmptyWFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDEmptyRFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDFragment.java deleted file mode 100644 index 822442ac0..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDFragment.java +++ /dev/null @@ -1,298 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.xsd.XSDComponent; -import org.eclipse.xsd.XSDForm; -import org.eclipse.xsd.XSDNamedComponent; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDTypeDefinition; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public abstract class XSDFragment extends Fragment implements IXSDFragment -{ - private XSDToFragmentConfiguration config_; - private XSDTypeDefinition typeDef_; - private int seed_; - - public XSDFragment(String id, String name, XSDToFragmentConfiguration config) - { - super(id, name); - config_ = config; - if (config_ != null) - { - XSDComponent component = config.getXSDComponent(); - if (component instanceof XSDTypeDefinition) - typeDef_ = (XSDTypeDefinition)component; - else - typeDef_ = null; - } - seed_ = 0; - } - - public void setXSDToFragmentConfiguration(XSDToFragmentConfiguration config) - { - config_ = config; - if (config_ != null) - { - XSDComponent component = config.getXSDComponent(); - if (component instanceof XSDTypeDefinition) - setXSDTypeDefinition((XSDTypeDefinition)component); - } - } - - public XSDToFragmentConfiguration getXSDToFragmentConfiguration() - { - return config_; - } - - public void setXSDTypeDefinition(XSDTypeDefinition typeDef) - { - typeDef_ = typeDef; - } - - public XSDTypeDefinition getXSDTypeDefinition() - { - return typeDef_; - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) - { - Element[] instanceDocumentsCopy = getInstanceDocumentsByTagName(instanceDocuments, getName()); - String[] params = new String[instanceDocumentsCopy.length]; - boolean paramsValid = internalEquals(instanceDocumentsCopy, instanceDocuments); - for (int i = 0; i < instanceDocumentsCopy.length; i++) - { - params[i] = ""; - NodeList nodeList = instanceDocumentsCopy[i].getChildNodes(); - if (nodeList.getLength() > 0) - { - Node node = nodeList.item(0); - if (nodeList.getLength() > 1) - paramsValid = false; - if (node.getNodeType() != Node.TEXT_NODE) - paramsValid = false; - else - params[i] = node.getNodeValue(); - } - else - paramsValid = false; - } - setParameterValues(getID(), params); - return paramsValid && validateAllParameterValues(); - } - - protected Element[] getInstanceDocumentsByTagName(Element[] instanceDocuments, String tagName) - { - if (instanceDocuments == null) - return new Element[0]; - Vector instancesCopy = new Vector(); - for (int i = 0; i < instanceDocuments.length; i++) - { - if (instanceDocuments[i] == null) - continue; - String instanceTagName = trimPrefix(instanceDocuments[i].getTagName()); - if (instanceTagName.equals(tagName)) - instancesCopy.add(instanceDocuments[i]); - } - Element[] instances = new Element[instancesCopy.size()]; - instancesCopy.copyInto(instances); - return instances; - } - - protected String trimPrefix(String s) - { - String sCopy = new String(s); - int colonIndex = sCopy.indexOf(FragmentConstants.COLON); - if (colonIndex != -1 && colonIndex + 1 < sCopy.length() && !((String.valueOf(sCopy.charAt(colonIndex + 1))).equals(FragmentConstants.COLON))) - sCopy = sCopy.substring(colonIndex + 1, sCopy.length()); - return sCopy; - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) - { - String[] params = getParameterValues(getID()); - if (params == null) - return new Element[0]; - Element[] instanceDocuments = new Element[params.length]; - String tagName = getInstanceDocumentTagName(namespaceTable); - for (int i = 0; i < instanceDocuments.length; i++) - { - Element instanceDocument = doc.createElement(tagName); - Node textNode = doc.createTextNode(params[i]); - instanceDocument.appendChild(textNode); - instanceDocuments[i] = instanceDocument; - } - return (genXSIType ? addXSIType(instanceDocuments, namespaceTable) : instanceDocuments); - } - - public String genID() - { - StringBuffer newID = new StringBuffer(); - newID.append(getID()); - newID.append(FragmentConstants.ID_SEPERATOR); - newID.append(seed_++); - return newID.toString(); - } - - protected boolean isInstanceNamespaceQualified() - { - XSDSchema xsdSchema = config_.getXSDComponent().getSchema(); - return (!config_.getIsWSDLPart() && config_.getPartEncoding() == FragmentConstants.ENCODING_LITERAL && xsdSchema.getElementFormDefault().getValue() == XSDForm.QUALIFIED); - } - - protected String getInstanceDocumentTagName(Hashtable namespaceTable) - { - StringBuffer tagName = new StringBuffer(); - if (isInstanceNamespaceQualified()) - { - String nsURI = config_.getXSDComponent().getSchema().getTargetNamespace(); - String prefix = getPrefixFromNamespaceURI(nsURI, namespaceTable); - tagName.append(prefix); - tagName.append(FragmentConstants.COLON); - } - tagName.append(getName()); - return tagName.toString(); - } - - protected Element[] addXSIType(Element[] instanceDocuments, Hashtable namespaceTable) - { - XSDComponent xsdComponent = config_.getXSDComponent(); - if (instanceDocuments != null && (xsdComponent instanceof XSDNamedComponent)) - { - String xsdComponentName = ((XSDNamedComponent)xsdComponent).getName(); - if (xsdComponentName != null && xsdComponentName.length() > 0) - { - for (int i = 0; i < instanceDocuments.length; i++) - { - if (instanceDocuments[i] == null) - continue; - String xsiURI = FragmentConstants.URI_XSI; - String xsiPrefix = getPrefixFromNamespaceURI(xsiURI, namespaceTable); - String xsiTypeURI = xsdComponent.getSchema().getTargetNamespace(); - String xsiTypePrefix = getPrefixFromNamespaceURI(xsiTypeURI, namespaceTable); - ; - StringBuffer attrName = new StringBuffer(); - attrName.append(xsiPrefix); - attrName.append(FragmentConstants.COLON); - attrName.append(FragmentConstants.XSI_TYPE); - StringBuffer attrValue = new StringBuffer(); - attrValue.append(xsiTypePrefix); - attrValue.append(FragmentConstants.COLON); - attrValue.append(xsdComponentName); - instanceDocuments[i].setAttribute(attrName.toString(), attrValue.toString()); - } - } - } - return instanceDocuments; - } - - public boolean validateAllParameterValues() - { - if (!super.validateAllParameterValues()) - return false; - String[] params = getParameterValues(getID()); - int length = (params != null) ? params.length : 0; - int min = config_.getMinOccurs(); - int max = config_.getMaxOccurs(); - return (length >= min && (max == FragmentConstants.UNBOUNDED || length <= max)); - } - - protected String getPrefixFromNamespaceURI(String nsURI, Hashtable namespaceTable) - { - String prefix = (String)namespaceTable.get(nsURI); - int i = 0; - while (prefix == null || prefix.length() <= 0) - { - StringBuffer prefixCopy = new StringBuffer(); - prefixCopy.append(FragmentConstants.QNAME_PREFIX); - prefixCopy.append(String.valueOf(i)); - i++; - if (!namespaceTable.contains(prefixCopy.toString())) - { - namespaceTable.put(nsURI, prefixCopy.toString()); - prefix = prefixCopy.toString(); - } - } - return prefix; - } - - protected Element setElementTagName(Element e, String tagName) - { - if (!e.getTagName().equals(tagName)) - { - try - { - Document doc = e.getOwnerDocument(); - NodeList children = e.getChildNodes(); - NamedNodeMap attributes = e.getAttributes(); - Element eCopy = doc.createElement(tagName); - for (int i = 0; i < children.getLength(); i++) - { - Node child = children.item(i); - if (child != null) - { - eCopy.appendChild(child); - // When you append a node from one element to another, - // the original element will lose its reference to this node, - // therefore, the size of the node list will decrease by 1. - i--; - } - } - for (int j = 0; j < attributes.getLength(); j++) - { - Node attr = attributes.item(j); - if (attr != null && (attr instanceof Attr)) - { - Attr attribute = (Attr)attr; - eCopy.setAttribute(attribute.getName(), attribute.getValue()); - } - } - return eCopy; - } - catch (Exception exception) - { - } - } - return e; - } - - protected Element[] setElementsTagName(Element[] e, String tagName) - { - Element[] eCopy = new Element[e.length]; - for (int i = 0; i < eCopy.length; i++) - { - eCopy[i] = setElementTagName(e[i], tagName); - } - return eCopy; - } - - protected boolean internalEquals(Element[] instanceDocumentsCopy, Element[] instanceDocuments) - { - if (!config_.getIsWSDLPart()) - { - int length = (instanceDocuments != null) ? instanceDocuments.length : 0; - int lengthCopy = (instanceDocumentsCopy != null) ? instanceDocumentsCopy.length : 0; - return (length == lengthCopy); - } - return true; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupAllFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupAllFragment.java deleted file mode 100644 index 6ed6df191..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupAllFragment.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDGroupAllFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDModelGroup; -import org.w3c.dom.Element; - -public class XSDGroupAllFragment extends XSDGroupFragment implements IXSDGroupAllFragment { - private String groupID_; - - public XSDGroupAllFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller, xsdModelGroup); - groupID_ = null; - } - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException { - String groupID = parser.getParameter(getID()); - if (groupID_ != null && groupID != null && groupID_.equals(groupID)) { - setGroupMemberIDsOrdering(parser.getParameterValues(groupID_)); - boolean valuesValid = true; - IXSDFragment[] groupMemberFragments = getGroupMemberFragments(groupID_); - for (int i = 0; i < groupMemberFragments.length; i++) { - if (groupMemberFragments[i] != null && !groupMemberFragments[i].processParameterValues(parser)) - valuesValid = false; - } - return valuesValid; - } - else { - groupID_ = null; - removeGroupIDs(); - return true; - } - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) { - removeGroupIDs(); - boolean paramsValid = true; - if (instanceDocuments != null && instanceDocuments.length > 0) { - groupID_ = createInstance(); - IXSDFragment[] groupMemberFrags = getGroupMemberFragments(groupID_); - String[] groupMemberIDsOrder = new String[groupMemberFrags.length]; - int orderIndex = 0; - for (int i = 0; i < instanceDocuments.length; i++) { - boolean paramsAssigned = false; - for (int j = 0; j < groupMemberFrags.length; j++) { - if (groupMemberFrags[j] != null && groupMemberFrags[j].getName().equals(trimPrefix(instanceDocuments[i].getTagName()))) { - Element[] childInstance = {instanceDocuments[i]}; - if (!groupMemberFrags[j].setParameterValuesFromInstanceDocuments(childInstance)) - paramsValid = false; - groupMemberIDsOrder[orderIndex] = groupMemberFrags[j].getID(); - orderIndex++; - paramsAssigned = true; - groupMemberFrags[j] = null; - break; - } - } - if (!paramsAssigned) - paramsValid = false; - } - for (int k = 0; k < groupMemberFrags.length; k++) { - if (groupMemberFrags[k] != null) { - groupMemberIDsOrder[orderIndex] = groupMemberFrags[k].getID(); - orderIndex++; - } - } - setGroupMemberIDsOrdering(groupMemberIDsOrder); - } - return paramsValid; - } - - public String getGroupAllInstance() { - if (groupID_ == null) - groupID_ = createGroupInstance(); - return groupID_; - } - - public String createInstance() { - return getGroupAllInstance(); - } - - public boolean setGroupMemberIDsOrdering(String[] groupMemberIDs) { - if (groupMemberIDs == null) - return false; - String[] existingGroupMemberIDs = getGroupMemberIDs(groupID_); - if (existingGroupMemberIDs.length != groupMemberIDs.length) - return false; - Vector existingGroupMemberIDsVector = new Vector(); - for (int i = 0; i < existingGroupMemberIDs.length; i++) { - existingGroupMemberIDsVector.add(existingGroupMemberIDs[i]); - } - for (int j = 0; j < groupMemberIDs.length; j++) { - if (!existingGroupMemberIDsVector.remove(groupMemberIDs[j])) - return false; - } - if (setFragmentsOrder(groupMemberIDs)) { - setGroupMemberIDs(groupID_, groupMemberIDs); - return true; - } - else - return false; - } - - public boolean moveUpGroupMemberID(String groupMemberID) { - String[] groupMemberIDs = getGroupMemberIDs(groupID_); - if (groupMemberID.equals(groupMemberIDs[0])) - return false; - for (int i = 1; i < groupMemberIDs.length; i++) { - if (groupMemberID.equals(groupMemberIDs[i])) { - groupMemberIDs[i] = groupMemberIDs[i - 1]; - groupMemberIDs[i - 1] = groupMemberID; - if (setFragmentsOrder(groupMemberIDs)) { - setGroupMemberIDs(groupID_, groupMemberIDs); - return true; - } - else - return false; - } - } - return false; - } - - public boolean moveDownGroupMemberID(String groupMemberID) { - String[] groupMemberIDs = getGroupMemberIDs(groupID_); - if (groupMemberID.equals(groupMemberIDs[groupMemberIDs.length - 1])) - return false; - for (int i = 0; i < groupMemberIDs.length - 1; i++) { - if (groupMemberID.equals(groupMemberIDs[i])) { - groupMemberIDs[i] = groupMemberIDs[i + 1]; - groupMemberIDs[i + 1] = groupMemberID; - if (setFragmentsOrder(groupMemberIDs)) { - setGroupMemberIDs(groupID_, groupMemberIDs); - return true; - } - else - return false; - } - } - return false; - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDGroupRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDGroupAllWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupChoiceFixFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupChoiceFixFragment.java deleted file mode 100644 index 4f6d724cc..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupChoiceFixFragment.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDModelGroup; - -public class XSDGroupChoiceFixFragment extends XSDGroupChoiceFragment { - public XSDGroupChoiceFixFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller, xsdModelGroup); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDGroupChoiceRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDGroupChoiceFixWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupChoiceFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupChoiceFragment.java deleted file mode 100644 index bd8edc753..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupChoiceFragment.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.emf.common.util.EList; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDGroupChoiceFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDParticle; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public abstract class XSDGroupChoiceFragment extends XSDGroupFragment implements IXSDGroupChoiceFragment { - private XSDParticle[] choices_; - private Hashtable choiceIndexes_; - - public XSDGroupChoiceFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller, xsdModelGroup); - choices_ = null; - choiceIndexes_ = new Hashtable(); - } - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException { - super.processParameterValues(parser); - String[] groupIDs = getGroupIDs(); - choiceIndexes_.clear(); - boolean paramsValid = true; - for (int i = 0; i < groupIDs.length; i++) { - String selectedChoiceFragID = parser.getParameter(groupIDs[i]); - int choiceIndex = 0; - IXSDFragment[] choiceFrags = getGroupMemberFragments(groupIDs[i]); - for (int j = 0; j < choiceFrags.length; j++) { - if (choiceFrags[j].getID().equals(selectedChoiceFragID)) { - choiceIndex = j; - paramsValid = (paramsValid && choiceFrags[j].validateAllParameterValues()); - break; - } - } - setChoiceIndex(groupIDs[i], choiceIndex); - } - return paramsValid; - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) { - removeGroupIDs(); - choiceIndexes_.clear(); - boolean paramsValid = true; - if (instanceDocuments != null) { - for (int i = 0; i < instanceDocuments.length; i++) { - String groupID = createGroupChoiceInstance(0); - IXSDFragment[] choiceFrags = getGroupMemberFragments(groupID); - for (int j = 0; j < choiceFrags.length; j++) { - if (choiceFrags[j].getName().equals(trimPrefix(instanceDocuments[i].getTagName()))) { - XSDToFragmentConfiguration xsdConfig = choiceFrags[j].getXSDToFragmentConfiguration(); - Element[] childInstances = getInstanceDocumentPartition(instanceDocuments, i, xsdConfig.getMinOccurs(), xsdConfig.getMaxOccurs()); - if (!choiceFrags[j].setParameterValuesFromInstanceDocuments(childInstances)) - paramsValid = false; - setChoiceIndex(groupID, j); - if (childInstances.length > 0) - i = i + childInstances.length - 1; // minus 1 because there's an i++ in the outer for loop - break; - } - } - } - } - return paramsValid; - } - - private Element[] getInstanceDocumentPartition(Element[] instanceDocuments, int start, int minSize, int maxSize) { - String tagName = instanceDocuments[start].getTagName(); - int size = 1; - for (int i = start + 1; i < instanceDocuments.length; i++) { - if (instanceDocuments[i].getTagName().equals(tagName)) - size++; - else - break; - } - if (maxSize != FragmentConstants.UNBOUNDED && size > maxSize) { - size = size - minSize; - if (size > maxSize) - size = maxSize; - } - Element[] subset = new Element[size]; - for (int j = 0; j < subset.length; j++) { - subset[j] = instanceDocuments[start + j]; - } - return subset; - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) { - Vector instanceDocumentsCopy = new Vector(); - String[] groupIDs = getGroupIDs(); - for (int i = 0; i < groupIDs.length; i++) { - IXSDFragment[] choiceFrags = getGroupMemberFragments(groupIDs[i]); - int choiceIndex = getChoiceIndex(groupIDs[i]); - Element[] choiceFragInstances = choiceFrags[choiceIndex].genInstanceDocumentsFromParameterValues(genXSIType, namespaceTable, doc); - for (int j = 0; j < choiceFragInstances.length; j++) { - instanceDocumentsCopy.add(choiceFragInstances[j]); - } - } - Element[] instanceDocuments = new Element[instanceDocumentsCopy.size()]; - instanceDocumentsCopy.copyInto(instanceDocuments); - return instanceDocuments; - } - - public XSDParticle[] getChoices() { - if (choices_ == null) { - EList particles = getXSDModelGroup().getParticles(); - choices_ = new XSDParticle[particles.size()]; - for (int i = 0; i < choices_.length; i++) { - choices_[i] = (XSDParticle)particles.get(i); - } - } - return choices_; - } - - public String createGroupChoiceInstance(int choiceIndex) { - getChoices(); - if (choiceIndex < 0 || choiceIndex > choices_.length - 1) - return null; - String groupID = createGroupInstance(); - setChoiceIndex(groupID, choiceIndex); - return groupID; - } - - public String createInstance() { - return createGroupChoiceInstance(0); - } - - public int getChoiceIndex(String groupID) { - Integer index = (Integer)choiceIndexes_.get(groupID); - if (index != null) - return index.intValue(); - else - return 0; - } - - public void setChoiceIndex(String groupID, int choiceIndex) { - choiceIndexes_.put(groupID, new Integer(choiceIndex)); - } - - public boolean validateAllParameterValues() - { - String[] groupIDs = getGroupIDs(); - for (int i = 0; i < groupIDs.length; i++) - { - int selectionIndex = getChoiceIndex(groupIDs[i]); - if (!getGroupMemberFragments(groupIDs[i])[selectionIndex].validateAllParameterValues()) - return false; - } - return true; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupChoiceRangeFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupChoiceRangeFragment.java deleted file mode 100644 index ca3bffb4c..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupChoiceRangeFragment.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDModelGroup; - -public class XSDGroupChoiceRangeFragment extends XSDGroupChoiceFragment { - public XSDGroupChoiceRangeFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller, xsdModelGroup); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDGroupChoiceRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDGroupChoiceRangeWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupFragment.java deleted file mode 100644 index 682a2f363..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupFragment.java +++ /dev/null @@ -1,261 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - - -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.emf.common.util.EList; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDGroupFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDComponent; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDParticleContent; -import org.eclipse.xsd.XSDWildcard; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public abstract class XSDGroupFragment extends XSDMapFragment implements IXSDGroupFragment { - private XSDModelGroup xsdModelGroup_; - private Vector groupIDsOrder_; - private Hashtable groupIDs_; - - public XSDGroupFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller); - xsdModelGroup_ = xsdModelGroup; - groupIDsOrder_ = new Vector(); - groupIDs_ = new Hashtable(); - } - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException { - boolean valuesValid = true; - String[] params = parser.getParameterValues(getID()); - Vector frags = new Vector(); - Vector groupIDsOrderCopy = new Vector(); - Hashtable groupIDsCopy = new Hashtable(); - for (int i = 0; params != null && i < params.length; i++) { - if (params[i] != null) { - groupIDsOrderCopy.add(params[i]); - groupIDsCopy.put(params[i], getGroupMemberIDs(params[i])); - IXSDFragment[] groupMemberFragments = getGroupMemberFragments(params[i]); - for (int j = 0; j < groupMemberFragments.length; j++) { - if (groupMemberFragments[j] != null) { - frags.add(groupMemberFragments[j]); - if (!groupMemberFragments[j].processParameterValues(parser)) - valuesValid = false; - } - } - } - } - groupIDsOrder_ = groupIDsOrderCopy; - groupIDs_ = groupIDsCopy; - removeAllFragments(); - addFragments(frags); - return valuesValid; - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) { - removeGroupIDs(); - boolean paramsValid = true; - String prevGroupID = null; - String currGroupID = null; - int groupMemberIndex = 0; - for (int i = 0; i < instanceDocuments.length; ) { - if (currGroupID == null) { - String newGroupID = createInstance(); - prevGroupID = currGroupID; - currGroupID = newGroupID; - } - Element[] instancePartition = null; - int j = groupMemberIndex; - boolean paramsAssigned = false; - int wildcardFragIndex = -1; - do { - IXSDFragment[] groupMemberFrags = getGroupMemberFragments(currGroupID); - XSDComponent xsdComponent = groupMemberFrags[j].getXSDToFragmentConfiguration().getXSDComponent(); - if (xsdComponent instanceof XSDWildcard) { - if (wildcardFragIndex < 0) - wildcardFragIndex = j; - } - else if (groupMemberFrags[j].getName().equals(trimPrefix(instanceDocuments[i].getTagName()))) { - instancePartition = getInstanceDocumentPartition(instanceDocuments, i, groupMemberFrags[j].getXSDToFragmentConfiguration().getMaxOccurs()); - if (!groupMemberFrags[j].setParameterValuesFromInstanceDocuments(instancePartition)) - paramsValid = false; - paramsAssigned = true; - } - if (j == groupMemberFrags.length - 1) { - j = 0; - String newGroupID; - if (!paramsAssigned) - newGroupID = createInstance(); - else - newGroupID = null; - prevGroupID = currGroupID; - currGroupID = newGroupID; - } - else - j++; - } while (!paramsAssigned && j != groupMemberIndex); - groupMemberIndex = j; - if (!paramsAssigned) { - instancePartition = getInstanceDocumentPartition(instanceDocuments, i, FragmentConstants.UNBOUNDED); - if (wildcardFragIndex >= 0) { - if (wildcardFragIndex >= groupMemberIndex) { - removeGroupID(currGroupID); - currGroupID = prevGroupID; - } - groupMemberIndex = wildcardFragIndex; - IXSDFragment[] groupMemberFrags = getGroupMemberFragments(currGroupID); - if (!groupMemberFrags[wildcardFragIndex].setParameterValuesFromInstanceDocuments(instancePartition)) - paramsValid = false; - paramsAssigned = true; - } - else if (currGroupID != null && (prevGroupID == null || !currGroupID.equals(prevGroupID))) { - paramsValid = false; - removeGroupID(currGroupID); - currGroupID = prevGroupID; - } - } - i = i + instancePartition.length; - } - return paramsValid; - } - - private Element[] getInstanceDocumentPartition(Element[] instanceDocuments, int start, int maxSize) { - String tagName = instanceDocuments[start].getTagName(); - int size = 1; - for (int i = start + 1; i < instanceDocuments.length; i++) { - if (maxSize != FragmentConstants.UNBOUNDED && size >= maxSize) - break; - else if (instanceDocuments[i].getTagName().equals(tagName)) - size++; - else - break; - } - Element[] subset = new Element[size]; - for (int j = 0; j < subset.length; j++) { - subset[j] = instanceDocuments[start + j]; - } - return subset; - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) { - IXSDFragment[] groupMemberFragments = getAllFragments(); - Vector instanceDocumentsCopy = new Vector(); - for (int i = 0; i < groupMemberFragments.length; i++) { - Element[] fragmentInstances = groupMemberFragments[i].genInstanceDocumentsFromParameterValues(genXSIType, namespaceTable, doc); - for (int j = 0; j < fragmentInstances.length; j++) { - instanceDocumentsCopy.add(fragmentInstances[j]); - } - } - Element[] instanceDocuments = new Element[instanceDocumentsCopy.size()]; - for (int k = 0; k < instanceDocuments.length; k++) { - instanceDocuments[k] = (Element)instanceDocumentsCopy.get(k); - } - return instanceDocuments; - } - - public void setXSDModelGroup(XSDModelGroup xsdModelGroup) { - xsdModelGroup_ = xsdModelGroup; - } - - public XSDModelGroup getXSDModelGroup() { - return xsdModelGroup_; - } - - public String[] getGroupIDs() { - String[] groupIDs = new String[groupIDsOrder_.size()]; - for (int i = 0; i < groupIDs.length; i++) { - groupIDs[i] = (String)groupIDsOrder_.get(i); - } - return groupIDs; - } - - protected void removeGroupIDs() { - removeAllFragments(); - groupIDsOrder_.clear(); - groupIDs_.clear(); - } - - protected void removeGroupID(String groupID) { - String[] memberFragIDs = getGroupMemberIDs(groupID); - removeFragments(memberFragIDs); - groupIDsOrder_.remove(groupID); - groupIDs_.remove(groupID); - } - - protected void setGroupMemberIDs(String groupID, String[] groupMemberIDs) { - if (groupID != null) { - if (!groupIDsOrder_.contains(groupID)) - groupIDsOrder_.add(groupID); - if (groupMemberIDs != null) - groupIDs_.put(groupID, groupMemberIDs); - else - groupIDs_.put(groupID, new String[0]); - } - } - - protected void setGroupMemberFragments(String groupID, IXSDFragment[] groupMemberFragments) { - addFragments(groupMemberFragments); - String[] ids = new String[groupMemberFragments.length]; - for (int i = 0; i < ids.length; i++) { - ids[i] = groupMemberFragments[i].getID(); - } - setGroupMemberIDs(groupID, ids); - } - - public String[] getGroupMemberIDs(String groupID) { - if (groupID != null) { - String[] groupMemberIDs = (String[])groupIDs_.get(groupID); - if (groupMemberIDs != null) - return groupMemberIDs; - } - return new String[0]; - } - - public IXSDFragment[] getGroupMemberFragments(String groupID) { - String[] groupMemberIDs = getGroupMemberIDs(groupID); - IXSDFragment[] groupMemberFragments = new IXSDFragment[groupMemberIDs.length]; - for (int i = 0; i < groupMemberFragments.length; i++) { - groupMemberFragments[i] = getFragment(groupMemberIDs[i]); - } - return groupMemberFragments; - } - - protected String createGroupInstance() { - String groupID = genID(); - EList particles = getXSDModelGroup().getParticles(); - String[] groupMemberIDs = new String[particles.size()]; - for (int i = 0; i < particles.size(); i++) { - XSDParticle xsdParticle = (XSDParticle)particles.get(i); - XSDParticleContent xsdParticleContent = xsdParticle.getContent(); - XSDToFragmentConfiguration thisConfig = getXSDToFragmentConfiguration(); - XSDToFragmentConfiguration xsdConfig = new XSDToFragmentConfiguration(); - if (xsdParticleContent instanceof XSDComponent) - xsdConfig.setXSDComponent((XSDComponent)xsdParticleContent); - else - xsdConfig.setXSDComponent(null); - xsdConfig.setStyle(thisConfig.getStyle()); - xsdConfig.setPartEncoding(thisConfig.getPartEncoding()); - xsdConfig.setWSDLPartName(thisConfig.getWSDLPartName()); - groupMemberIDs[i] = genID(); - addFragment(groupMemberIDs[i], getXSDToFragmentController().getFragment(xsdConfig, groupMemberIDs[i], groupMemberIDs[i])); - } - setGroupMemberIDs(groupID, groupMemberIDs); - return groupID; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupSeqFixFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupSeqFixFragment.java deleted file mode 100644 index 31a1a372c..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupSeqFixFragment.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDModelGroup; - -public class XSDGroupSeqFixFragment extends XSDGroupSeqFragment { - public XSDGroupSeqFixFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller, xsdModelGroup); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDGroupRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDGroupSeqFixWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupSeqFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupSeqFragment.java deleted file mode 100644 index e30813040..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupSeqFragment.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDGroupSeqFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDModelGroup; - -public abstract class XSDGroupSeqFragment extends XSDGroupFragment implements IXSDGroupSeqFragment { - public XSDGroupSeqFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller, xsdModelGroup); - } - - public String createGroupSeqInstance() { - return createGroupInstance(); - } - - public String createInstance() { - return createGroupSeqInstance(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupSeqRangeFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupSeqRangeFragment.java deleted file mode 100644 index afb6a59fb..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDGroupSeqRangeFragment.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDModelGroup; - -public class XSDGroupSeqRangeFragment extends XSDGroupSeqFragment { - public XSDGroupSeqRangeFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller, XSDModelGroup xsdModelGroup) { - super(id, name, config, controller, xsdModelGroup); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDGroupRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDGroupSeqRangeWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDMapFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDMapFragment.java deleted file mode 100644 index 1c5404f49..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDMapFragment.java +++ /dev/null @@ -1,229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDMapFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; - -public abstract class XSDMapFragment extends XSDFragment implements IXSDMapFragment { - private XSDToFragmentController controller_; - private Vector fragmentsOrder_; - private Hashtable fragments_; - - public XSDMapFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) { - super(id, name, config); - controller_ = controller; - fragmentsOrder_ = new Vector(); - fragments_ = new Hashtable(); - } - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException { - boolean valuesValid = true; - String[] params = parser.getParameterValues(getID()); - Vector frags = new Vector(); - if (params != null) { - for (int i = 0; i < params.length; i++) { - if (params[i] != null) { - IXSDFragment frag = getFragment(params[i]); - if (frag != null) { - frags.add(frag); - if (!frag.processParameterValues(parser)) - valuesValid = false; - } - } - } - } - removeAllFragments(); - addFragments(frags); - return valuesValid; - } - - public void setParameterValues(String paramKey, String[] params) { - IXSDFragment frag = getFragment(paramKey); - if (frag != null) - frag.setParameterValues(paramKey, params); - } - - public String[] getParameterValues(String paramKey) { - IXSDFragment frag = getFragment(paramKey); - return (frag != null) ? frag.getParameterValues(paramKey) : null; - } - - public boolean validateAllParameterValues() { - IXSDFragment[] fragments = getAllFragments(); - for (int i = 0; i < fragments.length; i++) { - if (!fragments[i].validateAllParameterValues()) - return false; - } - return true; - } - - public boolean validateParameterValues(String paramKey) { - IXSDFragment frag = getFragment(paramKey); - return (frag != null) ? frag.validateParameterValues(paramKey) : true; - } - - public boolean validateParameterValue(String paramKey, int paramIndex) { - IXSDFragment frag = getFragment(paramKey); - return (frag != null) ? frag.validateParameterValue(paramKey, paramIndex) : true; - } - - public void setXSDToFragmentController(XSDToFragmentController controller) { - controller_ = controller; - } - - public XSDToFragmentController getXSDToFragmentController() { - return controller_; - } - - protected void addFragment(String id, IXSDFragment frag) { - addFragment(id, frag, true); - } - - protected void addFragments(String[] id, IXSDFragment[] frags) { - addFragments(id, frags, true); - } - - protected void addFragment(IXSDFragment frag) { - addFragment(frag, true); - } - - protected void addFragments(IXSDFragment[] frags) { - addFragments(frags, true); - } - - protected void addFragments(Vector frags) { - addFragments(frags, true); - } - - protected void addFragment(String id, IXSDFragment frag, boolean addToController) { - fragmentsOrder_.add(id); - fragments_.put(id, frag); - controller_.addToCache(id, frag); - } - - protected void addFragments(String[] id, IXSDFragment[] frags, boolean addToController) { - for (int i = 0; i < id.length && i < frags.length; i++) { - addFragment(id[i], frags[i], addToController); - } - } - - protected void addFragment(IXSDFragment frag, boolean addToController) { - addFragment(frag.getID(), frag, addToController); - } - - protected void addFragments(IXSDFragment[] frags, boolean addToController) { - for (int i = 0; i < frags.length; i++) { - addFragment(frags[i].getID(), frags[i], addToController); - } - } - - protected void addFragments(Vector frags, boolean addToController) { - Iterator it = frags.iterator(); - while (it.hasNext()) { - Object obj = it.next(); - if (obj instanceof IXSDFragment) { - IXSDFragment frag = (IXSDFragment)obj; - addFragment(frag.getID(), frag, addToController); - } - } - } - - public String[] getFragmentsOrder() { - String[] fragmentsOrder = new String[fragmentsOrder_.size()]; - for (int i = 0; i < fragmentsOrder.length; i++) { - fragmentsOrder[i] = (String)fragmentsOrder_.get(i); - } - return fragmentsOrder; - } - - protected boolean setFragmentsOrder(String[] fragmentsOrder) { - if (fragmentsOrder.length != fragmentsOrder_.size()) - return false; - Vector fragmentsOrderCopy = new Vector(fragmentsOrder_); - for (int i = 0; i < fragmentsOrder.length; i++) { - if (!fragmentsOrderCopy.remove(fragmentsOrder[i])) - return false; - } - fragmentsOrder_.clear(); - for (int j = 0; j < fragmentsOrder.length; j++) { - fragmentsOrder_.add(fragmentsOrder[j]); - } - return true; - } - - public IXSDFragment getFragment(String id) { - return (IXSDFragment)fragments_.get(id); - } - - public IXSDFragment[] getFragments(String[] ids) { - IXSDFragment[] frags = new IXSDFragment[ids.length]; - for (int i = 0; i < frags.length; i++) { - frags[i] = getFragment(ids[i]); - } - return frags; - } - - public IXSDFragment[] getAllFragments() { - IXSDFragment[] fragments = new IXSDFragment[fragmentsOrder_.size()]; - for (int i = 0; i < fragmentsOrder_.size(); i++) { - fragments[i] = getFragment((String)fragmentsOrder_.get(i)); - } - return fragments; - } - - protected void removeFragment(String id) { - removeFragment(id, true); - } - - protected void removeFragments(String[] ids) { - removeFragments(ids, true); - } - - protected void removeAllFragments() { - removeAllFragments(true); - } - - protected void removeFragment(String id, boolean removeFromController) { - fragmentsOrder_.remove(id); - fragments_.remove(id); - if (removeFromController) - controller_.removeFromCache(id); - } - - protected void removeFragments(String[] ids, boolean removeFromController) { - for (int i = 0; i < ids.length; i++) { - removeFragment(ids[i], removeFromController); - } - } - - protected void removeAllFragments(boolean removeFromController) { - if (removeFromController) - { - Enumeration ids = fragments_.keys(); - while (ids.hasMoreElements()) - { - String id = (String)ids.nextElement(); - controller_.removeFromCache(id); - } - } - fragmentsOrder_.clear(); - fragments_.clear(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicDateTimeFixFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicDateTimeFixFragment.java deleted file mode 100644 index 3be533708..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicDateTimeFixFragment.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; - -public class XSDSimpleAtomicDateTimeFixFragment extends XSDSimpleAtomicFixFragment { - private int calendarType_; - public XSDSimpleAtomicDateTimeFixFragment(String id, String name, XSDToFragmentConfiguration config, int calendarType) { - super(id, name, config); - calendarType_ = calendarType; - } - - public String getWriteFragment() { - StringBuffer fragmentLink = new StringBuffer("/wsdl/fragment/XSDSimpleAtomicDateTimeFixWFragmentJSP.jsp?"); - fragmentLink.append(ActionInputs.CALENDAR_TYPE).append('=').append(calendarType_); - return fragmentLink.toString(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicDateTimeRangeFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicDateTimeRangeFragment.java deleted file mode 100644 index 6fb2f2cc4..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicDateTimeRangeFragment.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; - -public class XSDSimpleAtomicDateTimeRangeFragment extends XSDSimpleAtomicRangeFragment { - private int calendarType_; - public XSDSimpleAtomicDateTimeRangeFragment(String id, String name, XSDToFragmentConfiguration config, int calendarType) { - super(id, name, config); - calendarType_ = calendarType; - } - - public String getWriteFragment() { - StringBuffer fragmentLink = new StringBuffer("/wsdl/fragment/XSDSimpleAtomicDateTimeRangeWFragmentJSP.jsp?"); - fragmentLink.append(ActionInputs.CALENDAR_TYPE).append('=').append(calendarType_); - return fragmentLink.toString(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicEnumFixFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicEnumFixFragment.java deleted file mode 100644 index 796bd862a..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicEnumFixFragment.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.util.OptionVector; - -public class XSDSimpleAtomicEnumFixFragment extends XSDSimpleAtomicEnumFragment { - public XSDSimpleAtomicEnumFixFragment(String id, String name, XSDToFragmentConfiguration config, EList elist) { - super(id, name, config, elist); - } - - public XSDSimpleAtomicEnumFixFragment(String id, String name, XSDToFragmentConfiguration config, OptionVector v) - { - super(id, name, config, v); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDSimpleAtomicInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDSimpleAtomicRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDSimpleAtomicEnumFixWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicEnumFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicEnumFragment.java deleted file mode 100644 index 96387f551..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicEnumFragment.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.util.OptionVector; -import org.eclipse.xsd.XSDEnumerationFacet; - -public abstract class XSDSimpleAtomicEnumFragment extends XSDSimpleAtomicFragment { - private OptionVector optionVector_; - public XSDSimpleAtomicEnumFragment(String id, String name, XSDToFragmentConfiguration config, EList elist) { - super(id, name, config); - optionVector_ = new OptionVector(); - for (int i=0;i<elist.size();i++) - { - String enumValue = ((XSDEnumerationFacet)elist.get(i)).getLexicalValue(); - optionVector_.addOption(enumValue,enumValue); - } - } - - public XSDSimpleAtomicEnumFragment(String id, String name, XSDToFragmentConfiguration config, OptionVector v) - { - super(id, name, config); - optionVector_ = new OptionVector(); - for (int i=0;i<v.size();i++) - optionVector_.addOption(v.getDisplayValue(i),v.getValue(i)); - } - - public final OptionVector getOptionVector() - { - return optionVector_; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicEnumRangeFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicEnumRangeFragment.java deleted file mode 100644 index 4ed3c814b..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicEnumRangeFragment.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.util.OptionVector; - -public class XSDSimpleAtomicEnumRangeFragment extends XSDSimpleAtomicEnumFragment { - public XSDSimpleAtomicEnumRangeFragment(String id, String name, XSDToFragmentConfiguration config, EList elist) { - super(id, name, config, elist); - } - - public XSDSimpleAtomicEnumRangeFragment(String id, String name, XSDToFragmentConfiguration config, OptionVector v) - { - super(id, name, config, v); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDSimpleAtomicInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDSimpleAtomicRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDSimpleAtomicEnumRangeWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicFixFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicFixFragment.java deleted file mode 100644 index 5c8dddfcf..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicFixFragment.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; - -public class XSDSimpleAtomicFixFragment extends XSDSimpleAtomicFragment { - public XSDSimpleAtomicFixFragment(String id, String name, XSDToFragmentConfiguration config) { - super(id, name, config); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDSimpleAtomicInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDSimpleAtomicRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDSimpleAtomicFixWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicFragment.java deleted file mode 100644 index 132f6f6db..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicFragment.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDSimpleAtomicFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.xsd.XSDSimpleTypeDefinition; - -public abstract class XSDSimpleAtomicFragment extends XSDFragment implements IXSDSimpleAtomicFragment { - public XSDSimpleAtomicFragment(String id, String name, XSDToFragmentConfiguration config) { - super(id, name, config); - } - - public boolean validateParameterValue(String paramKey, int paramIndex) { - String param = getParameterValue(paramKey, paramIndex); - if (param != null && !((XSDSimpleTypeDefinition)getXSDTypeDefinition()).isValidLiteral(param)) - return false; - else - return true; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicRangeFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicRangeFragment.java deleted file mode 100644 index e3bbd7600..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleAtomicRangeFragment.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; - -public class XSDSimpleAtomicRangeFragment extends XSDSimpleAtomicFragment { - public XSDSimpleAtomicRangeFragment(String id, String name, XSDToFragmentConfiguration config) { - super(id, name, config); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDSimpleAtomicInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDSimpleAtomicRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDSimpleAtomicRangeWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleListFixFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleListFixFragment.java deleted file mode 100644 index e265bac5b..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleListFixFragment.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; - -public class XSDSimpleListFixFragment extends XSDSimpleListFragment { - public XSDSimpleListFixFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) { - super(id, name, config, controller); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDSimpleListRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDSimpleListFixWFragmentJSP.jsp"; - } - -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleListFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleListFragment.java deleted file mode 100644 index 764f84255..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleListFragment.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import java.util.Hashtable; -import java.util.StringTokenizer; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDSimpleListFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDLengthFacet; -import org.eclipse.xsd.XSDMaxLengthFacet; -import org.eclipse.xsd.XSDMinLengthFacet; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public abstract class XSDSimpleListFragment extends XSDMapFragment implements IXSDSimpleListFragment -{ - public XSDSimpleListFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) - { - super(id, name, config, controller); - } - - public void setName(String name) - { - super.setName(name); - IXSDFragment[] fragments = getAllFragments(); - for (int i = 0; i < fragments.length; i++) - { - fragments[i].setName(name); - } - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) - { - Element[] instanceDocumentsCopy = getInstanceDocumentsByTagName(instanceDocuments, getName()); - String[] params = new String[instanceDocumentsCopy.length]; - boolean paramsValid = internalEquals(instanceDocumentsCopy, instanceDocuments); - for (int i = 0; i < instanceDocumentsCopy.length; i++) - { - params[i] = ""; - NodeList nodeList = instanceDocumentsCopy[i].getChildNodes(); - if (nodeList.getLength() > 0) - { - Node node = nodeList.item(0); - if (nodeList.getLength() > 1) - paramsValid = false; - if (node.getNodeType() != Node.TEXT_NODE) - paramsValid = false; - else - params[i] = node.getNodeValue(); - } - else - paramsValid = false; - } - removeAllFragments(); - for (int i = 0; i < params.length; i++) - { - IXSDFragment childFrag = getFragment(createListInstance()); - StringTokenizer st = new StringTokenizer(params[i].trim()); - String[] childParams = new String[st.countTokens()]; - for (int j = 0; j < childParams.length; j++) - { - childParams[j] = st.nextToken(); - } - childFrag.setParameterValues(childFrag.getID(), childParams); - paramsValid = paramsValid && childFrag.validateAllParameterValues(); - } - return paramsValid; - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) - { - IXSDFragment[] fragments = getAllFragments(); - Element[] instanceDocuments = new Element[fragments.length]; - String tagName = getInstanceDocumentTagName(namespaceTable); - for (int i = 0; i < fragments.length; i++) - { - Element instanceDocument = doc.createElement(tagName); - StringBuffer listValue = new StringBuffer(); - String[] params = fragments[i].getParameterValues(fragments[i].getID()); - for (int j = 0; params != null && j < params.length; j++) - { - if (j != 0) - listValue.append(FragmentConstants.LIST_SEPERATOR); - listValue.append(params[j]); - } - Node textNode = doc.createTextNode(listValue.toString()); - instanceDocument.appendChild(textNode); - instanceDocuments[i] = instanceDocument; - } - return (genXSIType ? addXSIType(instanceDocuments, namespaceTable) : instanceDocuments); - } - - public String createListInstance() - { - String newID = genID(); - XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition)getXSDTypeDefinition(); - int min = 0; - int max = FragmentConstants.UNBOUNDED; - XSDLengthFacet xsdLengthFacet = simpleType.getLengthFacet(); - // port to org.eclipse.xsd - if (xsdLengthFacet != null) - { - min = xsdLengthFacet.getValue(); - max = xsdLengthFacet.getValue(); - } - else - { - XSDMinLengthFacet xsdMinLengthFacet = simpleType.getMinLengthFacet(); - XSDMaxLengthFacet xsdMaxLengthFacet = simpleType.getMaxLengthFacet(); - // port to org.eclipse.xsd - if (xsdMinLengthFacet != null) - min = xsdMinLengthFacet.getValue(); - if (xsdMaxLengthFacet != null) - max = xsdMaxLengthFacet.getValue(); - } - XSDToFragmentConfiguration thisConfig = getXSDToFragmentConfiguration(); - XSDToFragmentConfiguration xsdConfig = new XSDToFragmentConfiguration(); - xsdConfig.setXSDComponent(simpleType.getItemTypeDefinition()); - xsdConfig.setStyle(thisConfig.getStyle()); - xsdConfig.setPartEncoding(thisConfig.getPartEncoding()); - xsdConfig.setWSDLPartName(thisConfig.getWSDLPartName()); - xsdConfig.setMinOccurs(min); - xsdConfig.setMaxOccurs(max); - IXSDFragment frag = getXSDToFragmentController().getFragment(xsdConfig, newID, getName()); - frag.setID(newID); - frag.setName(getName()); - addFragment(newID, frag); - return newID; - } - - public String createInstance() - { - return createListInstance(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleListRangeFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleListRangeFragment.java deleted file mode 100644 index aeb95054f..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleListRangeFragment.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; - -public class XSDSimpleListRangeFragment extends XSDSimpleListFragment { - public XSDSimpleListRangeFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) { - super(id, name, config, controller); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDSimpleListRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDSimpleListRangeWFragmentJSP.jsp"; - } - -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleUnionFixFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleUnionFixFragment.java deleted file mode 100644 index b6c2242f8..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleUnionFixFragment.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; - -public class XSDSimpleUnionFixFragment extends XSDSimpleUnionFragment { - public XSDSimpleUnionFixFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) { - super(id, name, config, controller); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDSimpleUnionRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDSimpleUnionFixWFragmentJSP.jsp"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleUnionFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleUnionFragment.java deleted file mode 100644 index 1a20e373e..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleUnionFragment.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - - -import java.util.Hashtable; -import java.util.Vector; -import org.eclipse.emf.common.util.EList; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDSimpleUnionFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public abstract class XSDSimpleUnionFragment extends XSDMapFragment implements IXSDSimpleUnionFragment { - private XSDSimpleTypeDefinition[] memberTypes_; - - public XSDSimpleUnionFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) { - super(id, name, config, controller); - memberTypes_ = null; - } - - public void setName(String name) { - super.setName(name); - IXSDFragment[] fragments = getAllFragments(); - for (int i = 0; i < fragments.length; i++) { - fragments[i].setName(name); - } - } - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments) { - Element[] instanceDocumentsCopy = getInstanceDocumentsByTagName(instanceDocuments, getName()); - int numTypes = getMemberTypeDefinitions().length; - boolean paramsValid = internalEquals(instanceDocumentsCopy, instanceDocuments); - Vector memberFragments = new Vector(); - for (int i = 0; i < instanceDocumentsCopy.length; i++) { - IXSDFragment compatibleFrag = null; - for (int j = 0; j < numTypes; j++) { - IXSDFragment memberFrag = getFragment(createUnionInstance(j)); - Element[] memberInstanceDocument = new Element[1]; - memberInstanceDocument[0] = setElementTagName(instanceDocumentsCopy[i], memberFrag.getName()); - if (memberFrag.setParameterValuesFromInstanceDocuments(memberInstanceDocument)) { - if (memberFrag.validateAllParameterValues()) { - compatibleFrag = memberFrag; - break; - } - else if (compatibleFrag == null) - compatibleFrag = memberFrag; - } - } - if (compatibleFrag != null) - memberFragments.add(compatibleFrag); - else - paramsValid = false; - } - removeAllFragments(); - addFragments(memberFragments); - return paramsValid; - } - - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) { - IXSDFragment[] fragments = getAllFragments(); - Vector instanceDocumentsCopy = new Vector(); - for (int i = 0; i < fragments.length; i++) { - Element[] fragmentInstances = fragments[i].genInstanceDocumentsFromParameterValues(genXSIType, namespaceTable, doc); - if (fragmentInstances.length > 0) - instanceDocumentsCopy.add(fragmentInstances[0]); - } - Element[] instanceDocuments = new Element[instanceDocumentsCopy.size()]; - for (int i = 0; i < instanceDocuments.length; i++) { - instanceDocuments[i] = (Element)instanceDocumentsCopy.get(i); - } - return setElementsTagName(instanceDocuments, getInstanceDocumentTagName(namespaceTable)); - } - - public XSDSimpleTypeDefinition[] getMemberTypeDefinitions() { - if (memberTypes_ == null) { - EList memberTypes = ((XSDSimpleTypeDefinition)getXSDTypeDefinition()).getMemberTypeDefinitions(); - memberTypes_ = new XSDSimpleTypeDefinition[memberTypes.size()]; - for (int i = 0; i < memberTypes_.length; i++) { - memberTypes_[i] = (XSDSimpleTypeDefinition)memberTypes.get(i); - } - } - return memberTypes_; - } - - public String createUnionInstance(int memberTypeIndex) { - getMemberTypeDefinitions(); - if (memberTypeIndex < 0 || memberTypeIndex > memberTypes_.length - 1) - return null; - String newID = genID(); - XSDToFragmentConfiguration thisConfig = getXSDToFragmentConfiguration(); - XSDToFragmentConfiguration xsdConfig = new XSDToFragmentConfiguration(); - xsdConfig.setXSDComponent(memberTypes_[memberTypeIndex]); - xsdConfig.setStyle(thisConfig.getStyle()); - xsdConfig.setPartEncoding(thisConfig.getPartEncoding()); - xsdConfig.setWSDLPartName(thisConfig.getWSDLPartName()); - IXSDFragment frag = getXSDToFragmentController().getFragment(xsdConfig, newID, getName()); - frag.setID(newID); - frag.setName(getName()); - addFragment(newID, frag); - return newID; - } - - public String createInstance() { - return createUnionInstance(0); - } - -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleUnionRangeFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleUnionRangeFragment.java deleted file mode 100644 index ec2bb8d02..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDSimpleUnionRangeFragment.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController; - -public class XSDSimpleUnionRangeFragment extends XSDSimpleUnionFragment { - public XSDSimpleUnionRangeFragment(String id, String name, XSDToFragmentConfiguration config, XSDToFragmentController controller) { - super(id, name, config, controller); - } - - public String getInformationFragment() { - return "/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp"; - } - - public String getReadFragment() { - return "/wsdl/fragment/XSDSimpleUnionRFragmentJSP.jsp"; - } - - public String getWriteFragment() { - return "/wsdl/fragment/XSDSimpleUnionRangeWFragmentJSP.jsp"; - } -} |