diff options
author | kchong | 2005-11-15 07:22:38 +0000 |
---|---|---|
committer | kchong | 2005-11-15 07:22:38 +0000 |
commit | 9622f406baf477c46c10df6168a93f7b57319184 (patch) | |
tree | ea0c146fad8dc4d9b818bee5f3eb990e2145ee5f /bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment | |
parent | da7cb01e3ecc19c75cdde27a0b1684b25fcdcc94 (diff) | |
download | webtools.webservices-20051115_1102.tar.gz webtools.webservices-20051115_1102.tar.xz webtools.webservices-20051115_1102.zip |
This commit was manufactured by cvs2svn to create tag 'v20051115_1102'.v20051115_1102
Diffstat (limited to 'bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment')
63 files changed, 0 insertions, 4818 deletions
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IFragment.java deleted file mode 100644 index 6695a41fa..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IFragment.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; - -import java.util.Vector; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; - -public interface IFragment { - public void setID(String id); - public String getID(); - - public void setName(String name); - public String getName(); - - public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException; - - public void setParameterValues(String paramKey, String[] params); - public void setParameterValues(String paramKey, Vector params); - public String[] getParameterValues(String paramKey); - public String getParameterValue(String paramKey, int paramIndex); - - public boolean validateAllParameterValues(); - public boolean validateParameterValues(String paramKey); - public boolean validateParameterValue(String paramKey, int paramIndex); - - public String getInformationFragment(); - public String getWriteFragment(); - public String getReadFragment(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/ISOAPEncArrayFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/ISOAPEncArrayFragment.java deleted file mode 100644 index d30dbd5b4..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/ISOAPEncArrayFragment.java +++ /dev/null @@ -1,15 +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; - -public interface ISOAPEncArrayFragment extends IXSDGroupSeqFragment { - public String createSOAPEncArrayInstance(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/ISOAPEncodingWrapperFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/ISOAPEncodingWrapperFragment.java deleted file mode 100644 index 65013d94b..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/ISOAPEncodingWrapperFragment.java +++ /dev/null @@ -1,18 +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; - -import java.util.Hashtable; - -public interface ISOAPEncodingWrapperFragment extends IXSDDelegationFragment -{ - public void setURIReferences(Hashtable uriReferences); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDComplexFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDComplexFragment.java deleted file mode 100644 index dca6da2be..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDComplexFragment.java +++ /dev/null @@ -1,15 +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; - -public interface IXSDComplexFragment extends IXSDMapFragment { - public String createComplexInstance(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDDelegationFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDDelegationFragment.java deleted file mode 100644 index eb43be581..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDDelegationFragment.java +++ /dev/null @@ -1,16 +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; - -public interface IXSDDelegationFragment extends IXSDFragment { - public void setXSDDelegationFragment(IXSDFragment xsdFragment); - public IXSDFragment getXSDDelegationFragment(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDElementFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDElementFragment.java deleted file mode 100644 index 19b872b0f..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDElementFragment.java +++ /dev/null @@ -1,16 +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; - -public interface IXSDElementFragment extends IXSDDelegationFragment { - public int getMinOccurs(); - public int getMaxOccurs(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDFragment.java deleted file mode 100644 index 42926b3f1..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDFragment.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; - -import java.util.Hashtable; -import org.eclipse.xsd.XSDTypeDefinition; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public interface IXSDFragment extends IFragment { - public void setXSDToFragmentConfiguration(XSDToFragmentConfiguration config); - public XSDToFragmentConfiguration getXSDToFragmentConfiguration(); - - public void setXSDTypeDefinition(XSDTypeDefinition typeDef); - public XSDTypeDefinition getXSDTypeDefinition(); - - public boolean setParameterValuesFromInstanceDocuments(Element[] instanceDocuments); - public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc); - - public String genID(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupAllFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupAllFragment.java deleted file mode 100644 index 9bd54e66e..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupAllFragment.java +++ /dev/null @@ -1,15 +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; - -public interface IXSDGroupAllFragment extends IXSDGroupFragment { - public String getGroupAllInstance(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupChoiceFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupChoiceFragment.java deleted file mode 100644 index 864837cc2..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupChoiceFragment.java +++ /dev/null @@ -1,20 +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; - -import org.eclipse.xsd.XSDParticle; - -public interface IXSDGroupChoiceFragment extends IXSDGroupFragment { - public XSDParticle[] getChoices(); - public String createGroupChoiceInstance(int choiceIndex); - public int getChoiceIndex(String groupID); - public void setChoiceIndex(String groupID, int choiceIndex); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupFragment.java deleted file mode 100644 index 9da875972..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupFragment.java +++ /dev/null @@ -1,22 +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; - -import org.eclipse.xsd.XSDModelGroup; - -public interface IXSDGroupFragment extends IXSDMapFragment { - public void setXSDModelGroup(XSDModelGroup xsdModelGroup); - public XSDModelGroup getXSDModelGroup(); - - public String[] getGroupIDs(); - public String[] getGroupMemberIDs(String groupID); - public IXSDFragment[] getGroupMemberFragments(String groupID); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupSeqFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupSeqFragment.java deleted file mode 100644 index 614433eee..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDGroupSeqFragment.java +++ /dev/null @@ -1,15 +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; - -public interface IXSDGroupSeqFragment extends IXSDGroupFragment { - public String createGroupSeqInstance(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDMapFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDMapFragment.java deleted file mode 100644 index 1a9fd3b9a..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDMapFragment.java +++ /dev/null @@ -1,23 +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; - -public interface IXSDMapFragment extends IXSDFragment { - public void setXSDToFragmentController(XSDToFragmentController controller); - public XSDToFragmentController getXSDToFragmentController(); - - public String createInstance(); - - public String[] getFragmentsOrder(); - public IXSDFragment getFragment(String id); - public IXSDFragment[] getFragments(String[] ids); - public IXSDFragment[] getAllFragments(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDSimpleAtomicFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDSimpleAtomicFragment.java deleted file mode 100644 index 33f97da25..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDSimpleAtomicFragment.java +++ /dev/null @@ -1,14 +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; - -public interface IXSDSimpleAtomicFragment extends IXSDFragment { -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDSimpleListFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDSimpleListFragment.java deleted file mode 100644 index 00925a379..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDSimpleListFragment.java +++ /dev/null @@ -1,15 +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; - -public interface IXSDSimpleListFragment extends IXSDMapFragment { - public String createListInstance(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDSimpleUnionFragment.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDSimpleUnionFragment.java deleted file mode 100644 index ba86a1232..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/IXSDSimpleUnionFragment.java +++ /dev/null @@ -1,18 +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; - -import org.eclipse.xsd.XSDSimpleTypeDefinition; - -public interface IXSDSimpleUnionFragment extends IXSDMapFragment { - public XSDSimpleTypeDefinition[] getMemberTypeDefinitions(); - public String createUnionInstance(int memberTypeIndex); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDComplexTypeToFragmentMapper.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDComplexTypeToFragmentMapper.java deleted file mode 100644 index ce5bac7a4..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDComplexTypeToFragmentMapper.java +++ /dev/null @@ -1,45 +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; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDComplexFixFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDComplexRangeFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.util.XSDTypeDefinitionUtil; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper; -import org.eclipse.xsd.XSDComplexTypeContent; -import org.eclipse.xsd.XSDComplexTypeDefinition; - -public class XSDComplexTypeToFragmentMapper extends XSDToFragmentMapper { - public XSDComplexTypeToFragmentMapper(XSDToFragmentController controller, WSDLPartsToXSDTypeMapper wsdlToXSDMapper) { - super(controller, wsdlToXSDMapper); - } - - public IXSDFragment getFragment(XSDToFragmentConfiguration config, String id, String name) { - XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition)config.getXSDComponent(); - if (complexType != null && complexType.isMixed()) - return getXSDDefaultFragment(config, id, name); - XSDComplexTypeContent complexTypeContent = XSDTypeDefinitionUtil.getXSDComplexTypeContent(complexType); - if (complexTypeContent != null) - return getXSDComplexFragment(config, id, name); - else - return getXSDEmptyFragment(config, id, name); - } - - private IXSDFragment getXSDComplexFragment(XSDToFragmentConfiguration config, String id, String name) { - int minOccurs = config.getMinOccurs(); - int maxOccurs = config.getMaxOccurs(); - - if (minOccurs == maxOccurs) - return new XSDComplexFixFragment(id, name, config, getController()); - else - return new XSDComplexRangeFragment(id, name, config, getController()); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDElementDeclarationToFragmentMapper.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDElementDeclarationToFragmentMapper.java deleted file mode 100644 index 939623b6e..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDElementDeclarationToFragmentMapper.java +++ /dev/null @@ -1,91 +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; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDElementFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper; -import org.eclipse.xsd.XSDComponent; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDTypeDefinition; - - -public class XSDElementDeclarationToFragmentMapper extends XSDToFragmentMapper { - public XSDElementDeclarationToFragmentMapper(XSDToFragmentController controller, WSDLPartsToXSDTypeMapper wsdlToXSDMapper) { - super(controller, wsdlToXSDMapper); - } - - public IXSDFragment getFragment(XSDToFragmentConfiguration config, String id, String name) { - XSDElementDeclaration element = (XSDElementDeclaration)config.getXSDComponent(); - if (element != null) { - XSDElementDeclaration resolvedElement = resolveXSDElementDeclaration(element); - XSDTypeDefinition typeDef = getXSDTypeDefinition(resolvedElement); - if (typeDef != null) { - int minOccurs = FragmentConstants.DEFAULT_MIN_OCCURS; - int maxOccurs = FragmentConstants.DEFAULT_MAX_OCCURS; - XSDConcreteComponent concreteComponent = element.getContainer(); - if (concreteComponent != null && concreteComponent instanceof XSDParticle) { - XSDParticle particle = (XSDParticle)concreteComponent; - if (particle.isSetMinOccurs()) - minOccurs = particle.getMinOccurs(); - if (particle.isSetMaxOccurs()) - maxOccurs = particle.getMaxOccurs(); - } - config.setMinOccurs(minOccurs); - config.setMaxOccurs(maxOccurs); - IXSDElementFragment elementFrag = new XSDElementFragment(id, resolvedElement.getName(), config); - elementFrag.setXSDTypeDefinition(typeDef); - XSDToFragmentConfiguration elementTypeConfig = new XSDToFragmentConfiguration(); - elementTypeConfig.setXSDComponent(typeDef); - elementTypeConfig.setMinOccurs(minOccurs); - elementTypeConfig.setMaxOccurs(maxOccurs); - elementTypeConfig.setStyle(config.getStyle()); - elementTypeConfig.setPartEncoding(config.getPartEncoding()); - elementTypeConfig.setWSDLPartName(config.getWSDLPartName()); - IXSDFragment xsdFragment = getController().getFragment(elementTypeConfig, elementFrag.genID(), resolvedElement.getName()); - elementFrag.setXSDDelegationFragment(xsdFragment); - return elementFrag; - } - } - return getXSDDefaultFragment(config, id, name); - } - - private XSDElementDeclaration resolveXSDElementDeclaration(XSDElementDeclaration element) { - // port to org.eclipse.xsd - if (element.getResolvedElementDeclaration() != null) - { - XSDElementDeclaration resolvedElement = element.getResolvedElementDeclaration(); - if (!isComponentResolvable(resolvedElement)) - { - XSDComponent resolvedComponent = getWSDLPartsToXSDTypeMapper().resolveXSDNamedComponent(resolvedElement); - if (resolvedComponent != null && (resolvedComponent instanceof XSDElementDeclaration)) - resolvedElement = (XSDElementDeclaration)resolvedComponent; - } - return resolvedElement; - } - else - return element; - } - - private XSDTypeDefinition getXSDTypeDefinition(XSDElementDeclaration element) { - // port to org.eclipse.xsd - if (element.getTypeDefinition() != null) - return element.getTypeDefinition(); - // port to org.eclipse.xsd - else if (element.getAnonymousTypeDefinition() != null) - return element.getAnonymousTypeDefinition(); - else - return null; - } - -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDLiteralXMLEncodingToFragmentMapper.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDLiteralXMLEncodingToFragmentMapper.java deleted file mode 100644 index 31aa8316e..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDLiteralXMLEncodingToFragmentMapper.java +++ /dev/null @@ -1,77 +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; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDComponent; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDParticleContent; -import org.eclipse.xsd.XSDSimpleTypeDefinition; - -public class XSDLiteralXMLEncodingToFragmentMapper extends XSDToFragmentMapper { - private XSDSimpleTypeToFragmentMapper xsdSimpleMapper_; - private XSDComplexTypeToFragmentMapper xsdComplexMapper_; - private XSDElementDeclarationToFragmentMapper xsdElementMapper_; - private XSDParticleToFragmentMapper xsdParticleMapper_; - - public XSDLiteralXMLEncodingToFragmentMapper(XSDToFragmentController controller, WSDLPartsToXSDTypeMapper wsdlToXSDMapper) { - super(controller, wsdlToXSDMapper); - xsdSimpleMapper_ = null; - xsdComplexMapper_ = null; - xsdElementMapper_ = null; - xsdParticleMapper_= null; - } - - private XSDSimpleTypeToFragmentMapper getXSDSimpleMapper() { - if (xsdSimpleMapper_ == null) - xsdSimpleMapper_ = new XSDSimpleTypeToFragmentMapper(getController(), getWSDLPartsToXSDTypeMapper()); - return xsdSimpleMapper_; - } - - private XSDComplexTypeToFragmentMapper getXSDComplexMapper() { - if (xsdComplexMapper_ == null) - xsdComplexMapper_ = new XSDComplexTypeToFragmentMapper(getController(), getWSDLPartsToXSDTypeMapper()); - return xsdComplexMapper_; - } - - private XSDElementDeclarationToFragmentMapper getXSDElementMapper() { - if (xsdElementMapper_ == null) - xsdElementMapper_ = new XSDElementDeclarationToFragmentMapper(getController(), getWSDLPartsToXSDTypeMapper()); - return xsdElementMapper_; - } - - private XSDParticleToFragmentMapper getXSDParticleMapper() { - if (xsdParticleMapper_ == null) - xsdParticleMapper_ = new XSDParticleToFragmentMapper(getController(), getWSDLPartsToXSDTypeMapper()); - return xsdParticleMapper_; - } - - public IXSDFragment getFragment(XSDToFragmentConfiguration config, String id, String name) { - config = resolveXSDComponent(config); - XSDComponent component = config.getXSDComponent(); - if (!isComponentResolvable(component)) - return getXSDDefaultFragment(config, id, name); - else if (component instanceof XSDElementDeclaration) - return getXSDElementMapper().getFragment(config, id, name); - else if (component instanceof XSDSimpleTypeDefinition) - return getXSDSimpleMapper().getFragment(config, id, name); - else if (component instanceof XSDComplexTypeDefinition) - return getXSDComplexMapper().getFragment(config, id, name); - else if (component instanceof XSDParticle) - return getXSDParticleMapper().getFragment(config, id, name); - else if (component instanceof XSDParticleContent) - return getXSDParticleMapper().getFragment(config, id, name); - else - return getXSDDefaultFragment(config, id, name); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDParticleToFragmentMapper.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDParticleToFragmentMapper.java deleted file mode 100644 index bd4579730..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDParticleToFragmentMapper.java +++ /dev/null @@ -1,104 +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; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDGroupAllFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDGroupChoiceFixFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDGroupChoiceRangeFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDGroupSeqFixFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDGroupSeqRangeFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper; -import org.eclipse.xsd.XSDComponent; -import org.eclipse.xsd.XSDCompositor; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDModelGroupDefinition; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDParticleContent; -import org.eclipse.xsd.XSDWildcard; - - -public class XSDParticleToFragmentMapper extends XSDToFragmentMapper { - public XSDParticleToFragmentMapper(XSDToFragmentController controller, WSDLPartsToXSDTypeMapper wsdlToXSDMapper) { - super(controller, wsdlToXSDMapper); - } - - public IXSDFragment getFragment(XSDToFragmentConfiguration config, String id, String name) { - XSDComponent component = config.getXSDComponent(); - XSDParticleContent xsdParticleContent; - if (component instanceof XSDParticle) - xsdParticleContent = ((XSDParticle)component).getContent(); - else if (component instanceof XSDParticleContent) - xsdParticleContent = (XSDParticleContent)component; - else - xsdParticleContent = null; - if (xsdParticleContent != null) { - if (xsdParticleContent instanceof XSDModelGroupDefinition) - return getXSDModelGroupDefFragment(config, id, name, (XSDModelGroupDefinition)xsdParticleContent); - else if (xsdParticleContent instanceof XSDModelGroup) - return getXSDModelGroupFragment(config, id, name, (XSDModelGroup)xsdParticleContent); - else if (xsdParticleContent instanceof XSDWildcard) - return getXSDWildcardFragment(config, id, name, (XSDWildcard)xsdParticleContent); - else - return getXSDDefaultFragment(config, id, name); - } - else - return getXSDDefaultFragment(config, id, name); - } - - private IXSDFragment getXSDModelGroupDefFragment(XSDToFragmentConfiguration config, String id, String name, XSDModelGroupDefinition xsdModelGroupDef) { - XSDModelGroupDefinition resolvedXSDModelGroupDef = xsdModelGroupDef; - if (xsdModelGroupDef.isModelGroupDefinitionReference()) - resolvedXSDModelGroupDef = xsdModelGroupDef.getResolvedModelGroupDefinition(); - XSDModelGroup xsdModelGroup = resolvedXSDModelGroupDef.getModelGroup(); - if (xsdModelGroup == null) - return getXSDDefaultFragment(config, id, name); - else - return getXSDModelGroupFragment(config, id, name, xsdModelGroup); - } - - private IXSDFragment getXSDModelGroupFragment(XSDToFragmentConfiguration config, String id, String name, XSDModelGroup xsdModelGroup) { - int minOccurs = FragmentConstants.DEFAULT_MIN_OCCURS; - int maxOccurs = FragmentConstants.DEFAULT_MAX_OCCURS; - XSDConcreteComponent concreteComponent = xsdModelGroup.getContainer(); - if (concreteComponent != null && concreteComponent instanceof XSDParticle) { - XSDParticle particle = (XSDParticle)concreteComponent; - if (particle.isSetMinOccurs()) - minOccurs = particle.getMinOccurs(); - if (particle.isSetMaxOccurs()) - maxOccurs = particle.getMaxOccurs(); - } - config.setMinOccurs(minOccurs); - config.setMaxOccurs(maxOccurs); - - switch (xsdModelGroup.getCompositor().getValue()) { - case XSDCompositor.SEQUENCE: - if (minOccurs == maxOccurs) - return new XSDGroupSeqFixFragment(id, name, config, getController(), xsdModelGroup); - else - return new XSDGroupSeqRangeFragment(id, name, config, getController(), xsdModelGroup); - case XSDCompositor.CHOICE: - if (minOccurs == maxOccurs) - return new XSDGroupChoiceFixFragment(id, name, config, getController(), xsdModelGroup); - else - return new XSDGroupChoiceRangeFragment(id, name, config, getController(), xsdModelGroup); - case XSDCompositor.ALL: - return new XSDGroupAllFragment(id, name, config, getController(), xsdModelGroup); - default: - return getXSDDefaultFragment(config, id, name); - } - } - - private IXSDFragment getXSDWildcardFragment(XSDToFragmentConfiguration config, String id, String name, XSDWildcard xsdParticleContent) { - return getXSDDefaultFragment(config, id, name); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDSOAPEncodingToFragmentMapper.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDSOAPEncodingToFragmentMapper.java deleted file mode 100644 index 5fafacc4c..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDSOAPEncodingToFragmentMapper.java +++ /dev/null @@ -1,130 +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; - -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.impl.SOAPEncArrayFixFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.SOAPEncArrayRangeFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.SOAPEncodingWrapperFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.util.XSDTypeDefinitionUtil; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper; -import org.eclipse.xsd.XSDAttributeGroupContent; -import org.eclipse.xsd.XSDComplexTypeContent; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDComponent; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDParticleContent; -import org.eclipse.xsd.XSDTypeDefinition; -import org.w3c.dom.Element; - -public class XSDSOAPEncodingToFragmentMapper extends XSDToFragmentMapper { - private XSDLiteralXMLEncodingToFragmentMapper xsdLiteralMapper_; - private XSDComplexTypeToFragmentMapper xsdComplexMapper_; - - public XSDSOAPEncodingToFragmentMapper(XSDToFragmentController controller, WSDLPartsToXSDTypeMapper wsdlToXSDMapper) { - super(controller, wsdlToXSDMapper); - xsdLiteralMapper_ = null; - xsdComplexMapper_ = null; - } - - private XSDLiteralXMLEncodingToFragmentMapper getXSDLiteralMapper() { - if (xsdLiteralMapper_ == null) - xsdLiteralMapper_ = new XSDLiteralXMLEncodingToFragmentMapper(getController(), getWSDLPartsToXSDTypeMapper()); - return xsdLiteralMapper_; - } - - private XSDComplexTypeToFragmentMapper getXSDComplexMapper() { - if (xsdComplexMapper_ == null) - xsdComplexMapper_ = new XSDComplexTypeToFragmentMapper(getController(), getWSDLPartsToXSDTypeMapper()); - return xsdComplexMapper_; - } - - public IXSDFragment getFragment(XSDToFragmentConfiguration config, String id, String name) { - if (config.getIsWSDLPart()) { - ISOAPEncodingWrapperFragment wrapperFragment = new SOAPEncodingWrapperFragment(id, name, null); - String delegationFragId = wrapperFragment.genID(); - IXSDFragment delegationFragment = getFragmentDelegate(config, delegationFragId, name); - wrapperFragment.setXSDDelegationFragment(delegationFragment); - getController().addToCache(delegationFragId, delegationFragment); - return wrapperFragment; - } - else - return getFragmentDelegate(config, id, name); - } - - public IXSDFragment getFragmentDelegate(XSDToFragmentConfiguration config, String id, String name) { - config = resolveXSDComponent(config); - XSDComponent component = config.getXSDComponent(); - if (!isComponentResolvable(component)) - return getXSDDefaultFragment(config, id, name); - else if (component instanceof XSDComplexTypeDefinition) { - XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition)component; - if (XSDTypeDefinitionUtil.isSoapEncArray(complexType)) - return getSOAPEncArrayFragment(config, id, name, complexType); - else - return getXSDComplexMapper().getFragment(config, id, name); - } - else - return getXSDLiteralMapper().getFragment(config, id, name); - } - - private IXSDFragment getSOAPEncArrayFragment(XSDToFragmentConfiguration config, String id, String name, XSDComplexTypeDefinition complexType) { - EList xsdAttrContents = complexType.getAttributeContents(); - for (int i = 0; i < xsdAttrContents.size(); i++) { - String soapEncArrayTypeNamespaceURI = null; - String soapEncArrayTypeLocalName = null; - int soapEncArrayDimension = 0; - XSDAttributeGroupContent xsdAttrContent = (XSDAttributeGroupContent)xsdAttrContents.get(i); - Element element = xsdAttrContent.getElement(); - String arrayTypeAttr = element.getAttributeNS(FragmentConstants.URI_WSDL, FragmentConstants.QNAME_LOCAL_NAME_ARRAY_TYPE); - if (arrayTypeAttr != null && arrayTypeAttr.length() > 0) { - int colon = arrayTypeAttr.indexOf(FragmentConstants.COLON); - String nsPrefix = (colon > 0) ? arrayTypeAttr.substring(0, colon) : null; - soapEncArrayTypeNamespaceURI = (String)xsdAttrContent.getSchema().getQNamePrefixToNamespaceMap().get(nsPrefix); - int dimensionIndex = arrayTypeAttr.indexOf(FragmentConstants.LEFT_SQUARE_BRACKET); - soapEncArrayTypeLocalName = arrayTypeAttr.substring(colon + 1, dimensionIndex); - String dimensionString = arrayTypeAttr.substring(dimensionIndex, arrayTypeAttr.length()); - for (int j = 0; j < dimensionString.length() - 1; j++) { - if (dimensionString.charAt(j) == FragmentConstants.LEFT_SQUARE_BRACKET.charAt(0) && dimensionString.charAt(j + 1) == FragmentConstants.RIGHT_SQUARE_BRACKET.charAt(0)) { - soapEncArrayDimension++; - j++; - } - else { - soapEncArrayDimension = 0; - break; - } - } - } - if (soapEncArrayTypeNamespaceURI != null && soapEncArrayTypeLocalName != null && soapEncArrayDimension == 1) { - XSDComponent soapEncArrayType = getWSDLPartsToXSDTypeMapper().getXSDTypeFromSchema(soapEncArrayTypeNamespaceURI, soapEncArrayTypeLocalName, false); - if (soapEncArrayType != null && soapEncArrayType instanceof XSDTypeDefinition) { - XSDModelGroup sequence = null; - XSDComplexTypeContent complexTypeContent = XSDTypeDefinitionUtil.getXSDComplexTypeContent(complexType); - if (complexTypeContent != null && (complexTypeContent instanceof XSDParticle)) { - XSDParticleContent xsdParticleContent = ((XSDParticle)complexTypeContent).getContent(); - if (xsdParticleContent instanceof XSDModelGroup) - sequence = (XSDModelGroup)xsdParticleContent; - } - ISOAPEncArrayFragment frag; - if (config.getMinOccurs() == config.getMaxOccurs()) - frag = new SOAPEncArrayFixFragment(id, name, config, getController(), sequence); - else - frag = new SOAPEncArrayRangeFragment(id, name, config, getController(), sequence); - frag.setXSDTypeDefinition((XSDTypeDefinition)soapEncArrayType); - return frag; - } - } - } - return getXSDComplexMapper().getFragment(config, id, name); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDSimpleTypeToFragmentMapper.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDSimpleTypeToFragmentMapper.java deleted file mode 100644 index e62489231..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDSimpleTypeToFragmentMapper.java +++ /dev/null @@ -1,174 +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; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleAtomicDateTimeFixFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleAtomicDateTimeRangeFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleAtomicEnumFixFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleAtomicEnumRangeFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleAtomicFixFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleAtomicFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleAtomicRangeFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleListFixFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleListRangeFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleUnionFixFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDSimpleUnionRangeFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.util.OptionVector; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.util.XSDTypeDefinitionUtil; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.XSDVariety; - -public class XSDSimpleTypeToFragmentMapper extends XSDToFragmentMapper { - public XSDSimpleTypeToFragmentMapper(XSDToFragmentController controller, WSDLPartsToXSDTypeMapper wsdlToXSDMapper) { - super(controller, wsdlToXSDMapper); - } - - public IXSDFragment getFragment(XSDToFragmentConfiguration config, String id, String name) { - XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition)config.getXSDComponent(); - if (simpleType != null && simpleType.getVariety() != null) { - switch (simpleType.getVariety().getValue()) { - case XSDVariety.ATOMIC: - return getXSDSimpleAtomicFragment(config, id, name); - case XSDVariety.LIST: - return getXSDSimpleListFragment(config, id, name); - case XSDVariety.UNION: - return getXSDSimpleUnionFragment(config, id, name); - default: - return getXSDDefaultFragment(config, id, name); - } - } - else - return getXSDDefaultFragment(config, id, name); - } - - private IXSDFragment getXSDSimpleAtomicFragment(XSDToFragmentConfiguration config, String id, String name) { - boolean isFixed = ((config.getMinOccurs() == config.getMaxOccurs()) && config.getMaxOccurs() != FragmentConstants.UNBOUNDED); - XSDSimpleTypeDefinition xsdSimpleTypeDef = (XSDSimpleTypeDefinition)config.getXSDComponent(); - XSDSimpleTypeDefinition xsdBaseSimpleTypeDef = (XSDSimpleTypeDefinition)XSDTypeDefinitionUtil.resolveToXSDBuiltInTypeDefinition(xsdSimpleTypeDef); - String baseSimpleTypeDefNS = null; - String baseSimpleTypeDefName = null; - if (xsdBaseSimpleTypeDef != null) - { - baseSimpleTypeDefNS = xsdBaseSimpleTypeDef.getTargetNamespace(); - baseSimpleTypeDefName = xsdBaseSimpleTypeDef.getName(); - } - boolean isEnum = isSimpleTypeEnumeration(xsdSimpleTypeDef); - if (FragmentConstants.URI_XSD.equals(baseSimpleTypeDefNS)) - { - if (baseSimpleTypeDefName.equals("date")) - return getXSDSimpleDateTimeFragment(id, name, config, ActionInputs.CALENDAR_TYPE_DATE,xsdSimpleTypeDef,isEnum,isFixed); - else if (baseSimpleTypeDefName.equals("dateTime")) - return getXSDSimpleDateTimeFragment(id, name, config, ActionInputs.CALENDAR_TYPE_DATETIME,xsdSimpleTypeDef,isEnum,isFixed); - else if (baseSimpleTypeDefName.equals("gYearMonth")) - return getXSDSimpleDateTimeFragment(id, name, config, ActionInputs.CALENDAR_TYPE_GYEARMONTH,xsdSimpleTypeDef,isEnum,isFixed); - else if (baseSimpleTypeDefName.equals("gMonthDay")) - return getXSDSimpleDateTimeFragment(id, name, config, ActionInputs.CALENDAR_TYPE_GMONTHDAY,xsdSimpleTypeDef,isEnum,isFixed); - else if (baseSimpleTypeDefName.equals("gDay")) - return getXSDSimpleGDayFragment(id, name, config, xsdSimpleTypeDef,isEnum,isFixed); - else if (baseSimpleTypeDefName.equals("boolean")) - return getXSDSimpleBooleanFragment(id, name, config, xsdSimpleTypeDef,isEnum,isFixed); - } - - if (isEnum) - { - if (isFixed) - return new XSDSimpleAtomicEnumFixFragment(id, name, config, xsdSimpleTypeDef.getEnumerationFacets()); - else - return new XSDSimpleAtomicEnumRangeFragment(id, name, config, xsdSimpleTypeDef.getEnumerationFacets()); - } - else - { - if (isFixed) - return new XSDSimpleAtomicFixFragment(id, name, config); - else - return new XSDSimpleAtomicRangeFragment(id, name, config); - } - } - - private XSDSimpleAtomicFragment getXSDSimpleDateTimeFragment(String id, String name, XSDToFragmentConfiguration config, int calendarType,XSDSimpleTypeDefinition xsdDateTimeType,boolean isEnum,boolean isFixed) - { - if (isEnum) - { - if (isFixed) - return new XSDSimpleAtomicEnumFixFragment(id, name, config, xsdDateTimeType.getEnumerationFacets()); - else - return new XSDSimpleAtomicEnumRangeFragment(id, name, config, xsdDateTimeType.getEnumerationFacets()); - } - else - { - if (isFixed) - return new XSDSimpleAtomicDateTimeFixFragment(id, name, config, calendarType); - else - return new XSDSimpleAtomicDateTimeRangeFragment(id, name, config, calendarType); - } - } - - private XSDSimpleAtomicFragment getXSDSimpleGDayFragment(String id, String name, XSDToFragmentConfiguration config, XSDSimpleTypeDefinition xsdDateTimeType,boolean isEnum,boolean isFixed) - { - if (isEnum) - return null; - OptionVector optionVector = new OptionVector(); - StringBuffer value = new StringBuffer(); - for (int i=1;i<=31;i++) - { - value.setLength(0); - value.append("---"); - if (i<10) - value.append(0); - value.append(i); - optionVector.addOption(String.valueOf(i),value.toString()); - } - if (isFixed) - return new XSDSimpleAtomicEnumFixFragment(id, name, config, optionVector); - else - return new XSDSimpleAtomicEnumRangeFragment(id, name, config, optionVector); - } - - private XSDSimpleAtomicFragment getXSDSimpleBooleanFragment(String id, String name, XSDToFragmentConfiguration config, XSDSimpleTypeDefinition xsdBooleanType,boolean isEnum,boolean isFixed) - { - if (isEnum) - return null; - OptionVector optionVector = new OptionVector(); - optionVector.addOption("true","true"); - optionVector.addOption("false","false"); - if (isFixed) - return new XSDSimpleAtomicEnumFixFragment(id, name, config, optionVector); - else - return new XSDSimpleAtomicEnumRangeFragment(id, name, config, optionVector); - } - - private IXSDFragment getXSDSimpleListFragment(XSDToFragmentConfiguration config, String id, String name) { - - boolean isFixed = ((config.getMinOccurs() == config.getMaxOccurs()) && config.getMaxOccurs() != FragmentConstants.UNBOUNDED); - if (isFixed) - return new XSDSimpleListFixFragment(id, name, config, getController()); - else - return new XSDSimpleListRangeFragment(id, name, config, getController()); - } - - private IXSDFragment getXSDSimpleUnionFragment(XSDToFragmentConfiguration config, String id, String name) { - - boolean isFixed = ((config.getMinOccurs() == config.getMaxOccurs()) && config.getMaxOccurs() != FragmentConstants.UNBOUNDED); - if (isFixed) - return new XSDSimpleUnionFixFragment(id, name, config, getController()); - else - return new XSDSimpleUnionRangeFragment(id, name, config, getController()); - } - - private boolean isSimpleTypeEnumeration(XSDSimpleTypeDefinition simpleType) { - EList e = simpleType.getEnumerationFacets(); - return (e != null && e.size() > 0); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDToFragmentConfiguration.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDToFragmentConfiguration.java deleted file mode 100644 index 0537da155..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDToFragmentConfiguration.java +++ /dev/null @@ -1,90 +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; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.xsd.XSDComponent; - -public class XSDToFragmentConfiguration { - private XSDComponent component_; - private int minOccurs_; - private int maxOccurs_; - private int style_; - private int partEncoding_; - private boolean isWSDLPart_; - private String wsdlPartName_; - - public XSDToFragmentConfiguration() { - component_ = null; - minOccurs_ = FragmentConstants.DEFAULT_MIN_OCCURS; - maxOccurs_ = FragmentConstants.DEFAULT_MAX_OCCURS; - style_ = FragmentConstants.STYLE_DOCUMENT; - partEncoding_ = FragmentConstants.ENCODING_LITERAL; - isWSDLPart_ = false; - wsdlPartName_ = null; - } - - public void setXSDComponent(XSDComponent component) { - component_ = component; - } - - public XSDComponent getXSDComponent() { - return component_; - } - - public void setMinOccurs(int minOccurs) { - minOccurs_ = minOccurs; - } - - public int getMinOccurs() { - return minOccurs_; - } - - public void setMaxOccurs(int maxOccurs) { - maxOccurs_ = maxOccurs; - } - - public int getMaxOccurs() { - return maxOccurs_; - } - - public void setStyle(int style) { - style_ = style; - } - - public int getStyle() { - return style_; - } - - public void setPartEncoding(int partEncoding) { - partEncoding_ = partEncoding; - } - - public int getPartEncoding() { - return partEncoding_; - } - - public void setIsWSDLPart(boolean isWSDLPart) { - isWSDLPart_ = isWSDLPart; - } - - public boolean getIsWSDLPart() { - return isWSDLPart_; - } - - public void setWSDLPartName(String wsdlPartName) { - wsdlPartName_ = wsdlPartName; - } - - public String getWSDLPartName() { - return wsdlPartName_; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDToFragmentController.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDToFragmentController.java deleted file mode 100644 index ce323c1ec..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDToFragmentController.java +++ /dev/null @@ -1,87 +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; - -import java.util.Hashtable; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper; - -public class XSDToFragmentController { - private WSDLPartsToXSDTypeMapper wsdlToXSDMapper_; - private XSDLiteralXMLEncodingToFragmentMapper xsdLiteralMapper_; - private XSDSOAPEncodingToFragmentMapper xsdSoapMapper_; - private Hashtable xsdToFragmentCache_; - - public XSDToFragmentController() { - wsdlToXSDMapper_ = null; - xsdLiteralMapper_ = null; - xsdSoapMapper_ = null; - xsdToFragmentCache_ = new Hashtable(); - } - - public void setWSDLPartsToXSDTypeMapper(WSDLPartsToXSDTypeMapper wsdlToXSDMapper) { - wsdlToXSDMapper_ = wsdlToXSDMapper; - } - - public WSDLPartsToXSDTypeMapper getWSDLPartsToXSDTypeMapper() { - return wsdlToXSDMapper_; - } - - private XSDLiteralXMLEncodingToFragmentMapper getXSDLiteralMapper() { - if (xsdLiteralMapper_ == null) - xsdLiteralMapper_ = new XSDLiteralXMLEncodingToFragmentMapper(this, wsdlToXSDMapper_); - return xsdLiteralMapper_; - } - - private XSDSOAPEncodingToFragmentMapper getXSDSOAPMapper() { - if (xsdSoapMapper_ == null) - xsdSoapMapper_ = new XSDSOAPEncodingToFragmentMapper(this, wsdlToXSDMapper_); - return xsdSoapMapper_; - } - - public IXSDFragment getFragment(XSDToFragmentConfiguration config, String id, String name) { - IXSDFragment frag = getCachedFragment(id); - if (frag != null) - return frag; - frag = getNewFragment(config, id, name); - if (frag != null) - addToCache(id, frag); - return frag; - } - - public IXSDFragment getCachedFragment(String id) { - return (IXSDFragment)xsdToFragmentCache_.get(id); - } - - public IXSDFragment getNewFragment(XSDToFragmentConfiguration config, String id, String name) { - switch (config.getPartEncoding()) - { - case FragmentConstants.ENCODING_SOAP: - return getXSDSOAPMapper().getFragment(config,id,name); - case FragmentConstants.ENCODING_LITERAL: - case FragmentConstants.ENCODING_URL: - default: - return getXSDLiteralMapper().getFragment(config,id,name); - } - } - - public void addToCache(String id, IXSDFragment frag) { - xsdToFragmentCache_.put(id, frag); - } - - public void removeFromCache(String id) { - xsdToFragmentCache_.remove(id); - } - - public void emptyCache() { - xsdToFragmentCache_.clear(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDToFragmentMapper.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDToFragmentMapper.java deleted file mode 100644 index 1cfc58fe3..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/XSDToFragmentMapper.java +++ /dev/null @@ -1,78 +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; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDefaultFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDEmptyFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper; -import org.eclipse.xsd.XSDComponent; -import org.eclipse.xsd.XSDNamedComponent; -import org.eclipse.xsd.XSDSchema; - -public abstract class XSDToFragmentMapper { - private XSDToFragmentController controller_; - private WSDLPartsToXSDTypeMapper wsdlToXSDMapper_; - - public XSDToFragmentMapper(XSDToFragmentController controller, WSDLPartsToXSDTypeMapper wsdlToXSDMapper) { - controller_ = controller; - wsdlToXSDMapper_ = wsdlToXSDMapper; - } - - public void setController(XSDToFragmentController controller) { - controller_ = controller; - } - - public XSDToFragmentController getController() { - return controller_; - } - - public void setWSDLPartsToXSDTypeMapper(WSDLPartsToXSDTypeMapper wsdlToXSDMapper) { - wsdlToXSDMapper_ = wsdlToXSDMapper; - } - - public WSDLPartsToXSDTypeMapper getWSDLPartsToXSDTypeMapper() { - return wsdlToXSDMapper_; - } - - protected IXSDFragment getXSDDefaultFragment(XSDToFragmentConfiguration config, String id, String name) { - return new XSDDefaultFragment(id, name, config); - } - - protected IXSDFragment getXSDEmptyFragment(XSDToFragmentConfiguration config, String id, String name) { - return new XSDEmptyFragment(id, name, config); - } - - public abstract IXSDFragment getFragment(XSDToFragmentConfiguration config, String id, String name); - - protected XSDToFragmentConfiguration resolveXSDComponent(XSDToFragmentConfiguration config) - { - XSDComponent component = config.getXSDComponent(); - if (!isComponentResolvable(component) && (component instanceof XSDNamedComponent)) - { - XSDComponent resolvedComponent = getWSDLPartsToXSDTypeMapper().resolveXSDNamedComponent((XSDNamedComponent)component); - if (resolvedComponent != null) - config.setXSDComponent(resolvedComponent); - } - return config; - } - - protected boolean isComponentResolvable(XSDComponent component) - { - if (component == null) - return false; - XSDSchema schema = component.getSchema(); - if (schema == null) - return false; - if (schema.getTargetNamespace() == null) - 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/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"; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/util/HTTPUtil.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/util/HTTPUtil.java deleted file mode 100644 index 1d487e333..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/util/HTTPUtil.java +++ /dev/null @@ -1,103 +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.util; - -import java.util.Hashtable; -import javax.xml.parsers.ParserConfigurationException; -import org.apache.axis.Constants; -import org.eclipse.wst.ws.internal.explorer.platform.util.URLUtils; -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.IXSDFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDSimpleAtomicFragment; -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDSimpleListFragment; -import org.w3c.dom.Element; - -public class HTTPUtil -{ - private HTTPUtil() - { - } - - public static String genURLEncodedParameters(IXSDFragment fragment) - { - if (fragment instanceof IXSDSimpleListFragment) - return genURLEncodedParamsFromListFragment((IXSDSimpleListFragment)fragment); - else if (fragment instanceof IXSDSimpleAtomicFragment) - return genURLEncodedParamsFromAtomicFragment((IXSDSimpleAtomicFragment)fragment); - else - return genURLEncodedXMLParameters(fragment); - } - - private static String genURLEncodedParamsFromAtomicFragment(IXSDSimpleAtomicFragment fragment) - { - StringBuffer urlEncodedParam = new StringBuffer(); - String[] params = fragment.getParameterValues(fragment.getID()); - for (int i = 0; i < params.length; i++) - { - urlEncodedParam.append(URLUtils.encode(fragment.getName())); - urlEncodedParam.append("="); - urlEncodedParam.append(URLUtils.encode(params[i])); - if (i < params.length - 1) - urlEncodedParam.append("&"); - } - return urlEncodedParam.toString(); - } - - private static String genURLEncodedParamsFromListFragment(IXSDSimpleListFragment fragment) - { - StringBuffer urlEncodedParam = new StringBuffer(); - IXSDFragment[] childFrags = fragment.getAllFragments(); - for (int i = 0; i < childFrags.length; i++) - { - urlEncodedParam.append(URLUtils.encode(fragment.getName())); - urlEncodedParam.append("="); - String[] params = childFrags[i].getParameterValues(childFrags[i].getID()); - StringBuffer paramBuffer = new StringBuffer(); - for (int j = 0; j < params.length; j++) - { - paramBuffer.append(params[j]); - if (j < params.length - 1) - paramBuffer.append(FragmentConstants.LIST_SEPERATOR); - } - urlEncodedParam.append(URLUtils.encode(paramBuffer.toString())); - if (i < childFrags.length - 1) - urlEncodedParam.append("&"); - } - return urlEncodedParam.toString(); - } - - private static String genURLEncodedXMLParameters(IXSDFragment fragment) - { - StringBuffer urlEncodedParam = new StringBuffer(); - Hashtable soapEnvelopeNamespaceTable = new Hashtable(); - soapEnvelopeNamespaceTable.put(Constants.URI_SOAP11_ENV, Constants.NS_PREFIX_SOAP_ENV); - soapEnvelopeNamespaceTable.put(Constants.URI_2001_SCHEMA_XSI, Constants.NS_PREFIX_SCHEMA_XSI); - soapEnvelopeNamespaceTable.put(Constants.URI_2001_SCHEMA_XSD, Constants.NS_PREFIX_SCHEMA_XSD); - Element[] instanceDocuments = new Element[0]; - try - { - instanceDocuments = fragment.genInstanceDocumentsFromParameterValues(true, soapEnvelopeNamespaceTable, XMLUtils.createNewDocument(null)); - } - catch (ParserConfigurationException pce) - { - } - for (int i = 0; i < instanceDocuments.length; i++) - { - urlEncodedParam.append(URLUtils.encode(fragment.getName())); - urlEncodedParam.append("="); - urlEncodedParam.append(URLUtils.encode(XMLUtils.serialize(instanceDocuments[i], true))); - if (i < instanceDocuments.length - 1) - urlEncodedParam.append("&"); - } - return urlEncodedParam.toString(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/util/OptionVector.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/util/OptionVector.java deleted file mode 100644 index 412881df3..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/util/OptionVector.java +++ /dev/null @@ -1,66 +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.util; - -import java.util.Vector; - -public class OptionVector -{ - private Vector options_; - - public OptionVector() - { - options_ = new Vector(); - } - - public void addOption(String displayValue,String value) - { - options_.addElement(new Option(displayValue,value)); - } - - public String getDisplayValue(int position) - { - Option option = (Option)options_.elementAt(position); - return option.getDisplayValue(); - } - - public String getValue(int position) - { - Option option = (Option)options_.elementAt(position); - return option.getValue(); - } - - public int size() - { - return options_.size(); - } - - private final class Option - { - private String displayValue_; - private String value_; - public Option(String displayValue,String value) - { - displayValue_ = displayValue; - value_ = value; - } - - public final String getDisplayValue() - { - return displayValue_; - } - - public final String getValue() - { - return value_; - } - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/util/XSDTypeDefinitionUtil.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/util/XSDTypeDefinitionUtil.java deleted file mode 100644 index a8e250f87..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/util/XSDTypeDefinitionUtil.java +++ /dev/null @@ -1,114 +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.util; - -import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; -import org.eclipse.xsd.XSDComplexTypeContent; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDTypeDefinition; - -public class XSDTypeDefinitionUtil { - private XSDTypeDefinitionUtil() { - } - - public static boolean isXSDBuiltInTypeDefinition(XSDTypeDefinition type) { - if (type == null) - return false; - String ns = type.getTargetNamespace(); - return (ns != null && ns.equals(FragmentConstants.URI_XSD)); - } - - public static boolean isRootTypeDefinition(XSDTypeDefinition type) { - if (type == null) - return true; - XSDTypeDefinition baseType = type.getBaseType(); - if (baseType == null) - return true; - String typeNS = type.getTargetNamespace(); - String baseTypeNS = baseType.getTargetNamespace(); - String typeName = type.getName(); - String baseTypeName = baseType.getName(); - boolean sameNS; - boolean sameName; - if (typeNS == null && baseTypeNS == null) - sameNS = true; - else if (typeNS != null && baseTypeNS != null && typeNS.equals(baseTypeNS)) - sameNS = true; - else - sameNS = false; - if (typeName == null && baseTypeName == null) - sameName = true; - else if (typeName != null && baseTypeName != null && typeName.equals(baseTypeName)) - sameName = true; - else - sameName = false; - return (sameNS && sameName); - } - - public static XSDTypeDefinition resolveToXSDBuiltInTypeDefinition(XSDTypeDefinition type) { - if (type == null) - return null; - XSDTypeDefinition currType = type; - while (!isXSDBuiltInTypeDefinition(currType)) { - if (isRootTypeDefinition(currType)) - return null; - currType = currType.getBaseType(); - } - return currType; - } - - public static boolean isSoapEncArray(XSDTypeDefinition type) { - XSDTypeDefinition currType = type; - if (currType != null) - while(currType != null) { - String ns = currType.getTargetNamespace(); - String name = currType.getName(); - if (FragmentConstants.URI_SOAP.equals(ns) && FragmentConstants.QNAME_LOCAL_NAME_ARRAY.equals(name)) - return true; - else if (isRootTypeDefinition(currType)) - return false; - else - currType = currType.getBaseType(); - } - return false; - } - - /** - * Returns the complex type content given a complex type. - * If complexType is a user defined type: - * This method will return the user defined complex content of this type or the content of the extended - * or derived type iff the extended or derived type is not a built-in XSD type (for example, xsd:anyType). - * If complexType is a built-in XSD type: - * It will return the complex content of this built-in XSD complex type. It will not return the - * complex content of its extended or derived type. - * @param complexType XSDComplexTypeDefinition complex type. - * @return XSDComplexTypeContent XSDComplexTypeContent the resolved complex type content. - **/ - public static XSDComplexTypeContent getXSDComplexTypeContent(XSDComplexTypeDefinition complexType) - { - if (!isXSDBuiltInTypeDefinition(complexType)) - { - XSDTypeDefinition type = complexType; - while (!isXSDBuiltInTypeDefinition(type) && (type instanceof XSDComplexTypeDefinition)) - { - XSDComplexTypeContent complexTypeContent = ((XSDComplexTypeDefinition)type).getContent(); - if (complexTypeContent != null) - return complexTypeContent; - if (isRootTypeDefinition(type)) - return null; - type = type.getBaseType(); - } - return null; - } - else - return complexType.getContent(); - } -} |