Source Code Cross Referenced for IEPModelProviderInsideIde.java in  » IDE-Netbeans » iep.editor » org » netbeans » modules » iep » model » common » 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 » iep.editor » org.netbeans.modules.iep.model.common 
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.iep.model.common;
020:
021:        import java.io.File;
022:        import java.io.FileInputStream;
023:        import java.net.URI;
024:        import java.util.logging.Logger;
025:
026:        import org.netbeans.editor.BaseDocument;
027:        import org.netbeans.modules.iep.model.IEPModel;
028:        import org.netbeans.modules.iep.model.IEPModelFactory;
029:        import org.netbeans.modules.xml.retriever.catalog.impl.CatalogWriteModelImpl;
030:        import org.netbeans.modules.xml.xam.ModelSource;
031:        import org.netbeans.modules.xml.xam.locator.CatalogModel;
032:        import org.netbeans.modules.xml.xam.locator.CatalogModelException;
033:        import org.openide.filesystems.FileObject;
034:        import org.openide.filesystems.FileUtil;
035:        import org.openide.loaders.DataObject;
036:        import org.openide.loaders.DataObjectNotFoundException;
037:        import org.openide.util.Lookup;
038:        import org.openide.util.lookup.Lookups;
039:
040:        /**
041:         *
042:         * @author radval
043:         */
044:        public class IEPModelProviderInsideIde extends CatalogWriteModelImpl
045:                implements  IEPModelProvider {
046:
047:            /** Creates a new instance of BPELModelProviderInsideIde */
048:            public IEPModelProviderInsideIde() {
049:            }
050:
051:            public IEPModel getWLMModel(URI locationURI) throws Exception {
052:                System.out.println(toString() + " :" + locationURI);
053:                ModelSource source = getModelSource(locationURI);
054:                IEPModel model = IEPModelFactory.getDefault().getModel(source);
055:                //        model.sync();
056:                return model;
057:            }
058:
059:            public ModelSource getModelSource(URI locationURI)
060:                    throws CatalogModelException {
061:                File file = new File(locationURI);
062:                FileObject this FileObj = FileUtil.toFileObject(file);
063:                return createModelSource(this FileObj, true);
064:            }
065:
066:            public ModelSource getModelSource(URI locationURI,
067:                    ModelSource modelSourceOfSourceDocument)
068:                    throws CatalogModelException {
069:                if (locationURI == null) {
070:                    return null;
071:                }
072:
073:                URI resolvedURI = locationURI;
074:
075:                if (modelSourceOfSourceDocument != null) {
076:                    FileObject sFileObj = (FileObject) modelSourceOfSourceDocument
077:                            .getLookup().lookup(FileObject.class);
078:                    if (sFileObj != null) {
079:                        File sFile = FileUtil.toFile(sFileObj);
080:                        if (sFile != null) {
081:                            URI sURI = sFile.toURI();
082:                            resolvedURI = sURI.resolve(locationURI);
083:                        }
084:                    }
085:                }
086:
087:                if (resolvedURI != null) {
088:                    return getModelSource(resolvedURI);
089:                }
090:
091:                return null;
092:            }
093:
094:            protected BaseDocument getDocument(FileObject fo) {
095:                BaseDocument result = null;
096:
097:                try {
098:
099:                    File file = FileUtil.toFile(fo);
100:                    FileInputStream fis = new FileInputStream(file);
101:                    byte buffer[] = new byte[fis.available()];
102:                    result = new org.netbeans.editor.BaseDocument(
103:                            org.netbeans.modules.xml.text.syntax.XMLKit.class,
104:                            false);
105:                    //            result = new javax.swing.text.PlainDocument();
106:                    result.remove(0, result.getLength());
107:                    fis.read(buffer);
108:                    fis.close();
109:                    String str = new String(buffer);
110:                    result.insertString(0, str, null);
111:
112:                } catch (Exception dObjEx) {
113:                    return null;
114:                }
115:
116:                return result;
117:            }
118:
119:            protected CatalogModel createCatalogModel(FileObject fo)
120:                    throws CatalogModelException {
121:                return this ;
122:            }
123:
124:            public ModelSource createModelSource(FileObject this FileObj,
125:                    boolean editable) throws CatalogModelException {
126:                assert this FileObj != null : "Null file object.";
127:                final DataObject dobj;
128:                try {
129:                    dobj = DataObject.find(this FileObj);
130:                } catch (DataObjectNotFoundException ex) {
131:                    throw new CatalogModelException(ex);
132:                }
133:                Lookup proxyLookup = Lookups.proxy(new Lookup.Provider() {
134:                    public Lookup getLookup() {
135:                        Logger l = Logger.getLogger(getClass().getName());
136:                        BaseDocument document = getDocument(dobj
137:                                .getPrimaryFile());
138:                        return Lookups.fixed(new Object[] {
139:
140:                        dobj.getPrimaryFile(), document, dobj,
141:                                IEPModelProviderInsideIde.this 
142:
143:                        });
144:                    }
145:                }
146:
147:                );
148:                return new ModelSource(proxyLookup, editable);
149:            }
150:
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.