Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1d444aa17599acfe0b9793c2d68ed6557658534d (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/*******************************************************************************
 * Copyright (c) 2004 Composent, Inc. and others. 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: Composent, Inc. - initial API and implementation
 ******************************************************************************/
package org.eclipse.ecf.core.identity;

import java.util.List;

/**
 * Contract for {@link IDFactory}
 * 
 */
public interface IIDFactory {
	/**
	 * Add the given Namespace to our table of available Namespaces
	 * 
	 * @param n
	 *            the Namespace to add
	 * @return Namespace the namespace already in table (null if Namespace not
	 *         previously in table)
	 * @exception SecurityException
	 *                thrown if caller does not have appropriate
	 *                NamespacePermission for given namespace
	 */
	public Namespace addNamespace(Namespace n) throws SecurityException;

	/**
	 * Check whether table contains given Namespace instance
	 * 
	 * @param n
	 *            the Namespace to look for
	 * @return true if table does contain given Namespace, false otherwise
	 * @exception SecurityException
	 *                thrown if caller does not have appropriate
	 *                NamespacePermission for given namespace
	 */
	public boolean containsNamespace(Namespace n) throws SecurityException;

	/**
	 * Get a list of the current Namespace instances exposed by this factory.
	 * 
	 * @return List<Namespace> of Namespace instances
	 * @exception SecurityException
	 *                thrown if caller does not have appropriate
	 *                NamespacePermission for given namespace
	 */
	public List getNamespaces() throws SecurityException;

	/**
	 * Get the given Namespace instance from table
	 * 
	 * @param n
	 *            the Namespace to look for
	 * @return Namespace
	 * @exception SecurityException
	 *                thrown if caller does not have appropriate
	 *                NamespacePermission for given namespace
	 */
	public Namespace getNamespace(Namespace n) throws SecurityException;

	/**
	 * Get a Namespace instance by its string name.
	 * 
	 * @param name
	 *            the name to use for lookup
	 * @return Namespace instance. Null if not found.
	 * @exception SecurityException
	 *                thrown if caller does not have appropriate
	 *                NamespacePermission for given namespace
	 */
	public Namespace getNamespaceByName(String name) throws SecurityException;

	/**
	 * Make a GUID using SHA-1 hash algorithm and a default of 16bits of data
	 * length. The value is Base64 encoded to allow for easy display.
	 * 
	 * @return new ID instance
	 * @throws IDCreateException
	 *             if ID cannot be constructed
	 */
	public ID createGUID() throws IDCreateException;

	/**
	 * Make a GUID using SHA-1 hash algorithm and a default of 16bits of data
	 * length. The value is Base64 encoded to allow for easy display.
	 * 
	 * @param length
	 *            the byte-length of data used to create a GUID
	 * @return new ID instance
	 * @throws IDCreateException
	 *             if ID cannot be constructed
	 */
	public ID createGUID(int length) throws IDCreateException;

	/**
	 * Make a new identity. Given a Namespace, and an array of instance
	 * constructor parameters, return a new instance of an ID belonging to the
	 * given Namespace
	 * 
	 * @param n
	 *            the Namespace to which the ID will belong
	 * @param args
	 *            an Object [] of the parameters for the ID instance constructor
	 * @exception IDCreateException
	 *                thrown if class for instantiator or instance can't be
	 *                loaded, if something goes wrong during instance
	 *                construction
	 */
	public ID createID(Namespace n, Object[] args) throws IDCreateException;

	/**
	 * Make a new identity. Given a Namespace name, and an array of instance
	 * constructor parameters, return a new instance of an ID belonging to the
	 * given Namespace
	 * 
	 * @param namespacename
	 *            the name of the Namespace to which the ID will belong
	 * @param args
	 *            an Object [] of the parameters for the ID instance constructor
	 * @exception IDCreateException
	 *                thrown if class for instantiator or ID instance can't be
	 *                loaded, if something goes wrong during instance
	 *                construction
	 */
	public ID createID(String namespacename, Object[] args)
			throws IDCreateException;

	/**
	 * Make a new identity instance from a namespace and String.
	 * 
	 * @param namespace
	 *            the namespace to use to create the ID
	 * @param uri
	 *            the String uri to use to create the ID
	 * @exception IDCreateException
	 *                thrown if class for instantiator or ID instance can't be
	 *                loaded, if something goes wrong during instance
	 *                construction
	 */
	public ID createID(Namespace namespace, String uri)
			throws IDCreateException;

	/**
	 * Make a new identity instance from a namespacename and idvalue. The
	 * namespacename is first used to lookup the namespace with
	 * getNamespaceByName(), and then the result is passed into
	 * createID(Namespace,String).
	 * 
	 * @param namespacename
	 *            the namespacename to use to create the ID
	 * @param idvalue
	 *            the String idvalue to use to create the ID
	 * @exception IDCreateException
	 *                thrown if class for instantiator or ID instance can't be
	 *                loaded, if something goes wrong during instance
	 *                construction
	 */
	public ID createID(String namespacename, String idvalue)
			throws IDCreateException;

	/**
	 * Make a an ID from a String
	 * 
	 * @param idstring
	 *            the String to use as this ID's unique value. Note: It is
	 *            incumbent upon the caller of this method to be sure that the
	 *            given string allows the resulting ID to satisfy the ID
	 *            contract for global uniqueness within the associated
	 *            Namespace.
	 * 
	 * @return valid ID instance
	 * @throws IDCreateException
	 *             thrown if class for instantiator or ID instance can't be
	 *             loaded, if something goes wrong during instance construction
	 */
	public ID createStringID(String idstring) throws IDCreateException;

	/**
	 * Make a an ID from a long
	 * 
	 * @param l
	 *            the long to use as this ID's unique value. Note: It is
	 *            incumbent upon the caller of this method to be sure that the
	 *            given long allows the resulting ID to satisfy the ID contract
	 *            for global uniqueness within the associated Namespace.
	 * 
	 * @return valid ID instance
	 * @throws IDCreateException
	 *             thrown if class for instantiator or ID instance can't be
	 *             loaded, if something goes wrong during instance construction
	 */
	public ID createLongID(long l) throws IDCreateException;

	/**
	 * Remove the given Namespace from our table of available Namespaces
	 * 
	 * @param n
	 *            the Namespace to remove
	 * @return Namespace the namespace already in table (null if Namespace not
	 *         previously in table)
	 * @exception SecurityException
	 *                thrown if caller does not have appropriate
	 *                NamespacePermission for given namespace
	 */
	public Namespace removeNamespace(Namespace n) throws SecurityException;
}

Back to the top