blob: ba14fbd975ba0847e63abacfb5a467ccac8ecf3a (
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
|
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.team.core.subscribers;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.core.SaveContext;
/**
* A subscriber factory is responsible for saving and restoring subscribers. Implementations must
* provide a public no-arg constructor.
*
* Example extension point for registering a subscriber factory:
*
* <extension point="org.eclipse.team.core.subscriber">
* <subscriber class="org.eclipse.team.internal.webdav.DavSubscriberFactory"/>
*</extension>
*
* @see org.eclipse.team.core.subscribers.TeamSubscriber
*/
abstract public class TeamSubscriberFactory {
/**
* A subscriber factory id identifies the factory type and the type of it's subscribers. Subscribers
* created via a specific factory should return a qualified name from TeamSubscriber#getID() that
* matches the id of their factory.
* <p>
* For example, a WebDav subscriber factory would have "org.eclipse.team.webdav.subscriber" as
* its id. Subsequent WebDav subscribers must construct their id based on this qualifier.
*
* @return the factory's id
*/
abstract public String getID();
/**
* Called to save the state of the given subscriber. The saved state should contain enough
* information so that a subcriber can be recreated from the returned <code>SaveContext</code>.
* A subscriber that doesn't have information to the saved should return <code>null</code>.
* <p>
* This may be called during workspace snapshot or at shutdown.
* </p>
*
* @return a save context containing the state of this subscriber
* @throws TeamException if there was a problem creating the save context.
*/
abstract public SaveContext saveSubscriber(TeamSubscriber subscriber) throws TeamException;
/**
* Called to restore a subscriber with <code>id</code> from a given <code>SaveContext</code>. This is
* used to restore subscribers between workbench sessions.
*
* @return a subscriber instance
* @throws TeamException if there was a problem restoring from the save context.
*/
abstract public TeamSubscriber restoreSubscriber(QualifiedName id, SaveContext saveContext) throws TeamException;
}
|