当前位置: 首页>>代码示例>>Java>>正文


Java IModule类代码示例

本文整理汇总了Java中org.eclipse.wst.server.core.IModule的典型用法代码示例。如果您正苦于以下问题:Java IModule类的具体用法?Java IModule怎么用?Java IModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IModule类属于org.eclipse.wst.server.core包,在下文中一共展示了IModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCheckConflictingId_defaultServiceIds

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
@Test
public void testCheckConflictingId_defaultServiceIds() throws CoreException {
  delegate = getDelegateWithServer();
  delegate.serviceIdFunction = new Function<IModule, String>() {
    @Override
    public String apply(IModule module) {
      return "default";
    }
  };

  Assert.assertEquals(Status.ERROR, delegate.checkConflictingServiceIds(new IModule[] {module1},
      new IModule[] {module2}, null).getSeverity());

  // should be ok if we remove module1 and add module2
  Assert.assertEquals(Status.OK, delegate.checkConflictingServiceIds(new IModule[] {module1},
      new IModule[] {module2}, new IModule[] {module1}).getSeverity());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:18,代码来源:LocalAppEngineServerDelegateTest.java

示例2: testCheckConflictingId_deletedModules

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
@Test
public void testCheckConflictingId_deletedModules() throws CoreException {
  delegate = getDelegateWithServer();
  delegate.serviceIdFunction = new ModuleNameFunction();
  when(module1.exists()).thenReturn(false);
  IStatus status;

  // it should be ok when we currently have a deleted module
  status = delegate.checkConflictingServiceIds(new IModule[] {module1}, null, null);
  Assert.assertEquals(Status.OK, status.getSeverity());

  // it should be an error to add a deleted module
  status = delegate.checkConflictingServiceIds(new IModule[0], new IModule[] {module1}, null);
  Assert.assertEquals(Status.ERROR, status.getSeverity());

  // it should be ok to remove a deleted module
  status = delegate.checkConflictingServiceIds(new IModule[0], null, new IModule[] {module1});
  Assert.assertEquals(Status.OK, status.getSeverity());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:20,代码来源:LocalAppEngineServerDelegateTest.java

示例3: testGetChildModules_webModuleType

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
@Test
public void testGetChildModules_webModuleType() {
  IModuleType webModuleType = ModuleType.getModuleType("jst.web", "1.0");
  when(module1.getModuleType()).thenReturn(webModuleType);
  when(module1.getId()).thenReturn("module1");
  when(module1.loadAdapter(IWebModule.class, null)).thenReturn(webModule1);
  when(webModule1.getModules()).thenReturn(new IModule[] {module2});
  when(module2.getModuleType()).thenReturn(webModuleType);
  when(module2.getId()).thenReturn("module2");
  when(module2.loadAdapter(IWebModule.class, null)).thenReturn(webModule2);
  when(webModule2.getModules()).thenReturn(new IModule[] {module3});
  when(module3.getModuleType()).thenReturn(webModuleType);
  when(module3.getId()).thenReturn("module3");

  IModule[] childModules;
  childModules = delegate.getChildModules(new IModule[] {module1});
  Assert.assertEquals(1, childModules.length);
  Assert.assertEquals("module2", childModules[0].getId());

  childModules = delegate.getChildModules(new IModule[] {module1, module2});
  Assert.assertEquals(1, childModules.length);
  Assert.assertEquals("module3", childModules[0].getId());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:LocalAppEngineServerDelegateTest.java

示例4: testGetAllModules_multi

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
@Test
public void testGetAllModules_multi() {
  Mockito.when(server.getModules()).thenReturn(new IModule[] {module1});
  Mockito.when(server.getChildModules(any(IModule[].class), any(IProgressMonitor.class)))
      .thenReturn(new IModule[0]);

  Mockito.when(server.getChildModules(AdditionalMatchers.aryEq(new IModule[] {module1}),
      any(IProgressMonitor.class))).thenReturn(new IModule[] {module2a, module2b});

  Mockito.when(server.getChildModules(AdditionalMatchers.aryEq(new IModule[] {module1, module2b}),
      any(IProgressMonitor.class))).thenReturn(new IModule[] {module3});

  IModule[] result = ModuleUtils.getAllModules(server);
  Assert.assertNotNull(result);
  Assert.assertEquals(4, result.length);
  Assert.assertThat(result,
      IsArrayContainingInOrder.arrayContaining(module1, module2a, module2b, module3));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:ModuleUtilsGetAllModulesTest.java

示例5: setUp

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
@Before
public void setUp() {
  handler = new LaunchHelper() {
    @Override
    protected void launch(IServer server, String launchMode, SubMonitor progress)
        throws CoreException {
      // do nothing
    }


    @Override
    public Collection<IServer> findExistingServers(IModule[] modules, boolean exact,
        SubMonitor progress) {
      if (serverToReturn != null) {
        return Collections.singleton(serverToReturn);
      }
      return super.findExistingServers(modules, exact, progress);
    }
  };
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:21,代码来源:LaunchHelperTest.java

示例6: getTasks

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public PublishOperation[] getTasks(IServer server, int kind, List/* <IModule[]> */ modules,
    List/* <Integer> */ kindList) {
  if (modules == null || modules.isEmpty()) {
    return null;
  }

  LocalAppEngineServerBehaviour gaeServer =
      (LocalAppEngineServerBehaviour) server.loadAdapter(LocalAppEngineServerBehaviour.class, null);

  List<PublishOperation> tasks = Lists.newArrayList();
  for (int i = 0; i < modules.size(); i++) {
    IModule[] module = (IModule[]) modules.get(i);
    tasks.add(new LocalAppEnginePublishOperation(gaeServer, kind, module, (Integer) kindList.get(i)));
  }

  return tasks.toArray(new PublishOperation[tasks.size()]);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:20,代码来源:LocalAppEnginePublishTaskDelegate.java

示例7: checkProjectFacets

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
/**
 * Check that the associated projects support the App Engine runtime.
 */
@VisibleForTesting
IStatus checkProjectFacets(IModule[] toBeAdded) {
  if (toBeAdded != null) {
    for (IModule module : toBeAdded) {
      if (!module.exists()) {
        return StatusUtil.error(this, Messages.getString("deleted.project", module.getName())); //$NON-NLS-1$
      }
      if (module.getProject() != null) {
        IStatus supportedFacets = FacetUtil.verifyFacets(module.getProject(), getServer());
        if (supportedFacets != null && !supportedFacets.isOK()) {
          return supportedFacets;
        }
        IStatus appEngineStandardFacetPresent = hasAppEngineStandardFacet(module);
        if (appEngineStandardFacetPresent != null && !appEngineStandardFacetPresent.isOK()) {
          return appEngineStandardFacetPresent;
        }
      }
    }
  }
  return Status.OK_STATUS;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:25,代码来源:LocalAppEngineServerDelegate.java

示例8: getChildModules

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
/**
 * If the module is a web module returns the utility modules contained within its WAR, otherwise
 * returns an empty list.
 *
 * @param module the module path traversed to this point
 */
@Override
public IModule[] getChildModules(IModule[] module) {
  if (module == null || module.length == 0) {
    return EMPTY_MODULES;
  }
  IModule thisModule = module[module.length - 1];
  if (thisModule != null && thisModule.getModuleType() != null) {
    IModuleType moduleType = thisModule.getModuleType();
    if (moduleType != null && SERVLET_MODULE_FACET.equals(moduleType.getId())) {
      IWebModule webModule = (IWebModule) thisModule.loadAdapter(IWebModule.class, null);
      if (webModule != null) {
        IModule[] modules = webModule.getModules();
        return modules;
      }
    }
  }
  return EMPTY_MODULES;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:25,代码来源:LocalAppEngineServerDelegate.java

示例9: getModuleRootURL

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
@Override
public URL getModuleRootURL(IModule module) {
  // use getAdapter() to avoid unnecessarily loading the class (e.g., not started yet)
  LocalAppEngineServerBehaviour serverBehaviour =
      getServer().getAdapter(LocalAppEngineServerBehaviour.class);
  if (serverBehaviour == null) {
    return null;
  }
  try {
    String url;
    if (module == null) {
      url = "http://" + getServer().getHost() + ":" + serverBehaviour.getAdminPort(); //$NON-NLS-1$ //$NON-NLS-2$
    } else {
      String serviceId = getServiceId(module); // never null
      url = serverBehaviour.getServiceUrl(serviceId);
    }
    return new URL(url);
  } catch (MalformedURLException ex) {
    logger.log(Level.WARNING, "Generated invalid URL", ex); //$NON-NLS-1$
    return null;
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:23,代码来源:LocalAppEngineServerDelegate.java

示例10: getLaunchConfigurations

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
/**
 * Find any applicable launch configurations.
 */
private ILaunchConfiguration[] getLaunchConfigurations(IModule[] modules) {
  // First check if there's a server with exactly these modules
  Collection<IServer> servers = launcher.findExistingServers(modules, /* exact */ true, null);
  if (servers.isEmpty()) {
    // otherwise check if there's a server with at least these modules
    servers = launcher.findExistingServers(modules, /* exact */ false, null);
  }
  Collection<ILaunchConfiguration> launchConfigs = new ArrayList<>();
  for (IServer server : servers) {
    // Could filter out running servers, but then more servers are created
    try {
      ILaunchConfiguration launchConfig = server.getLaunchConfiguration(false, null);
      if (launchConfig != null) {
        launchConfigs.add(launchConfig);
      }
    } catch (CoreException ex) {
      /* ignore */
    }
  }
  return launchConfigs.toArray(new ILaunchConfiguration[launchConfigs.size()]);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:25,代码来源:LocalAppEngineStandardLaunchShortcut.java

示例11: asModule

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
private IModule asModule(Object object) throws CoreException {
  IModule module = AdapterUtil.adapt(object, IModule.class);
  if (module != null) {
    return module;
  }
  IProject project = toProject(object);
  if (project != null) {
    module = ServerUtil.getModule(project);
    if (module != null) {
      return module;
    }
  }
  logger.warning("Unable to map to a module: " + object);
  throw new CoreException(
      StatusUtil.error(this, Messages.getString("CANNOT_DETERMINE_EXECUTION_CONTEXT"))); //$NON-NLS-1$
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:17,代码来源:LaunchHelper.java

示例12: refreshForDeploymentChange

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
public BehaviourOperation refreshForDeploymentChange(final IModule module) {
		return new BehaviourOperation(behaviour, module) {

			@Override
			public void run(IProgressMonitor monitor) throws CoreException {

				if (module == null) {
					throw CloudErrorUtil.toCoreException("Internal Error: No module to refresh in - " + //$NON-NLS-1$
							getBehaviour().getCloudFoundryServer().getServerId());
				}

//				getBehaviour().updateCloudModuleWithInstances(module, monitor);
				ServerEventHandler.getDefault().fireAppDeploymentChanged(behaviour.getCloudFoundryServer(), module);
			}
		};
	}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:17,代码来源:CloudBehaviourOperations.java

示例13: getModules

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
/**
 * Get the modules added in the server.
 * 
 * @return
 */
public static IModule[] getModules(IServer server) {
  // Multi-module project
  IModule[] modules = server.getChildModules(server.getModules(), new NullProgressMonitor());
  if (modules == null || modules.length == 0) { // does it have multi-modules?
    // So it doesn't have multi-modules, lets use the root as the module.
    modules = server.getModules();
  }

  // Just in case
  if (modules == null || modules.length == 0) {
    GwtWtpPlugin.logMessage(
        "Could not find GWT Faceted project from the Server runtime. Add a GWT Facet to the server modules.");
    return null;
  }

  return modules;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:23,代码来源:GwtFacetUtils.java

示例14: moduleListToString

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
/** Convert an array of modules to a String for debugging.*/
private static String moduleListToString(IModule[] module) {
	String moduleStr = "{ ";
	if(module != null) {
		for(int x = 0; x < module.length; x++) {
			IModule currModule = module[x];
			
			if(currModule == null) { continue; } 
			
			moduleStr += currModule.getName()+" ["+currModule.getId()+"/"+(currModule.getModuleType() != null ? currModule.getModuleType().getId() : "")  +"]";
			
			if(x+1 < module.length) {
				moduleStr += ", ";
			}
		}
	}
	moduleStr = moduleStr.trim() + "}";
	
	return moduleStr;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:21,代码来源:CloudFoundryServer.java

示例15: assertApplicationIsDeployed

import org.eclipse.wst.server.core.IModule; //导入依赖的package包/类
/**
 * Asserts that the application is deployed although it may not necessarily
 * be started.
 * @param appName
 * @return
 * @throws Exception
 */
protected CloudFoundryApplicationModule assertApplicationIsDeployed(String appName, IProject project)
		throws Exception {
	// Get the local WST IModule. NOTE that the PROJECT name needs to be
	// used as opposed to the
	// app name, as the project name and app name may differ, and the
	// IModule is mapped to the project.
	IModule module = getWstModule(project.getName());

	// Once the application is started, verify that the Cloud module is
	// valid,
	// and mapped to
	// an actual CloudApplication representing the deployed application.
	CloudFoundryApplicationModule appModule = assertCloudFoundryModuleExists(module, appName);

	assertNotNull("No Cloud Application mapping in Cloud module. Failed to refresh deployed application",
			appModule.getApplication());

	return appModule;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:27,代码来源:AbstractCloudFoundryTest.java


注:本文中的org.eclipse.wst.server.core.IModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。