blob: 264c95401a95bdd6e7e00fcfe47157c5f83e941b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*******************************************************************************
* Copyright (c) 2010 Markus Alexander Kuppe.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Alexander Kuppe (ecf-dev_eclipse.org <at> lemmster <dot> de) - initial API and implementation
******************************************************************************/
package org.eclipse.ecf.internal.discovery;
import java.net.URI;
import org.eclipse.ecf.core.identity.*;
import org.eclipse.ecf.discovery.identity.IServiceTypeID;
import org.eclipse.ecf.discovery.identity.ServiceID;
public class DiscoveryNamespace extends Namespace {
private static final long serialVersionUID = 6474091408790223505L;
public static final String NAME = "ecf.namespace.discovery"; //$NON-NLS-1$
public DiscoveryNamespace() {
super();
}
public DiscoveryNamespace(String description) {
super(NAME, description);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ecf.core.identity.Namespace#createInstance(java.lang.Object
* [])
*/
public ID createInstance(Object[] parameters) throws IDCreateException {
if (parameters != null && parameters.length == 1
&& parameters[0] instanceof IServiceTypeID) {
return (ID) parameters[0];
} else if (parameters != null && parameters.length == 2
&& parameters[0] instanceof IServiceTypeID
&& parameters[1] instanceof URI) {
final IServiceTypeID type = (IServiceTypeID) parameters[0];
final URI uri = (URI) parameters[1];
return new DiscoveryServiceID(this, type, uri);
}
throw new IDCreateException("Parameters must be of type IServiceTypeID"); //$NON-NLS-1$
}
private static class DiscoveryServiceID extends ServiceID {
private static final long serialVersionUID = -9017925060137305026L;
// Need public constructor
public DiscoveryServiceID(Namespace namespace, IServiceTypeID type,
URI uri) {
super(namespace, type, uri);
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ecf.core.identity.Namespace#getScheme()
*/
public String getScheme() {
return "discovery"; //$NON-NLS-1$
}
}
|