Source Code Cross Referenced for ServicemoduleDistributionGeneratorApplication.java in  » UML » MetaBoss » com » metaboss » sdlctools » applications » cmdlinetools » 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 » UML » MetaBoss » com.metaboss.sdlctools.applications.cmdlinetools 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015:        package com.metaboss.sdlctools.applications.cmdlinetools;
016:
017:        import java.util.Properties;
018:        import java.util.StringTokenizer;
019:
020:        import javax.naming.Context;
021:        import javax.naming.InitialContext;
022:
023:        import com.metaboss.sdlctools.models.ModelRepository;
024:        import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
025:        import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
026:        import com.metaboss.sdlctools.models.metabossmodel.ModelElementClass;
027:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Servicemodule;
028:        import com.metaboss.sdlctools.services.codegeneration.BSServiceDistributionGenerator;
029:        import com.metaboss.util.PropertiesUtils;
030:
031:        /** This class offers command line access to the code generation of the servicemodule distribution.
032:         * It expects following arguments :
033:         * <OL>
034:         * <LI>Implementation mapping. Since every distribution implementation generator mapping must be a subpackage of the
035:         * com.metaboss.sdlctools.services.codegeneration.distribution package, implementation mapping argument is only expected to contain
036:         * relative package name. <I>For example to invoke jboss generator implemented in "com.metaboss.sdlctools.services.codegeneration.distribution.j2ee.jboss"
037:         * this argument must only contain "j2ee.jboss"</I>
038:         * There is also the reserved word - "default" - if it is used this application will look for implementation
039:         * mapping in the jndi properties (if default mapping is not configurred - naming error will occur).</LI>
040:         * <LI>Destination directory. The directory to generate code to.</LI>
041:         * <LI>Ref. The reference to generate code for. Allowed types are System or Servicemodule.
042:         * This argument can also contain a comma separated list of references in case this appliction needs to be run for more than one element of the model.
043:         * The result will be just like calling this application separately for each ref.</LI>
044:         * </OL>
045:         * It expects following java properties :
046:         * <UL>
047:         * <LI>MetaBoss.Home - this property should point to the top level installation directory of MetaBoss. <I>For example : "-DMetaBoss.Home=c:\MetaBoss-0.1"</I></LI>  
048:         * <LI>MetaBoss.ModelDir - this property should point to the top level directory of the model. <I>For example : "-DMetaBoss.ModelDir=c:\MetaBoss-0.1\example\EnterpriseModel"</I></LI>
049:         * <LI>Any number of properties in form "MetaBoss.&lt;implementation mapping&gt;.&lt;property name&gt; to be passed to actual implementation.
050:         *  <i>For example to pass property to the j2ee.jboss implementation it must be in form "MetaBoss.j2ee.jboss.&lt;property name&gt;</i>"</LI>
051:         * </UL>   
052:         */
053:        public class ServicemoduleDistributionGeneratorApplication {
054:            public static void main(String[] args) {
055:                try {
056:                    // Call common initialisation
057:                    ApplicationUtils.initialiseApplication();
058:
059:                    // Scan the arguments (must be three)
060:                    if (args == null || args.length != 3)
061:                        throw new IllegalArgumentException(
062:                                "Invalid arguments passed to the generator. Expecting three arguments : <implementation name> <destination directory> <reference type> <reference>");
063:                    // arg[0] is the implementation mapping
064:                    String lImplementationMapping = args[0];
065:                    // arg[1] is the absolute path to the destination directory
066:                    String lDestinationDirectory = args[1];
067:                    // arg[2] is the ref - comma separated list of references to work on
068:                    String lReferences = args[2];
069:                    // Prepare the property based on implementation asked for
070:                    Properties lContextProps = new Properties();
071:                    if (!lImplementationMapping.equals("default"))
072:                        lContextProps
073:                                .setProperty(
074:                                        "com.metaboss.naming.component.com.metaboss.sdlctools.services.codegeneration.BSServicemoduleDistributionGenerator",
075:                                        "com.metaboss.sdlctools.services.codegeneration.servicemoduledistributiongenerator."
076:                                                + lImplementationMapping);
077:                    // Also pass all possible MetaBoss environment properties
078:                    lContextProps.putAll(PropertiesUtils.filterProperties(
079:                            System.getProperties(), "MetaBoss.", false));
080:                    Context ctx = new InitialContext(lContextProps);
081:                    BSServiceDistributionGenerator lGenerator = (BSServiceDistributionGenerator) ctx
082:                            .lookup(BSServiceDistributionGenerator.COMPONENT_URL);
083:                    // Now iterate through references calling all generators on each reference
084:                    Context lContext = new InitialContext();
085:                    ModelRepository lModelRepository = (ModelRepository) lContext
086:                            .lookup(ModelRepository.COMPONENT_URL);
087:                    MetaBossModelPackage lMetaBossModelPackage = (MetaBossModelPackage) lModelRepository
088:                            .getDefaultModelExtent();
089:                    ModelElementClass lModelElementClass = lMetaBossModelPackage
090:                            .getModelElement();
091:                    StringTokenizer lReferencesTokenizer = new StringTokenizer(
092:                            lReferences, ",", false);
093:                    while (lReferencesTokenizer.hasMoreTokens()) {
094:                        String lRef = lReferencesTokenizer.nextToken();
095:                        ModelElement lModelElement = lModelElementClass
096:                                .getByRef(lRef);
097:                        if (lModelElement instanceof  com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System)
098:                            lGenerator
099:                                    .generateImplementationSourceCodeForSystem(
100:                                            lDestinationDirectory, lRef);
101:                        else if (lModelElement instanceof  Servicemodule)
102:                            lGenerator
103:                                    .generateImplementationSourceCodeForServicemodule(
104:                                            lDestinationDirectory, lRef);
105:                        else
106:                            throw new IllegalArgumentException(
107:                                    "Invalid reference passed to the generator. Expecting reference to the System or Servicemodule. Got "
108:                                            + lRef);
109:                    }
110:                    System.exit(0);
111:                } catch (Throwable t) {
112:                    ApplicationUtils.handleException(t);
113:                    System.exit(1);
114:                }
115:            }
116:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.