Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5e271dd0a23a4e65e27bc584d47b900c49a112d5 (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
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.ecf.identity" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
      <appInfo>
         <meta.schema plugin="org.eclipse.ecf.identity" id="namespace" name="ECF Namespace"/>
      </appInfo>
      <documentation>
         Extension point that allows other plugins to define new Namespaces.  Namespaces are used by the IDFactory for creating new ID instances.  Plugins may define extension Namespace implementation, which will then be used to construct ID instances within than Namespace when clients use the default ECF identity factory (accessed via org.eclipse.ecf.core.identity.IDFactory.getDefault()).
&lt;p&gt;
Plugins implementing this extension point must define a Namespace class that extends &lt;b&gt;org.eclipse.ecf.core.identity.Namespace&lt;/b&gt;.  The class attribute of the namespace extension must provide a valid Namespace subclass.  The name attribute defines the namespace name.  If the name attribute is not present, then the Namespace class will be used as the Namespace name.  The optional description attribute is an optional arbitrary description for the Namespace.
      </documentation>
   </annotation>

   <element name="extension">
      <annotation>
         <appInfo>
            <meta.element />
         </appInfo>
      </annotation>
      <complexType>
         <sequence>
            <element ref="namespace" minOccurs="1" maxOccurs="unbounded"/>
         </sequence>
         <attribute name="point" type="string" use="required">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
         <attribute name="id" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
         <attribute name="name" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
      </complexType>
   </element>

   <element name="namespace">
      <annotation>
         <documentation>
            Element allowing plugins to define new ECF Namespaces.  Plugins wishing to define new Namespaces must provide an extension of this extension point.
         </documentation>
      </annotation>
      <complexType>
         <attribute name="name" type="string">
            <annotation>
               <documentation>
                  Optional name for new Namespace.  If not provided, the name will be assumed to be the value provided by the &apos;class&apos; attribute for this extension point.  Note that this name must &lt;b&gt;not&lt;/b&gt; conflict with any other Namespace name in the ECF IDFactory in order to be successfully registered.  Care should therefore be taken in selection of a namespace name such that it does not conflict with other implementations.
               </documentation>
            </annotation>
         </attribute>
         <attribute name="class" type="string" use="required">
            <annotation>
               <documentation>
                  The fully qualified name of a class that extends &lt;b&gt;org.eclipse.ecf.core.identity.Namespace&lt;/b&gt;.
               </documentation>
               <appInfo>
                  <meta.attribute kind="java" basedOn="org.eclipse.ecf.core.identity.Namespace"/>
               </appInfo>
            </annotation>
         </attribute>
         <attribute name="description" type="string">
            <annotation>
               <documentation>
                  An optional description for the Namespace extension
               </documentation>
            </annotation>
         </attribute>
      </complexType>
   </element>

   <annotation>
      <appInfo>
         <meta.section type="since"/>
      </appInfo>
      <documentation>
         0.4.0
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="examples"/>
      </appInfo>
      <documentation>
         Here&apos;s an extension definition that associates an namespace class with namespace &apos;testid&apos;:

&lt;pre&gt;
   &lt;extension point=&quot;org.eclipse.ecf.identity.namespace&quot;&gt;
      &lt;namespace name=&quot;testnamespace&quot; class=&quot;org.eclipse.ecf.test.FooNamespace&quot; description=&quot;my namespace implementation&quot;/&gt;
   &lt;/extension&gt;
&lt;/pre&gt;

Here is some example code to implement this FooNamespace class:

&lt;pre&gt;
package org.eclipse.ecf.test;

import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDCreateException;
import org.eclipse.ecf.core.identity.Namespace;

public class FooNamespace extends
        org.eclipse.ecf.core.identity.Namespace {

    public ID createInstance(Class[] argTypes, Object[] args)
            throws IDCreateException {
        return new FooID((String) args[0]);
    }
}
&lt;/pre&gt;

In this example, the FooNamespace class implements the abstract  &lt;b&gt;Namesapce&lt;/b&gt;.createInstance method by creating and returning a new instance of FooID, a class also defined by the extension plugin.  This class must implement &lt;b&gt;ID&lt;/b&gt;, so that it can successfully be returned from the Namespace.createInstance call.

&lt;h3&gt;Example Usage of IDFactory by Clients&lt;/h3&gt;

Clients that wish to use the &apos;testnamespace&apos; Namespace implementation can do so simply by making the following call to create an &lt;b&gt;IDFactory&lt;/b&gt;:

&lt;pre&gt;
ID newID = IDFactory.getDefault().createID(&quot;testnamespace&quot;,&quot;email@emailserver.com&quot;); 
&lt;/pre&gt;
Another example would be:
&lt;pre&gt;
ID newID = IDFactory.getDefault().createID(new URI(&quot;testnamespace:email@emailserver.com&quot;));
&lt;/pre&gt;
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="apiInfo"/>
      </appInfo>
      <documentation>
         The client API for this extension point is provided by the &lt;b&gt;org.eclipse.ecf.core.IIDFactory.createID&lt;/b&gt; methods.  A valid IIDFactory is provided by the by the static &lt;b&gt;org.eclipse.ecf.core.identityIDFactory.getDefault()&lt;/b&gt; method.
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="implementation"/>
      </appInfo>
      <documentation>
         The following implementations of this extension point are provided by ECF itself:
&lt;p&gt;
StringID -- A namespace of ID instances that are implemented by &lt;b&gt;org.eclipse.ecf.core.identity.StringID&lt;/b&gt;
&lt;p&gt;Clients may use this namespace with calls to:
&lt;pre&gt;
ID newID = org.eclipse.ecf.core.identity.IDFactory.createStringID(&apos;idstringvalue&apos;);
&lt;/pre&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;
LongID -- A namespace of ID instances that are implemented by &lt;b&gt;org.eclipse.ecf.core.identity.LongID&lt;/b&gt;
&lt;p&gt;Clients may use this namespace with calls to:
&lt;pre&gt;
ID newID = org.eclipse.ecf.core.identity.IDFactory.createLongID(2004L);
&lt;/pre&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;
GUID -- A namespace of ID instances that are implemented by &lt;b&gt;org.eclipse.ecf.core.identity.GUID&lt;/b&gt;
&lt;p&gt;Clients may use this namespace with calls to:
&lt;pre&gt;
ID newID = org.eclipse.ecf.core.identity.IDFactory.createGUID(16);
&lt;/pre&gt;
&lt;/p&gt;
&lt;/p&gt;
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="copyright"/>
      </appInfo>
      <documentation>
         Copyright (c) 2004 Composent, Inc. and others.

This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

      </documentation>
   </annotation>

</schema>

Back to the top