Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
EXTSCRIPT-173 tagging manually since mvn release:prepare fails for wh…
…atever reason

git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/scripting/tags/extscript-root-1.0.4@1397013 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
werpu committed Oct 11, 2012
2 parents 5a53ab5 + 050adba commit 8987ac8
Show file tree
Hide file tree
Showing 16 changed files with 256 additions and 118 deletions.
Expand Up @@ -25,14 +25,10 @@

import javax.servlet.ServletContext;
import java.io.File;
import java.io.FilenameFilter;
import java.lang.ref.WeakReference;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.CopyOnWriteArrayList;
Expand Down Expand Up @@ -94,6 +90,31 @@ public Configuration()
{
}


private Collection<String> performWildCardSearch(String classPathEntry) {

if(classPathEntry.toLowerCase().endsWith("*.jar")|| classPathEntry.toLowerCase().endsWith("*.zip")){
//peform a full search of jars on the dir
classPathEntry = classPathEntry.substring(0, classPathEntry.length()-5);
File classPathDir = new File(classPathEntry);
String[] foundFiles = classPathDir.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".jar") || name.toLowerCase().endsWith(".zip");
}
});
if(foundFiles == null) {
return Collections.emptyList();
}
ArrayList<String> retVal = new ArrayList<String>(foundFiles.length);
for(String foundFile: foundFiles) {
retVal.add(classPathEntry+foundFile);
}
return retVal;
}
return Arrays.asList(new String[] {classPathEntry});
}

public void init(ServletContext context)
{
String packageWhiteList = context.getInitParameter(INIT_PARAM_SCRIPTING_PACKAGE_WHITELIST);
Expand All @@ -103,6 +124,10 @@ public void init(ServletContext context)
String additionalClassPath = context.getInitParameter(INIT_PARAM_SCRIPTING_ADDITIONAL_CLASSPATH);
additionalClassPath = (additionalClassPath == null) ? "" : additionalClassPath;
String[] additionalClassPaths = additionalClassPath.split("\\,");
for(String cp: additionalClassPaths) {
_additionalClassPath.addAll(performWildCardSearch(cp));
}

_additionalClassPath.addAll(Arrays.asList(additionalClassPaths));

String resourcePath = context.getInitParameter(INIT_PARAM_RESOURCE_PATH);
Expand Down
Expand Up @@ -111,7 +111,15 @@ public static synchronized ResourceMonitor getInstance()
*/
public void run()
{

try {
//on Glassfish we have to defer the initial scan to avoid an NPE, for
//reasons not debuggable, TODO check for a concurrency issue there
//which causes the npe
Thread.sleep(3000);
} catch (InterruptedException ex) {
Logger.getLogger(ResourceMonitor.class.getName()).log(Level.SEVERE, null, ex);
}

while (!Thread.currentThread().isInterrupted())
{
if (Thread.currentThread().isInterrupted()) break;
Expand Down
Expand Up @@ -38,7 +38,7 @@
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>

<!--
<context-param>
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
Expand Down Expand Up @@ -77,7 +77,7 @@
/Users/werpu2/development/workspace/extscript_trunk/extscript-examples/blog-example/src/main/webapp
</param-value>
</context-param>

-->

<context-param>
<description>State saving method: "client" or "server" (= default)
Expand Down
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
31 changes: 31 additions & 0 deletions extscript-examples/cdi-example/src/main/webapp/WEB-INF/sun-web.xml
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
<context-root>/testenterpriseweb2</context-root>
<class-loader delegate="false"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
<property name="useMyFaces" value="true"/>
<property name="useBundledJsf" value="true"/>
</sun-web-app>
20 changes: 0 additions & 20 deletions extscript-examples/cdi-example/src/main/webapp/WEB-INF/web.xml
Expand Up @@ -89,26 +89,6 @@
-->


<!--
<context-param>
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
<param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
<param-value>D:/whatever/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/groovy</param-value>
</context-param>
<context-param>
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
<param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
<param-value>D:/whatever/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/java</param-value>
</context-param>
-->


<context-param>
Expand Down
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
@@ -1,25 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
* 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.
-->
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 Servlet 2.4//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_4-1.dtd">

<sun-web-app >
<class-loader delegate="false"/>
<property name="useMyFaces" value="true"/>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
<context-root>/testenterpriseweb2</context-root>
<class-loader delegate="false"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
<property name="useMyFaces" value="true"/>
<property name="useBundledJsf" value="true"/>
</sun-web-app>
Expand Up @@ -34,14 +34,14 @@
</param-value>
</context-param>


<!--
<context-param>
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
<param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
<param-value>
/Users/werpu2/development/workspace/extscript_trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/groovy
/whatever/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/groovy
</param-value>
</context-param>
Expand All @@ -52,18 +52,18 @@
</description>
<param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
<param-value>
/Users/werpu2/development/workspace/extscript_trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java
/whatever/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java
</param-value>
</context-param>
<context-param>
<description>resource paths for our custom JSF2 resource resolver</description>
<param-name>org.apache.myfaces.extensions.scripting.resources.LOADER_PATHS</param-name>
<param-value>
/Users/werpu2/development/workspace/extscript_trunk/extscript-examples/myfaces20-example/src/main/webapp
/whatever/extscript-examples/myfaces20-example/src/main/webapp
</param-value>
</context-param>

-->

<context-param>
<description>a redirecting Facelet resource resolver which allows to pick up templates and resources from our
Expand All @@ -73,37 +73,6 @@
<param-value>org.apache.myfaces.extensions.scripting.jsf.facelet.MyFacesReroutingResourceResolver</param-value>
</context-param>

<!--
<context-param>
<description>a comma separated whitelist of root packages which are compiled those and nothing else
will be compiled during all compile stages, all other files stay permanently as they are
</description>
<param-name>org.apache.myfaces.extensions.scripting.PGK_WHITELIST</param-name>
<param-value>org.apache.myfaces.groovyloader.blog</param-value>
</context-param>
-->


<!--
<context-param>
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
<param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
<param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/groovy</param-value>
</context-param>
<context-param>
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
<param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
<param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/java</param-value>
</context-param>
-->


<context-param>
Expand Down
Expand Up @@ -40,7 +40,7 @@
<h2>Documentation</h2>

<h:outputLink target="_new"
value="http://people.apache.org/~werpu/ext-script-site/index.html">Extension Scripting Documentation</h:outputLink>
value="http://myfaces.apache.org/extensions/scripting/index.html">Extension Scripting Documentation</h:outputLink>


<h2>Demo and Testing Links</h2>
Expand Down
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<context-root>/myfaces20-extscript-helloworld</context-root>
<class-loader delegate="false"/>
<property name="useBundledJsf" value="true"/>
<property name="useMyFaces" value="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>

0 comments on commit 8987ac8

Please sign in to comment.