EXTSCRIPT-154: Code Rewrite/Refactoring, loading classes now works
git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/scripting/trunk@1298443 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/extscript-core-root/extscript-core/src/main/java/rewrite/org/apache/myfaces/extensions/scripting/jsf/adapters/ImplementationSPI.java b/extscript-core-root/extscript-core/src/main/java/rewrite/org/apache/myfaces/extensions/scripting/jsf/adapters/ImplementationSPI.java
new file mode 100644
index 0000000..7615d11
--- /dev/null
+++ b/extscript-core-root/extscript-core/src/main/java/rewrite/org/apache/myfaces/extensions/scripting/jsf/adapters/ImplementationSPI.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package rewrite.org.apache.myfaces.extensions.scripting.jsf.adapters;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ * SPI Interface which ever implementation
+ * connector has to implement
+ * This spi is mirrored into the WeavingContext
+ */
+public interface ImplementationSPI
+{
+ public void registerClassloadingExtension(ServletContext context);
+ public Class forName(String clazz);
+
+}
diff --git a/extscript-core-root/extscript-core/src/main/java/rewrite/org/apache/myfaces/extensions/scripting/jsf/adapters/MyFacesSPI.java b/extscript-core-root/extscript-core/src/main/java/rewrite/org/apache/myfaces/extensions/scripting/jsf/adapters/MyFacesSPI.java
index 02caaaf..e59a709 100644
--- a/extscript-core-root/extscript-core/src/main/java/rewrite/org/apache/myfaces/extensions/scripting/jsf/adapters/MyFacesSPI.java
+++ b/extscript-core-root/extscript-core/src/main/java/rewrite/org/apache/myfaces/extensions/scripting/jsf/adapters/MyFacesSPI.java
@@ -30,17 +30,23 @@
*
* SPI for various myfaces related tasks
*/
-public class MyFacesSPI
+public class MyFacesSPI implements ImplementationSPI
{
-
+ CustomChainLoader _loader = null;
+
public void registerClassloadingExtension(ServletContext context) {
- Object loader = new CustomChainLoader(context); //ReflectUtil.instantiate("extras.org.apache.myfaces.extensions
+ CustomChainLoader loader = new CustomChainLoader(context); //ReflectUtil.instantiate("extras.org.apache.myfaces.extensions
// .scripting.servlet" +
//".CustomChainLoader",
//new Cast(ServletContext.class, context));
ClassUtils.addClassLoadingExtension(loader, true);
+ _loader = loader;
}
+ public Class forName(String clazz) {
+ return _loader.forName(clazz);
+ }
+
private static MyFacesSPI ourInstance = new MyFacesSPI();