Source Code Cross Referenced for CustomDeployer.java in  » Web-Services-AXIS2 » kernal » org » apache » axis2 » deployment » deployers » 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 » kernal » org.apache.axis2.deployment.deployers 
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.deployment.deployers;
020:
021:        import org.apache.axis2.deployment.Deployer;
022:        import org.apache.axis2.deployment.DeploymentException;
023:        import org.apache.axis2.deployment.repository.util.DeploymentFileData;
024:        import org.apache.axis2.context.ConfigurationContext;
025:        import org.apache.axis2.AxisFault;
026:        import org.apache.commons.logging.LogFactory;
027:        import org.apache.commons.logging.Log;
028:
029:        import java.io.FileReader;
030:        import java.io.FileNotFoundException;
031:        import java.io.FileInputStream;
032:
033:        /**
034:         * A custom Deployer instance for testing.  This coordinates with the CustomDeployerTest and
035:         * the CustomDeployerRepo/ repository in test-resources/.  It's going to be set up to deploy
036:         * "svc" files, both in the services/ directory and in the widgets/ directory.  After the
037:         * config is complete, we should have 2 deployed items, and should have found both "Mary" and
038:         * "George" (see the repo for test data).  We use static fields to keep all this information
039:         * in a way that the test can access it.
040:         */
041:        public class CustomDeployer implements  Deployer {
042:            protected static final Log log = LogFactory
043:                    .getLog(CustomDeployer.class);
044:
045:            /** Has init() been called? */
046:            public static boolean initCalled;
047:            /** This is set to the last argument to setDirectory() */
048:            public static String directory;
049:            /** This is set to the last argument to setExtension() */
050:            public static String extension;
051:            /** The count of deployed items */
052:            public static int deployedItems;
053:            /** Set to true if "George" has been deployed */
054:            public static boolean georgeDeployed;
055:            /** Set to true if "Mary" has been deployed */
056:            public static boolean maryDeployed;
057:
058:            public static final String PARAM_NAME = "customDeployerParam";
059:            public static final String PARAM_VAL = "customDeployer parameter value";
060:
061:            /**
062:             * Initialize the Deployer
063:             *
064:             * @param configCtx our ConfigurationContext
065:             */
066:            public void init(ConfigurationContext configCtx) {
067:                initCalled = true;
068:
069:                // Set a property on the AxisConfig just to make sure we end up with the right one
070:                try {
071:                    configCtx.getAxisConfiguration().addParameter(PARAM_NAME,
072:                            PARAM_VAL);
073:                } catch (AxisFault axisFault) {
074:                    // Two comments - 1) why the heck does addParameter throw AxisFault?
075:                    //                2) why doesn't init() throw AxisFault?
076:                }
077:            }
078:
079:            /**
080:             * Process a file and add it to the configuration
081:             *
082:             * @param deploymentFileData the DeploymentFileData object to deploy
083:             * @throws org.apache.axis2.deployment.DeploymentException
084:             *          if there is a problem
085:             */
086:            public void deploy(DeploymentFileData deploymentFileData)
087:                    throws DeploymentException {
088:                log.info("Deploying - " + deploymentFileData.getName());
089:                try {
090:                    FileInputStream fis = new FileInputStream(
091:                            deploymentFileData.getFile());
092:                    int x = fis.available();
093:                    byte b[] = new byte[x];
094:                    fis.read(b);
095:                    String content = new String(b);
096:                    if (content.indexOf("George") > -1)
097:                        georgeDeployed = true;
098:                    if (content.indexOf("Mary") > -1)
099:                        maryDeployed = true;
100:                    deployedItems++;
101:                } catch (Exception e) {
102:                    throw new DeploymentException(e);
103:                }
104:            }
105:
106:            /**
107:             * Set the directory
108:             *
109:             * @param directory directory name
110:             */
111:            public void setDirectory(String directory) {
112:                CustomDeployer.directory = directory;
113:            }
114:
115:            /**
116:             * Set the extension to look for TODO: Support multiple extensions?
117:             *
118:             * @param extension the file extension associated with this Deployer
119:             */
120:            public void setExtension(String extension) {
121:                CustomDeployer.extension = extension;
122:            }
123:
124:            /**
125:             * Remove a given file from the configuration
126:             *
127:             * @param fileName name of item to remove
128:             * @throws org.apache.axis2.deployment.DeploymentException
129:             *          if there is a problem
130:             */
131:            public void unDeploy(String fileName) throws DeploymentException {
132:                // Undeploy
133:            }
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.