Package ch.ethz.iks.slp

Examples of ch.ethz.iks.slp.ServiceURL


   *
   * test from jSLP -> ECF discovery which needs to remove the first occurrence of "service:"
   */
  public void testCreateByjSLPAndRemoveServicePrefix() throws ServiceLocationException {
    final String internalRep = "service:foo.eclipse:bar";
    final ServiceURL sUrl = new ServiceURL(internalRep + "://localhost:1234/a/path/to/something", ServiceURL.LIFETIME_PERMANENT);

    final IServiceInfo serviceInfo = new JSLPServiceInfo(DiscoveryTestHelper.SERVICENAME, new ServiceURLAdapter(sUrl), DiscoveryTestHelper.PRIORITY, DiscoveryTestHelper.WEIGHT, new ServicePropertiesAdapter(new ArrayList()));
    assertEquals(serviceInfo.getPriority(), DiscoveryTestHelper.PRIORITY);
    assertEquals(serviceInfo.getWeight(), DiscoveryTestHelper.WEIGHT);
    final IServiceID sid = serviceInfo.getServiceID();
View Full Code Here


   *
   * test from jSLP -> ECF discovery which needs to remove the first occurrence of "service:"
   */
  public void testCreateByjSLPAndRemoveServicePrefixWithServiceService() throws ServiceLocationException {
    final String internalRep = "service:service.eclipse:foo:bar";
    final ServiceURL sUrl = new ServiceURL(internalRep + "://localhost:1234/a/path/to/something", ServiceURL.LIFETIME_PERMANENT);

    final IServiceInfo serviceInfo = new JSLPServiceInfo(DiscoveryTestHelper.SERVICENAME, new ServiceURLAdapter(sUrl), DiscoveryTestHelper.PRIORITY, DiscoveryTestHelper.WEIGHT, new ServicePropertiesAdapter(new ArrayList()));
    assertEquals(serviceInfo.getPriority(), DiscoveryTestHelper.PRIORITY);
    assertEquals(serviceInfo.getWeight(), DiscoveryTestHelper.WEIGHT);
    final IServiceID sid = serviceInfo.getServiceID();
View Full Code Here

  /* (non-Javadoc)
   * @see junit.framework.TestCase#setUp()
   */
  public void setUp() throws InterruptedException {
    try {
      service = new ServiceURL("service:osgi://" + HOST_AND_PORT, 10800);
      int i = 0;
      properties = new Hashtable();
      properties.put("attr", Boolean.FALSE);
      properties.put("attr" + i++, "value");
      properties.put("attr" + i++, "foo,bar");
View Full Code Here

   *             in case of IO errors.
   */
  void sign(final String spiStr) throws ServiceLocationException {
    List spiList = stringToList(spiStr, ",");
    for (Iterator urlIter = urlList.iterator(); urlIter.hasNext();) {
      ServiceURL url = (ServiceURL) urlIter.next();
      url.sign(spiList);
    }
  }
View Full Code Here

   * @throws ServiceLocationException
   *             in case of IO errors.
   */
  boolean verify() throws ServiceLocationException {
    for (Iterator urlIter = urlList.iterator(); urlIter.hasNext();) {
      ServiceURL url = (ServiceURL) urlIter.next();
      if (!url.verify()) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

    } else if (parameters[0] == null || parameters[0].equals("")) { //$NON-NLS-1$
      throw new IDCreateException("First parameter cannot be null or empty String"); //$NON-NLS-1$

      // create by jSLP ServiceURL
    } else if (parameters.length == 2 && parameters[0] instanceof ServiceURL) {
      final ServiceURL anURL = (ServiceURL) parameters[0];
      final String[] scopes = (String[]) parameters[1];
      return new JSLPServiceTypeID(this, anURL, scopes);
      //      final String serviceName = (String) (parameters[1] != null ? parameters[1] : anURL.getHost());
      //      return null /*new JSLPServiceID(this, stid, serviceName)*/;

 
View Full Code Here

  public IServiceTypeID[] getServiceTypes() {
    Set result = new HashSet();
    try {
      List aList = Activator.getDefault().getLocator().getServiceURLs((String) null, null);
      for (Iterator itr = aList.iterator(); itr.hasNext();) {
        ServiceURL serviceURL = (ServiceURL) itr.next();
        IServiceTypeID serviceTypeId = (IServiceTypeID) getConnectNamespace().createInstance(new Object[] {serviceURL, new String[] {}});
        result.add(serviceTypeId);
      }
    } catch (ServiceLocationException e) {
      Trace.catching(Activator.PLUGIN_ID, JSLPDebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "getServiceTypes(int)", e); //$NON-NLS-1$
View Full Code Here

  private IServiceInfo[] convertToIServiceInfo(Map serviceURLs, String[] scopes) {
    List tmp = new ArrayList();
    for (Iterator itr = serviceURLs.entrySet().iterator(); itr.hasNext();) {
      Map.Entry entry = (Entry) itr.next();
      ServiceURL url = (ServiceURL) entry.getKey();
      ServicePropertiesAdapter spa = new ServicePropertiesAdapter((List) entry.getValue());
      String serviceName = spa.getServiceName() == null ? url.toString() : spa.getServiceName();
      IServiceInfo serviceInfo = new JSLPServiceInfo(serviceName, new ServiceURLAdapter(url, scopes), spa.getPriority(), spa.getWeight(), spa);
      tmp.add(serviceInfo);
    }
    return (IServiceInfo[]) tmp.toArray(new IServiceInfo[tmp.size()]);
  }
View Full Code Here

    final IServiceTypeID stid = getServiceID().getServiceTypeID();
    final URI location = getLocation();
    final String scheme = location.getScheme();
    final String authority = location.getAuthority();
    final String path = location.getPath() == null ? "" : location.getPath(); //$NON-NLS-1$
    return new ServiceURL(stid.getInternal() + "://" + scheme + "://" + authority + path, ServiceURL.LIFETIME_PERMANENT); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

    try {
      final Map availableServices = Activator.getDefault().getLocator().getServiceURLs();
      final Map removedServices = new HashMap(services);
      for (final Iterator itr = availableServices.entrySet().iterator(); itr.hasNext() && !monitor.isCanceled();) {
        final Map.Entry entry = (Map.Entry) itr.next();
        final ServiceURL url = (ServiceURL) entry.getKey();
        // do we know the service already?
        if (removedServices.containsKey(url)) {
          removedServices.remove(url);
        } else { // we don't know the service, so we need to create the
          final ServicePropertiesAdapter spa = new ServicePropertiesAdapter((List) entry.getValue());
          final String serviceName = spa.getServiceName() == null ? url.toString() : spa.getServiceName();
          final IServiceInfo serviceInfo = new JSLPServiceInfo(serviceName, new ServiceURLAdapter(url), spa.getPriority(), spa.getWeight(), spa);
          services.put(url, serviceInfo);
          discoveryContainer.fireServiceTypeDiscovered(serviceInfo.getServiceID().getServiceTypeID());
          discoveryContainer.fireServiceDiscovered(serviceInfo);
        }
View Full Code Here

TOP

Related Classes of ch.ethz.iks.slp.ServiceURL

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.