Codota Logo
ResourceRepository.add
Code IndexAdd Codota to your IDE (free)

How to use
add
method
in
org.ldp4j.application.kernel.resource.ResourceRepository

Best Java code snippets using org.ldp4j.application.kernel.resource.ResourceRepository.add (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: ldp4j/ldp4j

  @Override
  public void execute(ResourceRepository sut) {
    sut.add(resource);
    sut.add(container);
  }
}
origin: ldp4j/ldp4j

private void createResource(final Resource resource, final Date lastModified, final String relativePath, final URI indirectId) {
  try {
    resource.setIndirectId(indirectId);
    this.resourceRepository.add(resource);
    final Endpoint newEndpoint=
      this.endpointManagementService.
        createEndpointForResource(
          resource,
          relativePath,
          generateEntityTag(resource),
          lastModified);
    if(LOGGER.isTraceEnabled()) {
      LOGGER.trace("Created "+resource);
      LOGGER.trace("Created "+newEndpoint);
    }
  } catch (final EndpointCreationException e) {
    throw new IllegalStateException(e);
  }
}
origin: ldp4j/ldp4j

@Test
public void testPublishResource$preexisting$noClash() throws ApplicationConfigurationException {
  this.endpointRepository.add(this.endpoint);
  this.resourceRepository.add(this.resource);
  this.sut.publishResource(NAME1,PersonHandler.class,VALID_PATH);
  this.sut.configureRootResources();
  Resource resource1 = verifyResource(NAME1, PersonHandler.class);
  assertThat(resource1,sameInstance(this.resource));
  Endpoint endpoint1 = verifyEndpoint(VALID_PATH, resource1);
  assertThat(endpoint1,sameInstance(this.endpoint));
}
origin: ldp4j/ldp4j

@Test
public void testPublishResource$preexisting$idClash() throws ApplicationConfigurationException {
  this.endpointRepository.add(this.endpoint);
  this.resourceRepository.add(this.resource);
  this.sut.publishResource(NAME1,PersonHandler.class,"anotherPath/");
  try {
    this.sut.configureRootResources();
    fail("Should not allow publishing root resources with preexisting id clash");
  } catch (ApplicationConfigurationException e) {
    logFailure(e);
  }
}
origin: ldp4j/ldp4j

private void publish(RootResource rootResource, Date creationDate) throws ApplicationConfigurationException {
  ResourceId resourceId = rootResource.resourceId();
  String path = rootResource.path();
  Resource prevResource = this.resourceRepository.resourceById(resourceId,Resource.class);
  Endpoint prevEndpoint = this.endpointRepository.endpointOfPath(path);
  if(prevEndpoint!=null && !prevEndpoint.resourceId().equals(resourceId)) {
    throw new ApplicationConfigurationException(String.format("Resource %s cannot be published at '%s' as that path is already in use by a resource %s",toString(resourceId),path,toString(prevEndpoint.resourceId())));
  }
  if(prevEndpoint==null) {
    if(prevResource!=null) {
      throw new ApplicationConfigurationException(String.format("Resource %s cannot be published at '%s' as it is already published at '%s'",toString(resourceId),path,this.endpointRepository.endpointOfResource(resourceId).path()));
    } else {
      Resource resource=this.modelFactory.createResource(rootResource.template(),rootResource.name());
      this.resourceRepository.add(resource);
      Endpoint endpoint=this.modelFactory.createEndpoint(path,resource,creationDate,EntityTag.createStrong(path));
      this.endpointRepository.add(endpoint);
    }
  }
}
origin: ldp4j/ldp4j

@Test
public void testPublishResource$preexisting$pathClash() throws ApplicationConfigurationException {
  this.endpointRepository.add(this.endpoint);
  this.resourceRepository.add(this.resource);
  this.sut.publishResource(NAME2,PersonHandler.class,VALID_PATH);
  try {
    this.sut.configureRootResources();
    fail("Should not allow publishing root resources with preexisting path clash");
  } catch (ApplicationConfigurationException e) {
    logFailure(e);
  }
}
origin: ldp4j/ldp4j

  @Override
  public void execute(ResourceRepository sut) {
    Resource result1 = sut.resourceOfId(resourceId);
    debug("Retrieving resource {%s}: %s",resourceId,result1);
    Resource attachment = result1.attach(PersonHandler.ADDRESS_ID,attachmentId);
    sut.add(attachment);
    debug("Created attachment: %s",attachment);
    Container result2 = sut.containerOfId(containerId);
    debug("Retrieving container {%s}: %s",containerId,result2);
    Slug slug1=result2.addSlug("test");
    debug("Created slug: %s",slug1);
    Slug slug2=result2.addSlug("anotherTest");
    debug("Created slug: %s",slug2);
    Resource member = result2.addMember(memberId);
    sut.add(member);
    debug("Created member: %s",member);
  }
}
origin: ldp4j/ldp4j

private <T extends Resource> T publishResource(Class<? extends T> clazz, String templateId, Name<?> resourceName, String path) {
  Transaction transaction = RuntimeDelegate.getInstance().getTransactionManager().currentTransaction();
  transaction.begin();
  Resource newResource=this.modelFactory.createResource(this.tms.templateOfId(templateId),resourceName);
  T resource=clazz.cast(newResource);
  RuntimeDelegate.getInstance().getResourceRepository().add(resource);
  Endpoint endpoint=this.modelFactory.createEndpoint(path,resource,new Date(),EntityTag.createStrong(path));
  RuntimeDelegate.getInstance().getEndpointRepository().add(endpoint);
  transaction.commit();
  return resource;
}
origin: ldp4j/ldp4j

@Test
public void testPublishResource$preexisting$corrupted() throws ApplicationConfigurationException {
  Resource createResource = TestingModelFactory.createResource(NAME1, "UnknownTemplate");
  this.endpointRepository.add(createEndpoint(VALID_PATH, createResource));
  this.resourceRepository.add(createResource);
  this.sut.publishResource(NAME2,PersonHandler.class,VALID_PATH);
  try {
    this.sut.configureRootResources();
    fail("Should not allow publishing root resources with preexisting path clash");
  } catch (ApplicationConfigurationException e) {
    logFailure(e);
  }
}
origin: ldp4j/ldp4j

private Resource initialize(final String id, final String path) {
  final Transaction transaction=
    RuntimeDelegate.
      getInstance().
        getTransactionManager().
          currentTransaction();
  transaction.begin();
  try {
    this.uow = UnitOfWork.newCurrent();
    final Resource resource=
      this.modelFactory.createResource(
        this.templateManagementService.templateOfId("personTemplate"),
        name(id));
    final Endpoint endpoint=this.modelFactory.createEndpoint(path,resource,new Date(),EntityTag.createStrong(path));
    RuntimeDelegate.getInstance().getResourceRepository().add(resource);
    RuntimeDelegate.getInstance().getEndpointRepository().add(endpoint);
    UnitOfWork.setCurrent(null);
    transaction.commit();
    return resource;
  } finally {
    if(transaction.isActive()) {
      transaction.rollback();
    }
  }
}
org.ldp4j.application.kernel.resourceResourceRepositoryadd

Popular methods of ResourceRepository

  • containerOfId
  • remove
  • resourceById
  • resourceOfId

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getApplicationContext (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now