protected static IModule getModuleProject(IProject project, Iterator iterator) { IModule deployable = null; while (iterator.hasNext()) { Object next = iterator.next(); if (next instanceof IModule) { deployable = (IModule) next; if (deployable.getProject().equals(project)) return deployable; } } return null; }
/** * Creates a cloud module that has a corresponding local module. This should * be used if there is an accessible workspace project for the deployed app * (the presence of an IModule would indicate a possible accessible * workspace resource for the application). * @param module local module from the WST server. Must not be null. * @param deployedApplicationName name of the deployed application. It may * not match the local workspace project name, as users are allowed to * specify a different deployment name when pushing an application. Must not * be null * @param server. Must not be null. */ public CloudFoundryApplicationModule(IModule module, String deployedApplicationName, IServer server) { this(module, deployedApplicationName, module.getName(), server); }
/** * Scans the module using the specified visitor. * * @param module module to traverse * @param visitor visitor to handle resources * @param monitor a progress monitor * @throws CoreException */ public static void traverse(IModule module, IModuleVisitor visitor, IProgressMonitor monitor) throws CoreException { if (module == null || module.getModuleType() == null) return; String typeId = module.getModuleType().getId(); IVirtualComponent component = ComponentCore.createComponent(module.getProject()); if (component == null) { // can happen if project has been closed Trace.trace(Trace.WARNING, "Unable to create component for module " + module.getName()); return; } if (EAR_MODULE.equals(typeId)) { traverseEarComponent(component, visitor, monitor); } else if (WEB_MODULE.equals(typeId)) { traverseWebComponent(component, visitor, monitor); } }
public static IWebModule getWebModule(IModule[] modules) { IModuleType moduleType = modules[0].getModuleType(); if (modules.length == 1 && moduleType != null && "jst.web".equals(moduleType.getId())) { //$NON-NLS-1$ return (IWebModule) modules[0].loadAdapter(IWebModule.class, null); } return null; }
/** * * @param module corresponding the the application that needs to be * published. * @param resources to publish to the CF server. * @throws CoreException if resources is null or empty. There must be at * least one resource to archive and publish to the CF server. */ public ModuleResourceApplicationArchive(IModule module, List<IModuleResource> resources) throws CoreException { super(module, resources); if (resources == null || resources.isEmpty()) { throw new CoreException( CloudFoundryPlugin.getErrorStatus(NLS.bind(Messages.ModuleResourceApplicationArchive_ERROR_NO_DEPLOYABLE_RES_FOUND, module.getName(), module.getId()))); } }
protected static IModuleArtifact createModuleObject(IModule module, String ejbName, boolean remote, boolean local) { if (module != null) { String jndiName = null; if (ejbName != null) { module.loadAdapter(ModuleDelegate.class, new NullProgressMonitor()); J2EEFlexProjDeployable moduleDelegate = (J2EEFlexProjDeployable)module.getAdapter(ModuleDelegate.class); jndiName = moduleDelegate.getJNDIName(ejbName); return new EJBBean(module, jndiName, remote, local); } return new NullModuleArtifact(module); } return null; }
private String getContainedURI(IModule module) { if (component instanceof J2EEModuleVirtualArchiveComponent || isBinaryModuleArchive(module)) return new Path(module.getName()).lastSegment(); IVirtualComponent comp = ComponentCore.createComponent(module.getProject()); String aURI = null; if (comp!=null && component!=null && J2EEProjectUtilities.isEARProject(component.getProject())) { EARArtifactEdit earEdit = null; try { earEdit = EARArtifactEdit.getEARArtifactEditForRead(component); if (earEdit != null) aURI = earEdit.getModuleURI(comp); } catch (Exception e) { e.printStackTrace(); } finally { if (earEdit != null) earEdit.dispose(); } } if (aURI !=null && aURI.length()>1 && aURI.startsWith("/")) //$NON-NLS-1$ aURI = aURI.substring(1); return aURI; }
/** * @see ITomcatVersionHandler#canAddModule(IModule) */ public IStatus canAddModule(IModule module) { String version = module.getModuleType().getVersion(); if ("2.2".equals(version) || "2.3".equals(version)) return Status.OK_STATUS; return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorSpec40, null); }
for (int i = 0; i < size; i++) { IModule module3 = add[i]; IWebModule module = (IWebModule) module3.loadAdapter(IWebModule.class, monitor); String contextRoot = module.getContextRoot(); if (contextRoot != null && !contextRoot.startsWith("/") && contextRoot.length() > 0) contextRoot = "/" + contextRoot; String docBase = config.getDocBasePrefix() + module3.getName(); WebModule module2 = new WebModule(contextRoot, docBase, module3.getId(), true); config.addWebModule(-1, module2); for (int j = 0; j < size2; j++) { IModule module3 = remove[j]; String memento = module3.getId(); List modules = getTomcatConfiguration().getWebModules(); int size = modules.size();
if (!ApplicationRegistry.isSupportedModule(module)) { return new Status(IStatus.ERROR, CloudFoundryPlugin.PLUGIN_ID, 0, NLS.bind( Messages.CloudFoundryServer_ERROR_APPTYPE_NOT_SUPPORTED, module.getModuleType().getId()), null); if (module.getProject() != null && !ignoreFacetCheck) { status = FacetUtil.verifyFacets(module.getProject(), getServer()); if (status != null && !status.isOK()) { return status;
toRemove[0] = new DeletedModule(originalModule.getId(), originalModule.getName(), originalModule.getModuleType()); final IModuleType moduleType = newModule.getModuleType(); ((Module) newModule).getModuleFactory().getModules(); newModule = new Module(((Module) newModule).getModuleFactory(), newProject.getName(), newProject.getName(), moduleType.getId(),
File targetFile = new File(tempFile, modules[0].getName() + ".war"); //$NON-NLS-1$ targetFile.deleteOnExit(); PublishHelper helper = new PublishHelper(tempFile); childUri = webModule.getURI(child); IJ2EEModule childModule = (IJ2EEModule) child.loadAdapter(IJ2EEModule.class, monitor); boolean isBinary = false; if (childModule != null) { childUri = "WEB-INF/lib/" + child.getName(); //$NON-NLS-1$ childUri = "WEB-INF/lib/" + child.getName() + ".jar"; //$NON-NLS-1$ //$NON-NLS-2$ new Path(targetFile.getAbsolutePath()), monitor); merge(result, status); throwException(result, "Publishing of " + modules[0].getName() + " failed"); //$NON-NLS-1$ //$NON-NLS-2$
label.setLayoutData(data); } else { IModuleType mt = module.getModuleType(); if (mt != null) { Label label = new Label(composite, SWT.NONE); data.verticalIndent = 5; moduleKind.setLayoutData(data); moduleKind.setText(module.getName() + " (" + mt.getName() + ")");
public static IJ2EEModule getModuleDelegate(IModule module) { return (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null); }
/** * Returns the given module from the config. * * @param module a web module * @return a web module */ protected WebModule getWebModule(IModule module) { if (module == null) return null; String memento = module.getId(); List modules = getWebModules(); int size = modules.size(); for (int i = 0; i < size; i++) { WebModule webModule = (WebModule) modules.get(i); if (memento.equals(webModule.getMemento())) { return webModule; } } return null; }
public Color getForeground(Object element) { if (element instanceof ModuleServer) { ModuleServer ms = (ModuleServer)element; IModule module = ms.module[0]; if (module.isExternal()) { Color c = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY); return c; } } return null; } }
IProject project = module.getProject(); Object remoteProjectObj = getRemotingProject.invoke(null, project); if (remoteProjectObj != null .toCoreException("No Cloud application deployment URL found for " + module.getName() + ". Unable to automatically set a deployment URL in JRebel remoting."); //$NON-NLS-1$ //$NON-NLS-2$
synchronized CloudFoundryApplicationModule getExistingCloudModule(IModule module) { if (module == null) { return null; } // See if the cloud module for the given local IModule has been // created. CloudFoundryApplicationModule appModule = getCloudModuleToLocalModuleName(module.getName()); if (appModule != null) { return appModule; } // Otherwise check if there is a mapping between the IModule ID and // the deployed application name, and // search for a cloud module that matches the deployed application // name String deployedAppName = getLocalModuleToCloudModuleMapping().get(module.getId()); if (deployedAppName != null) { appModule = getCloudModuleByDeployedAppName(deployedAppName); if (appModule != null) { return appModule; } // If not available, it means it needs to be created below. } return null; }
/** * @see ITomcatVersionHandler#canAddModule(IModule) */ public IStatus canAddModule(IModule module) { if ("2.2".equals(module.getModuleType().getVersion())) return Status.OK_STATUS; return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorSpec32, null); }
for (int i = 0; i < size; i++) { IModule module = add[i]; if (!"jst.web".equals(module.getModuleType().getId())) return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorWebModulesOnly, null); return status; if (module.getProject() != null) { status = FacetUtil.verifyFacets(module.getProject(), getServer()); if (status != null && !status.isOK()) return status;