1 7 8 package org.apache.jetspeed.xml.api.jcm; 9 10 14 import org.exolab.castor.mapping.AccessMode; 15 import org.exolab.castor.mapping.ClassDescriptor; 16 import org.exolab.castor.mapping.FieldDescriptor; 17 import org.exolab.castor.xml.*; 18 import org.exolab.castor.xml.FieldValidator; 19 import org.exolab.castor.xml.TypeValidator; 20 import org.exolab.castor.xml.XMLFieldDescriptor; 21 import org.exolab.castor.xml.handlers.*; 22 import org.exolab.castor.xml.util.XMLFieldDescriptorImpl; 23 import org.exolab.castor.xml.validators.*; 24 25 29 public class ContentDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { 30 31 32 36 private java.lang.String nsPrefix; 37 38 private java.lang.String nsURI; 39 40 private java.lang.String xmlName; 41 42 private org.exolab.castor.xml.XMLFieldDescriptor identity; 43 44 45 49 public ContentDescriptor() { 50 super(); 51 nsURI = "http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"; 52 xmlName = "content"; 53 XMLFieldDescriptorImpl desc = null; 54 XMLFieldHandler handler = null; 55 FieldValidator fieldValidator = null; 56 58 desc = new XMLFieldDescriptorImpl(java.lang.String .class, "_version", "version", NodeType.Attribute); 60 desc.setImmutable(true); 61 handler = (new XMLFieldHandler() { 62 public Object getValue( Object object ) 63 throws IllegalStateException 64 { 65 Content target = (Content) object; 66 return target.getVersion(); 67 } 68 public void setValue( Object object, Object value) 69 throws IllegalStateException , IllegalArgumentException 70 { 71 try { 72 Content target = (Content) object; 73 target.setVersion( (java.lang.String ) value); 74 } 75 catch (Exception ex) { 76 throw new IllegalStateException (ex.toString()); 77 } 78 } 79 public Object newInstance( Object parent ) { 80 return null; 81 } 82 } ); 83 desc.setHandler(handler); 84 desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"); 85 addFieldDescriptor(desc); 86 87 fieldValidator = new FieldValidator(); 89 { StringValidator sv = new StringValidator(); 91 sv.setWhiteSpace("preserve"); 92 fieldValidator.setValidator(sv); 93 } 94 desc.setValidator(fieldValidator); 95 96 98 desc = new XMLFieldDescriptorImpl(Channel.class, "_channel", "channel", NodeType.Element); 100 handler = (new XMLFieldHandler() { 101 public Object getValue( Object object ) 102 throws IllegalStateException 103 { 104 Content target = (Content) object; 105 return target.getChannel(); 106 } 107 public void setValue( Object object, Object value) 108 throws IllegalStateException , IllegalArgumentException 109 { 110 try { 111 Content target = (Content) object; 112 target.setChannel( (Channel) value); 113 } 114 catch (Exception ex) { 115 throw new IllegalStateException (ex.toString()); 116 } 117 } 118 public Object newInstance( Object parent ) { 119 return new Channel(); 120 } 121 } ); 122 desc.setHandler(handler); 123 desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content"); 124 desc.setRequired(true); 125 desc.setMultivalued(false); 126 addFieldDescriptor(desc); 127 128 fieldValidator = new FieldValidator(); 130 fieldValidator.setMinOccurs(1); 131 desc.setValidator(fieldValidator); 132 133 } 135 136 140 142 public org.exolab.castor.mapping.AccessMode getAccessMode() 143 { 144 return null; 145 } 147 149 public org.exolab.castor.mapping.ClassDescriptor getExtends() 150 { 151 return null; 152 } 154 156 public org.exolab.castor.mapping.FieldDescriptor getIdentity() 157 { 158 return identity; 159 } 161 163 public java.lang.Class getJavaClass() 164 { 165 return org.apache.jetspeed.xml.api.jcm.Content.class; 166 } 168 170 public java.lang.String getNameSpacePrefix() 171 { 172 return nsPrefix; 173 } 175 177 public java.lang.String getNameSpaceURI() 178 { 179 return nsURI; 180 } 182 184 public org.exolab.castor.xml.TypeValidator getValidator() 185 { 186 return this; 187 } 189 191 public java.lang.String getXMLName() 192 { 193 return xmlName; 194 } 196 } 197 | Popular Tags |