You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/03/26 16:57:00 UTC

svn commit: r1085747 - in /myfaces/core/branches/2.1.x/api/src/main/java/javax/faces: FactoryFinder.java view/facelets/FaceletCache.java view/facelets/FaceletCacheFactory.java

Author: lu4242
Date: Sat Mar 26 15:57:00 2011
New Revision: 1085747

URL: http://svn.apache.org/viewvc?rev=1085747&view=rev
Log:
MYFACES-3089 Implement FaceletCacheFactory and FaceletCache methods

Added:
    myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCache.java
    myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCacheFactory.java
Modified:
    myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/FactoryFinder.java

Modified: myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/FactoryFinder.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/FactoryFinder.java?rev=1085747&r1=1085746&r2=1085747&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/FactoryFinder.java (original)
+++ myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/FactoryFinder.java Sat Mar 26 15:57:00 2011
@@ -38,6 +38,7 @@ import javax.faces.context.PartialViewCo
 import javax.faces.lifecycle.LifecycleFactory;
 import javax.faces.render.RenderKitFactory;
 import javax.faces.view.ViewDeclarationLanguageFactory;
+import javax.faces.view.facelets.FaceletCacheFactory;
 import javax.faces.view.facelets.TagHandlerDelegateFactory;
 
 /**
@@ -58,6 +59,7 @@ public final class FactoryFinder
     public static final String TAG_HANDLER_DELEGATE_FACTORY = "javax.faces.view.facelets.TagHandlerDelegateFactory";
     public static final String VIEW_DECLARATION_LANGUAGE_FACTORY = "javax.faces.view.ViewDeclarationLanguageFactory";
     public static final String VISIT_CONTEXT_FACTORY = "javax.faces.component.visit.VisitContextFactory";
+    public static final String FACELET_CACHE_FACTORY = "javax.faces.view.facelets.FaceletCacheFactory";
 
     /**
      * used as a monitor for itself and _factories. Maps in this map are used as monitors for themselves and the
@@ -91,6 +93,7 @@ public final class FactoryFinder
         VALID_FACTORY_NAMES.add(TAG_HANDLER_DELEGATE_FACTORY);
         VALID_FACTORY_NAMES.add(VIEW_DECLARATION_LANGUAGE_FACTORY);
         VALID_FACTORY_NAMES.add(VISIT_CONTEXT_FACTORY);
+        VALID_FACTORY_NAMES.add(FACELET_CACHE_FACTORY);
         
         ABSTRACT_FACTORY_CLASSES.put(APPLICATION_FACTORY, ApplicationFactory.class);
         ABSTRACT_FACTORY_CLASSES.put(EXCEPTION_HANDLER_FACTORY, ExceptionHandlerFactory.class);
@@ -102,6 +105,7 @@ public final class FactoryFinder
         ABSTRACT_FACTORY_CLASSES.put(TAG_HANDLER_DELEGATE_FACTORY, TagHandlerDelegateFactory.class);
         ABSTRACT_FACTORY_CLASSES.put(VIEW_DECLARATION_LANGUAGE_FACTORY, ViewDeclarationLanguageFactory.class);
         ABSTRACT_FACTORY_CLASSES.put(VISIT_CONTEXT_FACTORY, VisitContextFactory.class);
+        ABSTRACT_FACTORY_CLASSES.put(FACELET_CACHE_FACTORY, FaceletCacheFactory.class);
         try
         {
             ClassLoader classLoader;

Added: myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCache.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCache.java?rev=1085747&view=auto
==============================================================================
--- myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCache.java (added)
+++ myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCache.java Sat Mar 26 15:57:00 2011
@@ -0,0 +1,61 @@
+/*
+ * 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 javax.faces.view.facelets;
+
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * 
+ * @author Leonardo Uribe
+ * @since 2.1
+ */
+public abstract class FaceletCache<V>
+{
+    public abstract V getFacelet(URL url) throws IOException;
+    
+    public abstract boolean isFaceletCached(URL url);
+    
+    public abstract V getViewMetadataFacelet(URL url) throws IOException;
+    
+    public abstract boolean isViewMetadataFaceletCached(URL url);
+    
+    protected void setMemberFactories(FaceletCache.MemberFactory<V> faceletFactory, FaceletCache.MemberFactory<V> viewMetadataFaceletFactory)
+    {
+        //TODO: Write content
+    }
+
+    protected FaceletCache.MemberFactory<V> getMemberFactory()
+    {
+        //TODO: Write content
+        return null;
+    }
+    
+    protected FaceletCache.MemberFactory<V> getMetadataMemberFactory()
+    {
+        //TODO: Write content
+        return null;
+    }
+    
+    public static interface MemberFactory<V>
+    {
+        V newInstance(URL key) throws IOException;
+    }
+}

Added: myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCacheFactory.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCacheFactory.java?rev=1085747&view=auto
==============================================================================
--- myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCacheFactory.java (added)
+++ myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/view/facelets/FaceletCacheFactory.java Sat Mar 26 15:57:00 2011
@@ -0,0 +1,38 @@
+/*
+ * 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 javax.faces.view.facelets;
+
+import javax.faces.FacesWrapper;
+
+/**
+ * 
+ * @author Leonardo Uribe
+ * @since 2.1
+ */
+public abstract class FaceletCacheFactory implements FacesWrapper<FaceletCacheFactory>
+{
+
+    public abstract FaceletCache getFaceletCache();
+
+    public FaceletCacheFactory getWrapped()
+    {
+        return null;
+    }
+
+}