myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r921131 - in /myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share: ./ io/ io/InputStreamProvider.java io/NameResolver.java
Date Tue, 09 Mar 2010 21:24:02 GMT
Author: jwaldman
Date: Tue Mar  9 21:24:01 2010
New Revision: 921131

URL: http://svn.apache.org/viewvc?rev=921131&view=rev
Log:
TRINIDAD-1746 move InputStreamProvider to be a public API
also move NameResolver to be public.
forgot to add the new files in the previous checkin!

Added:
    myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/
    myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/
    myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java
    myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java

Added: myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java?rev=921131&view=auto
==============================================================================
--- myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java
(added)
+++ myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java
Tue Mar  9 21:24:01 2010
@@ -0,0 +1,82 @@
+/*
+ *  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 org.apache.myfaces.trinidad.share.io;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * InputStreamProviders encapsulate a single target file. An InputStreamProvider is used
to 
+ * get an inputStream, cache results and see if the file has been modified. 
+ * (There's no real requirement that there be a physical file
+ * at the target location).
+ * <p>
+ * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/io/InputStreamProvider.java#0
$) $Date: 10-nov-2005.19:00:08 $
+ */
+public interface InputStreamProvider
+{
+  /**
+   * Return an InputStream for the target.  This function
+   * should never return null - if a stream cannot be opened,
+   * throw an IOException.
+   */
+  public InputStream       openInputStream() throws IOException;
+
+  /**
+   * Returns the name of the target location, suitable
+   * for user display.
+   */
+  public String            getDisplayName();
+
+  /**
+   * Returns an identifier object that uniquely
+   * identifies the target location. If two providers
+   * return equal identifiers, that is, given:
+   * <pre>
+   *   Object identifierA = providerA.getIdentifier();
+   *   Object identifierB = providerB.getIdentifier();
+   * </pre>
+   * ... then:
+   * <pre>
+   *   if (identifierA.equals(identifierB)) ...
+   * </pre>
+   * then the two providers must point to the same location.
+   */
+  public Object            getIdentifier();
+
+  /**
+   * Returns true if the underlying target has changed
+   * since the last call to openInputStream()
+   */
+  public boolean           hasSourceChanged();
+
+  /**
+   * Returns the cached result from reading and parsing this
+   * provider.
+   * @see CachingNameResolver
+   */
+  public Object            getCachedResult();
+
+  /**
+   * Stores the cached result of reading and parsing this
+   * provider.
+   * @see CachingNameResolver
+   */
+  public void              setCachedResult(Object value);
+}

Added: myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java?rev=921131&view=auto
==============================================================================
--- myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java
(added)
+++ myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java
Tue Mar  9 21:24:01 2010
@@ -0,0 +1,57 @@
+/*
+ *  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 org.apache.myfaces.trinidad.share.io;
+
+import java.io.IOException;
+
+
+
+/**
+ * NameResolvers are responsible for converting string names
+ * into InputStreamProviders, which encapsulate a remote file.
+ * Implementations exist that support using URLs, Files, Class
+ * resources, and the Servlet API to locate files, but other APIs
+ * may be substituted.
+ * <p>
+ * In some cases, the resolved target file may have need to
+ * locate support files of its own (like imported css files).  Since those support files
should
+ * be looked for relative to the target file, NameResolver supports
+ * creating new relative NameResolvers.
+ * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/io/NameResolver.java#0
$) $Date: 10-nov-2005.19:00:09 $
+ */
+public interface NameResolver
+{
+  /**
+   * Given a name, returns an InputStreamProvider.  This
+   * function should never return null - if the target
+   * cannot be resolved, throw an IOException.
+   * @param name the name of the target
+   */
+  public InputStreamProvider getProvider(String name) throws IOException;
+
+  /**
+   * Return the new NameResolver that should be used to resolve
+   * names relative to a given name.  This function should never
+   * return null - if the target cannot be resolved, return a
+   * resolver that can only support absolute names.
+   * @param name the name of the target
+   */
+  public NameResolver        getResolver(String name);
+}
+



Mime
View raw message