Source Code Cross Referenced for JaxWsNode.java in  » IDE-Netbeans » web.core » org » netbeans » modules » websvc » core » jaxws » nodes » 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 » IDE Netbeans » web.core » org.netbeans.modules.websvc.core.jaxws.nodes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
0028:         * Microsystems, Inc. All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         */
0041:        package org.netbeans.modules.websvc.core.jaxws.nodes;
0042:
0043:        import java.awt.Dialog;
0044:        import java.awt.Image;
0045:        import java.awt.datatransfer.Transferable;
0046:        import java.beans.PropertyVetoException;
0047:        import java.io.File;
0048:        import java.io.IOException;
0049:        import java.io.UnsupportedEncodingException;
0050:        import java.net.HttpURLConnection;
0051:        import java.net.URL;
0052:        import java.net.URLConnection;
0053:        import java.net.URLEncoder;
0054:        import java.util.ArrayList;
0055:        import java.util.Arrays;
0056:        import java.util.List;
0057:        import java.util.Map;
0058:        import javax.lang.model.element.AnnotationMirror;
0059:        import javax.lang.model.element.AnnotationValue;
0060:        import javax.lang.model.element.ExecutableElement;
0061:        import javax.lang.model.element.TypeElement;
0062:        import javax.swing.Action;
0063:        import org.apache.tools.ant.module.api.support.ActionUtils;
0064:        import org.netbeans.api.java.source.CancellableTask;
0065:        import org.netbeans.api.java.source.CompilationController;
0066:        import org.netbeans.api.java.source.JavaSource;
0067:        import org.netbeans.api.java.source.JavaSource.Phase;
0068:        import org.netbeans.api.project.FileOwnerQuery;
0069:        import org.netbeans.api.project.Project;
0070:        import org.netbeans.modules.j2ee.common.Util;
0071:        import org.netbeans.modules.j2ee.dd.api.web.DDProvider;
0072:        import org.netbeans.modules.j2ee.dd.api.web.Servlet;
0073:        import org.netbeans.modules.j2ee.dd.api.web.ServletMapping;
0074:        import org.netbeans.modules.j2ee.dd.api.web.WebApp;
0075:        import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
0076:        import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
0077:        import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
0078:        import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
0079:        import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
0080:        import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
0081:        import org.netbeans.modules.web.api.webmodule.WebModule;
0082:        import org.netbeans.modules.websvc.api.jaxws.project.GeneratedFilesHelper;
0083:        import org.netbeans.modules.websvc.api.jaxws.project.config.Endpoints;
0084:        import org.netbeans.modules.websvc.api.jaxws.project.config.Handler;
0085:        import org.netbeans.modules.websvc.api.jaxws.project.config.HandlerChain;
0086:        import org.netbeans.modules.websvc.api.jaxws.project.config.HandlerChains;
0087:        import org.netbeans.modules.websvc.api.jaxws.project.config.HandlerChainsProvider;
0088:        import org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlModeler;
0089:        import org.netbeans.modules.websvc.api.support.java.SourceUtils;
0090:        import org.netbeans.modules.websvc.core.JaxWsUtils;
0091:        import org.netbeans.modules.websvc.core.WebServiceReference;
0092:        import org.netbeans.modules.websvc.core.WebServiceTransferable;
0093:        import org.netbeans.modules.websvc.core.dev.wizard.PlatformUtil;
0094:        import org.netbeans.modules.websvc.core.jaxws.actions.AddOperationAction;
0095:        import org.netbeans.modules.websvc.core.jaxws.actions.JaxWsRefreshAction;
0096:        import org.netbeans.modules.websvc.core.jaxws.actions.WsTesterPageAction;
0097:        import org.netbeans.modules.websvc.core.ConfigureHandlerAction;
0098:        import org.netbeans.modules.websvc.core.ConfigureHandlerCookie;
0099:        import org.netbeans.modules.websvc.core.webservices.ui.panels.MessageHandlerPanel;
0100:        import org.netbeans.modules.websvc.core.wseditor.support.WSEditAttributesAction;
0101:        import org.netbeans.modules.websvc.jaxws.api.JaxWsRefreshCookie;
0102:        import org.netbeans.modules.websvc.jaxws.api.JaxWsTesterCookie;
0103:        import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel;
0104:        import org.netbeans.modules.websvc.api.jaxws.project.config.Service;
0105:        import org.openide.DialogDescriptor;
0106:        import org.openide.DialogDisplayer;
0107:        import org.openide.ErrorManager;
0108:        import org.openide.actions.DeleteAction;
0109:        import org.openide.actions.OpenAction;
0110:        import org.openide.actions.PropertiesAction;
0111:        import org.openide.cookies.OpenCookie;
0112:        import org.openide.execution.ExecutorTask;
0113:        import org.openide.filesystems.FileObject;
0114:        import org.openide.loaders.DataObject;
0115:        import org.openide.loaders.DataObjectNotFoundException;
0116:        import org.openide.nodes.AbstractNode;
0117:        import org.openide.util.HelpCtx;
0118:        import org.openide.util.NbBundle;
0119:        import org.openide.util.actions.SystemAction;
0120:        import org.openide.util.lookup.AbstractLookup;
0121:        import org.openide.util.lookup.InstanceContent;
0122:        import org.netbeans.modules.websvc.api.jaxws.project.config.Endpoint;
0123:        import org.netbeans.modules.websvc.api.jaxws.project.config.EndpointsProvider;
0124:        import org.netbeans.modules.websvc.core.WsWsdlCookie;
0125:        import org.netbeans.modules.websvc.core.jaxws.actions.JaxWsGenWSDLAction;
0126:        import org.netbeans.modules.websvc.core.jaxws.actions.JaxWsGenWSDLImpl;
0127:        import org.netbeans.modules.websvc.core.wseditor.support.EditWSAttributesCookieImpl;
0128:        import org.netbeans.modules.websvc.jaxws.api.JAXWSSupport;
0129:        import org.openide.NotifyDescriptor;
0130:        import org.openide.filesystems.FileLock;
0131:        import org.openide.filesystems.FileUtil;
0132:        import org.openide.util.Lookup;
0133:        import org.openide.util.lookup.Lookups;
0134:
0135:        public class JaxWsNode extends AbstractNode implements  WsWsdlCookie,
0136:                JaxWsTesterCookie, ConfigureHandlerCookie {
0137:
0138:            Service service;
0139:            FileObject srcRoot;
0140:            JaxWsModel jaxWsModel;
0141:            private FileObject implBeanClass;
0142:            InstanceContent content;
0143:            Project project;
0144:
0145:            public JaxWsNode(JaxWsModel jaxWsModel, Service service,
0146:                    FileObject srcRoot, FileObject implBeanClass) {
0147:                this (jaxWsModel, service, srcRoot, implBeanClass,
0148:                        new InstanceContent());
0149:            }
0150:
0151:            private JaxWsNode(JaxWsModel jaxWsModel, Service service,
0152:                    FileObject srcRoot, FileObject implBeanClass,
0153:                    InstanceContent content) {
0154:                super (new JaxWsChildren(service, srcRoot, implBeanClass),
0155:                        new AbstractLookup(content));
0156:                this .jaxWsModel = jaxWsModel;
0157:                this .service = service;
0158:                this .srcRoot = srcRoot;
0159:                this .content = content;
0160:                this .implBeanClass = implBeanClass;
0161:                project = FileOwnerQuery.getOwner(srcRoot);
0162:                if (implBeanClass.getAttribute("jax-ws-service") == null) {
0163:                    try {
0164:                        implBeanClass.setAttribute("jax-ws-service",
0165:                                java.lang.Boolean.TRUE);
0166:                        getDataObject().setValid(false);
0167:                    } catch (PropertyVetoException ex) {
0168:                        ErrorManager.getDefault().notify(ex);
0169:                    } catch (IOException ex) {
0170:                        ErrorManager.getDefault().notify(ex);
0171:                    }
0172:                }
0173:                String serviceName = service.getName();
0174:                setName(serviceName);
0175:                content.add(this );
0176:                content.add(service);
0177:                content.add(implBeanClass);
0178:                content.add(new EditWSAttributesCookieImpl(this , jaxWsModel));
0179:                if (service.getWsdlUrl() != null) {
0180:                    content.add(new RefreshServiceImpl());
0181:                } else {
0182:                    content.add(new JaxWsGenWSDLImpl(project, serviceName));
0183:                }
0184:                OpenCookie cookie = new OpenCookie() {
0185:
0186:                    public void open() {
0187:                        OpenCookie oc = getOpenCookie();
0188:                        if (oc != null) {
0189:                            oc.open();
0190:                        }
0191:                    }
0192:                };
0193:                content.add(cookie);
0194:                setValue("wsdl-url", getWsdlURL());
0195:            }
0196:
0197:            @Override
0198:            public String getDisplayName() {
0199:                if (service.getWsdlUrl() != null) {
0200:                    return NbBundle.getMessage(JaxWsNode.class,
0201:                            "LBL_serviceNodeName", service.getServiceName(),
0202:                            service.getPortName());
0203:                } else {
0204:                    return service.getName();
0205:                }
0206:            }
0207:
0208:            @Override
0209:            public String getShortDescription() {
0210:                return getWsdlURL();
0211:            }
0212:
0213:            private static final String WAITING_BADGE = "org/netbeans/modules/websvc/core/webservices/ui/resources/waiting.png"; // NOI18N
0214:            private static final String ERROR_BADGE = "org/netbeans/modules/websvc/core/webservices/ui/resources/error-badge.gif"; //NOI18N
0215:            private static final String SERVICE_BADGE = "org/netbeans/modules/websvc/core/webservices/ui/resources/XMLServiceDataIcon.gif"; //NOI18N
0216:            private java.awt.Image cachedWaitingBadge;
0217:            private java.awt.Image cachedErrorBadge;
0218:            private java.awt.Image cachedServiceBadge;
0219:
0220:            @Override
0221:            public java.awt.Image getIcon(int type) {
0222:                WsdlModeler wsdlModeler = ((JaxWsChildren) getChildren())
0223:                        .getWsdlModeler();
0224:                if (wsdlModeler == null) {
0225:                    return getServiceImage();
0226:                } else if (wsdlModeler.getCreationException() == null) {
0227:                    if (((JaxWsChildren) getChildren())
0228:                            .isModelGenerationFinished()) {
0229:                        return getServiceImage();
0230:                    } else {
0231:                        return org.openide.util.Utilities.mergeImages(
0232:                                getServiceImage(), getWaitingBadge(), 15, 8);
0233:                    }
0234:                } else {
0235:                    Image dirtyNodeImage = org.openide.util.Utilities
0236:                            .mergeImages(getServiceImage(), getErrorBadge(), 6,
0237:                                    6);
0238:                    if (((JaxWsChildren) getChildren())
0239:                            .isModelGenerationFinished()) {
0240:                        return dirtyNodeImage;
0241:                    } else {
0242:                        return org.openide.util.Utilities.mergeImages(
0243:                                dirtyNodeImage, getWaitingBadge(), 15, 8);
0244:                    }
0245:                }
0246:            }
0247:
0248:            private java.awt.Image getServiceImage() {
0249:                if (cachedServiceBadge == null) {
0250:                    cachedServiceBadge = org.openide.util.Utilities
0251:                            .loadImage(SERVICE_BADGE);
0252:                }
0253:                return cachedServiceBadge;
0254:            }
0255:
0256:            private java.awt.Image getErrorBadge() {
0257:                if (cachedErrorBadge == null) {
0258:                    cachedErrorBadge = org.openide.util.Utilities
0259:                            .loadImage(ERROR_BADGE);
0260:                }
0261:                return cachedErrorBadge;
0262:            }
0263:
0264:            private java.awt.Image getWaitingBadge() {
0265:                if (cachedWaitingBadge == null) {
0266:                    cachedWaitingBadge = org.openide.util.Utilities
0267:                            .loadImage(WAITING_BADGE);
0268:                }
0269:                return cachedWaitingBadge;
0270:            }
0271:
0272:            void changeIcon() {
0273:                fireIconChange();
0274:            }
0275:
0276:            @Override
0277:            public Image getOpenedIcon(int type) {
0278:                return getIcon(type);
0279:            }
0280:
0281:            private DataObject getDataObject() {
0282:                FileObject f = getImplBean();
0283:                if (f != null) {
0284:                    try {
0285:                        return DataObject.find(f);
0286:                    } catch (DataObjectNotFoundException de) {
0287:                        ErrorManager.getDefault().log(
0288:                                ErrorManager.INFORMATIONAL, de.toString());
0289:                    }
0290:                }
0291:                return null;
0292:            }
0293:
0294:            private OpenCookie getOpenCookie() {
0295:                OpenCookie oc = null;
0296:                FileObject f = getImplBean();
0297:                if (f != null) {
0298:                    try {
0299:                        DataObject d = DataObject.find(f);
0300:                        oc = d.getCookie(OpenCookie.class);
0301:                    } catch (DataObjectNotFoundException de) {
0302:                        ErrorManager.getDefault().log(
0303:                                ErrorManager.INFORMATIONAL, de.toString());
0304:                    }
0305:                }
0306:                return oc;
0307:            }
0308:
0309:            @Override
0310:            public Action getPreferredAction() {
0311:                return SystemAction.get(OpenAction.class);
0312:            }
0313:
0314:            // Create the popup menu:
0315:            @Override
0316:            public Action[] getActions(boolean context) {
0317:                DataObject dobj = getCookie(DataObject.class);
0318:                ArrayList<Action> actions = new ArrayList<Action>(Arrays
0319:                        .asList(SystemAction.get(OpenAction.class),
0320:                                SystemAction.get(JaxWsRefreshAction.class),
0321:                                null, SystemAction
0322:                                        .get(AddOperationAction.class), null,
0323:                                SystemAction.get(WsTesterPageAction.class),
0324:                                null, SystemAction
0325:                                        .get(WSEditAttributesAction.class),
0326:                                null, SystemAction
0327:                                        .get(ConfigureHandlerAction.class),
0328:                                null, SystemAction
0329:                                        .get(JaxWsGenWSDLAction.class), null,
0330:                                SystemAction.get(DeleteAction.class), null,
0331:                                SystemAction.get(PropertiesAction.class)));
0332:                addFromLayers(actions, "WebServices/Services/Actions");
0333:                return actions.toArray(new Action[actions.size()]);
0334:            }
0335:
0336:            private void addFromLayers(List<Action> actions, String path) {
0337:                Lookup look = Lookups.forPath(path);
0338:                for (Object next : look.lookupAll(Object.class)) {
0339:                    if (next instanceof  Action) {
0340:                        actions.add((Action) next);
0341:                    } else if (next instanceof  javax.swing.JSeparator) {
0342:                        actions.add(null);
0343:                    }
0344:                }
0345:            }
0346:
0347:            @Override
0348:            public HelpCtx getHelpCtx() {
0349:                return HelpCtx.DEFAULT_HELP;
0350:            }
0351:
0352:            // Handle deleting:
0353:            @Override
0354:            public boolean canDestroy() {
0355:                return true;
0356:            }
0357:
0358:            /**
0359:             * get URL for Web Service WSDL file
0360:             */
0361:            public String getWebServiceURL() {
0362:                J2eeModuleProvider provider = project.getLookup().lookup(
0363:                        J2eeModuleProvider.class);
0364:                InstanceProperties instanceProperties = provider
0365:                        .getInstanceProperties();
0366:                if (instanceProperties == null) {
0367:                    DialogDisplayer.getDefault().notify(
0368:                            new NotifyDescriptor.Message(NbBundle.getMessage(
0369:                                    JaxWsNode.class, "MSG_MissingServer"),
0370:                                    NotifyDescriptor.ERROR_MESSAGE));
0371:                    return "";
0372:                }
0373:                // getting port
0374:                String portNumber = instanceProperties
0375:                        .getProperty(InstanceProperties.HTTP_PORT_NUMBER);
0376:                if (portNumber == null || portNumber.equals("")) {
0377:                    portNumber = "8080"; //NOI18N
0378:                }
0379:
0380:                // getting hostName
0381:                String serverUrl = instanceProperties
0382:                        .getProperty(InstanceProperties.URL_ATTR);
0383:                String hostName = "localhost"; //NOI18N
0384:                if (serverUrl != null && serverUrl.indexOf("::") > 0) {
0385:                    //NOI18N
0386:                    int index1 = serverUrl.indexOf("::"); //NOI18N
0387:                    int index2 = serverUrl.lastIndexOf(":"); //NOI18N
0388:                    if (index2 > index1 + 2) {
0389:                        hostName = serverUrl.substring(index1 + 2, index2);
0390:                    }
0391:                }
0392:
0393:                String contextRoot = null;
0394:                Object moduleType = provider.getJ2eeModule().getModuleType();
0395:                // need to compute from annotations
0396:                String wsURI = null;
0397:                if (J2eeModule.WAR.equals(moduleType)
0398:                        && PlatformUtil.isJaxWsInJ2ee14Supported(project)) {
0399:                    // JBoss type
0400:                    try {
0401:                        wsURI = getUriFromDD(moduleType);
0402:                    } catch (UnsupportedEncodingException ex) {
0403:                        // this shouldn't happen'
0404:                    }
0405:                } else if (J2eeModule.EJB.equals(moduleType)
0406:                        && PlatformUtil.isJaxWsInJ2ee14Supported(project)) {
0407:                    // JBoss type
0408:                    wsURI = getNameFromPackageName(service
0409:                            .getImplementationClass());
0410:                } else if (isJsr109Supported(project)
0411:                        && Util.isJavaEE5orHigher(project)
0412:                        || JaxWsUtils.isEjbJavaEE5orHigher(project)) {
0413:                    try {
0414:                        wsURI = getServiceUri(moduleType);
0415:                    } catch (UnsupportedEncodingException ex) {
0416:                        // this shouldn't happen'
0417:                    }
0418:                } else {
0419:                    // non jsr109 type (Tomcat)
0420:                    try {
0421:                        wsURI = getNonJsr109Uri(moduleType);
0422:                    } catch (UnsupportedEncodingException ex) {
0423:                        // this shouldn't happen'
0424:                    }
0425:                }
0426:                if (J2eeModule.WAR.equals(moduleType)) {
0427:                    J2eeModuleProvider.ConfigSupport configSupport = provider
0428:                            .getConfigSupport();
0429:                    try {
0430:                        contextRoot = configSupport.getWebContextRoot();
0431:                    } catch (ConfigurationException e) {
0432:                        // TODO the context root value could not be read, let the user know about it
0433:                    }
0434:                    if (contextRoot != null && contextRoot.startsWith("/")) {
0435:                        //NOI18N
0436:                        contextRoot = contextRoot.substring(1);
0437:                    }
0438:                } else if (J2eeModule.EJB.equals(moduleType)
0439:                        && PlatformUtil.isJaxWsInJ2ee14Supported(project)) {
0440:                    // JBoss type
0441:                    contextRoot = project.getProjectDirectory().getName();
0442:                }
0443:
0444:                return "http://"
0445:                        + hostName
0446:                        + ":"
0447:                        + portNumber
0448:                        + "/"
0449:                        + (contextRoot != null && !contextRoot.equals("") ? contextRoot
0450:                                + "/"
0451:                                : "") + wsURI; //NOI18N
0452:            }
0453:
0454:            private String getNonJsr109Uri(Object moduleType)
0455:                    throws UnsupportedEncodingException {
0456:                if (J2eeModule.WAR.equals(moduleType)) {
0457:                    WebModule webModule = WebModule.getWebModule(project
0458:                            .getProjectDirectory());
0459:                    FileObject webInfFo = webModule.getWebInf();
0460:                    if (webInfFo != null) {
0461:                        FileObject sunJaxwsFo = webInfFo.getFileObject(
0462:                                "sun-jaxws", "xml"); //NOI18N
0463:                        if (sunJaxwsFo != null) {
0464:                            try {
0465:                                Endpoints endpoints = EndpointsProvider
0466:                                        .getDefault().getEndpoints(sunJaxwsFo);
0467:                                if (endpoints != null) {
0468:                                    String urlPattern = findUrlPattern(
0469:                                            endpoints, service
0470:                                                    .getImplementationClass());
0471:                                    if (urlPattern != null) {
0472:                                        return URLEncoder.encode(urlPattern,
0473:                                                "UTF-8"); //NOI18N
0474:                                    }
0475:                                }
0476:                            } catch (IOException ex) {
0477:                                ErrorManager.getDefault().log(
0478:                                        ex.getLocalizedMessage());
0479:                            }
0480:                        }
0481:                    }
0482:                }
0483:                return URLEncoder.encode(getNameFromPackageName(service
0484:                        .getImplementationClass()), "UTF-8"); //NOI18N
0485:            }
0486:
0487:            private String getUriFromDD(Object moduleType)
0488:                    throws UnsupportedEncodingException {
0489:                WebModule webModule = WebModule.getWebModule(project
0490:                        .getProjectDirectory());
0491:                if (webModule != null) {
0492:                    FileObject ddFo = webModule.getDeploymentDescriptor();
0493:                    if (ddFo != null) {
0494:                        try {
0495:                            WebApp webApp = DDProvider.getDefault().getDDRoot(
0496:                                    ddFo);
0497:                            if (webApp != null) {
0498:                                String urlPattern = findUrlPattern(webApp,
0499:                                        service.getImplementationClass());
0500:                                if (urlPattern != null) {
0501:                                    return URLEncoder.encode(urlPattern,
0502:                                            "UTF-8"); //NOI18N
0503:                                }
0504:                            }
0505:                        } catch (IOException ex) {
0506:                            ErrorManager.getDefault().log(
0507:                                    ex.getLocalizedMessage());
0508:                        }
0509:                    }
0510:                }
0511:                return URLEncoder.encode(getNameFromPackageName(service
0512:                        .getImplementationClass()), "UTF-8"); //NOI18N
0513:            }
0514:
0515:            private String findUrlPattern(Endpoints endpoints,
0516:                    String implementationClass) {
0517:                Endpoint[] endp = endpoints.getEndpoints();
0518:                for (int i = 0; i < endp.length; i++) {
0519:                    if (implementationClass.equals(endp[i].getImplementation())) {
0520:                        String urlPattern = endp[i].getUrlPattern();
0521:                        if (urlPattern != null) {
0522:                            return urlPattern.startsWith("/") ? urlPattern
0523:                                    .substring(1) : urlPattern; //NOI18N
0524:                        }
0525:                    }
0526:                }
0527:                return null;
0528:            }
0529:
0530:            private String findUrlPattern(WebApp webApp,
0531:                    String implementationClass) {
0532:                for (Servlet servlet : webApp.getServlet()) {
0533:                    if (implementationClass.equals(servlet.getServletClass())) {
0534:                        String servletName = servlet.getServletName();
0535:                        if (servletName != null) {
0536:                            for (ServletMapping servletMapping : webApp
0537:                                    .getServletMapping()) {
0538:                                if (servletName.equals(servletMapping
0539:                                        .getServletName())) {
0540:                                    String urlPattern = servletMapping
0541:                                            .getUrlPattern();
0542:                                    return urlPattern.startsWith("/") ? urlPattern
0543:                                            .substring(1)
0544:                                            : urlPattern; //NOI18N
0545:                                }
0546:                            }
0547:                        }
0548:                    }
0549:                }
0550:                return null;
0551:            }
0552:
0553:            private String getServiceUri(final Object moduleType)
0554:                    throws UnsupportedEncodingException {
0555:                final String[] serviceName = new String[1];
0556:                final String[] name = new String[1];
0557:                final boolean[] isProvider = { false };
0558:                JavaSource javaSource = getImplBeanJavaSource();
0559:                if (javaSource != null) {
0560:                    CancellableTask<CompilationController> task = new CancellableTask<CompilationController>() {
0561:
0562:                        public void run(CompilationController controller)
0563:                                throws IOException {
0564:                            controller.toPhase(Phase.ELEMENTS_RESOLVED);
0565:                            TypeElement typeElement = SourceUtils
0566:                                    .getPublicTopLevelElement(controller);
0567:                            TypeElement wsElement = controller.getElements()
0568:                                    .getTypeElement("javax.jws.WebService"); //NOI18N
0569:                            if (typeElement != null && wsElement != null) {
0570:                                boolean foundWsAnnotation = resolveServiceUrl(
0571:                                        moduleType, controller, typeElement,
0572:                                        wsElement, serviceName, name);
0573:                                if (!foundWsAnnotation) {
0574:                                    TypeElement wsProviderElement = controller
0575:                                            .getElements()
0576:                                            .getTypeElement(
0577:                                                    "javax.xml.ws.WebServiceProvider"); //NOI18N
0578:                                    List<? extends AnnotationMirror> annotations = typeElement
0579:                                            .getAnnotationMirrors();
0580:                                    for (AnnotationMirror anMirror : annotations) {
0581:                                        if (controller.getTypes().isSameType(
0582:                                                wsProviderElement.asType(),
0583:                                                anMirror.getAnnotationType())) {
0584:                                            isProvider[0] = true;
0585:                                        }
0586:                                    }
0587:                                }
0588:                            }
0589:                        }
0590:
0591:                        public void cancel() {
0592:                        }
0593:                    };
0594:                    try {
0595:                        javaSource.runUserActionTask(task, true);
0596:                    } catch (IOException ex) {
0597:                        ErrorManager.getDefault().notify(ex);
0598:                    }
0599:                }
0600:
0601:                String qualifiedImplClassName = service
0602:                        .getImplementationClass();
0603:                String implClassName = getNameFromPackageName(qualifiedImplClassName);
0604:                if (serviceName[0] == null) {
0605:                    serviceName[0] = URLEncoder.encode(implClassName
0606:                            + "Service", "UTF-8"); //NOI18N
0607:                }
0608:                if (J2eeModule.WAR.equals(moduleType)) {
0609:                    return serviceName[0];
0610:                } else if (J2eeModule.EJB.equals(moduleType)) {
0611:                    if (name[0] == null) {
0612:                        if (isProvider[0]) {
0613:                            //per JSR 109, use qualified impl class name for EJB
0614:                            name[0] = qualifiedImplClassName;
0615:                        } else {
0616:                            name[0] = implClassName;
0617:                        }
0618:                        name[0] = URLEncoder.encode(name[0], "UTF-8"); //NOI18N
0619:                    }
0620:                    return serviceName[0] + "/" + name[0];
0621:                } else {
0622:                    return serviceName[0];
0623:                }
0624:            }
0625:
0626:            private boolean resolveServiceUrl(Object moduleType,
0627:                    CompilationController controller,
0628:                    TypeElement targetElement, TypeElement wsElement,
0629:                    String[] serviceName, String[] name) throws IOException {
0630:                boolean foundWsAnnotation = false;
0631:                List<? extends AnnotationMirror> annotations = targetElement
0632:                        .getAnnotationMirrors();
0633:                for (AnnotationMirror anMirror : annotations) {
0634:                    if (controller.getTypes().isSameType(wsElement.asType(),
0635:                            anMirror.getAnnotationType())) {
0636:                        foundWsAnnotation = true;
0637:                        Map<? extends ExecutableElement, ? extends AnnotationValue> expressions = anMirror
0638:                                .getElementValues();
0639:                        for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : expressions
0640:                                .entrySet()) {
0641:                            if (entry.getKey().getSimpleName().contentEquals(
0642:                                    "serviceName")) {
0643:                                serviceName[0] = (String) expressions.get(
0644:                                        entry.getKey()).getValue();
0645:                                if (serviceName[0] != null) {
0646:                                    serviceName[0] = URLEncoder.encode(
0647:                                            serviceName[0], "UTF-8"); //NOI18N
0648:                                }
0649:                            } else if (entry.getKey().getSimpleName()
0650:                                    .contentEquals("name")) {
0651:                                name[0] = (String) expressions.get(
0652:                                        entry.getKey()).getValue();
0653:                                if (name[0] != null) {
0654:                                    name[0] = URLEncoder.encode(name[0],
0655:                                            "UTF-8");
0656:                                }
0657:                            }
0658:                            if (serviceName[0] != null && name[0] != null) {
0659:                                break;
0660:                            }
0661:                        }
0662:                        break;
0663:                    } // end if
0664:                } // end for
0665:                return foundWsAnnotation;
0666:            }
0667:
0668:            private String getNameFromPackageName(String packageName) {
0669:                int index = packageName.lastIndexOf("."); //NOI18N
0670:                return index >= 0 ? packageName.substring(index + 1)
0671:                        : packageName;
0672:            }
0673:
0674:            public String getWsdlURL() {
0675:                String wsdlUrl = getWebServiceURL();
0676:                return wsdlUrl.length() == 0 ? "" : wsdlUrl + "?wsdl"; //NOI18N
0677:            }
0678:
0679:            /**
0680:             * get URL for Web Service Tester Page
0681:             */
0682:            public String getTesterPageURL() {
0683:                if (isJsr109Supported(project)
0684:                        && (Util.isJavaEE5orHigher(project) || JaxWsUtils
0685:                                .isEjbJavaEE5orHigher(project))) {
0686:                    return getWebServiceURL() + "?Tester"; //NOI18N
0687:                } else {
0688:                    return getWebServiceURL(); //NOI18N
0689:                }
0690:            }
0691:
0692:            @Override
0693:            public void destroy() throws java.io.IOException {
0694:                String serviceName = service.getName();
0695:                NotifyDescriptor.Confirmation notifyDesc = new NotifyDescriptor.Confirmation(
0696:                        NbBundle.getMessage(JaxWsNode.class,
0697:                                "MSG_CONFIRM_DELETE", serviceName));
0698:                DialogDisplayer.getDefault().notify(notifyDesc);
0699:                if (notifyDesc.getValue() == NotifyDescriptor.YES_OPTION) {
0700:                    JAXWSSupport wss = JAXWSSupport.getJAXWSSupport(project
0701:                            .getProjectDirectory());
0702:                    if (wss != null) {
0703:                        FileObject localWsdlFolder = wss
0704:                                .getLocalWsdlFolderForService(serviceName,
0705:                                        false);
0706:                        if (localWsdlFolder != null) {
0707:                            // removing local wsdl and xml artifacts
0708:                            FileLock lock = null;
0709:                            FileObject clientArtifactsFolder = localWsdlFolder
0710:                                    .getParent();
0711:                            try {
0712:                                lock = clientArtifactsFolder.lock();
0713:                                clientArtifactsFolder.delete(lock);
0714:                            } finally {
0715:                                if (lock != null) {
0716:                                    lock.releaseLock();
0717:                                }
0718:                            }
0719:                            // removing wsdl and xml artifacts from WEB-INF/wsdl
0720:                            FileObject wsdlFolder = wss.getWsdlFolder(false);
0721:                            if (wsdlFolder != null) {
0722:                                FileObject serviceWsdlFolder = wsdlFolder
0723:                                        .getFileObject(serviceName);
0724:                                if (serviceWsdlFolder != null) {
0725:                                    try {
0726:                                        lock = serviceWsdlFolder.lock();
0727:                                        serviceWsdlFolder.delete(lock);
0728:                                    } finally {
0729:                                        if (lock != null) {
0730:                                            lock.releaseLock();
0731:                                        }
0732:                                    }
0733:                                }
0734:                            }
0735:                            // cleaning java artifacts
0736:                            FileObject buildImplFo = project
0737:                                    .getProjectDirectory()
0738:                                    .getFileObject(
0739:                                            GeneratedFilesHelper.BUILD_IMPL_XML_PATH);
0740:                            try {
0741:                                ExecutorTask wsimportTask = ActionUtils
0742:                                        .runTarget(
0743:                                                buildImplFo,
0744:                                                new String[] { "wsimport-service-clean-"
0745:                                                        + serviceName }, null); //NOI18N
0746:                                wsimportTask.waitFinished();
0747:                            } catch (java.io.IOException ex) {
0748:                                ErrorManager.getDefault().log(
0749:                                        ex.getLocalizedMessage());
0750:                            } catch (IllegalArgumentException ex) {
0751:                                ErrorManager.getDefault().log(
0752:                                        ex.getLocalizedMessage());
0753:                            }
0754:                        }
0755:
0756:                        // removing service from jax-ws.xml
0757:                        wss.removeService(serviceName);
0758:
0759:                        // remove non JSR109 entries
0760:                        Boolean isJsr109 = jaxWsModel.getJsr109();
0761:                        if (isJsr109 != null && !isJsr109.booleanValue()) {
0762:                            if (service.getWsdlUrl() != null) {
0763:                                //if coming from wsdl
0764:                                serviceName = service.getServiceName();
0765:                            }
0766:                            wss.removeNonJsr109Entries(serviceName);
0767:                        }
0768:                        super .destroy();
0769:                    }
0770:                }
0771:            }
0772:
0773:            private FileObject getImplBean() {
0774:                String implBean = service.getImplementationClass();
0775:                if (implBean != null) {
0776:                    return srcRoot.getFileObject(implBean.replace('.', '/')
0777:                            + ".java");
0778:                }
0779:                return null;
0780:            }
0781:
0782:            private JavaSource getImplBeanJavaSource() {
0783:                FileObject implBean = getImplBean();
0784:                if (implBean != null) {
0785:                    return JavaSource.forFileObject(implBean);
0786:                }
0787:                return null;
0788:            }
0789:
0790:            /**
0791:             * Adds possibility to display custom delete dialog
0792:             */
0793:            @Override
0794:            public Object getValue(String attributeName) {
0795:                Object retValue;
0796:                if (attributeName.equals("customDelete")) {
0797:                    //NOI18N
0798:                    retValue = Boolean.TRUE;
0799:                } else {
0800:                    retValue = super .getValue(attributeName);
0801:                }
0802:                return retValue;
0803:            }
0804:
0805:            /**
0806:             * Implementation of the ConfigureHandlerCookie
0807:             */
0808:            public void configureHandler() {
0809:                FileObject implBeanFo = getImplBean();
0810:                List<String> handlerClasses = new ArrayList<String>();
0811:                FileObject handlerFO = null;
0812:                HandlerChains handlerChains = null;
0813:                //obtain the handler config file, if any from annotation in implbean
0814:                final String[] handlerFileName = new String[1];
0815:                final boolean[] isNew = new boolean[] { true };
0816:                JavaSource implBeanJavaSrc = JavaSource
0817:                        .forFileObject(implBeanFo);
0818:                CancellableTask<CompilationController> task = new CancellableTask<CompilationController>() {
0819:
0820:                    public void run(CompilationController controller)
0821:                            throws IOException {
0822:                        controller.toPhase(Phase.ELEMENTS_RESOLVED);
0823:                        TypeElement typeElement = SourceUtils
0824:                                .getPublicTopLevelElement(controller);
0825:                        AnnotationMirror handlerAnnotation = getAnnotation(
0826:                                controller, typeElement,
0827:                                "javax.jws.HandlerChain"); //NOI18N
0828:                        if (handlerAnnotation != null) {
0829:                            isNew[0] = false;
0830:                            Map<? extends ExecutableElement, ? extends AnnotationValue> expressions = handlerAnnotation
0831:                                    .getElementValues();
0832:                            for (ExecutableElement ex : expressions.keySet()) {
0833:                                if (ex.getSimpleName().contentEquals("file")) { //NOI18N
0834:                                    handlerFileName[0] = (String) expressions
0835:                                            .get(ex).getValue();
0836:                                    break;
0837:                                }
0838:                            }
0839:                        }
0840:                    }
0841:
0842:                    public void cancel() {
0843:                    }
0844:                };
0845:                try {
0846:                    implBeanJavaSrc.runUserActionTask(task, true);
0847:                } catch (IOException ex) {
0848:                    ErrorManager.getDefault().notify(ex);
0849:                }
0850:
0851:                if (!isNew[0] && handlerFileName[0] != null) {
0852:                    try {
0853:                        // look for handlerFile
0854:                        FileObject parent = implBeanFo.getParent();
0855:                        File parentFile = FileUtil.toFile(parent);
0856:
0857:                        File file = new File(parentFile, handlerFileName[0]);
0858:                        if (file.exists()) {
0859:                            file = file.getCanonicalFile();
0860:                            handlerFO = FileUtil.toFileObject(file);
0861:                        }
0862:                        if (handlerFO != null) {
0863:                            try {
0864:                                handlerChains = HandlerChainsProvider
0865:                                        .getDefault().getHandlerChains(
0866:                                                handlerFO);
0867:                            } catch (Exception e) {
0868:                                ErrorManager.getDefault().notify(e);
0869:                                return; //TODO handle this
0870:                            }
0871:                            HandlerChain[] handlerChainArray = handlerChains
0872:                                    .getHandlerChains();
0873:                            //there is always only one, so get the first one
0874:                            HandlerChain chain = handlerChainArray[0];
0875:                            Handler[] handlers = chain.getHandlers();
0876:                            for (int i = 0; i < handlers.length; i++) {
0877:                                handlerClasses.add(handlers[i]
0878:                                        .getHandlerClass());
0879:                            }
0880:                        } else {
0881:                            //unable to find the handler file, display a warning
0882:                            NotifyDescriptor.Message dialogDesc = new NotifyDescriptor.Message(
0883:                                    NbBundle.getMessage(JaxWsNode.class,
0884:                                            "MSG_HANDLER_FILE_NOT_FOUND",
0885:                                            handlerFileName),
0886:                                    NotifyDescriptor.INFORMATION_MESSAGE);
0887:                            DialogDisplayer.getDefault().notify(dialogDesc);
0888:                        }
0889:                    } catch (IOException ex) {
0890:                        ErrorManager.getDefault().notify(ex);
0891:                    }
0892:                }
0893:                final MessageHandlerPanel panel = new MessageHandlerPanel(
0894:                        project, handlerClasses, true, service.getName());
0895:                String title = NbBundle.getMessage(JaxWsNode.class,
0896:                        "TTL_MessageHandlerPanel");
0897:                DialogDescriptor dialogDesc = new DialogDescriptor(panel, title);
0898:                dialogDesc
0899:                        .setButtonListener(new HandlerButtonListener(panel,
0900:                                handlerChains, handlerFO, implBeanFo, service,
0901:                                isNew[0]));
0902:                Dialog dialog = DialogDisplayer.getDefault().createDialog(
0903:                        dialogDesc);
0904:                dialog.getAccessibleContext().setAccessibleDescription(
0905:                        dialog.getTitle());
0906:                dialog.setVisible(true);
0907:            }
0908:
0909:            static AnnotationMirror getAnnotation(
0910:                    CompilationController controller, TypeElement typeElement,
0911:                    String annotationType) {
0912:                TypeElement anElement = controller.getElements()
0913:                        .getTypeElement(annotationType);
0914:                if (anElement != null) {
0915:                    List<? extends AnnotationMirror> annotations = typeElement
0916:                            .getAnnotationMirrors();
0917:                    for (AnnotationMirror annotation : annotations) {
0918:                        if (controller.getTypes().isSameType(
0919:                                anElement.asType(),
0920:                                annotation.getAnnotationType())) {
0921:                            return annotation;
0922:                        }
0923:                    }
0924:                }
0925:                return null;
0926:            }
0927:
0928:            private boolean isJsr109Supported(Project project) {
0929:                JAXWSSupport wss = JAXWSSupport.getJAXWSSupport(project
0930:                        .getProjectDirectory());
0931:                if (wss != null) {
0932:                    Map properties = wss.getAntProjectHelper()
0933:                            .getStandardPropertyEvaluator().getProperties();
0934:                    String serverInstance = (String) properties
0935:                            .get("j2ee.server.instance"); //NOI18N
0936:                    if (serverInstance != null) {
0937:                        J2eePlatform j2eePlatform = Deployment.getDefault()
0938:                                .getJ2eePlatform(serverInstance);
0939:                        if (j2eePlatform != null) {
0940:                            return j2eePlatform
0941:                                    .isToolSupported(J2eePlatform.TOOL_JSR109);
0942:                        }
0943:                    }
0944:                }
0945:                return false;
0946:            }
0947:
0948:            void refreshImplClass() {
0949:                if (implBeanClass != null) {
0950:                    content.remove(implBeanClass);
0951:                }
0952:                implBeanClass = getImplBean();
0953:                content.add(implBeanClass);
0954:            }
0955:
0956:            @Override
0957:            public boolean canCopy() {
0958:                return true;
0959:            }
0960:
0961:            @Override
0962:            public boolean canCut() {
0963:                return true;
0964:            }
0965:
0966:            @Override
0967:            public Transferable clipboardCopy() throws IOException {
0968:                URL url = new URL(getWsdlURL());
0969:                boolean connectionOK = false;
0970:                try {
0971:                    URLConnection connection = url.openConnection();
0972:                    if (connection instanceof  HttpURLConnection) {
0973:                        HttpURLConnection httpConnection = (HttpURLConnection) connection;
0974:                        try {
0975:                            httpConnection.setRequestMethod("GET"); //NOI18N
0976:                            httpConnection.connect();
0977:                            if (HttpURLConnection.HTTP_OK == httpConnection
0978:                                    .getResponseCode()) {
0979:                                connectionOK = true;
0980:                            }
0981:                        } catch (java.net.ConnectException ex) {
0982:                            //TODO: throw exception here?
0983:                            url = null;
0984:                        } finally {
0985:                            if (httpConnection != null) {
0986:                                httpConnection.disconnect();
0987:                            }
0988:                        }
0989:                        if (!connectionOK) {
0990:                            //TODO: throw exception here?
0991:                            url = null;
0992:                        }
0993:                    }
0994:                } catch (IOException ex) {
0995:                    //TODO: throw exception here?
0996:                    url = null;
0997:                }
0998:
0999:                return new WebServiceTransferable(new WebServiceReference(url,
1000:                        service.getWsdlUrl() != null ? service.getServiceName()
1001:                                : service.getName(), project
1002:                                .getProjectDirectory().getName()));
1003:            }
1004:
1005:            private class RefreshServiceImpl implements  JaxWsRefreshCookie {
1006:
1007:                /**
1008:                 * refresh service information obtained from wsdl (when wsdl file was changed)
1009:                 */
1010:                public void refreshService(boolean downloadWsdl) {
1011:                    if (downloadWsdl) {
1012:                        String result = RefreshWsDialog.open(downloadWsdl,
1013:                                service.getImplementationClass(), service
1014:                                        .getWsdlUrl());
1015:                        if (RefreshWsDialog.CLOSE.equals(result)) {
1016:                            return;
1017:                        }
1018:                        if (result.startsWith(RefreshWsDialog.DO_ALL)) {
1019:                            ((JaxWsChildren) getChildren()).refreshKeys(true,
1020:                                    true, result.substring(1));
1021:                        } else if (result
1022:                                .startsWith(RefreshWsDialog.DOWNLOAD_WSDL)) {
1023:                            ((JaxWsChildren) getChildren()).refreshKeys(true,
1024:                                    false, result.substring(1));
1025:                        } else if (RefreshWsDialog.REGENERATE_IMPL_CLASS
1026:                                .equals(result)) {
1027:                            ((JaxWsChildren) getChildren()).refreshKeys(false,
1028:                                    true, null);
1029:                        } else {
1030:                            ((JaxWsChildren) getChildren()).refreshKeys(false,
1031:                                    false, null);
1032:                        }
1033:                    } else {
1034:                        String result = RefreshWsDialog.openWithOKButtonOnly(
1035:                                downloadWsdl, service.getImplementationClass(),
1036:                                service.getWsdlUrl());
1037:                        if (RefreshWsDialog.REGENERATE_IMPL_CLASS
1038:                                .equals(result)) {
1039:                            ((JaxWsChildren) getChildren()).refreshKeys(false,
1040:                                    true, null);
1041:                        } else {
1042:                            ((JaxWsChildren) getChildren()).refreshKeys(false,
1043:                                    false, null);
1044:                        }
1045:                    }
1046:                }
1047:            }
1048:        }
w___ww__._j___a__v_a___2s_._com__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.