1 /** |
|
2 * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 * Symbian Foundation - initial contribution. |
|
11 * Contributors: |
|
12 * Description: |
|
13 * Overview: |
|
14 * Details: |
|
15 * Platforms/Drives/Compatibility: |
|
16 * Assumptions/Requirement/Pre-requisites: |
|
17 * Failures and causes: |
|
18 */ |
|
19 |
|
20 package org.symbian.tools.wrttools.core.deployer; |
|
21 |
|
22 import org.symbian.tools.wrttools.core.status.IWRTConstants; |
|
23 import org.symbian.tools.wrttools.core.status.IWRTStatusListener; |
|
24 import org.symbian.tools.wrttools.core.status.WRTStatus; |
|
25 import org.symbian.tools.wrttools.core.status.WRTStatusHandler; |
|
26 |
|
27 /** |
|
28 * Main Class for the widget Deployer.This implements the IWidgetDeployer. |
|
29 * Different Deployer need to extend this class.This also contains the default |
|
30 * implementation for the actual widget deployer such as making a sure the widget |
|
31 * is validated before deploying and also if the widget is packaged correctly before |
|
32 * deploying. |
|
33 * @author avraina |
|
34 * |
|
35 */ |
|
36 public abstract class WidgetDeployer implements IWidgetDeployer{ |
|
37 |
|
38 private WRTStatusHandler statusHandler; |
|
39 |
|
40 IWRTStatusListener statusListener; |
|
41 |
|
42 public WidgetDeployer() { |
|
43 setStatus(); |
|
44 } |
|
45 |
|
46 /** |
|
47 * The method is to check whether the widget project is validated. |
|
48 * This should be done before calling the deploy method. |
|
49 * @param fileName. The file name which needs to be validated. |
|
50 * @return true if the project is validated else false. |
|
51 */ |
|
52 public boolean callValidator(String fileName){ |
|
53 return false; |
|
54 } |
|
55 |
|
56 /** |
|
57 * The method is to check whether the widget project is packaged. |
|
58 * This should be done before calling the deploy method. |
|
59 * @param fileName. The file name which need to be deployed. |
|
60 * @return true if the project is packaged else false. |
|
61 */ |
|
62 public boolean callPackager(String fileName){ |
|
63 return false; |
|
64 } |
|
65 |
|
66 /** |
|
67 * The method returns the extension of the widget to be deployed. |
|
68 * @return the extension of the widget. |
|
69 */ |
|
70 public String checkPackagedInput(){ |
|
71 return IWRTConstants.WIDGET_FILE_EXTENSION; |
|
72 } |
|
73 |
|
74 protected void setStatus() { |
|
75 statusHandler = new WRTStatusHandler(); |
|
76 statusHandler.addListener(getStatusListener()); |
|
77 } |
|
78 |
|
79 /** |
|
80 * Returns the associated status listner with the widget deployer |
|
81 * @return status listener |
|
82 */ |
|
83 public IWRTStatusListener getStatusListener() { |
|
84 return statusListener; |
|
85 } |
|
86 |
|
87 /** |
|
88 * Sets the status listner associated with the widget deployer |
|
89 * @param statusListener the status listner to be associated. |
|
90 */ |
|
91 public void setStatusListener(IWRTStatusListener statusListener) { |
|
92 this.statusListener = statusListener; |
|
93 } |
|
94 |
|
95 /** |
|
96 * Creates the status specific to the widget deployer |
|
97 * @param statusDescription the description of the status |
|
98 * @return the WRTStatus created |
|
99 */ |
|
100 protected void emitStatus(String statusDescription) { |
|
101 WRTStatus status = new WRTStatus(); |
|
102 status.setStatusSource(IWRTConstants.StatusSourceType.DEPLOYER.name()); |
|
103 status.setStatusDescription(statusDescription); |
|
104 getStatusListener().emitStatus(status); |
|
105 } |
|
106 |
|
107 public boolean needsReport() { |
|
108 return true; |
|
109 } |
|
110 } |
|