Source Code Cross Referenced for AbstractTransformationDesc.java in  » IDE-Netbeans » xml » org » netbeans » modules » xslt » tmap » model » xsltmap » 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 » IDE Netbeans » xml » org.netbeans.modules.xslt.tmap.model.xsltmap 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         * 
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:         * 
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         * 
015:         * The Original Software is NetBeans. The Initial Developer of the Original
016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017:         * Microsystems, Inc. All Rights Reserved.
018:         */
019:        package org.netbeans.modules.xslt.tmap.model.xsltmap;
020:
021:        import java.util.Collection;
022:        import org.netbeans.modules.soa.ui.axinodes.AxiomUtils;
023:        import org.netbeans.modules.xml.axi.AXIComponent;
024:        import org.netbeans.modules.xml.axi.AXIDocument;
025:        import org.netbeans.modules.xml.axi.AXIModel;
026:        import org.netbeans.modules.xml.axi.AXIModelFactory;
027:        import org.netbeans.modules.xml.schema.model.ReferenceableSchemaComponent;
028:        import org.netbeans.modules.xml.schema.model.SchemaModel;
029:        import org.netbeans.modules.xml.wsdl.model.Message;
030:        import org.netbeans.modules.xml.wsdl.model.Operation;
031:        import org.netbeans.modules.xml.wsdl.model.Part;
032:        import org.netbeans.modules.xml.wsdl.model.WSDLModel;
033:        import org.netbeans.modules.xml.xam.dom.NamedComponentReference;
034:        import org.netbeans.modules.xslt.tmap.util.Util;
035:        import org.openide.filesystems.FileObject;
036:
037:        /**
038:         *
039:         * @author Vitaly Bychkov
040:         * @version 1.0
041:         */
042:        public abstract class AbstractTransformationDesc implements 
043:                TransformationDesc {
044:            private String partnerLink;
045:            private String roleName;
046:            private String portType;
047:            private String operation;
048:            private String messageType;
049:            private String file;
050:            private boolean transformJBI;
051:            private TransformationUC parentTUC;
052:            private XsltMapModel model;
053:
054:            public AbstractTransformationDesc(XsltMapModel model,
055:                    TransformationUC parent) {
056:                this .parentTUC = parent;
057:                this .model = model;
058:                parentTUC.addTransformationDesc(this );
059:            }
060:
061:            public XsltMapModel getXsltMapModel() {
062:                return model;
063:            }
064:
065:            public TransformationUC getParent() {
066:                return parentTUC;
067:            }
068:
069:            public XsltMapModel getModel() {
070:                return model;
071:            }
072:
073:            public String getPartnerLink() {
074:                return partnerLink;
075:            }
076:
077:            public void setPartnerLink(String partnerLink) {
078:                this .partnerLink = partnerLink;
079:            }
080:
081:            public String getRoleName() {
082:                return roleName;
083:            }
084:
085:            public void setRoleName(String roleName) {
086:                this .roleName = roleName;
087:            }
088:
089:            public String getPortType() {
090:                return portType;
091:            }
092:
093:            public void setPortType(String portType) {
094:                this .portType = portType;
095:            }
096:
097:            public void setOperation(String operation) {
098:                this .operation = operation;
099:            }
100:
101:            public String getOperation() {
102:                return operation;
103:            }
104:
105:            public String getMessageType() {
106:                return messageType;
107:            }
108:
109:            public void setMessageType(String messageType) {
110:                this .messageType = messageType;
111:            }
112:
113:            public String getFile() {
114:                return file;
115:            }
116:
117:            public void setFile(String file) {
118:                this .file = file;
119:            }
120:
121:            public String getTransformJBI() {
122:                return Boolean.toString(transformJBI);
123:            }
124:
125:            public void setTransformJBI(boolean transformJBI) {
126:                this .transformJBI = transformJBI;
127:            }
128:
129:            public void setTransformJBI(String transformJBI) {
130:                this .transformJBI = "true".equals(transformJBI);
131:            }
132:
133:            public boolean isTransformJBI() {
134:                return transformJBI;
135:            }
136:
137:            public boolean isEqualInputFile(FileObject xsltFile) {
138:                String inputFile = getFile();
139:                return inputFile != null && xsltFile != null
140:                        && inputFile.equals(xsltFile.getNameExt());
141:            }
142:
143:            public AXIModel getSourceAxiModel(FileObject projectRoot) {
144:                assert projectRoot != null;
145:                AXIModel axiSourceModel = null;
146:                SchemaModel sourceSchema = getSourceSchema(projectRoot);
147:                if (sourceSchema != null) {
148:                    axiSourceModel = AXIModelFactory.getDefault().getModel(
149:                            sourceSchema);
150:                }
151:
152:                return axiSourceModel;
153:            }
154:
155:            public SchemaModel getSourceSchema(FileObject projectRoot) {
156:                if (isTransformJBI()) {
157:                    return getJBISourceSchema();
158:                }
159:
160:                assert projectRoot != null;
161:                SchemaModel sourceSchema = null;
162:                Operation operation = Util.findWsdlOperation(projectRoot, this );
163:                if (operation != null) {
164:                    org.netbeans.modules.xml.wsdl.model.Input wsdlInput = operation
165:                            .getInput();
166:                    NamedComponentReference<Message> message = wsdlInput
167:                            .getMessage();
168:                    if (message == null) {
169:                        return null;
170:                    }
171:
172:                    sourceSchema = getMessageSchemaModel(operation.getModel(),
173:                            message);
174:                }
175:                return sourceSchema;
176:            }
177:
178:            public ReferenceableSchemaComponent getSourceType(
179:                    FileObject projectRoot) {
180:                if (isTransformJBI()) {
181:                    return null;
182:                }
183:
184:                assert projectRoot != null;
185:                ReferenceableSchemaComponent sourceSchemaComponent = null;
186:                Operation operation = Util.findWsdlOperation(projectRoot, this );
187:                if (operation != null) {
188:                    org.netbeans.modules.xml.wsdl.model.Input wsdlInput = operation
189:                            .getInput();
190:                    NamedComponentReference<Message> message = wsdlInput
191:                            .getMessage();
192:                    if (message == null) {
193:                        return null;
194:                    }
195:
196:                    sourceSchemaComponent = getMessageSchemaType(operation
197:                            .getModel(), message);
198:                }
199:
200:                return sourceSchemaComponent;
201:            }
202:
203:            public AXIComponent getPltSourceAXIType(FileObject projectRoot) {
204:                assert projectRoot != null;
205:                return getAXIComponent(getSourceType(projectRoot));
206:            }
207:
208:            private SchemaModel getJBISourceSchema() {
209:                // TODO impl it
210:                return null;
211:            }
212:
213:            private SchemaModel getJBITargetSchema() {
214:                // TODO impl it
215:                return null;
216:            }
217:
218:            /**
219:             * returns first message part element/type schema model
220:             */
221:            private SchemaModel getMessageSchemaModel(WSDLModel wsdlModel,
222:                    NamedComponentReference<Message> message) {
223:                if (wsdlModel == null || message == null) {
224:                    return null;
225:                }
226:                SchemaModel schemaModel = null;
227:
228:                // look at parts
229:                String elNamespace = null;
230:                Class<? extends ReferenceableSchemaComponent> elType = null;
231:                Collection<Part> parts = message.get().getParts();
232:                Part partElem = null;
233:                if (parts != null && parts.size() > 0) {
234:                    partElem = parts.iterator().next();
235:                }
236:
237:                NamedComponentReference<? extends ReferenceableSchemaComponent> element = partElem
238:                        .getElement();
239:                if (element == null) {
240:                    element = partElem.getType();
241:                }
242:
243:                if (element != null && element.get() != null) {
244:                    schemaModel = element.get().getModel();
245:                }
246:
247:                return schemaModel;
248:            }
249:
250:            /**
251:             * returns first message part type 
252:             */
253:            private ReferenceableSchemaComponent getMessageSchemaType(
254:                    WSDLModel wsdlModel,
255:                    NamedComponentReference<Message> message) {
256:                if (wsdlModel == null || message == null) {
257:                    return null;
258:                }
259:                ReferenceableSchemaComponent schemaComponent = null;
260:
261:                // look at parts
262:                String elNamespace = null;
263:                Class<? extends ReferenceableSchemaComponent> elType = null;
264:                Collection<Part> parts = message.get().getParts();
265:                Part partElem = null;
266:                if (parts != null && parts.size() > 0) {
267:                    partElem = parts.iterator().next();
268:                }
269:
270:                NamedComponentReference<? extends ReferenceableSchemaComponent> element = partElem
271:                        .getElement();
272:                if (element == null) {
273:                    element = partElem.getType();
274:                }
275:
276:                // TODO r
277:                //        if (equalMessageType(element)) {
278:                //            schemaComponent = element.get();
279:                //        }
280:                schemaComponent = element.get();
281:
282:                return schemaComponent;
283:            }
284:
285:            private boolean equalMessageType(
286:                    NamedComponentReference<? extends ReferenceableSchemaComponent> element) {
287:                String curMessageType = getMessageType();
288:                if (curMessageType == null || element == null) {
289:                    return false;
290:                }
291:
292:                return curMessageType.equals(element.getRefString());
293:            }
294:
295:            public ReferenceableSchemaComponent getTargetType(
296:                    FileObject projectRoot) {
297:                if (isTransformJBI()) {
298:                    return null;
299:                }
300:
301:                assert projectRoot != null;
302:                ReferenceableSchemaComponent targetSchemaComponent = null;
303:                Operation operation = Util.findWsdlOperation(projectRoot, this );
304:                if (operation != null) {
305:                    org.netbeans.modules.xml.wsdl.model.Output wsdlOutput = operation
306:                            .getOutput();
307:                    NamedComponentReference<Message> message = wsdlOutput
308:                            .getMessage();
309:                    if (message == null) {
310:                        return null;
311:                    }
312:
313:                    targetSchemaComponent = getMessageSchemaType(operation
314:                            .getModel(), message);
315:                }
316:                return targetSchemaComponent;
317:            }
318:
319:            private AXIComponent getAXIComponent(
320:                    ReferenceableSchemaComponent schemaComponent) {
321:                if (schemaComponent == null) {
322:                    return null;
323:                }
324:                AXIComponent axiComponent = null;
325:
326:                AXIModel axiModel = AXIModelFactory.getDefault().getModel(
327:                        schemaComponent.getModel());
328:                if (axiModel != null) {
329:                    axiComponent = AxiomUtils.findGlobalComponent(axiModel
330:                            .getRoot(), null, schemaComponent);
331:                }
332:
333:                return axiComponent;
334:            }
335:
336:            public AXIComponent getPltTargetAXIType(FileObject projectRoot) {
337:                assert projectRoot != null;
338:                return getAXIComponent(getTargetType(projectRoot));
339:            }
340:
341:            public SchemaModel getTargetSchema(FileObject projectRoot) {
342:                if (isTransformJBI()) {
343:                    return getJBITargetSchema();
344:                }
345:
346:                assert projectRoot != null;
347:                SchemaModel targetSchema = null;
348:                Operation operation = Util.findWsdlOperation(projectRoot, this );
349:                if (operation != null) {
350:                    org.netbeans.modules.xml.wsdl.model.Output wsdlOutput = operation
351:                            .getOutput();
352:                    if (wsdlOutput != null) {
353:                        NamedComponentReference<Message> message = wsdlOutput
354:                                .getMessage();
355:                        if (message == null) {
356:                            return null;
357:                        }
358:
359:                        targetSchema = getMessageSchemaModel(operation
360:                                .getModel(), message);
361:                    }
362:                }
363:                return targetSchema;
364:            }
365:
366:            public AXIModel getTargetAxiModel(FileObject projectRoot) {
367:                assert projectRoot != null;
368:                AXIModel axiTargetModel = null;
369:                SchemaModel targetSchema = getTargetSchema(projectRoot);
370:                if (targetSchema != null) {
371:                    axiTargetModel = AXIModelFactory.getDefault().getModel(
372:                            targetSchema);
373:                }
374:
375:                return axiTargetModel;
376:            }
377:        }
w___ww.j__a_v_a___2_s__.___c_o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.