Source Code Cross Referenced for XLinkSchema.java in  » GIS » GeoTools-2.4.1 » org » geotools » xml » xLink » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.xml.xLink 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         *    GeoTools - OpenSource mapping toolkit
0003:         *    http://geotools.org
0004:         *    (C) 2004-2006, GeoTools Project Managment Committee (PMC)
0005:         *    
0006:         *    This library is free software; you can redistribute it and/or
0007:         *    modify it under the terms of the GNU Lesser General Public
0008:         *    License as published by the Free Software Foundation;
0009:         *    version 2.1 of the License.
0010:         *
0011:         *    This library is distributed in the hope that it will be useful,
0012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014:         *    Lesser General Public License for more details.
0015:         */
0016:        package org.geotools.xml.xLink;
0017:
0018:        import java.net.URI;
0019:        import java.net.URISyntaxException;
0020:        import java.util.Collections;
0021:        import java.util.LinkedList;
0022:        import java.util.List;
0023:        import java.util.Map;
0024:
0025:        import org.geotools.xml.PrintHandler;
0026:        import org.geotools.xml.schema.Attribute;
0027:        import org.geotools.xml.schema.AttributeGroup;
0028:        import org.geotools.xml.schema.AttributeValue;
0029:        import org.geotools.xml.schema.ComplexType;
0030:        import org.geotools.xml.schema.Element;
0031:        import org.geotools.xml.schema.ElementValue;
0032:        import org.geotools.xml.schema.Facet;
0033:        import org.geotools.xml.schema.Group;
0034:        import org.geotools.xml.schema.Schema;
0035:        import org.geotools.xml.schema.SimpleType;
0036:        import org.geotools.xml.schema.impl.AttributeValueGT;
0037:        import org.geotools.xml.schema.impl.FacetGT;
0038:        import org.geotools.xml.xsi.XSISimpleTypes;
0039:        import org.xml.sax.Attributes;
0040:        import org.xml.sax.SAXException;
0041:
0042:        /**
0043:         * <p>
0044:         * This class is a hard-coded version of the XLink Schema. The results of
0045:         * parsing the schema in through the parser and calling the resulting Schema
0046:         * objects methods should be the same as calling these methods, except that
0047:         * these methods should be faster.
0048:         * </p>
0049:         * 
0050:         * <p>
0051:         * This class consists of a series of internal private classes and an
0052:         * implementation of the Schema interface which is public.
0053:         * </p>
0054:         *
0055:         * @author dzwiers www.refractions.net
0056:         *
0057:         * @see Schema
0058:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/xml/src/main/java/org/geotools/xml/xLink/XLinkSchema.java $
0059:         */
0060:        public class XLinkSchema implements  Schema {
0061:            private static Schema instance = new XLinkSchema();
0062:
0063:            // local list of attribute declarations
0064:            private static final Attribute[] attributes = loadAttributes();
0065:
0066:            // local list of attributeGroup declarations
0067:            private static final AttributeGroup[] attributeGroups = loadAttributeGroups();
0068:
0069:            /** The full xLink namespace */
0070:            public static final URI NAMESPACE = makeURI("http://www.w3.org/1999/xlink");
0071:
0072:            /**
0073:             * @see org.geotools.xml.schema.Schema#getInstance()
0074:             */
0075:            public static Schema getInstance() {
0076:                return instance;
0077:            }
0078:
0079:            /*
0080:             * loads the list of attribute declarations for the XLink Schema
0081:             */
0082:            private static Attribute[] loadAttributes() {
0083:                Attribute[] r = new Attribute[9];
0084:                r[0] = Href.getInstance();
0085:                r[1] = Role.getInstance();
0086:                r[2] = Arcrole.getInstance();
0087:                r[3] = Title.getInstance();
0088:                r[4] = Show.getInstance();
0089:                r[5] = Actuate.getInstance();
0090:                r[6] = Label.getInstance();
0091:                r[7] = From.getInstance();
0092:                r[8] = To.getInstance();
0093:
0094:                return r;
0095:            }
0096:
0097:            /*
0098:             * loads the list of attributeGroup declarations for the XLink Schema
0099:             */
0100:            private static AttributeGroup[] loadAttributeGroups() {
0101:                AttributeGroup[] r = new AttributeGroup[7];
0102:                r[0] = SimpleLink.getInstance();
0103:                r[1] = ExtendedLink.getInstance();
0104:                r[2] = LocatorLink.getInstance();
0105:                r[3] = ArcLink.getInstance();
0106:                r[4] = ResourceLink.getInstance();
0107:                r[5] = TitleLink.getInstance();
0108:                r[6] = EmptyLink.getInstance();
0109:
0110:                return r;
0111:            }
0112:
0113:            /**
0114:             * @see schema.Schema#getAttributeGroups()
0115:             */
0116:            public AttributeGroup[] getAttributeGroups() {
0117:                return attributeGroups;
0118:            }
0119:
0120:            /**
0121:             * @see schema.Schema#getAttributes()
0122:             */
0123:            public Attribute[] getAttributes() {
0124:                return attributes;
0125:            }
0126:
0127:            /*
0128:             * (non-Javadoc)
0129:             *
0130:             * @see schema.Schema#getBlockDefault()
0131:             */
0132:            public int getBlockDefault() {
0133:                return NONE;
0134:            }
0135:
0136:            /**
0137:             * @see schema.Schema#getComplexTypes()
0138:             */
0139:            public ComplexType[] getComplexTypes() {
0140:                return new ComplexType[0];
0141:            }
0142:
0143:            /**
0144:             * @see schema.Schema#getElements()
0145:             */
0146:            public Element[] getElements() {
0147:                return new Element[0];
0148:            }
0149:
0150:            /**
0151:             * @see schema.Schema#getFinalDefault()
0152:             */
0153:            public int getFinalDefault() {
0154:                return NONE;
0155:            }
0156:
0157:            /**
0158:             * @see schema.Schema#getGroups()
0159:             */
0160:            public Group[] getGroups() {
0161:                return new Group[0];
0162:            }
0163:
0164:            /**
0165:             * @see schema.Schema#getId()
0166:             */
0167:            public String getId() {
0168:                return null;
0169:            }
0170:
0171:            /**
0172:             * @see schema.Schema#getImports()
0173:             */
0174:            public Schema[] getImports() {
0175:                return new Schema[0];
0176:            }
0177:
0178:            /**
0179:             * @see schema.Schema#getSimpleTypes()
0180:             */
0181:            public SimpleType[] getSimpleTypes() {
0182:                return new SimpleType[0];
0183:            }
0184:
0185:            /**
0186:             * @see schema.Schema#getTargetNamespace()
0187:             */
0188:            public URI getTargetNamespace() {
0189:                return NAMESPACE;
0190:            }
0191:
0192:            public URI getURI() {
0193:                return NAMESPACE;
0194:            }
0195:
0196:            /**
0197:             * @see schema.Schema#getVersion()
0198:             */
0199:            public String getVersion() {
0200:                return "2.1.2";
0201:            }
0202:
0203:            /**
0204:             * @see schema.Schema#includesURI(java.net.URI)
0205:             */
0206:            public boolean includesURI(URI uri) {
0207:                //        if (uri.toString().toLowerCase().endsWith("xlinks.xsd")) {
0208:                //            return true;
0209:                //        }
0210:                //
0211:                //        return false;
0212:                // this is a spec ... we never want the def modified.
0213:                // TODO see if this affects printing
0214:                return true;
0215:            }
0216:
0217:            // convinience method to deal with the URISyntaxException
0218:            private static URI makeURI(String s) {
0219:                try {
0220:                    return new URI(s);
0221:                } catch (URISyntaxException e) {
0222:                    // do nothing
0223:                    return null;
0224:                }
0225:            }
0226:
0227:            /**
0228:             * DOCUMENT ME!
0229:             *
0230:             */
0231:            public String getPrefix() {
0232:                return "xLink";
0233:            }
0234:
0235:            /**
0236:             * @see schema.Schema#isAttributeFormDefault()
0237:             */
0238:            public boolean isAttributeFormDefault() {
0239:                return false;
0240:            }
0241:
0242:            /**
0243:             * @see schema.Schema#isElementFormDefault()
0244:             */
0245:            public boolean isElementFormDefault() {
0246:                return false;
0247:            }
0248:
0249:            /**
0250:             * ActuateSimpleType purpose.
0251:             * 
0252:             * <p>
0253:             * A static representation of an Actuate type as defined in the XLink
0254:             * Schema
0255:             * </p>
0256:             * 
0257:             * <p></p>
0258:             *
0259:             * @author dzwiers, Refractions Research, Inc. http://www.refractions.net
0260:             * @author $Author:$ (last modification)
0261:             * @version $Id: XLinkSchema.java 22347 2006-10-24 01:57:23Z jdeolive $
0262:             */
0263:            private static class ActuateSimpleType implements  SimpleType {
0264:                // list of allowable enumeration values
0265:                private static List lookUpTable = loadTable();
0266:
0267:                /**
0268:                 * @see org.geotools.xml.schema.Type#findChildElement(java.lang.String)
0269:                 */
0270:                public Element findChildElement(String name) {
0271:                    return null; // will never happen
0272:                }
0273:
0274:                /**
0275:                 * @see org.geotools.xml.schema.Type#canEncode(org.geotools.xml.schema.Element,
0276:                 *      java.lang.Object, java.util.Map)
0277:                 */
0278:                public boolean canEncode(Element element, Object value,
0279:                        Map hints) {
0280:                    //            return (lookUpTable.contains(value));
0281:                    return false; // it's an attribute
0282:                }
0283:
0284:                /**
0285:                 * @see org.geotools.xml.schema.Type#encode(org.geotools.xml.schema.Element,
0286:                 *      java.lang.Object, org.geotools.xml.PrintHandler,
0287:                 *      java.util.Map)
0288:                 */
0289:                public void encode(Element element, Object value,
0290:                        PrintHandler output, Map hints) {
0291:                    // it's an attribute ... do nothing
0292:                }
0293:
0294:                public Class getInstanceType() {
0295:                    return String.class;
0296:                }
0297:
0298:                public org.geotools.xml.schema.Type getParent() {
0299:                    return null;
0300:                }
0301:
0302:                /**
0303:                 * @see schema.SimpleType#getNamespace()
0304:                 */
0305:                public URI getNamespace() {
0306:                    return XLinkSchema.NAMESPACE;
0307:                }
0308:
0309:                /**
0310:                 * @see schema.SimpleType#getFinal()
0311:                 */
0312:                public int getFinal() {
0313:                    return NONE;
0314:                }
0315:
0316:                /**
0317:                 * @see schema.SimpleType#getId()
0318:                 */
0319:                public String getId() {
0320:                    return null;
0321:                }
0322:
0323:                /**
0324:                 * @see schema.SimpleType#getName()
0325:                 */
0326:                public String getName() {
0327:                    return null;
0328:                }
0329:
0330:                private static List loadTable() {
0331:                    lookUpTable = new LinkedList();
0332:                    lookUpTable.add("onLoad");
0333:                    lookUpTable.add("onRequest");
0334:                    lookUpTable.add("other");
0335:                    lookUpTable.add("none");
0336:
0337:                    return lookUpTable;
0338:                }
0339:
0340:                /**
0341:                 * @see schema.Type#getValue(java.lang.Object, org.xml.sax.Attributes)
0342:                 */
0343:                public Object getValue(Element element, ElementValue[] value,
0344:                        Attributes attrs, Map hints) throws SAXException {
0345:                    if ((value == null) || (value.length != 1)
0346:                            || (value[0] == null)) {
0347:                        return null;
0348:                    }
0349:
0350:                    if (value[0].getValue() instanceof  String) {
0351:                        if (lookUpTable.contains(value[0].getValue())) {
0352:                            return value[0].getValue();
0353:                        }
0354:
0355:                        throw new SAXException(
0356:                                "The value speficified was not one of the expected values.");
0357:                    }
0358:
0359:                    return null;
0360:                }
0361:
0362:                /**
0363:                 * @see org.geotools.xml.schema.SimpleType#toAttributes(org.geotools.xml.schema.Attribute,
0364:                 *      java.lang.Object, java.util.Map)
0365:                 */
0366:                public AttributeValue toAttribute(Attribute attribute,
0367:                        Object value, Map hints) {
0368:                    if (canCreateAttributes(attribute, value, hints)) {
0369:                        return new AttributeValueGT(attribute, (String) value);
0370:                    }
0371:
0372:                    return null;
0373:                }
0374:
0375:                /**
0376:                 * @see org.geotools.xml.schema.SimpleType#canCreateAttributes(org.geotools.xml.schema.Attribute,
0377:                 *      java.lang.Object, java.util.Map)
0378:                 */
0379:                public boolean canCreateAttributes(Attribute attribute,
0380:                        Object value, Map hints) {
0381:                    return (attribute.getName() != null)
0382:                            && attribute.getName().equals(
0383:                                    Actuate.getInstance().getName())
0384:                            && lookUpTable.contains(value);
0385:                }
0386:
0387:                /**
0388:                 * @see org.geotools.xml.schema.SimpleType#getChildType()
0389:                 */
0390:                public int getChildType() {
0391:                    return RESTRICTION;
0392:                }
0393:
0394:                /**
0395:                 * @see org.geotools.xml.schema.SimpleType#getParents()
0396:                 */
0397:                public SimpleType[] getParents() {
0398:                    return new SimpleType[] { XSISimpleTypes.String
0399:                            .getInstance() };
0400:                }
0401:
0402:                /**
0403:                 * @see org.geotools.xml.schema.SimpleType#getFacets()
0404:                 */
0405:                public Facet[] getFacets() {
0406:                    return new Facet[] {
0407:                            new FacetGT(Facet.ENUMERATION, "onLoad"),
0408:                            new FacetGT(Facet.ENUMERATION, "onRequest"),
0409:                            new FacetGT(Facet.ENUMERATION, "other"),
0410:                            new FacetGT(Facet.ENUMERATION, "none"), };
0411:                }
0412:            }
0413:
0414:            /**
0415:             * ShowSimpleType purpose.
0416:             * 
0417:             * <p>
0418:             * Represents the Show type in the XLink Schema
0419:             * </p>
0420:             * 
0421:             * <p></p>
0422:             *
0423:             * @author dzwiers, Refractions Research, Inc. http://www.refractions.net
0424:             * @author $Author:$ (last modification)
0425:             * @version $Id: XLinkSchema.java 22347 2006-10-24 01:57:23Z jdeolive $
0426:             */
0427:            private static class ShowSimpleType implements  SimpleType {
0428:                // static enumeration list
0429:                private static List lookUpTable = loadTable();
0430:
0431:                /**
0432:                 * @see org.geotools.xml.schema.SimpleType#toAttributes(org.geotools.xml.schema.Attribute,
0433:                 *      java.lang.Object, java.util.Map)
0434:                 */
0435:                public AttributeValue toAttribute(Attribute attribute,
0436:                        Object value, Map hints) {
0437:                    if (canCreateAttributes(attribute, value, hints)) {
0438:                        return new AttributeValueGT(attribute, (String) value);
0439:                    }
0440:
0441:                    return null;
0442:                }
0443:
0444:                /**
0445:                 * @see org.geotools.xml.schema.Type#findChildElement(java.lang.String)
0446:                 */
0447:                public Element findChildElement(String name) {
0448:                    return null; // will never happen
0449:                }
0450:
0451:                /**
0452:                 * @see org.geotools.xml.schema.SimpleType#canCreateAttributes(org.geotools.xml.schema.Attribute,
0453:                 *      java.lang.Object, java.util.Map)
0454:                 */
0455:                public boolean canCreateAttributes(Attribute attribute,
0456:                        Object value, Map hints) {
0457:                    return (attribute.getName() != null)
0458:                            && attribute.getName().equals(
0459:                                    Actuate.getInstance().getName())
0460:                            && lookUpTable.contains(value);
0461:                }
0462:
0463:                public Class getInstanceType() {
0464:                    return String.class;
0465:                }
0466:
0467:                public org.geotools.xml.schema.Type getParent() {
0468:                    return null;
0469:                }
0470:
0471:                /**
0472:                 * @see schema.SimpleType#getNamespace()
0473:                 */
0474:                public URI getNamespace() {
0475:                    return XLinkSchema.NAMESPACE;
0476:                }
0477:
0478:                /**
0479:                 * @see schema.SimpleType#getFinal()
0480:                 */
0481:                public int getFinal() {
0482:                    return NONE;
0483:                }
0484:
0485:                /**
0486:                 * @see schema.SimpleType#getId()
0487:                 */
0488:                public String getId() {
0489:                    return null;
0490:                }
0491:
0492:                /**
0493:                 * @see schema.SimpleType#getName()
0494:                 */
0495:                public String getName() {
0496:                    return null;
0497:                }
0498:
0499:                private static List loadTable() {
0500:                    lookUpTable = new LinkedList();
0501:                    lookUpTable.add("new");
0502:                    lookUpTable.add("replace");
0503:                    lookUpTable.add("embed");
0504:                    lookUpTable.add("other");
0505:                    lookUpTable.add("none");
0506:
0507:                    return lookUpTable;
0508:                }
0509:
0510:                /**
0511:                 * @see schema.Type#getValue(java.lang.Object, org.xml.sax.Attributes)
0512:                 */
0513:                public Object getValue(Element element, ElementValue[] value,
0514:                        Attributes attrs, Map hints) throws SAXException {
0515:                    if ((value == null) || (value.length != 1)
0516:                            || (value[0] == null)) {
0517:                        return null;
0518:                    }
0519:
0520:                    if (value[0].getValue() instanceof  String) {
0521:                        if (lookUpTable.contains(value[0].getValue())) {
0522:                            return value[0].getValue();
0523:                        }
0524:
0525:                        throw new SAXException(
0526:                                "The value speficified was not one of the expected values.");
0527:                    }
0528:
0529:                    return null;
0530:                }
0531:
0532:                /**
0533:                 * @see org.geotools.xml.schema.Type#canEncode(org.geotools.xml.schema.Element,
0534:                 *      java.lang.Object, java.util.Map)
0535:                 */
0536:                public boolean canEncode(Element element, Object value,
0537:                        Map hints) {
0538:                    //            return (lookUpTable.contains(value));
0539:                    return false; // it's an attribute
0540:                }
0541:
0542:                /**
0543:                 * @see org.geotools.xml.schema.Type#encode(org.geotools.xml.schema.Element,
0544:                 *      java.lang.Object, org.geotools.xml.PrintHandler,
0545:                 *      java.util.Map)
0546:                 */
0547:                public void encode(Element element, Object value,
0548:                        PrintHandler output, Map hints) {
0549:                    // it's an attribute ... do nothing
0550:                }
0551:
0552:                /**
0553:                 * @see org.geotools.xml.schema.SimpleType#getChildType()
0554:                 */
0555:                public int getChildType() {
0556:                    return RESTRICTION;
0557:                }
0558:
0559:                /**
0560:                 * @see org.geotools.xml.schema.SimpleType#getParents()
0561:                 */
0562:                public SimpleType[] getParents() {
0563:                    return new SimpleType[] { XSISimpleTypes.String
0564:                            .getInstance() };
0565:                }
0566:
0567:                /**
0568:                 * @see org.geotools.xml.schema.SimpleType#getFacets()
0569:                 */
0570:                public Facet[] getFacets() {
0571:                    return new Facet[] { new FacetGT(Facet.ENUMERATION, "new"),
0572:                            new FacetGT(Facet.ENUMERATION, "replace"),
0573:                            new FacetGT(Facet.ENUMERATION, "embed"),
0574:                            new FacetGT(Facet.ENUMERATION, "other"),
0575:                            new FacetGT(Facet.ENUMERATION, "none"), };
0576:                }
0577:            }
0578:
0579:            /**
0580:             * XLinkAttribute purpose.
0581:             * 
0582:             * <p>
0583:             * Used to define some constant values for XLink attributes, such as
0584:             * Namespace
0585:             * </p>
0586:             *
0587:             * @author dzwiers, Refractions Research, Inc. http://www.refractions.net
0588:             * @author $Author:$ (last modification)
0589:             * @version $Id: XLinkSchema.java 22347 2006-10-24 01:57:23Z jdeolive $
0590:             */
0591:            protected abstract static class XLinkAttribute implements  Attribute {
0592:                /**
0593:                 * @see schema.Attribute#getNameSpace()
0594:                 */
0595:                public URI getNamespace() {
0596:                    return XLinkSchema.NAMESPACE;
0597:                }
0598:
0599:                /**
0600:                 * @see schema.Attribute#getDefault()
0601:                 */
0602:                public String getDefault() {
0603:                    return null;
0604:                }
0605:
0606:                /**
0607:                 * @see schema.Attribute#isForm()
0608:                 */
0609:                public boolean isForm() {
0610:                    return false;
0611:                }
0612:
0613:                /**
0614:                 * @see schema.Attribute#getId()
0615:                 */
0616:                public String getId() {
0617:                    return null;
0618:                }
0619:            }
0620:
0621:            /**
0622:             * Href purpose.
0623:             * 
0624:             * <p>
0625:             * Represents an Href Attribute in the XLink Schema
0626:             * </p>
0627:             *
0628:             * @author dzwiers, Refractions Research, Inc. http://www.refractions.net
0629:             * @author $Author:$ (last modification)
0630:             * @version $Id: XLinkSchema.java 22347 2006-10-24 01:57:23Z jdeolive $
0631:             */
0632:            public static class Href extends XLinkAttribute {
0633:                // singleton instance
0634:                static Attribute instance1;
0635:
0636:                // internal storage for the attribute's use (required,optional ...)
0637:                private int use = Attribute.OPTIONAL;
0638:
0639:                /**
0640:                 * Href constructor.
0641:                 * 
0642:                 * <p>
0643:                 * Creates an instance of the Href Attribute of the XLink Schema
0644:                 * </p>
0645:                 *
0646:                 * @param use
0647:                 *
0648:                 * @see Attribute#getUse()
0649:                 */
0650:                public Href(int use) {
0651:                    this .use = use;
0652:                }
0653:
0654:                /**
0655:                 * Href constructor
0656:                 * 
0657:                 * <p>
0658:                 * Creates an instance of the Href Attribute of the XLink Schema. Sets
0659:                 * the usage to Optional.
0660:                 * </p>
0661:                 */
0662:                public Href() {
0663:                    use = Attribute.OPTIONAL;
0664:                }
0665:
0666:                /**
0667:                 * Returns a copy of the default instance.
0668:                 *
0669:                 * @return A default instance
0670:                 */
0671:                public static Attribute getInstance() {
0672:                    if (instance1 == null) {
0673:                        instance1 = new Href();
0674:                    }
0675:
0676:                    return instance1;
0677:                }
0678:
0679:                /*
0680:                 * (non-Javadoc)
0681:                 *
0682:                 * @see schema.Attribute#getFixed()
0683:                 */
0684:                public String getFixed() {
0685:                    return null;
0686:                }
0687:
0688:                /**
0689:                 * @see schema.Attribute#getName()
0690:                 */
0691:                public String getName() {
0692:                    return "href";
0693:                }
0694:
0695:                /**
0696:                 * @see schema.Attribute#getUse()
0697:                 */
0698:                public int getUse() {
0699:                    return use;
0700:                }
0701:
0702:                /**
0703:                 * @see schema.Attribute#getSimpleType()
0704:                 */
0705:                public SimpleType getSimpleType() {
0706:                    return XSISimpleTypes.AnyURI.getInstance();
0707:                }
0708:            }
0709:
0710:            public static class Role extends XLinkAttribute {
0711:                static Attribute instance1 = new Role();
0712:
0713:                public static Attribute getInstance() {
0714:                    return instance1;
0715:                }
0716:
0717:                /**
0718:                 * @see schema.Attribute#getFixed()
0719:                 */
0720:                public String getFixed() {
0721:                    return null;
0722:                }
0723:
0724:                /**
0725:                 * @see schema.Attribute#getName()
0726:                 */
0727:                public String getName() {
0728:                    return "role";
0729:                }
0730:
0731:                /**
0732:                 * @see schema.Attribute#getUse()
0733:                 */
0734:                public int getUse() {
0735:                    return Attribute.OPTIONAL;
0736:                }
0737:
0738:                /**
0739:                 * @see schema.Attribute#getSimpleType()
0740:                 */
0741:                public SimpleType getSimpleType() {
0742:                    return XSISimpleTypes.AnyURI.getInstance();
0743:                }
0744:            }
0745:
0746:            /**
0747:             * Arcrole represents an Arcrole attribute in the XLink Schema
0748:             *
0749:             * @author dzwiers
0750:             */
0751:            public static class Arcrole extends XLinkAttribute {
0752:                // the instance singleton
0753:                static Attribute instance1;
0754:
0755:                // returns the default instance
0756:                public static Attribute getInstance() {
0757:                    if (instance1 == null) {
0758:                        instance1 = new Arcrole();
0759:                    }
0760:
0761:                    return instance1;
0762:                }
0763:
0764:                /**
0765:                 * @see schema.Attribute#getFixed()
0766:                 */
0767:                public String getFixed() {
0768:                    return null;
0769:                }
0770:
0771:                /**
0772:                 * @see schema.Attribute#getName()
0773:                 */
0774:                public String getName() {
0775:                    return "arcrole";
0776:                }
0777:
0778:                /**
0779:                 * @see schema.Attribute#getUse()
0780:                 */
0781:                public int getUse() {
0782:                    return Attribute.OPTIONAL;
0783:                }
0784:
0785:                /**
0786:                 * @see schema.Attribute#getSimpleType()
0787:                 */
0788:                public SimpleType getSimpleType() {
0789:                    return XSISimpleTypes.AnyURI.getInstance();
0790:                }
0791:            }
0792:
0793:            /**
0794:             * Title represents a Title attribute in the XLink Schema
0795:             *
0796:             * @author dzwiers
0797:             */
0798:            public static class Title extends XLinkAttribute {
0799:                // the default singleton instance
0800:                static Attribute instance1;
0801:
0802:                /**
0803:                 * Returns the default singleton instance
0804:                 *
0805:                 */
0806:                public static Attribute getInstance() {
0807:                    if (instance1 == null) {
0808:                        instance1 = new Title();
0809:                    }
0810:
0811:                    return instance1;
0812:                }
0813:
0814:                /**
0815:                 * @see schema.Attribute#getFixed()
0816:                 */
0817:                public String getFixed() {
0818:                    return null;
0819:                }
0820:
0821:                /**
0822:                 * @see schema.Attribute#getName()
0823:                 */
0824:                public String getName() {
0825:                    return "title";
0826:                }
0827:
0828:                /**
0829:                 * @see schema.Attribute#getUse()
0830:                 */
0831:                public int getUse() {
0832:                    return Attribute.OPTIONAL;
0833:                }
0834:
0835:                /**
0836:                 * @see schema.Attribute#getSimpleType()
0837:                 */
0838:                public SimpleType getSimpleType() {
0839:                    return XSISimpleTypes.String.getInstance();
0840:                }
0841:            }
0842:
0843:            /**
0844:             * Show represents a Show attribute in the XLink Schema
0845:             *
0846:             * @author dzwiers
0847:             */
0848:            public static class Show extends XLinkAttribute {
0849:                // the singleton instance
0850:                static Attribute instance1;
0851:
0852:                // the asociated simpletype
0853:                private static SimpleType simpleType = new ShowSimpleType();
0854:
0855:                /**
0856:                 * Returns the singleton instance
0857:                 *
0858:                 */
0859:                public static Attribute getInstance() {
0860:                    return instance1;
0861:                }
0862:
0863:                /**
0864:                 * @see schema.Attribute#getFixed()
0865:                 */
0866:                public String getFixed() {
0867:                    return null;
0868:                }
0869:
0870:                /**
0871:                 * @see schema.Attribute#getName()
0872:                 */
0873:                public String getName() {
0874:                    return "show";
0875:                }
0876:
0877:                /**
0878:                 * @see schema.Attribute#getUse()
0879:                 */
0880:                public int getUse() {
0881:                    return Attribute.OPTIONAL;
0882:                }
0883:
0884:                /**
0885:                 * @see schema.Attribute#getSimpleType()
0886:                 */
0887:                public SimpleType getSimpleType() {
0888:                    return simpleType;
0889:                }
0890:            }
0891:
0892:            /**
0893:             * Actuate represents an Actuate attribute in the XLink Schema
0894:             *
0895:             * @author dzwiers
0896:             */
0897:            public static class Actuate extends XLinkAttribute {
0898:                // the singleton instance
0899:                static Attribute instance1;
0900:
0901:                // the simpletype for the attribute
0902:                private static SimpleType simpleType = new ActuateSimpleType();
0903:
0904:                /**
0905:                 * Return a singleton of an Actuate
0906:                 *
0907:                 */
0908:                public static Attribute getInstance() {
0909:                    if (instance1 == null) {
0910:                        instance1 = new Actuate();
0911:                    }
0912:
0913:                    return instance1;
0914:                }
0915:
0916:                /**
0917:                 * @see schema.Attribute#getFixed()
0918:                 */
0919:                public String getFixed() {
0920:                    return null;
0921:                }
0922:
0923:                /**
0924:                 * @see schema.Attribute#getName()
0925:                 */
0926:                public String getName() {
0927:                    return "actuate";
0928:                }
0929:
0930:                /**
0931:                 * @see schema.Attribute#getUse()
0932:                 */
0933:                public int getUse() {
0934:                    return Attribute.OPTIONAL;
0935:                }
0936:
0937:                /**
0938:                 * @see schema.Attribute#getSimpleType()
0939:                 */
0940:                public SimpleType getSimpleType() {
0941:                    return simpleType;
0942:                }
0943:            }
0944:
0945:            /**
0946:             * Label represents a Label attribute in the XLink Schema
0947:             *
0948:             * @author dzwiers
0949:             */
0950:            public static class Label extends XLinkAttribute {
0951:                // the singleton instance
0952:                static Attribute instance1;
0953:
0954:                /**
0955:                 * Returns a singleton of Label
0956:                 *
0957:                 */
0958:                public static Attribute getInstance() {
0959:                    return instance1;
0960:                }
0961:
0962:                /**
0963:                 * @see schema.Attribute#getFixed()
0964:                 */
0965:                public String getFixed() {
0966:                    return null;
0967:                }
0968:
0969:                /**
0970:                 * @see schema.Attribute#getName()
0971:                 */
0972:                public String getName() {
0973:                    return "label";
0974:                }
0975:
0976:                /**
0977:                 * @see schema.Attribute#getUse()
0978:                 */
0979:                public int getUse() {
0980:                    return Attribute.OPTIONAL;
0981:                }
0982:
0983:                /**
0984:                 * @see schema.Attribute#getSimpleType()
0985:                 */
0986:                public SimpleType getSimpleType() {
0987:                    return XSISimpleTypes.String.getInstance();
0988:                }
0989:            }
0990:
0991:            /**
0992:             * From represents a From attribute in the XLink Schema
0993:             *
0994:             * @author dzwiers
0995:             */
0996:            public static class From extends XLinkAttribute {
0997:                // the singleton instance
0998:                static Attribute instance1;
0999:
1000:                /**
1001:                 * Returns the singleton From instance
1002:                 *
1003:                 */
1004:                public static Attribute getInstance() {
1005:                    if (instance1 == null) {
1006:                        instance1 = new From();
1007:                    }
1008:
1009:                    return instance1;
1010:                }
1011:
1012:                /**
1013:                 * @see schema.Attribute#getFixed()
1014:                 */
1015:                public String getFixed() {
1016:                    return null;
1017:                }
1018:
1019:                /**
1020:                 * @see schema.Attribute#getName()
1021:                 */
1022:                public String getName() {
1023:                    return "from";
1024:                }
1025:
1026:                /**
1027:                 * @see schema.Attribute#getUse()
1028:                 */
1029:                public int getUse() {
1030:                    return Attribute.OPTIONAL;
1031:                }
1032:
1033:                /**
1034:                 * @see schema.Attribute#getSimpleType()
1035:                 */
1036:                public SimpleType getSimpleType() {
1037:                    return XSISimpleTypes.String.getInstance();
1038:                }
1039:            }
1040:
1041:            /**
1042:             * To represents a To attribute in the XLink Schema
1043:             *
1044:             * @author dzwiers
1045:             */
1046:            public static class To extends XLinkAttribute {
1047:                // the static instance
1048:                static Attribute instance1;
1049:
1050:                /**
1051:                 * Returns the singleton To instance
1052:                 *
1053:                 */
1054:                public static Attribute getInstance() {
1055:                    if (instance1 == null) {
1056:                        instance1 = new To();
1057:                    }
1058:
1059:                    return instance1;
1060:                }
1061:
1062:                /**
1063:                 * @see schema.Attribute#getFixed()
1064:                 */
1065:                public String getFixed() {
1066:                    return null;
1067:                }
1068:
1069:                /**
1070:                 * @see schema.Attribute#getName()
1071:                 */
1072:                public String getName() {
1073:                    return "to";
1074:                }
1075:
1076:                /**
1077:                 * @see schema.Attribute#getUse()
1078:                 */
1079:                public int getUse() {
1080:                    return Attribute.OPTIONAL;
1081:                }
1082:
1083:                /**
1084:                 * @see schema.Attribute#getSimpleType()
1085:                 */
1086:                public SimpleType getSimpleType() {
1087:                    return XSISimpleTypes.String.getInstance();
1088:                }
1089:            }
1090:
1091:            /**
1092:             * Type represents a Type attribute in the XLink Schema
1093:             *
1094:             * @author dzwiers
1095:             */
1096:            private static class Type extends XLinkAttribute {
1097:                // the fixed value of this type
1098:                private final String fixed;
1099:
1100:                /**
1101:                 * Creates a Type attribute with the specified fixed value.
1102:                 *
1103:                 * @param fixed The fixed value.
1104:                 */
1105:                public Type(String fixed) {
1106:                    this .fixed = fixed;
1107:                }
1108:
1109:                /**
1110:                 * @see schema.Attribute#getFixed()
1111:                 */
1112:                public String getFixed() {
1113:                    return fixed;
1114:                }
1115:
1116:                /**
1117:                 * @see schema.Attribute#getName()
1118:                 */
1119:                public String getName() {
1120:                    return "type";
1121:                }
1122:
1123:                /**
1124:                 * @see schema.Attribute#getUse()
1125:                 */
1126:                public int getUse() {
1127:                    return Attribute.REQUIRED;
1128:                }
1129:
1130:                /**
1131:                 * @see schema.Attribute#getSimpleType()
1132:                 */
1133:                public SimpleType getSimpleType() {
1134:                    return XSISimpleTypes.String.getInstance();
1135:                }
1136:            }
1137:
1138:            /**
1139:             * XLinkAttributeGroup purpose.
1140:             * 
1141:             * <p>
1142:             * Used to define some constant values for XLink attributeGroups, such as
1143:             * Namespace
1144:             * </p>
1145:             *
1146:             * @author dzwiers, Refractions Research, Inc. http://www.refractions.net
1147:             * @author $Author:$ (last modification)
1148:             * @version $Id: XLinkSchema.java 22347 2006-10-24 01:57:23Z jdeolive $
1149:             */
1150:            protected abstract static class XLinkAttributeGroup implements 
1151:                    AttributeGroup {
1152:                /**
1153:                 * @see schema.AttributeGroup#getNameSpace()
1154:                 */
1155:                public URI getNamespace() {
1156:                    return XLinkSchema.NAMESPACE;
1157:                }
1158:
1159:                /**
1160:                 * @see schema.AttributeGroup#getAnyAttributeNameSpace()
1161:                 */
1162:                public String getAnyAttributeNameSpace() {
1163:                    return null;
1164:                }
1165:
1166:                /**
1167:                 * @see schema.AttributeGroup#getId()
1168:                 */
1169:                public String getId() {
1170:                    return null;
1171:                }
1172:            }
1173:
1174:            /**
1175:             * SimpleLink represents a SimpleLink AttributeGroup in the XLink Schema
1176:             *
1177:             * @author dzwiers
1178:             */
1179:            public static class SimpleLink extends XLinkAttributeGroup {
1180:                // the singleton instance
1181:                private static AttributeGroup instance1;
1182:
1183:                // the static attribute list
1184:                private static final Attribute[] attributes1 = {
1185:                        Href.instance1, Role.instance1, Arcrole.instance1,
1186:                        Title.instance1, Show.instance1, Actuate.instance1, };
1187:
1188:                /**
1189:                 * @see schema.AttributeGroup#getAttributes()
1190:                 */
1191:                public Attribute[] getAttributes() {
1192:                    return attributes1;
1193:                }
1194:
1195:                /**
1196:                 * @see schema.AttributeGroup#getName()
1197:                 */
1198:                public String getName() {
1199:                    return "simpleLink";
1200:                }
1201:
1202:                /**
1203:                 * Returns the singleton SimpleLink instance
1204:                 *
1205:                 */
1206:                public static AttributeGroup getInstance() {
1207:                    if (instance1 == null) {
1208:                        instance1 = new SimpleLink();
1209:                    }
1210:
1211:                    return instance1;
1212:                }
1213:            }
1214:
1215:            /**
1216:             * ExtendedLink represents a ExtendedLink AttributeGroup in the XLink
1217:             * Schema
1218:             *
1219:             * @author dzwiers
1220:             */
1221:            public static class ExtendedLink extends XLinkAttributeGroup {
1222:                // the singleton instance
1223:                private static AttributeGroup instance1;
1224:
1225:                // the list of static attributes
1226:                private static final Attribute[] attributes1 = {
1227:                        Role.instance1, Title.instance1, };
1228:
1229:                /**
1230:                 * @see schema.AttributeGroup#getAttributes()
1231:                 */
1232:                public Attribute[] getAttributes() {
1233:                    return attributes1;
1234:                }
1235:
1236:                /**
1237:                 * @see schema.AttributeGroup#getName()
1238:                 */
1239:                public String getName() {
1240:                    return "extendedLink";
1241:                }
1242:
1243:                /**
1244:                 * Returns the singleton ExtendedLink instance
1245:                 *
1246:                 */
1247:                public static AttributeGroup getInstance() {
1248:                    if (instance1 == null) {
1249:                        instance1 = new ExtendedLink();
1250:                    }
1251:
1252:                    return instance1;
1253:                }
1254:            }
1255:
1256:            /**
1257:             * LocatorLink represents a LocatorLink AttributeGroup in the XLink Schema
1258:             *
1259:             * @author dzwiers
1260:             */
1261:            public static class LocatorLink extends XLinkAttributeGroup {
1262:                // the singleton instance
1263:                private static AttributeGroup instance1;
1264:
1265:                // the static attribute list
1266:                private static final Attribute[] attributes1 = {
1267:                        new Type("extended"), new Href(Attribute.REQUIRED),
1268:                        Role.instance1, Title.instance1, Label.instance1 };
1269:
1270:                /**
1271:                 * @see schema.AttributeGroup#getAttributes()
1272:                 */
1273:                public Attribute[] getAttributes() {
1274:                    return attributes1;
1275:                }
1276:
1277:                /**
1278:                 * @see schema.AttributeGroup#getName()
1279:                 */
1280:                public String getName() {
1281:                    return "locatorLink";
1282:                }
1283:
1284:                /**
1285:                 * Returns the singleton LocatorLink instance
1286:                 *
1287:                 */
1288:                public static AttributeGroup getInstance() {
1289:                    if (instance1 == null) {
1290:                        instance1 = new LocatorLink();
1291:                    }
1292:
1293:                    return instance1;
1294:                }
1295:            }
1296:
1297:            /**
1298:             * ArcLink represents a ArcLink AttributeGroup in the XLink Schema
1299:             *
1300:             * @author dzwiers
1301:             */
1302:            public static class ArcLink extends XLinkAttributeGroup {
1303:                // the singleton instance
1304:                private static AttributeGroup instance1;
1305:
1306:                //	the static attribute list
1307:                private static final Attribute[] attributes1 = {
1308:                        new Type("arc"), Arcrole.instance1, Title.instance1,
1309:                        Show.instance1, Actuate.instance1, From.instance1,
1310:                        To.instance1, };
1311:
1312:                /**
1313:                 * @see schema.AttributeGroup#getAttributes()
1314:                 */
1315:                public Attribute[] getAttributes() {
1316:                    return attributes1;
1317:                }
1318:
1319:                /**
1320:                 * @see schema.AttributeGroup#getName()
1321:                 */
1322:                public String getName() {
1323:                    return "arcLink";
1324:                }
1325:
1326:                /**
1327:                 * Returns the singleton ArcLink instance
1328:                 *
1329:                 */
1330:                public static AttributeGroup getInstance() {
1331:                    if (instance1 == null) {
1332:                        instance1 = new ArcLink();
1333:                    }
1334:
1335:                    return instance1;
1336:                }
1337:            }
1338:
1339:            /**
1340:             * ResourceLink represents a ResourceLink AttributeGroup in the XLink
1341:             * Schema
1342:             *
1343:             * @author dzwiers
1344:             */
1345:            public static class ResourceLink extends XLinkAttributeGroup {
1346:                // the singleton instance
1347:                private static AttributeGroup instance1;
1348:
1349:                // the static attribute list
1350:                private static final Attribute[] attributes1 = {
1351:                        new Type("resource"), Role.instance1, Title.instance1,
1352:                        Label.instance1, };
1353:
1354:                /**
1355:                 * @see schema.AttributeGroup#getAttributes()
1356:                 */
1357:                public Attribute[] getAttributes() {
1358:                    return attributes1;
1359:                }
1360:
1361:                /**
1362:                 * @see schema.AttributeGroup#getName()
1363:                 */
1364:                public String getName() {
1365:                    return "resourceLink";
1366:                }
1367:
1368:                /**
1369:                 * Returns the singleton ResourceLink instance
1370:                 *
1371:                 */
1372:                public static AttributeGroup getInstance() {
1373:                    if (instance1 == null) {
1374:                        instance1 = new ResourceLink();
1375:                    }
1376:
1377:                    return instance1;
1378:                }
1379:            }
1380:
1381:            /**
1382:             * TitleLink represents a TitleLink AttributeGroup in the XLink Schema
1383:             *
1384:             * @author dzwiers
1385:             */
1386:            public static class TitleLink extends XLinkAttributeGroup {
1387:                // the singleton instance
1388:                private static AttributeGroup instance1;
1389:
1390:                // the static attribute list
1391:                static final Attribute[] attributes1 = { new Type("title"), };
1392:
1393:                /**
1394:                 * @see schema.AttributeGroup#getAttributes()
1395:                 */
1396:                public Attribute[] getAttributes() {
1397:                    return attributes1;
1398:                }
1399:
1400:                /**
1401:                 * @see schema.AttributeGroup#getName()
1402:                 */
1403:                public String getName() {
1404:                    return "titleLink";
1405:                }
1406:
1407:                /**
1408:                 * Returns the singleton TitleLink instance
1409:                 *
1410:                 */
1411:                public static AttributeGroup getInstance() {
1412:                    if (instance1 == null) {
1413:                        instance1 = new TitleLink();
1414:                    }
1415:
1416:                    return instance1;
1417:                }
1418:            }
1419:
1420:            /**
1421:             * EmptyLink represents a EmptyLink AttributeGroup in the XLink Schema
1422:             *
1423:             * @author dzwiers
1424:             */
1425:            public static class EmptyLink extends XLinkAttributeGroup {
1426:                // the singleton instance
1427:                private static AttributeGroup instance1;
1428:
1429:                // the static attribute list
1430:                static final Attribute[] attributes1 = { new Type("empty"), };
1431:
1432:                /**
1433:                 * @see schema.AttributeGroup#getAttributes()
1434:                 */
1435:                public Attribute[] getAttributes() {
1436:                    return attributes1;
1437:                }
1438:
1439:                /**
1440:                 * @see schema.AttributeGroup#getName()
1441:                 */
1442:                public String getName() {
1443:                    return "emptyLink";
1444:                }
1445:
1446:                /**
1447:                 * Returns the singleton EmptyLink instance
1448:                 *
1449:                 */
1450:                public static AttributeGroup getInstance() {
1451:                    if (instance1 == null) {
1452:                        instance1 = new EmptyLink();
1453:                    }
1454:
1455:                    return instance1;
1456:                }
1457:            }
1458:
1459:            /**
1460:             * Returns the implementation hints. The default implementation returns en empty map.
1461:             */
1462:            public Map getImplementationHints() {
1463:                return Collections.EMPTY_MAP;
1464:            }
1465:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.