01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Pavel Dolgov
19: * @version $Revision: 1.2 $
20: */package org.apache.harmony.applet;
21:
22: import java.net.URL;
23: import java.util.Map;
24: import java.util.HashMap;
25:
26: /**
27: * Applet's startup parameters
28: */
29: final class Parameters {
30:
31: /** applet parameters provided by <param> tags */
32: final Map<String, String> parameters;
33: /** the location the document comes from */
34: final URL documentBase;
35: /** document's id from the host application */
36: final int documentId;
37: /** the location applet comes from */
38: final URL codeBase;
39: /** applet's id from host application */
40: final int id;
41: /** applet's class name (without suffix '.class') */
42: final String className;
43: /** applet's name in the document */
44: final String name;
45: /** host app's window to put applet into */
46: final long parentWindowId;
47: /** Java app's Container to put applet into */
48: final Object container;
49:
50: Parameters(int id, long parentWindowId, URL documentBase,
51: int documentId, URL codeBase, String className,
52: Map<String, String> parameters, String name,
53: Object container) {
54:
55: this .id = id;
56: this .parentWindowId = parentWindowId;
57: this .parameters = parameters;
58: this .documentBase = documentBase;
59: this .documentId = documentId;
60: this .codeBase = codeBase;
61: this .className = className;
62: this .name = name;
63: this .container = container;
64: }
65:
66: Parameters(int id, long parentWindowId, URL documentBase,
67: int documentId, URL codeBase, String className,
68: String[] paramStrings, String name, Object container) {
69:
70: this .id = id;
71: this .parentWindowId = parentWindowId;
72: this .documentBase = documentBase;
73: this .documentId = documentId;
74: this .codeBase = codeBase;
75: this .className = className;
76: this .name = name;
77: this .container = container;
78:
79: this .parameters = new HashMap<String, String>(
80: paramStrings.length / 2);
81: for (int i = 0; i + 1 < paramStrings.length; i += 2)
82: parameters.put(paramStrings[i], paramStrings[i + 1]);
83: }
84:
85: String getParameter(String name) {
86: return parameters.get(name);
87: }
88:
89: }
|