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


Java URI.createURI方法代码示例

本文整理汇总了Java中org.eclipse.emf.common.util.URI.createURI方法的典型用法代码示例。如果您正苦于以下问题:Java URI.createURI方法的具体用法?Java URI.createURI怎么用?Java URI.createURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.common.util.URI的用法示例。


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

示例1: loadPackage

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded) return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	}
	catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
	createResource(eNS_URI);
}
 
开发者ID:georghinkel,项目名称:ttc2017smartGrids,代码行数:26,代码来源:GluemodelPackageImpl.java

示例2: resolve

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public URI resolve(URI uri) {
	URI resolvedURI = super.resolve(uri);
	if (!_queryParameters.isEmpty() && resolvedURI.scheme() != null && !resolvedURI.scheme().equals("melange")
			&& resolvedURI.fileExtension() != null && resolvedURI.fileExtension().equals(_fileExtension)) {

		String fileExtensionWithPoint = "." + _fileExtension;
		int lastIndexOfFileExtension = resolvedURI.toString().lastIndexOf(fileExtensionWithPoint);
		String part1 = resolvedURI.toString().substring(0, lastIndexOfFileExtension);
		part1 = part1.replaceFirst("platform:/", "melange:/");
		String part2 = fileExtensionWithPoint + _queryParameters;
		String part3 = resolvedURI.toString()
				.substring(lastIndexOfFileExtension + fileExtensionWithPoint.length());
		String newURIAsString = part1 + part2 + part3;
		return URI.createURI(newURIAsString);
	}
	return resolvedURI;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:19,代码来源:DefaultModelLoader.java

示例3: loadPackage

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded)
		return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	} catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
	createResource(eNS_URI);
}
 
开发者ID:SvenPeldszus,项目名称:rgse.ttc17.emoflon.tgg,代码行数:26,代码来源:Task2PackageImpl.java

