1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Class for parsing operations |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package com.nokia.tools.themeinstaller.odtconverter; |
|
20 |
|
21 import java.io.IOException; |
|
22 import java.util.Enumeration; |
|
23 import java.util.Vector; |
|
24 |
|
25 import org.w3c.dom.Document; |
|
26 |
|
27 /** |
|
28 * This class provides a skeletal implementation of parsing operation |
|
29 */ |
|
30 public abstract class ParseOperation |
|
31 { |
|
32 |
|
33 /** Listener for parsing operations */ |
|
34 IParseOperationListener iListener; |
|
35 |
|
36 /** All listeners */ |
|
37 Vector iListeners = new Vector(); |
|
38 |
|
39 /** DOM document */ |
|
40 protected Document iDOMDocument; |
|
41 |
|
42 /** |
|
43 * Parses file to DOM Document. |
|
44 * |
|
45 * @throws IOException Signals that an I/O exception has occurred. |
|
46 * @throws ODTException the ODT exception |
|
47 */ |
|
48 public abstract void parse( ) |
|
49 throws IOException, ODTException; |
|
50 |
|
51 /** |
|
52 * Getter for DOM document |
|
53 * @return DOM document |
|
54 */ |
|
55 public Document getDOMDocument() |
|
56 { |
|
57 return iDOMDocument; |
|
58 } |
|
59 |
|
60 /** |
|
61 * Adds the listener. |
|
62 * @param aListener IParseOperationListener |
|
63 */ |
|
64 public void addListener( IParseOperationListener aListener ) |
|
65 { |
|
66 iListeners.addElement( aListener ); |
|
67 } |
|
68 |
|
69 /** |
|
70 * Calls OperationCompleted for all listeners |
|
71 * @param aErr |
|
72 * @param aReason |
|
73 */ |
|
74 public void operationCompleted( int aErr, String aReason ) |
|
75 { |
|
76 for ( Enumeration e = iListeners.elements(); e.hasMoreElements(); ) |
|
77 { |
|
78 IParseOperationListener listener = ( IParseOperationListener ) e |
|
79 .nextElement(); |
|
80 listener.parseOperationCompleted( aErr, aReason ); |
|
81 } |
|
82 } |
|
83 |
|
84 } |
|