Source Code Cross Referenced for ScriptModule.java in  » Web-Services-AXIS2 » scripting » org » apache » axis2 » scripting » 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 » scripting » org.apache.axis2.scripting 
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.axis2.scripting;
020:
021:        import java.io.File;
022:        import java.io.OutputStreamWriter;
023:        import java.io.UnsupportedEncodingException;
024:        import java.net.URISyntaxException;
025:        import java.net.URL;
026:        import java.net.URLDecoder;
027:
028:        import org.apache.axis2.AxisFault;
029:        import org.apache.axis2.context.ConfigurationContext;
030:        import org.apache.axis2.deployment.DeploymentException;
031:        import org.apache.axis2.description.AxisDescription;
032:        import org.apache.axis2.description.AxisModule;
033:        import org.apache.axis2.description.Parameter;
034:        import org.apache.axis2.engine.AxisConfiguration;
035:        import org.apache.axis2.modules.Module;
036:        import org.apache.commons.logging.Log;
037:        import org.apache.commons.logging.LogFactory;
038:        import org.apache.neethi.Assertion;
039:        import org.apache.neethi.Policy;
040:
041:        /**
042:         * Axis2 module to initialize script services. Uses a ScriptDeploymentEngine to
043:         * find all the scripts in the scriptServices directory and deploy them as Axis2
044:         * services.
045:         */
046:        public class ScriptModule implements  Module {
047:
048:            private static final Log log = LogFactory
049:                    .getLog(ScriptModule.class);
050:
051:            static String defaultEncoding = new OutputStreamWriter(System.out)
052:                    .getEncoding();
053:
054:            /**
055:             * Init by creating and deploying AxisServices for each script
056:             */
057:            public void init(ConfigurationContext configContext,
058:                    AxisModule module) throws AxisFault {
059:
060:                log.debug("script services init");
061:
062:                AxisConfiguration axisConfig = configContext
063:                        .getAxisConfiguration();
064:                if (axisConfig.getRepository() == null) {
065:                    log
066:                            .error("AxisConfiguration getRepository returns null, cannot deploy scripts");
067:                } else {
068:                    File scriptServicesDirectory = getScriptServicesDirectory(axisConfig);
069:                    ScriptDeploymentEngine deploymentEngine = new ScriptDeploymentEngine(
070:                            axisConfig);
071:                    deploymentEngine.loadRepository(scriptServicesDirectory);
072:                    deploymentEngine.loadServices();
073:                }
074:                log.info("script module activated");
075:            }
076:
077:            /**
078:             * Gets the repo directory for the scripts. The scripts directory is a
079:             * sub-directory of the Axis2 repository directory. Its name may be defined
080:             * by a 'scriptServicesDir' property in the axis2.xml otherwise it defaults
081:             * a to a directory named 'scriptServices'.
082:             */
083:            protected File getScriptServicesDirectory(
084:                    AxisConfiguration axisConfig) throws DeploymentException {
085:                try {
086:
087:                    URL axis2Repository = axisConfig.getRepository();
088:                    Parameter scriptsDirParam = axisConfig
089:                            .getParameter("scriptServicesDir");
090:                    String scriptsDir = scriptsDirParam == null ? "scriptServices"
091:                            : (String) scriptsDirParam.getValue();
092:
093:                    String path = URLDecoder.decode(axis2Repository.getPath(),
094:                            defaultEncoding);
095:                    java.io.File repoDir = new java.io.File(path.replace('/',
096:                            File.separatorChar).replace('|', ':'));
097:
098:                    return new File(repoDir, scriptsDir);
099:                } catch (UnsupportedEncodingException e) {
100:                    throw new DeploymentException(
101:                            "UnsupportedEncodingException getting script service directory",
102:                            e);
103:                }
104:            }
105:
106:            // --- the following are unused methods on the Module interface ---
107:
108:            public void applyPolicy(Policy policy,
109:                    AxisDescription axisDescription) throws AxisFault {
110:            }
111:
112:            public boolean canSupportAssertion(Assertion assertion) {
113:                return false;
114:            }
115:
116:            public void engageNotify(AxisDescription axisDescription)
117:                    throws AxisFault {
118:            }
119:
120:            public void shutdown(ConfigurationContext configurationContext)
121:                    throws AxisFault {
122:            }
123:
124:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.