Codota Logo
ModelFactory.createEndpoint
Code IndexAdd Codota to your IDE (free)

How to use
createEndpoint
method
in
org.ldp4j.application.kernel.spi.ModelFactory

Best Java code snippets using org.ldp4j.application.kernel.spi.ModelFactory.createEndpoint (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: ldp4j/ldp4j

private Endpoint createEndpoint(String path, Resource resource) {
  return
    this.modelFactory.
      createEndpoint(path, resource, new Date(), EntityTag.createStrong("etag"));
}
origin: ldp4j/ldp4j

protected final Endpoint endpoint(String path, Resource resource) {
  return this.delegate.getModelFactory().createEndpoint(path, resource, new Date(),EntityTag.createStrong("tag"));
}
origin: ldp4j/ldp4j

private Endpoint createEndpoint(Resource resource, String relativePath, EntityTag entityTag, Date lastModified) throws EndpointCreationException {
  String candidatePath=relativePath;
  int repetitions=0;
  while(repetitions<MAX_ENDPOINT_CREATION_FAILURE) {
    LOGGER.debug("({}) Creating endpoint for {} [{},{},{}]",repetitions,resource.id(),entityTag,lastModified,relativePath);
    try {
      String resourcePath = calculateResourcePath(resource,candidatePath);
      LOGGER.debug("({}) Trying resource path {} ",repetitions,resourcePath);
      Endpoint newEndpoint = this.modelFactory.createEndpoint(resourcePath, resource, lastModified, entityTag);
      this.endpointRepository.add(newEndpoint);
      return newEndpoint;
    } catch (EndpointNotFoundException e) {
      throw new EndpointCreationException("Could not calculate path for resource '"+resource.id()+"'",e);
    } catch (IllegalArgumentException e) {
      LOGGER.debug("Could not create endpoint ({} --> {})",repetitions,candidatePath,e);
      repetitions++;
      candidatePath=null;
    }
  }
  throw new EndpointCreationException("Could not create endpoint for resource '"+resource.id()+"' after "+MAX_ENDPOINT_CREATION_FAILURE+" tries");
}
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

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

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.spiModelFactorycreateEndpoint

Popular methods of ModelFactory

  • createResource
  • useTemplates

Popular in Java

  • Creating JSON documents from java classes using gson
  • runOnUiThread (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getExternalFilesDir (Context)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
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