@Override public String scheme() { return uri.scheme(); }
@Override public boolean canHandle(final URI uri) { String _scheme = uri.scheme(); return Objects.equal(_scheme, InMemoryURIHandler.SCHEME); }
@Override public boolean canHandle(URI uri) { return "archive".equals(uri.scheme()); }
public static boolean isClasspathUri(URI uri) { if (uri == null) return false; String scheme = uri.scheme(); return CLASSPATH_SCHEME.equals(scheme); }
@Override public boolean canHandle(URI uri) { return "archive".equals(uri.scheme()); }
/** * Does the passed URI have the form platform:/plugin/... ? * * @param uri * @return <code>true</code> if uri is platform plugin protocol. * * @since 1.0.0 */ public static boolean isPlatformPluginResourceURI(URI uri) { return JEMUtilPlugin.PLATFORM_PROTOCOL.equals(uri.scheme()) && JEMUtilPlugin.PLATFORM_PLUGIN.equals(uri.segment(0)); }
/** * Does the passed URI have the form platform:/resource/... ? * * @param uri * @return <code>true</code> if it is a platform resource protocol. * * @since 1.0.0 */ public static boolean isPlatformResourceURI(URI uri) { return JEMUtilPlugin.PLATFORM_PROTOCOL.equals(uri.scheme()) && JEMUtilPlugin.PLATFORM_RESOURCE.equals(uri.segment(0)); }
static public String EMFtoPlatform(org.eclipse.emf.common.util.URI uri) { if (!PLATFORM_SCHEMA_EMF.equals(uri.scheme())) return null; // remove all segments but first two - only need bundle/fragment name int segments = uri.segmentCount(); // segments: { "plugin", "org.eclipse.platform", "myDir", "model.e4xmi" } if (segments > 2) uri = uri.trimSegments(segments - 2); return uri.toString(); }
@Override public CDOTransferElement getElement(URI uri) { if (CDOURIUtil.PROTOCOL_NAME.equals(uri.scheme())) { return getElement(uri.path()); } return null; }
@Override public void close() { this.backend.close(); this.backend = PersistenceBackendFactoryRegistry.getFactoryProvider(uri.scheme()).createTransientBackend(); this.store = PersistenceBackendFactoryRegistry.getFactoryProvider(uri.scheme()).createTransientStore(this, backend); this.isPersistent = false; this.isLoaded = false; NeoLogger.info("{0} closed: {1}", PersistentResource.class.getSimpleName(), getURI()); }
/** * @return the URI#scheme part from the resource of the given EObject */ public String getResourceUriScheme(EObject eObject) { return eObject.eResource()!=null ? eObject.eResource().getURI().scheme() : ""; }
public boolean canHandle(URI uri) { if (CDO_URI_SCHEME.equals(uri.scheme())) { String uuid = view.getSession().getRepositoryInfo().getUUID(); return uuid.equals(CDOURIUtil.extractRepositoryUUID(uri)); } CDOViewProvider[] viewProviders = CDOViewProviderRegistry.INSTANCE.getViewProviders(uri); return viewProviders.length != 0; }
@Override public URI normalize(URI uri) { if (URIHelperConstants.PROTOCOL.equals(uri.scheme())) { String qualifiedName = uri.lastSegment(); if (qualifiedName.lastIndexOf('$') != -1) { String outermostClassName = new BinaryClass(qualifiedName, classLoader).getOutermostClassName(); return URIHelperConstants.OBJECTS_URI.appendSegment(outermostClassName); } return uri; } return existing.normalize(uri); }
public boolean canHandle(URI uri) { if (CDO_URI_SCHEME.equals(uri.scheme())) { String uuid = view.getSession().getRepositoryInfo().getUUID(); return uuid.equals(CDOURIUtil.extractRepositoryUUID(uri)); } CDOViewProvider[] viewProviders = CDOViewProviderRegistry.INSTANCE.getViewProviders(uri); return viewProviders.length != 0; }
/** * Constructs a new {@code DefaultPersistentResource} with the given {@code uri}. * * @param uri the URI of the resource */ public DefaultPersistentResource(URI uri) { super(uri); factory = BackendFactoryRegistry.getInstance().getFactoryFor(uri.scheme()); // Creates a transient backend until a call to `save()`/`load()` eStore = createTransientStore(); logState("created"); }
@Test void testCreateRemoteUriWithStringAddr() { final URI uri = factory.createRemoteUri("192.168.0.1", 1234, "test"); assertThat(uri.isHierarchical()).isTrue(); assertThat(uri.scheme()).isEqualTo(SCHEME); assertThat(uri.host()).isEqualTo("192.168.0.1"); assertThat(uri.port()).isEqualTo(Integer.toString(1234)); assertThat(uri.segments()).containsExactly("test"); }
@Test void testCreateLocalUriWithString() throws IOException { final URI uri = factory.createLocalUri(currentTempFile().getAbsolutePath()); assertThat(uri.isFile()).isTrue(); assertThat(uri.scheme()).isEqualTo(SCHEME); assertThat(new File(uri.toFileString())).isEqualTo(currentTempFile()); }
@Test void testCreateLocalUriWithFile() throws IOException { final URI uri = factory.createLocalUri(currentTempFile()); assertThat(uri.isFile()).isTrue(); assertThat(uri.scheme()).isEqualTo(SCHEME); assertThat(new File(uri.toFileString())).isEqualTo(currentTempFile()); }
@Test void testCreateLocalUriWithUri() throws IOException { final URI uri = factory.createLocalUri(URI.createFileURI(currentTempFile().getAbsolutePath())); assertThat(uri.isFile()).isTrue(); assertThat(uri.scheme()).isEqualTo(SCHEME); assertThat(new File(uri.toFileString())).isEqualTo(currentTempFile()); }