KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > flow > javascript > ScriptablePointerFactory


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.components.flow.javascript;
17
18 import org.apache.commons.jxpath.ri.model.NodePointerFactory;
19 import org.apache.commons.jxpath.ri.model.NodePointer;
20 import org.apache.commons.jxpath.ri.QName;
21 import java.util.Locale JavaDoc;
22 import org.mozilla.javascript.Scriptable;
23
24 /**
25  *
26  * @version CVS $Id: ScriptablePointerFactory.java 30932 2004-07-29 17:35:38Z vgritsenko $
27  */

28 public class ScriptablePointerFactory implements NodePointerFactory {
29
30     public int getOrder() {
31         return 1;
32     }
33
34     public NodePointer createNodePointer(QName name, Object JavaDoc object,
35                                          Locale JavaDoc locale) {
36         if (object instanceof Scriptable) {
37             return new ScriptablePointer(name, (Scriptable)object, locale);
38         }
39         return null;
40     }
41
42     public NodePointer createNodePointer(NodePointer parent,
43                                          QName name, Object JavaDoc object) {
44         if (object instanceof Scriptable) {
45             return new ScriptablePointer(parent, name,
46                                          (Scriptable)object);
47         }
48         return null;
49     }
50 }
51
Popular Tags