示例4: testTestTreeClone

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/***/
@Test
public void testTestTreeClone() throws Exception {
	final List<TestSuite> originalTestSuites = newArrayList();
	final TestSuite originalTestSuite = new TestSuite("name");
	final TestCase originalTestCase = new TestCase(new ID("testId"), "testId", "testId", "testId", "testId",
			URI.createURI("testURI_testId"));
	originalTestSuite.add(originalTestCase);
	originalTestSuites.add(originalTestSuite);
	final TestTree originalTestTree = new TestTree(new ID("value"), originalTestSuites);
	final TestTree copyTestTree = originalTestTree.clone();
	assertEquals(originalTestTree, copyTestTree);
	assertFalse(originalTestTree == copyTestTree);
	assertFalse(originalTestSuites == copyTestTree.getSuites());
	assertFalse(originalTestSuite == getOnlyElement(copyTestTree.getSuites()));
	assertEquals(originalTestCase, getOnlyElement(getOnlyElement(copyTestTree.getSuites())
			.getTestCases()));
	assertFalse(originalTestCase == getOnlyElement(getOnlyElement(copyTestTree.getSuites())
			.getTestCases()));
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:TesterDomainTest.java

示例5: tckParse

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
public void tckParse(final File f, final Boolean valid, final String description) throws IOException, TckParseException {
    final URI fileURI = URI.createURI(f.toURI().toString());
    try {
        final RamlModelResult<EObject> result = new RamlModelBuilder().build(fileURI);
        if (valid) {
            assertThat(result.getValidationResults())
                    .describedAs(fileURI.toFileString().replace(tckURL.getPath(), "") + "(" + f.getName() + ":0) " + description)
                    .isEmpty();
        } else {
            assertThat(result.getValidationResults())
                    .describedAs(fileURI.toFileString().replace(tckURL.getPath(), "") + "(" + f.getName() + ":0) " + description)
                    .isNotEmpty();
        }
    } catch (Throwable e) {
        throw new TckParseException(f.toString() + "(" + f.getName() + ":0)", e);
    }
}
 
开发者ID:vrapio,项目名称:rest-modeling-framework,代码行数:18,代码来源:RamlTck2Test.java

示例6: api

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Ignore
@Test
public void api() {
    final File apiFile = new File("/Users/mkoester/Development/commercetools-api-reference/api.raml");
    assumeTrue(apiFile.exists());

    final URI apiUri = URI.createURI(apiFile.toURI().toString());
    final URIConverter uriConverter = new RamlResourceSet().getURIConverter();
    final RAMLCustomLexer lexer = new RAMLCustomLexer(apiUri, uriConverter);
    final TokenStream tokenStream = new CommonTokenStream(lexer);

    final RAMLParser parser = new RAMLParser(tokenStream);
    final Resource resource = new RamlResourceSet().createResource(apiUri);

    final Scope scope = Scope.of(resource);
    final TypeDeclarationResolver resolver = new TypeDeclarationResolver();
    resolver.resolve(parser.api(), scope);

    assertThat(resource.getErrors()).isEmpty();
}
 
开发者ID:vrapio,项目名称:rest-modeling-framework,代码行数:21,代码来源:TypeDeclarationResolverTest.java

示例7: registerProject

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
 *
 * @param location
 *            project directory containing manifest.n4mf directly
 */
public void registerProject(URI location) {
	if (location.lastSegment().isEmpty()) {
		throw new IllegalArgumentException("lastSegment may not be empty");
	}

	if (!projectElementHandles.containsKey(location)) {
		LazyProjectDescriptionHandle lazyDescriptionHandle = createLazyDescriptionHandle(location, false);
		projectElementHandles.put(location, lazyDescriptionHandle);
		for (String libraryPath : lazyDescriptionHandle.createProjectElementHandle().getLibraryPaths()) {
			URI libraryFolder = location.appendSegment(libraryPath);
			File lib = new File(java.net.URI.create(libraryFolder.toString()));
			if (lib.isDirectory()) {
				for (File archive : lib.listFiles()) {
					if (archive.getName().endsWith(IN4JSArchive.NFAR_FILE_EXTENSION_WITH_DOT)) {
						URI archiveLocation = URI.createURI(archive.toURI().toString());
						projectElementHandles.put(archiveLocation,
								createLazyDescriptionHandle(archiveLocation, true));
					}
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:29,代码来源:FileBasedWorkspace.java

示例8: tckTest

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Test
@UseDataProvider("allTckApiRamlFiles")
public void tckTest(final File f) throws IOException, TckParseException  {
    final Resource resource;
    final URI fileURI = URI.createURI(f.toURI().toString());
    try {
        resource = fromUri(fileURI);
    } catch (Exception e) {
        throw new TckParseException(fileURI.toString(), e);
    }
    if (!resource.getErrors().isEmpty()) {
        String file = fileURI.toString();
        System.out.println(file);
    }
}
 
开发者ID:vrapio,项目名称:rest-modeling-framework,代码行数:16,代码来源:RamlTckTest.java

示例9: findArtifactInFolder

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public URI findArtifactInFolder(URI folderLocation, String folderRelativePath) {
	final Path sourceContainerDirectory = Paths.get(java.net.URI.create(folderLocation.toString()));
	final Path subPath = Paths.get(folderRelativePath.replace("/", File.separator));
	final File file = sourceContainerDirectory.resolve(subPath).toFile().getAbsoluteFile();
	if (file.exists())
		return URI.createURI(file.toURI().toString());
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:FileBasedWorkspace.java

示例10: testArchiveURIForZipEntry

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@SuppressWarnings("javadoc")
@Test
public void testArchiveURIForZipEntry() {
	ZipEntry entry = new ZipEntry("a/b/c.js");
	URI base = URI.createURI("file:/a/b/c.nfar");
	URI manifestURI = ArchiveURIUtil.createURI(base, entry);
	Assert.assertEquals("archive:file:/a/b/c.nfar!/a/b/c.js", manifestURI.toString());
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:ArchiveURIUtilTest.java

示例11: test

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
 * generated instances of the tests will use this base implementation
 */
@Override
@Test
public void test() throws Exception {
	if (this.parserN4JS == null) {
		throw new Error("parser instance is null");
	}

	String code = TestCodeProvider.getContentsFromFileEntry(config.entry, config.resourceName);
	if (code == null) {
		throw new Error("test data code instance is null");
	}

	Analyser analyser = createAnalyzer(code);
	XtextResourceSet resourceSet = resourceSetProvider.get();
	URI uri = URI.createURI(config.entry.getName());
	// ECMA 6 test suite was changed - "use strict" is synthesized by the test runner
	// we do the same here
	if (code.contains("flags: [onlyStrict]")) {
		// by using the proper file extension
		uri = uri.trimFileExtension().appendFileExtension("n4js");
	}
	Script script = doParse(code, uri, resourceSet, analyser);
	if (config.isValidator()) {
		// validation flag is bogus since it will produce linking issues
		// thus the negative tests will likely succeed for bogus reasons
		throw new IllegalStateException(config.entry.getName());
	}
	// try {
	analyser.analyse(script, config.entry.getName(), code);
	// } catch (AssertionError e) {
	// System.out.println(config.entry.getName());
	// throw e;
	// }
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:38,代码来源:ECMA6TestSuite.java

示例12: apiViaHttp

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Ignore
@Test
public void apiViaHttp() {
    final URI uri = URI.createURI("http://localhost:5050/api-raml/");
    final Resource resource = fromUri(uri);
    resource.getContents();
    assertThat(resource).isNotNull();
}
 
开发者ID:vrapio,项目名称:rest-modeling-framework,代码行数:9,代码来源:RamlResourceTest.java

示例13: setUp

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Before
public void setUp() throws IOException {
    uri = URI.createURI("file://tmp/");
    resource = new SharedResource(uri);
    //this.write(resource);

}
 
开发者ID:sunye,项目名称:model-consistency,代码行数:8,代码来源:SharedResourceTest.java

示例14: relative

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
public String relative ( String base, String uri )
{
	URI baseUri = URI.createURI(base);
	return URI.createURI(uri).deresolve(baseUri,false,true,false).toString();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:6,代码来源:Helper.java

示例15: getResource

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
public static Resource getResource(IFile file) {
	URI uri = URI.createURI(file.getLocationURI().toString());
	return getResource(uri);
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:5,代码来源:EMFResource.java


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