Source Code Cross Referenced for ArchiveBean.java in  » Web-Services-AXIS2 » tools » org » apache » ideaplugin » bean » 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 » Web Services AXIS2 » tools » org.apache.ideaplugin.bean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */
019:        package org.apache.ideaplugin.bean;
020:
021:        import java.io.File;
022:        import java.io.FileNotFoundException;
023:        import java.io.FileWriter;
024:        import java.io.IOException;
025:        import java.util.ArrayList;
026:        import java.util.Calendar;
027:
028:        /**
029:         * Author: Deepal Jayasinghe
030:         * Date: Sep 17, 2005
031:         * Time: 11:40:40 PM
032:         */
033:        public class ArchiveBean {
034:
035:            private boolean singleService = false;
036:            private boolean generetServiceDesc = false;
037:            private ArrayList classLocation = new ArrayList();
038:            private File classLoc;
039:            private ClassLoader classLoader;
040:            private String ServiceXML;
041:            public String fileSeparator = System.getProperty("file.separator");
042:            private ArrayList libs = new ArrayList();
043:            private ArrayList tempLibs = new ArrayList();
044:            private ArrayList tempWsdls = new ArrayList();
045:            private ArrayList wsdls = new ArrayList();
046:            private String outPath;
047:            private String archiveName;
048:            private ArrayList servicelsit = new ArrayList();
049:            private boolean includeClass = false;
050:
051:            public ArrayList getTempWsdls() {
052:                return tempWsdls;
053:            }
054:
055:            public void setTempWsdls(ArrayList tempWsdls) {
056:                this .tempWsdls = tempWsdls;
057:            }
058:
059:            public ArrayList getTempLibs() {
060:                return tempLibs;
061:            }
062:
063:            public void setTempLibs(ArrayList tempLibs) {
064:                this .tempLibs = tempLibs;
065:            }
066:
067:            public File getClassLoc() {
068:                return classLoc;
069:            }
070:
071:            public void setClassLoc(File classLoc) {
072:                this .classLoc = classLoc;
073:            }
074:
075:            public ArrayList getServicelsit() {
076:                return servicelsit;
077:            }
078:
079:            public void addToServicelsit(ServiceObj service) {
080:                for (int count = 0; count < servicelsit.size(); count++) {
081:                    if (((ServiceObj) servicelsit.get(count)).getServiceName()
082:                            .equalsIgnoreCase(service.getServiceName())) {
083:                        servicelsit.remove(count);
084:                        servicelsit.add(service);
085:                        return;
086:                    }
087:
088:                }
089:                servicelsit.add(service);
090:            }
091:
092:            public boolean isSingleService() {
093:                return singleService;
094:            }
095:
096:            public void setSingleService(boolean singleService) {
097:                this .singleService = singleService;
098:            }
099:
100:            public boolean isGeneretServiceDesc() {
101:                return generetServiceDesc;
102:            }
103:
104:            public void setGeneretServiceDesc(boolean generetServiceDesc) {
105:                this .generetServiceDesc = generetServiceDesc;
106:            }
107:
108:            public ArrayList getClassLocation() {
109:                return classLocation;
110:            }
111:
112:            public void addClassLocation(File classLocation) {
113:                this .classLocation.add(classLocation);
114:            }
115:
116:            public String getServiceXML() {
117:                return ServiceXML;
118:            }
119:
120:            public void setServiceXML(String serviceXML) {
121:                ServiceXML = serviceXML;
122:            }
123:
124:            public ArrayList getLibs() {
125:                return libs;
126:            }
127:
128:            public void addLibs(ArrayList libs) {
129:                this .libs.addAll(libs);
130:            }
131:
132:            public ArrayList getWsdls() {
133:                return wsdls;
134:            }
135:
136:            public void addWsdls(File wsdl) {
137:                this .wsdls.add(wsdl);
138:            }
139:
140:            public String getOutPath() {
141:                return outPath;
142:            }
143:
144:            public void setOutPath(String outPath) {
145:                this .outPath = outPath;
146:            }
147:
148:            public String getArchiveName() {
149:                return archiveName;
150:            }
151:
152:            public void setArchiveName(String archiveName) {
153:                this .archiveName = archiveName;
154:            }
155:
156:            public void setIncludeClass(boolean includeClass) {
157:                this .includeClass = includeClass;
158:            }
159:
160:            public boolean getIncludeClass() {
161:                return this .includeClass;
162:            }
163:
164:            public void finsh() throws Exception {
165:                //Creating out File
166:                try {
167:                    File outFile = new File(getOutPath());
168:                    String time = Calendar.getInstance().getTime().toString()
169:                            .replace(':', '-');
170:                    File tempfile = new File(outFile, "temp-" + time);
171:                    tempfile.mkdir();
172:                    //creating META-INF
173:                    File metainf = new File(tempfile, "META-INF");
174:                    if (!metainf.exists()) {
175:                        metainf.mkdir();
176:                    }
177:
178:                    // Writing services.xml
179:                    File servicexml = new File(metainf, "services.xml");
180:                    FileWriter writer = new FileWriter(servicexml);
181:                    writer.write(getServiceXML());
182:                    writer.flush();
183:                    writer.close();
184:
185:                    //Coping class files
186:                    FileCopier fc = new FileCopier();
187:                    if (includeClass) {
188:                        for (int count = 0; count < classLocation.size(); count++)
189:                            fc.copyFiles((File) classLocation.get(count),
190:                                    tempfile, ".class");
191:                    } else {
192:                        for (int count = 0; count < classLocation.size(); count++)
193:                            fc.copyFiles((File) classLocation.get(count),
194:                                    tempfile, null);
195:                    }
196:                    // Coping wsdl files
197:                    File lib = new File(tempfile, "lib");
198:                    if (!lib.exists()) {
199:                        lib.mkdir();
200:                    }
201:                    if (libs != null) {
202:                        for (int i = 0; i < libs.size(); i++) {
203:                            String libname = (String) libs.get(i);
204:                            fc.copyFiles(new File(libname), lib, null);
205:                        }
206:                    }
207:
208:                    //coping wsdl files
209:                    if (wsdls != null)
210:                        for (int i = 0; i < wsdls.size(); i++) {
211:                            File libname = (File) wsdls.get(i);
212:                            fc.copyFiles(libname, metainf, null);
213:                        }
214:
215:                    String arcivename = getArchiveName();
216:                    if (arcivename.indexOf(".aar") < 0) {
217:                        arcivename = arcivename + ".aar";
218:                    }
219:                    JarFileWriter jwriter = new JarFileWriter();
220:                    jwriter.writeJarFile(outFile, arcivename, tempfile);
221:                    //craeting the jar file
222:                    deleteDir(tempfile);
223:
224:                } catch (Exception e) {
225:                    throw e;
226:                }
227:            }
228:
229:            private boolean deleteDir(File dir) {
230:                if (dir.isDirectory()) {
231:                    String[] children = dir.list();
232:                    for (int i = 0; i < children.length; i++) {
233:                        boolean success = deleteDir(new File(dir, children[i]));
234:                        if (!success) {
235:                            return false;
236:                        }
237:                    }
238:                }
239:
240:                // The directory is now empty so delete it
241:                return dir.delete();
242:            }
243:
244:            public ClassLoader getClassLoader() {
245:                return classLoader;
246:            }
247:
248:            public void setClassLoader(ClassLoader classLoader) {
249:                this.classLoader = classLoader;
250:            }
251:
252:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.