javaextensions/wma/mms/javasrc/com/nokia/mj/impl/gcf/protocol/mms/PushValidatorImpl.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
16 */ |
16 */ |
17 |
17 |
18 package com.nokia.mj.impl.gcf.protocol.mms; |
18 package com.nokia.mj.impl.gcf.protocol.mms; |
19 |
19 |
20 import java.lang.String; |
20 import java.lang.String; |
|
21 import java.io.IOException; |
21 import com.nokia.mj.impl.utils.Uid; |
22 import com.nokia.mj.impl.utils.Uid; |
22 import com.nokia.mj.impl.gcf.PushValidator; |
23 import com.nokia.mj.impl.gcf.PushValidator; |
23 import com.nokia.mj.impl.mms.MMSPermissionImpl; |
24 import com.nokia.mj.impl.mms.MMSPermissionImpl; |
24 import com.nokia.mj.impl.rt.support.ApplicationUtils; |
25 import com.nokia.mj.impl.rt.support.ApplicationUtils; |
25 /** |
26 /** |
41 * @param aUri Uri to be validated |
42 * @param aUri Uri to be validated |
42 * @param aFilter filter to be validated |
43 * @param aFilter filter to be validated |
43 */ |
44 */ |
44 public void validate(String aUri, String aFilter, Uid aSuiteUid, |
45 public void validate(String aUri, String aFilter, Uid aSuiteUid, |
45 String aMidletName, boolean aIsStaticRegistration) |
46 String aMidletName, boolean aIsStaticRegistration) |
|
47 throws IOException |
46 { |
48 { |
47 if (!(aUri.startsWith(MMS_PREFIX))) |
49 if (!(aUri.startsWith(MMS_PREFIX))) |
48 { |
50 { |
49 throw new IllegalArgumentException(INVALID_URI); |
51 throw new IllegalArgumentException(INVALID_URI); |
50 } |
52 } |
65 if (!isValidPhoneNumber(aFilter)) |
67 if (!isValidPhoneNumber(aFilter)) |
66 { |
68 { |
67 throw new IllegalArgumentException("Invalid Filter"); |
69 throw new IllegalArgumentException("Invalid Filter"); |
68 |
70 |
69 } |
71 } |
|
72 Uid suiteUid = null; |
|
73 String commsName = null; |
|
74 if (aIsStaticRegistration) |
|
75 { |
|
76 suiteUid = aSuiteUid; |
|
77 commsName = PushValidator.INSTALLER_COMMS; |
|
78 } |
|
79 else |
|
80 { |
|
81 commsName = PushValidator.RUNTIME_COMMS; |
|
82 } |
|
83 if (PushValidator.isRegisteredPushUriStartingWith(aUri, suiteUid, |
|
84 commsName)) |
|
85 { |
|
86 if (aIsStaticRegistration) |
|
87 { |
|
88 throw new IllegalArgumentException(); |
|
89 } |
|
90 else |
|
91 { |
|
92 throw new IOException("connection already exists"); |
|
93 } |
|
94 } |
70 ApplicationUtils appUtils = ApplicationUtils.getInstance(); |
95 ApplicationUtils appUtils = ApplicationUtils.getInstance(); |
71 MMSPermissionImpl permission = new MMSPermissionImpl("mms://*","open"); |
96 MMSPermissionImpl permission = new MMSPermissionImpl("mms://*","open"); |
72 appUtils.checkPermission(permission); |
97 appUtils.checkPermission(permission); |
73 } |
98 } |
74 |
99 |