public void setWebComponentImpl(WebComponentDescriptor webComponent) { ejbComponentImpl = null; ejbLink = null; webComponentLink = webComponent.getCanonicalName(); webComponentImpl = webComponent; }
public void setWebComponentImpl(WebComponentDescriptor webComponent) { ejbComponentImpl = null; ejbLink = null; webComponentLink = webComponent.getCanonicalName(); webComponentImpl = webComponent; }
public boolean equals(Object other) { if (other instanceof WebComponentDescriptor && this.getCanonicalName().equals((( WebComponentDescriptor) other).getCanonicalName())) { return true; } return false; }
/** *@return true if this endpoint is implemented by a specific web component */ public boolean implementedByWebComponent(WebComponentDescriptor webComp) { return ( (webComponentLink != null) && (webComponentLink.equals(webComp.getCanonicalName())) ); }
/** *@return true if this endpoint is implemented by a specific web component */ public boolean implementedByWebComponent(WebComponentDescriptor webComp) { return ( (webComponentLink != null) && (webComponentLink.equals(webComp.getCanonicalName())) ); }
public int hashCode() { int result = 17; result = 37 * result + getCanonicalName().hashCode(); return result; }
/** * Search for a web component that I have by name. */ public WebComponentDescriptor getWebComponentByCanonicalName(String name) { for (WebComponentDescriptor next : getWebComponentDescriptors()) { if (next.getCanonicalName().equals(name)) { return (WebComponentDescriptor) next; } } return null; }
@Override public boolean add(String s) { Map<String, String> up2sname = getUrlPatternToServletNameMap(); if (up2sname != null) { String name = getCanonicalName(); String oldName = up2sname.put(s, getCanonicalName()); if (oldName != null && (!oldName.equals(name))) { throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionsameurlpattern", "Servlet [{0}] and Servlet [{1}] have the same url pattern: [{2}]", new Object[] { oldName, name, s })); } } return super.add(s); }
/** * Return all the references by a given component (by name) to the given rolename. */ public SecurityRoleReference getSecurityRoleReferenceByName(String compName, String roleName) { for (WebComponentDescriptor comp : getWebComponentDescriptors()) { if (!comp.getCanonicalName().equals(compName)) continue; SecurityRoleReference r = comp.getSecurityRoleReferenceByName(roleName); if (r != null) return r; } return null; }
void setServletName(Set webComponentDescriptors) { Iterator it = webComponentDescriptors.iterator(); String endpointName = null; while (it.hasNext()) { WebComponentDescriptor desc = (WebComponentDescriptor)it.next(); String name = desc.getCanonicalName(); if (JAXWS_SERVLET.equals(desc.getWebComponentImplementation())) { endpointName = name; } if (desc.getSecurityRoleReferences().hasMoreElements()) { servletName = name; break; } } if (servletName == null) { servletName = endpointName; } }
boolean isConflict(WebComponentDescriptor other, boolean allowNullImplNameOverride) { if (conflict || other.isConflict()) { return true; } if (!getCanonicalName().equals(other.getCanonicalName())) { return false; } String otherImplFile = other.getWebComponentImplementation(); boolean matchImplName = (allowNullImplNameOverride) ? // note that "" and null are regarded as the same here (implFile == null || implFile.length() == 0 || otherImplFile == null || otherImplFile.length() == 0 || implFile.equals(otherImplFile)) : (((implFile == null || implFile.length() == 0) && (otherImplFile == null || otherImplFile.length() == 0)) || (implFile != null && implFile.equals(otherImplFile)) ); boolean otherAsyncSupported = (other.isAsyncSupported() != null) ? other.isAsyncSupported() : false; boolean thisAsyncSupported = (asyncSupported != null) ? asyncSupported : false; boolean matchAsyncSupported = (thisAsyncSupported == otherAsyncSupported); return !(matchImplName && matchAsyncSupported); } }
/** * This method is used by WebComponentDescriptor only. * The returned map is supposed to be only modified by the corresponding url patterns set. */ Map<String, String> getUrlPatternToServletNameMap() { if (urlPattern2ServletName == null) { urlPattern2ServletName = new HashMap<String, String>(); for (WebComponentDescriptor wc : getWebComponentDescriptors()) { String name = wc.getCanonicalName(); for (String up : wc.getUrlPatternsSet()) { String oldName = urlPattern2ServletName.put(up, name); if (oldName != null && (!oldName.equals(name))) { throw new RuntimeException(localStrings.getLocalString( "enterprise.deployment.exceptionsameurlpattern", "Servlet [{0}] and Servlet [{1}] have the same url pattern: [{2}]", new Object[] { oldName, name, up })); } } } } return urlPattern2ServletName; }
private void initIncludeJars() { if (includeInitialized) { return; } String includeJarsString = null;; for (WebComponentDescriptor wcd: wbd.getWebComponentDescriptors()) { if ("jsp".equals(wcd.getCanonicalName())) { InitializationParameter initp = wcd.getInitializationParameterByName("system-jar-includes"); if (initp != null) { includeJarsString = initp.getValue(); break; } } } includeInitialized = true; if (includeJarsString == null) { includeJars = null; return; } includeJars = new ArrayList<String>(); StringTokenizer tokenizer = new StringTokenizer(includeJarsString); while (tokenizer.hasMoreElements()) { includeJars.add(tokenizer.nextToken()); } }
/** * Adds a new Web Component Descriptor to me. * @param webComponentDescriptor */ public void addWebComponentDescriptor(WebComponentDescriptor webComponentDescriptor) { String name = webComponentDescriptor.getCanonicalName(); webComponentDescriptor.setWebBundleDescriptor(this); WebComponentDescriptor webCompDesc = getWebComponentByCanonicalName(name); WebComponentDescriptor resultDesc = combineWebComponentDescriptor(webComponentDescriptor); // sync up urlPattern2ServletName map for (String up : resultDesc.getUrlPatternsSet()) { String oldName = getUrlPatternToServletNameMap().put(up, name); if (oldName != null && (!oldName.equals(name))) { throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionsameurlpattern", "Servlet [{0}] and Servlet [{1}] have the same url pattern: [{2}]", new Object[] { oldName, name, up })); } } }
String servlet = wcd.getCanonicalName();
@Override protected WebComponentDescriptor combineWebComponentDescriptor( WebComponentDescriptor webComponentDescriptor) { WebComponentDescriptor resultDesc = null; String name = webComponentDescriptor.getCanonicalName(); WebComponentDescriptor webCompDesc = getWebComponentByCanonicalName(name); if (webCompDesc != null) { resultDesc = webCompDesc; if (webCompDesc.isConflict(webComponentDescriptor, false)) { webCompDesc.setConflict(true); } else { // combine the contents of the given one to this one webCompDesc.add(webComponentDescriptor); } } else { resultDesc = webComponentDescriptor; this.getWebComponentDescriptors().add(webComponentDescriptor); } return resultDesc; }
public Node writeDescriptor(Element root, WebComponentDescriptor descriptor) { if (descriptor != null && descriptor.getRunAsIdentity() != null) { Node servletNode = appendChild(root, RuntimeTagNames.SERVLET_DESCRIPTOR); appendTextChild(servletNode, RuntimeTagNames.SERVLET_NAME, descriptor.getCanonicalName()); appendTextChild(servletNode, RuntimeTagNames.RUN_AS_PRINCIPAL_NAME, descriptor.getRunAsIdentity().getPrincipal()); return servletNode; } return null; } }
/** * The copy constructor. */ public WebComponentDescriptor(WebComponentDescriptor other) { setCanonicalName(other.getCanonicalName()); setServlet(other.isServlet()); setWebComponentImplementation( other.getWebComponentImplementation()); getInitializationParameterSet().addAll( other.getInitializationParameterSet()); getUrlPatternsSet().addAll(other.getUrlPatternsSet()); setLoadOnStartUp(other.getLoadOnStartUp()); getSecurityRoleReferenceSet().addAll( other.getSecurityRoleReferenceSet()); setRunAsIdentity(other.getRunAsIdentity()); setAsyncSupported(other.isAsyncSupported()); setMultipartConfig(other.getMultipartConfig()); setWebBundleDescriptor(other.getWebBundleDescriptor()); setConflict(other.isConflict()); }
private ObjectName registerWebModuleAndItsComponents( final ObjectName parentMBean, final MetadataImpl meta, final com.sun.enterprise.config.serverbeans.Application appConfig, final WebBundleDescriptor webBundleDescriptor ) { final String xmlDesc = getDeploymentDescriptor(webBundleDescriptor); if ( xmlDesc != null ) { meta.setDeploymentDescriptor( xmlDesc ); } final String moduleName = webBundleDescriptor.getModuleName(); final com.sun.enterprise.config.serverbeans.Module moduleConfig = getModuleConfig(appConfig, moduleName ); meta.setCorrespondingConfig(getObjectName(moduleConfig)); final ObjectName webModuleObjectName = registerJ2EEChild(parentMBean, meta, WebModule.class, WebModuleImpl.class, moduleName); meta.remove( Metadata.CORRESPONDING_CONFIG ); // none for a Servlet meta.remove( Metadata.DEPLOYMENT_DESCRIPTOR ); // none for an Servlet for (final WebComponentDescriptor desc : webBundleDescriptor.getWebComponentDescriptors()) { final String servletName = desc.getCanonicalName(); registerJ2EEChild(webModuleObjectName, meta, Servlet.class, ServletImpl.class, servletName); } return webModuleObjectName; }
webServices.hasEndpointsImplementedBy(descriptor) ) { Node servletNode = appendChild(parent, nodeName); appendTextChild(servletNode, RuntimeTagNames.SERVLET_NAME, descriptor.getCanonicalName());