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


Java ResourceStorageLoadable类代码示例

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


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

示例1: load

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
@Override
public void load(final Map<?, ?> options) throws IOException {
  if (((((!this.isLoaded) && (!this.isLoading)) && (this.resourceStorageFacade != null)) && this.resourceStorageFacade.shouldLoadFromStorage(this))) {
    boolean _isDebugEnabled = StorageAwareResource.LOG.isDebugEnabled();
    if (_isDebugEnabled) {
      URI _uRI = this.getURI();
      String _plus = ("Loading " + _uRI);
      String _plus_1 = (_plus + " from storage.");
      StorageAwareResource.LOG.debug(_plus_1);
    }
    try {
      final ResourceStorageLoadable in = this.resourceStorageFacade.getOrCreateResourceStorageLoadable(this);
      this.loadFromStorage(in);
      return;
    } catch (final Throwable _t) {
      if (_t instanceof IOException) {
        this.contents.clear();
        this.eAdapters.clear();
        this.unload();
      } else {
        throw Exceptions.sneakyThrow(_t);
      }
    }
  }
  super.load(options);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:27,代码来源:StorageAwareResource.java

示例2: loadFromStorage

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
public void loadFromStorage(final ResourceStorageLoadable storageInputStream) throws IOException {
  if ((storageInputStream == null)) {
    throw new NullPointerException("storageInputStream");
  }
  final Stopwatches.StoppedTask task = Stopwatches.forTask("Loading from storage");
  task.start();
  this.isLoading = true;
  this.isLoadedFromStorage = true;
  try {
    storageInputStream.loadIntoResource(this);
    this.isLoaded = true;
  } finally {
    this.isLoading = false;
    task.stop();
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:StorageAwareResource.java

示例3: getOrCreateResourceStorageLoadable

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
/**
 * Finds or creates a ResourceStorageLoadable for the given resource.
 * Clients should first call shouldLoadFromStorage to check whether there exists a storage version
 * of the given resource.
 * 
 * @return an IResourceStorageLoadable
 */
@Override
public ResourceStorageLoadable getOrCreateResourceStorageLoadable(final StorageAwareResource resource) {
  try {
    final ResourceStorageProviderAdapter stateProvider = IterableExtensions.<ResourceStorageProviderAdapter>head(Iterables.<ResourceStorageProviderAdapter>filter(resource.getResourceSet().eAdapters(), ResourceStorageProviderAdapter.class));
    if ((stateProvider != null)) {
      final ResourceStorageLoadable inputStream = stateProvider.getResourceStorageLoadable(resource);
      if ((inputStream != null)) {
        return inputStream;
      }
    }
    InputStream _xifexpression = null;
    boolean _exists = resource.getResourceSet().getURIConverter().exists(this.getBinaryStorageURI(resource.getURI()), CollectionLiterals.<Object, Object>emptyMap());
    if (_exists) {
      _xifexpression = resource.getResourceSet().getURIConverter().createInputStream(this.getBinaryStorageURI(resource.getURI()));
    } else {
      InputStream _xblockexpression = null;
      {
        final AbstractFileSystemAccess2 fsa = this.getFileSystemAccess(resource);
        final String outputRelativePath = this.computeOutputPath(resource);
        _xblockexpression = fsa.readBinaryFile(outputRelativePath);
      }
      _xifexpression = _xblockexpression;
    }
    final InputStream inputStream_1 = _xifexpression;
    return this.createResourceStorageLoadable(inputStream_1);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:37,代码来源:ResourceStorageFacade.java

示例4: testPortableReferenceDescriptions

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
@Test
public void testPortableReferenceDescriptions() {
  try {
    final XtextResourceSet resourceSet = this.<XtextResourceSet>get(XtextResourceSet.class);
    Resource _createResource = resourceSet.createResource(URI.createURI("hubba:/bubba.langatestlanguage"));
    final StorageAwareResource resourceA = ((StorageAwareResource) _createResource);
    Resource _createResource_1 = resourceSet.createResource(URI.createURI("hubba:/bubba2.langatestlanguage"));
    final StorageAwareResource resourceB = ((StorageAwareResource) _createResource_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("type B");
    _builder.newLine();
    resourceB.load(this.getAsStream(_builder.toString()), null);
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import \'hubba:/bubba2.langatestlanguage\'");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("type A extends B");
    _builder_1.newLine();
    resourceA.load(this.getAsStream(_builder_1.toString()), null);
    final ByteArrayOutputStream bout = new ByteArrayOutputStream();
    final ResourceStorageWritable writable = resourceA.getResourceStorageFacade().createResourceStorageWritable(bout);
    writable.writeResource(resourceA);
    byte[] _byteArray = bout.toByteArray();
    ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_byteArray);
    final ResourceStorageLoadable loadable = resourceA.getResourceStorageFacade().createResourceStorageLoadable(_byteArrayInputStream);
    Resource _createResource_2 = resourceSet.createResource(URI.createURI("hubba:/bubba3.langatestlanguage"));
    final StorageAwareResource resourceC = ((StorageAwareResource) _createResource_2);
    resourceC.loadFromStorage(loadable);
    final IReferenceDescription refDesc = IterableExtensions.<IReferenceDescription>head(resourceC.getResourceDescription().getReferenceDescriptions());
    EObject _head = IterableExtensions.<EObject>head(resourceB.getContents());
    Assert.assertSame(IterableExtensions.<Type>head(((Main) _head).getTypes()), resourceSet.getEObject(refDesc.getTargetEObjectUri(), false));
    EObject _head_1 = IterableExtensions.<EObject>head(resourceC.getContents());
    Assert.assertSame(IterableExtensions.<Type>head(((Main) _head_1).getTypes()), resourceSet.getEObject(refDesc.getSourceEObjectUri(), false));
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:38,代码来源:PortableURIsTest.java

示例5: createResourceStorageLoadable

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
@Override
public ResourceStorageLoadable createResourceStorageLoadable(final InputStream in) {
  boolean _isStoreNodeModel = this.isStoreNodeModel();
  return new BatchLinkableResourceStorageLoadable(in, _isStoreNodeModel);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:6,代码来源:BatchLinkableResourceStorageFacade.java

示例6: getResourceStorageLoadable

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
public ResourceStorageLoadable getResourceStorageLoadable(final StorageAwareResource resource) {
  return null;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:ResourceStorageProviderAdapter.java

示例7: createResourceStorageLoadable

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
@Override
public ResourceStorageLoadable createResourceStorageLoadable(final InputStream in) {
  boolean _isStoreNodeModel = this.isStoreNodeModel();
  return new ResourceStorageLoadable(in, _isStoreNodeModel);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:6,代码来源:ResourceStorageFacade.java

示例8: createResourceStorageLoadable

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
@Override
public ResourceStorageLoadable createResourceStorageLoadable(final InputStream in) {
  return new DirectLinkingResourceStorageLoadable(in, isStoreNodeModel(), traceSet);
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:5,代码来源:DirectLinkingResourceStorageFacade.java

示例9: getOrCreateResourceStorageLoadable

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
/**
 * Finds or creates a ResourceStorageLoadable for the given resource.
 * Clients should first call shouldLoadFromStorage to check whether there exists a storage version
 * of the given resource.
 * 
 * @return an IResourceStorageLoadable
 */
public abstract ResourceStorageLoadable getOrCreateResourceStorageLoadable(final StorageAwareResource resource);
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:IResourceStorageFacade.java

示例10: createResourceStorageLoadable

import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable; //导入依赖的package包/类
/**
 * Creates a fresh ResourceStorageLoadable wrapping the given InputStream
 */
public abstract ResourceStorageLoadable createResourceStorageLoadable(final InputStream inputStream);
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:IResourceStorageFacade.java


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