Source Code Cross Referenced for TSSLinkBuilder.java in  » EJB-Server-geronimo » plugins » org » apache » geronimo » corba » deployment » 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 » EJB Server geronimo » plugins » org.apache.geronimo.corba.deployment 
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:
020:        package org.apache.geronimo.corba.deployment;
021:
022:        import java.net.URI;
023:        import java.util.Map;
024:
025:        import javax.xml.namespace.QName;
026:
027:        import org.apache.geronimo.common.DeploymentException;
028:        import org.apache.geronimo.gbean.AbstractName;
029:        import org.apache.geronimo.gbean.AbstractNameQuery;
030:        import org.apache.geronimo.gbean.GBeanData;
031:        import org.apache.geronimo.gbean.GBeanInfo;
032:        import org.apache.geronimo.gbean.GBeanInfoBuilder;
033:        import org.apache.geronimo.j2ee.deployment.Module;
034:        import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
035:        import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
036:        import org.apache.geronimo.kernel.GBeanNotFoundException;
037:        import org.apache.geronimo.kernel.repository.Environment;
038:        import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
039:        import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
040:        import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
041:        import org.apache.geronimo.corba.TSSLinkGBean;
042:        import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSTssDocument;
043:        import org.apache.xmlbeans.QNameSet;
044:        import org.apache.xmlbeans.XmlObject;
045:        import org.apache.xmlbeans.XmlString;
046:
047:        /**
048:         * @version $Rev: 535381 $ $Date: 2007-05-04 14:04:18 -0700 (Fri, 04 May 2007) $
049:         */
050:        public class TSSLinkBuilder extends AbstractNamingBuilder {
051:            private static final String TSS_NAMESPACE = TSSTssDocument.type
052:                    .getDocumentElementName().getNamespaceURI();
053:            private static final QName TSS_LINK_QNAME = new QName(
054:                    TSS_NAMESPACE, "tss-link");
055:            private static final QName TSS_QNAME = new QName(TSS_NAMESPACE,
056:                    "tss");
057:            private static final QName JNDI_NAME_QNAME = new QName(
058:                    TSS_NAMESPACE, "jndi-name");
059:
060:            public TSSLinkBuilder() {
061:            }
062:
063:            public TSSLinkBuilder(Environment defaultEnvironment) {
064:                super (defaultEnvironment);
065:            }
066:
067:            protected boolean willMergeEnvironment(XmlObject specDD,
068:                    XmlObject plan) {
069:                return true;
070:                //        return hasTssLinks(plan);
071:            }
072:
073:            //    static boolean hasTssLinks(XmlObject plan) {
074:            //        return plan != null && (plan.selectChildren(TSS_LINK_QNAME).length > 0 ||
075:            //                plan.selectChildren(TSS_QNAME).length > 0);
076:            //    }
077:
078:            public void buildNaming(XmlObject specDD, XmlObject plan,
079:                    Module module, Map componentContext)
080:                    throws DeploymentException {
081:                if (plan == null) {
082:                    return;
083:                }
084:
085:                AbstractName ejbName = getGBeanName(componentContext);
086:
087:                String[] tssLinks = toStringArray(plan
088:                        .selectChildren(TSS_LINK_QNAME));
089:                XmlObject[] tsss = plan.selectChildren(TSS_QNAME);
090:                String[] jndiNames = toStringArray(plan
091:                        .selectChildren(JNDI_NAME_QNAME));
092:                for (int i = 0; i < tssLinks.length; i++) {
093:                    String tssLink = tssLinks[i];
094:                    URI moduleURI = module.getModuleURI();
095:                    String moduleString = moduleURI == null ? null : moduleURI
096:                            .toString();
097:                    AbstractNameQuery tssBeanName = ENCConfigBuilder
098:                            .buildAbstractNameQuery(null, moduleString,
099:                                    tssLink, NameFactory.EJB_MODULE,
100:                                    NameFactory.EJB_MODULE);
101:                    try {
102:                        module.getEarContext().findGBean(tssBeanName);
103:                    } catch (GBeanNotFoundException e) {
104:                        tssBeanName = ENCConfigBuilder.buildAbstractNameQuery(
105:                                null, null, tssLink, null,
106:                                NameFactory.EJB_MODULE);
107:                        try {
108:                            module.getEarContext().findGBean(tssBeanName);
109:                        } catch (GBeanNotFoundException e1) {
110:                            throw new DeploymentException("No tss bean found",
111:                                    e);
112:                        }
113:                    }
114:                    AbstractName tssLinkName = module.getEarContext()
115:                            .getNaming().createChildName(ejbName,
116:                                    "tssLink" + i, "TSSLink");
117:                    GBeanData tssLinkData = new GBeanData(tssLinkName,
118:                            TSSLinkGBean.GBEAN_INFO);
119:                    tssLinkData.setAttribute("jndiNames", jndiNames);
120:                    tssLinkData.setReferencePattern("EJB", ejbName);
121:                    tssLinkData.setReferencePattern("TSSBean", tssBeanName);
122:                    try {
123:                        module.getEarContext().addGBean(tssLinkData);
124:                    } catch (GBeanAlreadyExistsException e) {
125:                        throw new DeploymentException(
126:                                "tss link gbean already present", e);
127:                    }
128:                }
129:                for (int i = 0; i < tsss.length; i++) {
130:                    GerPatternType tss = (GerPatternType) tsss[i];
131:                    AbstractNameQuery tssBeanName = ENCConfigBuilder
132:                            .buildAbstractNameQuery(tss, NameFactory.CORBA_TSS,
133:                                    NameFactory.EJB_MODULE, null);
134:                    AbstractName tssLinkName = module.getEarContext()
135:                            .getNaming().createChildName(ejbName, "tssRef" + i,
136:                                    "TSSLink");
137:                    GBeanData tssLinkData = new GBeanData(tssLinkName,
138:                            TSSLinkGBean.GBEAN_INFO);
139:                    tssLinkData.setAttribute("jndiNames", jndiNames);
140:                    tssLinkData.setReferencePattern("EJB", ejbName);
141:                    tssLinkData.setReferencePattern("TSSBean", tssBeanName);
142:                    try {
143:                        module.getEarContext().addGBean(tssLinkData);
144:                    } catch (GBeanAlreadyExistsException e) {
145:                        throw new DeploymentException(
146:                                "tss link gbean already present", e);
147:                    }
148:                }
149:
150:            }
151:
152:            public QNameSet getSpecQNameSet() {
153:                return QNameSet.EMPTY;
154:            }
155:
156:            public QNameSet getPlanQNameSet() {
157:                return QNameSet.singleton(TSS_LINK_QNAME);
158:            }
159:
160:            private String[] toStringArray(XmlObject[] xmlObjects) {
161:                String[] result = new String[xmlObjects.length];
162:                for (int i = 0; i < result.length; i++) {
163:                    // toString() and xmlText() insert tags around the value, which
164:                    // is most definitely NOT what we want.
165:                    result[i] = ((XmlString) xmlObjects[i]).getStringValue();
166:                }
167:                return result;
168:            }
169:
170:            public static final GBeanInfo GBEAN_INFO;
171:
172:            static {
173:                GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(
174:                        TSSLinkBuilder.class, NameFactory.MODULE_BUILDER); //TODO decide what type this should be
175:                infoBuilder.addAttribute("defaultEnvironment",
176:                        Environment.class, true, true);
177:
178:                infoBuilder
179:                        .setConstructor(new String[] { "defaultEnvironment" });
180:
181:                GBEAN_INFO = infoBuilder.getBeanInfo();
182:            }
183:
184:            public static GBeanInfo getGBeanInfo() {
185:                return GBEAN_INFO;
186:            }
187:
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.