Ejemplo n.º 1
0
  public static ServiceProvider createServiceProvider(final String baseURI)
      throws OslcCoreApplicationException, URISyntaxException {
    final ServiceProvider serviceProvider =
        org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.createServiceProvider(
            baseURI,
            ServiceProviderRegistryURIs.getUIURI(),
            "OSLC Stock Quote Service Provider",
            "Reference Implementation OSLC Stock Quote Service Provider",
            new Publisher("Russell", "IBM"),
            RESOURCE_CLASSES);

    final PrefixDefinition[] prefixDefinitions = {
      new PrefixDefinition(
          OslcConstants.DCTERMS_NAMESPACE_PREFIX, new URI(OslcConstants.DCTERMS_NAMESPACE)),
      new PrefixDefinition(
          OslcConstants.OSLC_CORE_NAMESPACE_PREFIX, new URI(OslcConstants.OSLC_CORE_NAMESPACE)),
      new PrefixDefinition(
          OslcConstants.RDF_NAMESPACE_PREFIX, new URI(OslcConstants.RDF_NAMESPACE)),
      new PrefixDefinition(
          OslcConstants.RDFS_NAMESPACE_PREFIX, new URI(OslcConstants.RDFS_NAMESPACE)),
      new PrefixDefinition(
          Constants.STOCK_QUOTE_NAMESPACE_PREFIX, new URI(Constants.STOCK_QUOTE_NAMESPACE)),
    };

    serviceProvider.setPrefixDefinitions(prefixDefinitions);

    return serviceProvider;
  }
  /**
   * Create a new MagicDraw OSLC service provider.
   *
   * @param baseURI
   * @param product
   * @param parameterValueMap - a map containing the path replacement value for {productId}. See
   *     ServiceProviderCatalogSingleton. initServiceProvidersFromProducts()
   * @throws OslcCoreApplicationException
   * @throws URISyntaxException
   */
  public static ServiceProvider createServiceProvider(
      final String baseURI, final String product, final Map<String, Object> parameterValueMap)
      throws OslcCoreApplicationException, URISyntaxException {
    final ServiceProvider serviceProvider =
        ServiceProviderFactory.createServiceProvider(
            baseURI,
            ServiceProviderRegistryURIs.getUIURI(),
            product,
            "Service provider for MagicDraw project: " + product,
            new Publisher(
                "Georgia Institute of Technology OSLC Project", "urn:oslc:ServiceProvider"),
            RESOURCE_CLASSES,
            parameterValueMap);
    URI detailsURIs[] = {new URI(baseURI + "/details")};
    serviceProvider.setDetails(detailsURIs);

    final PrefixDefinition[] prefixDefinitions = {
      new PrefixDefinition(
          OslcConstants.DCTERMS_NAMESPACE_PREFIX, new URI(OslcConstants.DCTERMS_NAMESPACE)),
      new PrefixDefinition(
          OslcConstants.OSLC_CORE_NAMESPACE_PREFIX, new URI(OslcConstants.OSLC_CORE_NAMESPACE)),
      new PrefixDefinition(
          OslcConstants.OSLC_DATA_NAMESPACE_PREFIX, new URI(OslcConstants.OSLC_DATA_NAMESPACE)),
      new PrefixDefinition(
          OslcConstants.RDF_NAMESPACE_PREFIX, new URI(OslcConstants.RDF_NAMESPACE)),
      new PrefixDefinition(
          OslcConstants.RDFS_NAMESPACE_PREFIX, new URI(OslcConstants.RDFS_NAMESPACE)),
      new PrefixDefinition(
          Constants.CHANGE_MANAGEMENT_NAMESPACE_PREFIX,
          new URI(Constants.CHANGE_MANAGEMENT_NAMESPACE)),
      new PrefixDefinition(Constants.FOAF_NAMESPACE_PREFIX, new URI(Constants.FOAF_NAMESPACE)),
      new PrefixDefinition(
          Constants.QUALITY_MANAGEMENT_PREFIX, new URI(Constants.QUALITY_MANAGEMENT_NAMESPACE)),
      new PrefixDefinition(
          Constants.REQUIREMENTS_MANAGEMENT_PREFIX,
          new URI(Constants.REQUIREMENTS_MANAGEMENT_NAMESPACE)),
      new PrefixDefinition(
          Constants.SOFTWARE_CONFIGURATION_MANAGEMENT_PREFIX,
          new URI(Constants.SOFTWARE_CONFIGURATION_MANAGEMENT_NAMESPACE)),
      new PrefixDefinition(Constants.SYSML_PREFIX, new URI(Constants.SYSML_NAMESPACE))
    };
    serviceProvider.setPrefixDefinitions(prefixDefinitions);
    return serviceProvider;
  }