1 /*
2 * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 /*
21 * $Id: TemplatesImpl.java,v 1.8 2007/03/26 20:12:27 spericas Exp $
22 */
23
24 package com.sun.org.apache.xalan.internal.xsltc.trax;
25
26 import com.sun.org.apache.xalan.internal.XalanConstants;
27 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
28 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
29 import com.sun.org.apache.xalan.internal.xsltc.DOM;
30 import com.sun.org.apache.xalan.internal.xsltc.Translet;
31 import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
32 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
33 import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
34 import java.io.IOException;
35 import java.io.UncheckedIOException;
36 import java.io.NotSerializableException;
37 import java.io.ObjectInputStream;
38 import java.io.ObjectOutputStream;
39 import java.io.ObjectStreamField;
40 import java.io.Serializable;
41 import java.lang.module.Configuration;
42 import java.lang.module.ModuleDescriptor;
43 import java.lang.module.ModuleFinder;
148
149 /**
150 * @serialField _name String The Name of the main class
151 * @serialField _bytecodes byte[][] Class definition
152 * @serialField _class Class[] The translet class definition(s).
153 * @serialField _transletIndex int The index of the main translet class
154 * @serialField _outputProperties Properties Output properties of this translet.
155 * @serialField _indentNumber int Number of spaces to add for output indentation.
156 */
157 private static final ObjectStreamField[] serialPersistentFields =
158 new ObjectStreamField[] {
159 new ObjectStreamField("_name", String.class),
160 new ObjectStreamField("_bytecodes", byte[][].class),
161 new ObjectStreamField("_class", Class[].class),
162 new ObjectStreamField("_transletIndex", int.class),
163 new ObjectStreamField("_outputProperties", Properties.class),
164 new ObjectStreamField("_indentNumber", int.class),
165 };
166
167 static final class TransletClassLoader extends ClassLoader {
168 private final Map<String,Class> _loadedExternalExtensionFunctions;
169
170 TransletClassLoader(ClassLoader parent) {
171 super(parent);
172 _loadedExternalExtensionFunctions = null;
173 }
174
175 TransletClassLoader(ClassLoader parent,Map<String, Class> mapEF) {
176 super(parent);
177 _loadedExternalExtensionFunctions = mapEF;
178 }
179
180 public Class<?> loadClass(String name) throws ClassNotFoundException {
181 Class<?> ret = null;
182 // The _loadedExternalExtensionFunctions will be empty when the
183 // SecurityManager is not set and the FSP is turned off
184 if (_loadedExternalExtensionFunctions != null) {
185 ret = _loadedExternalExtensionFunctions.get(name);
186 }
187 if (ret == null) {
188 ret = super.loadClass(name);
189 }
190 return ret;
191 }
192
193 /**
194 * Access to final protected superclass member from outer class.
195 */
|
1 /*
2 * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 package com.sun.org.apache.xalan.internal.xsltc.trax;
21
22 import com.sun.org.apache.xalan.internal.XalanConstants;
23 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
24 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
25 import com.sun.org.apache.xalan.internal.xsltc.DOM;
26 import com.sun.org.apache.xalan.internal.xsltc.Translet;
27 import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
28 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
29 import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
30 import java.io.IOException;
31 import java.io.UncheckedIOException;
32 import java.io.NotSerializableException;
33 import java.io.ObjectInputStream;
34 import java.io.ObjectOutputStream;
35 import java.io.ObjectStreamField;
36 import java.io.Serializable;
37 import java.lang.module.Configuration;
38 import java.lang.module.ModuleDescriptor;
39 import java.lang.module.ModuleFinder;
144
145 /**
146 * @serialField _name String The Name of the main class
147 * @serialField _bytecodes byte[][] Class definition
148 * @serialField _class Class[] The translet class definition(s).
149 * @serialField _transletIndex int The index of the main translet class
150 * @serialField _outputProperties Properties Output properties of this translet.
151 * @serialField _indentNumber int Number of spaces to add for output indentation.
152 */
153 private static final ObjectStreamField[] serialPersistentFields =
154 new ObjectStreamField[] {
155 new ObjectStreamField("_name", String.class),
156 new ObjectStreamField("_bytecodes", byte[][].class),
157 new ObjectStreamField("_class", Class[].class),
158 new ObjectStreamField("_transletIndex", int.class),
159 new ObjectStreamField("_outputProperties", Properties.class),
160 new ObjectStreamField("_indentNumber", int.class),
161 };
162
163 static final class TransletClassLoader extends ClassLoader {
164 private final Map<String, Class<?>> _loadedExternalExtensionFunctions;
165
166 TransletClassLoader(ClassLoader parent) {
167 super(parent);
168 _loadedExternalExtensionFunctions = null;
169 }
170
171 TransletClassLoader(ClassLoader parent,Map<String, Class<?>> mapEF) {
172 super(parent);
173 _loadedExternalExtensionFunctions = mapEF;
174 }
175
176 public Class<?> loadClass(String name) throws ClassNotFoundException {
177 Class<?> ret = null;
178 // The _loadedExternalExtensionFunctions will be empty when the
179 // SecurityManager is not set and the FSP is turned off
180 if (_loadedExternalExtensionFunctions != null) {
181 ret = _loadedExternalExtensionFunctions.get(name);
182 }
183 if (ret == null) {
184 ret = super.loadClass(name);
185 }
186 return ret;
187 }
188
189 /**
190 * Access to final protected superclass member from outer class.
191 */
|