Author: sergeyb Date: Wed Jul 29 09:56:55 2009 New Revision: 798828 URL: http://svn.apache.org/viewvc?rev=798828&view=rev Log: CXF-2314 : Adding SDO write test, read one is ignored
Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/SdoFactory.java (with props) cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/Structure.java (with props) cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/SdoFactoryImpl.java (with props) cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/StructureImpl.java (with props) cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/structure.xsd (with props) Modified: cxf/trunk/rt/frontend/jaxrs/pom.xml cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingProviderTest.java Modified: cxf/trunk/rt/frontend/jaxrs/pom.xml URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/pom.xml?rev=798828&r1=798827&r2=798828&view=diff ============================================================================== --- cxf/trunk/rt/frontend/jaxrs/pom.xml (original) +++ cxf/trunk/rt/frontend/jaxrs/pom.xml Wed Jul 29 09:56:55 2009 @@ -168,14 +168,12 @@ <version>${project.version}</version> <scope>test</scope> </dependency> -<!-- <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-databinding-sdo</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> ---> <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingProviderTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingProviderTest.java?rev=798828&r1=798827&r2=798828&view=diff ============================================================================== --- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingProviderTest.java (original) +++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingProviderTest.java Wed Jul 29 09:56:55 2009 @@ -25,6 +25,7 @@ import java.lang.annotation.Annotation; import java.util.Collections; +import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -37,7 +38,10 @@ import org.apache.cxf.jaxrs.impl.MetadataMap; import org.apache.cxf.jaxrs.model.ClassResourceInfo; import org.apache.cxf.jaxrs.resources.Book; +import org.apache.cxf.jaxrs.resources.sdo.Structure; +import org.apache.cxf.jaxrs.resources.sdo.impl.StructureImpl; import org.apache.cxf.jaxrs.utils.ResourceUtils; +import org.apache.cxf.sdo.SDODataBinding; import org.apache.cxf.service.Service; import org.junit.Assert; @@ -48,10 +52,12 @@ public class DataBindingProviderTest extends Assert { private ClassResourceInfo c; + private ClassResourceInfo c2; @Before public void setUp() { c = ResourceUtils.createClassResourceInfo(TheBooks.class, TheBooks.class, true, true); + c2 = ResourceUtils.createClassResourceInfo(TheSDOBooks.class, TheSDOBooks.class, true, true); } @Test @@ -120,6 +126,51 @@ assertEquals(127L, book.getId()); } + @SuppressWarnings("unchecked") + @Test + public void testSDOWrite() throws Exception { + Service s = new JAXRSServiceImpl(Collections.singletonList(c2)); + DataBinding binding = new SDODataBinding(); + binding.initialize(s); + DataBindingProvider p = new DataBindingProvider(binding); + Structure struct = new StructureImpl(); + struct.getTexts().add("text1"); + struct.setText("sdo"); + struct.setInt(3); + struct.setDbl(123.5); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + p.writeTo(struct, Structure.class, Structure.class, + new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos); + String data = "<p0:Structure xmlns:p0=\"http://apache.org/structure/types\" " + + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + + "xsi:type=\"p0:Structure\">" + + "<p0:text>sdo</p0:text><p0:int>3</p0:int><p0:dbl>123.5</p0:dbl><p0:texts>text1</p0:texts>" + + "</p0:Structure>"; + assertEquals(bos.toString(), data); + } + + @SuppressWarnings("unchecked") + @Test + @Ignore + public void testSDORead() throws Exception { + String data = "<p0:Structure xmlns:p0=\"http://apache.org/structure/types\" " + + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + + "xsi:type=\"p0:Structure\">" + + "<p0:text>sdo</p0:text><p0:int>3</p0:int><p0:dbl>123.5</p0:dbl><p0:texts>text1</p0:texts>" + + "</p0:Structure>"; + Service s = new JAXRSServiceImpl(Collections.singletonList(c2)); + DataBinding binding = new SDODataBinding(); + binding.initialize(s); + DataBindingProvider p = new DataBindingProvider(binding); + ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes()); + Structure struct = (Structure)p.readFrom((Class)Structure.class, Structure.class, + new Annotation[0], MediaType.APPLICATION_XML_TYPE, + new MetadataMap<String, String>(), is); + assertEquals("sdo", struct.getText()); + assertEquals(123.5, struct.getDbl()); + assertEquals(3, struct.getInt()); + } + @Path("/") @Ignore public static class TheBooks { @@ -144,4 +195,15 @@ } } + @Path("/") + @Ignore + public static class TheSDOBooks { + + @GET + @Path("/books/{bookId}/{new}") + public Structure getStructure() { + return null; + } + + } } Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/SdoFactory.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/SdoFactory.java?rev=798828&view=auto ============================================================================== --- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/SdoFactory.java (added) +++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/SdoFactory.java Wed Jul 29 09:56:55 2009 @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.resources.sdo; + +import commonj.sdo.helper.HelperContext; + +public interface SdoFactory { + + SdoFactory INSTANCE = org.apache.cxf.jaxrs.resources.sdo.impl.SdoFactoryImpl.init(); + Structure createStructure(); + + void register(HelperContext scope); +} + Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/SdoFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/SdoFactory.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/Structure.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/Structure.java?rev=798828&view=auto ============================================================================== --- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/Structure.java (added) +++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/Structure.java Wed Jul 29 09:56:55 2009 @@ -0,0 +1,58 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.resources.sdo; + +import java.io.Serializable; + +import java.util.List; + +public interface Structure extends Serializable { + String getText(); + void setText(String value); + void unsetText(); + boolean isSetText(); + int getInt(); + void setInt(int value); + void unsetInt(); + boolean isSetInt(); + double getDbl(); + void setDbl(double value); + void unsetDbl(); + boolean isSetDbl(); + List getTexts(); +} + Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/Structure.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/Structure.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/SdoFactoryImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/SdoFactoryImpl.java?rev=798828&view=auto ============================================================================== --- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/SdoFactoryImpl.java (added) +++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/SdoFactoryImpl.java Wed Jul 29 09:56:55 2009 @@ -0,0 +1,185 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.jaxrs.resources.sdo.impl; + +import org.apache.cxf.jaxrs.resources.sdo.SdoFactory; +import org.apache.cxf.jaxrs.resources.sdo.Structure; +import org.apache.tuscany.sdo.helper.HelperContextImpl; +import org.apache.tuscany.sdo.impl.FactoryBase; +import org.apache.tuscany.sdo.model.ModelFactory; +import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.HelperContext; + +//CHECKSTYLE:OFF +public class SdoFactoryImpl extends FactoryBase implements SdoFactory { + public static final String NAMESPACE_URI = "http://apache.org/structure/types"; + public static final String NAMESPACE_PREFIX = "tns"; + public static final String PATTERN_VERSION = "1.2"; + public static final int STRUCTURE = 1; + private static SdoFactoryImpl instance = null; + protected Type structureType = null; + private boolean isCreated = false; + private boolean isInitialized = false; + + public SdoFactoryImpl() { + super(NAMESPACE_URI, NAMESPACE_PREFIX, "org.apache.cxf.jaxrs.resources.sdo"); + } + + public void register(HelperContext scope) { + if(scope == null) { + throw new IllegalArgumentException("Scope can not be null"); + } + + if (((HelperContextImpl)scope).getExtendedMetaData().getPackage(NAMESPACE_URI) != null) { + return; + } + // Register this package with provided scope + ((HelperContextImpl)scope).getExtendedMetaData().putPackage(NAMESPACE_URI, this); + + //Register dependent packages with provided scope + ModelFactory.INSTANCE.register(scope); + } + + public DataObject create(int typeNumber) { + switch (typeNumber) { + case STRUCTURE : + return (DataObject)createStructure(); + default : + return super.create(typeNumber); + } + } + + public Structure createStructure() { + return new StructureImpl(); + } + + public Type getStructure() { + return structureType; + } + + public static SdoFactoryImpl init() { + if (instance != null) { + return instance; + } + instance = new SdoFactoryImpl(); + + instance.createMetaData(); + instance.initializeMetaData(); + return instance; + } + + public void createMetaData() { + if (isCreated) { + return; + } + isCreated = true; + + structureType = createType(false, STRUCTURE); + createProperty(true, structureType,StructureImpl._INTERNAL_TEXT); + createProperty(true, structureType,StructureImpl._INTERNAL_INT); + createProperty(true, structureType,StructureImpl._INTERNAL_DBL); + createProperty(true, structureType,StructureImpl._INTERNAL_TEXTS); + } + + public void initializeMetaData() { + if (isInitialized) { + return; + } + isInitialized = true; + + ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)ModelFactoryImpl.init(); + Property property = null; + + // Add supertypes to types + + + initializeType(structureType, Structure.class, "Structure", false); + property = getLocalProperty(structureType, 0); + initializeProperty(property, theModelPackageImpl.getString(), "text", null, 1, 1, + Structure.class, false, true, false); + + property = getLocalProperty(structureType, 1); + initializeProperty(property, theModelPackageImpl.getInt(), "int", null, 1, 1, + Structure.class, false, true, false); + + property = getLocalProperty(structureType, 2); + initializeProperty(property, theModelPackageImpl.getDouble(), "dbl", null, 1, 1, + Structure.class, false, true, false); + + property = getLocalProperty(structureType, 3); + initializeProperty(property, theModelPackageImpl.getString(), "texts", null, 1, -1, + Structure.class, false, false, false); + + + createXSDMetaData(theModelPackageImpl); + } + + protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl) + { + super.initXSD(); + + addXSDMapping + (structureType, + new String[] { + "name", "Structure", + "kind", "elementOnly" + }); + + addXSDMapping + (getLocalProperty(structureType, 0), + new String[] { + "kind", "element", + "name", "text", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (getLocalProperty(structureType, 1), + new String[] { + "kind", "element", + "name", "int", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (getLocalProperty(structureType, 2), + new String[] { + "kind", "element", + "name", "dbl", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (getLocalProperty(structureType, 3), + new String[] { + "kind", "element", + "name", "texts", + "namespace", "##targetNamespace" + }); + } + + + +} //SdoFactoryImpl +//CHECKSTYLE:ON \ No newline at end of file Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/SdoFactoryImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/SdoFactoryImpl.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/StructureImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/StructureImpl.java?rev=798828&view=auto ============================================================================== --- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/StructureImpl.java (added) +++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/StructureImpl.java Wed Jul 29 09:56:55 2009 @@ -0,0 +1,495 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.resources.sdo.impl; + +import java.util.Collection; +import java.util.List; + +import org.apache.cxf.jaxrs.resources.sdo.SdoFactory; +import org.apache.cxf.jaxrs.resources.sdo.Structure; +import org.apache.tuscany.sdo.impl.DataObjectBase; + +import commonj.sdo.Type; + +//CHECKSTYLE:OFF +public class StructureImpl extends DataObjectBase implements Structure { + + public final static int TEXT = 0; + + public final static int INT = 1; + + public final static int DBL = 2; + + public final static int TEXTS = 3; + + public final static int SDO_PROPERTY_COUNT = 4; + + public final static int EXTENDED_PROPERTY_COUNT = 0; + + + /** + * The internal feature id for the '<em><b>Text</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int _INTERNAL_TEXT = 0; + + /** + * The internal feature id for the '<em><b>Int</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int _INTERNAL_INT = 1; + + /** + * The internal feature id for the '<em><b>Dbl</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int _INTERNAL_DBL = 2; + + /** + * The internal feature id for the '<em><b>Texts</b></em>' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int _INTERNAL_TEXTS = 3; + + /** + * The number of properties for this type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 4; + + /** + * The default value of the '{...@link #getText() <em>Text</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getText() + * @generated + * @ordered + */ + protected static final String TEXT_DEFAULT_ = null; + + /** + * The cached value of the '{...@link #getText() <em>Text</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getText() + * @generated + * @ordered + */ + protected String text = TEXT_DEFAULT_; + + /** + * This is true if the Text attribute has been set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + protected boolean text_set_ = false; + + /** + * The default value of the '{...@link #getInt() <em>Int</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getInt() + * @generated + * @ordered + */ + protected static final int INT_DEFAULT_ = 0; + + /** + * The cached value of the '{...@link #getInt() <em>Int</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getInt() + * @generated + * @ordered + */ + protected int int_ = INT_DEFAULT_; + + /** + * This is true if the Int attribute has been set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + protected boolean int_set_ = false; + + /** + * The default value of the '{...@link #getDbl() <em>Dbl</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDbl() + * @generated + * @ordered + */ + protected static final double DBL_DEFAULT_ = 0.0; + + /** + * The cached value of the '{...@link #getDbl() <em>Dbl</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDbl() + * @generated + * @ordered + */ + protected double dbl = DBL_DEFAULT_; + + /** + * This is true if the Dbl attribute has been set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + protected boolean dbl_set_ = false; + + /** + * The cached value of the '{...@link #getTexts() <em>Texts</em>}' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getTexts() + * @generated + * @ordered + */ + + protected List texts = null; + + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public StructureImpl() { + super(); + } + + + protected int internalConvertIndex(int internalIndex) { + switch (internalIndex) { + case _INTERNAL_TEXT: + return TEXT; + case _INTERNAL_INT: + return INT; + case _INTERNAL_DBL: + return DBL; + case _INTERNAL_TEXTS: + return TEXTS; + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Type getStaticType() { + return ((SdoFactoryImpl)SdoFactory.INSTANCE).getStructure(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public int getStaticPropertyCount() { + return INTERNAL_PROPERTY_COUNT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getText() { + return text; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setText(String newText) { + String oldText = text; + text = newText; + boolean oldText_set_ = text_set_; + text_set_ = true; + if (isNotifying()) { + notify(ChangeKind.SET, _INTERNAL_TEXT, oldText, text, !oldText_set_); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetText() { + String oldText = text; + boolean oldText_set_ = text_set_; + text = TEXT_DEFAULT_; + text_set_ = false; + if (isNotifying()) { + notify(ChangeKind.UNSET, _INTERNAL_TEXT, oldText, TEXT_DEFAULT_, oldText_set_); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetText() { + return text_set_; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public int getInt() { + return int_; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setInt(int newInt) { + int oldInt = int_; + int_ = newInt; + boolean oldInt_set_ = int_set_; + int_set_ = true; + if (isNotifying()) { + notify(ChangeKind.SET, _INTERNAL_INT, oldInt, int_, !oldInt_set_); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetInt() { + int oldInt = int_; + boolean oldInt_set_ = int_set_; + int_ = INT_DEFAULT_; + int_set_ = false; + if (isNotifying()) { + notify(ChangeKind.UNSET, _INTERNAL_INT, oldInt, INT_DEFAULT_, oldInt_set_); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetInt() { + return int_set_; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public double getDbl() { + return dbl; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDbl(double newDbl) { + double oldDbl = dbl; + dbl = newDbl; + boolean oldDbl_set_ = dbl_set_; + dbl_set_ = true; + if (isNotifying()) { + notify(ChangeKind.SET, _INTERNAL_DBL, oldDbl, dbl, !oldDbl_set_); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetDbl() { + double oldDbl = dbl; + boolean oldDbl_set_ = dbl_set_; + dbl = DBL_DEFAULT_; + dbl_set_ = false; + if (isNotifying()) { + notify(ChangeKind.UNSET, _INTERNAL_DBL, oldDbl, DBL_DEFAULT_, oldDbl_set_); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetDbl() { + return dbl_set_; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public List getTexts() { + if (texts == null) { + texts = createPropertyList(ListKind.DATATYPE, String.class, TEXTS, 0); + } + return texts; + } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Object get(int propertyIndex, boolean resolve) { + switch (propertyIndex) { + case TEXT : + return getText(); + case INT : + return new Integer(getInt()); + case DBL : + return new Double(getDbl()); + case TEXTS : + return getTexts(); + } + return super.get(propertyIndex, resolve); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + public void set(int propertyIndex, Object newValue) { + switch (propertyIndex) { + case TEXT : + setText((String)newValue); + return; + case INT : + setInt(((Integer)newValue).intValue()); + return; + case DBL : + setDbl(((Double)newValue).doubleValue()); + return; + case TEXTS : + getTexts().clear(); + getTexts().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unset(int propertyIndex) { + switch (propertyIndex) { + case TEXT : + unsetText(); + return; + case INT : + unsetInt(); + return; + case DBL : + unsetDbl(); + return; + case TEXTS : + getTexts().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSet(int propertyIndex) { + switch (propertyIndex) { + case TEXT : + return isSetText(); + case INT : + return isSetInt(); + case DBL : + return isSetDbl(); + case TEXTS : + return texts != null && !texts.isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String toString() { + if (isProxy(this)) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (text: "); + if (text_set_) result.append(text); else result.append("<unset>"); + result.append(", int: "); + if (int_set_) result.append(int_); else result.append("<unset>"); + result.append(", dbl: "); + if (dbl_set_) result.append(dbl); else result.append("<unset>"); + result.append(", texts: "); + result.append(texts); + result.append(')'); + return result.toString(); + } + +} +//CHECKSTYLE:ON \ No newline at end of file Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/StructureImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/StructureImpl.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/structure.xsd URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/structure.xsd?rev=798828&view=auto ============================================================================== --- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/structure.xsd (added) +++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/structure.xsd Wed Jul 29 09:56:55 2009 @@ -0,0 +1,11 @@ +<schema targetNamespace="http://apache.org/structure/types" xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://apache.org/structure/types" elementFormDefault="qualified"> + <complexType name="Structure"> + <sequence> + <element name="text" type="string"/> + <element name="int" type="int"/> + <element name="dbl" type="double"/> + <element name="texts" type="string" maxOccurs="unbounded"/> + </sequence> + </complexType> +</schema> \ No newline at end of file Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/structure.xsd ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/structure.xsd ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/structure.xsd ------------------------------------------------------------------------------ svn:mime-type = text/xml