You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 12:30:54 UTC

[myfaces-trinidad] 31/36: 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!

This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.2-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 048678a763aa18e38c7375c97b1cc87fa8bef6fa
Author: Jeanne Waldman <jw...@apache.org>
AuthorDate: Tue Mar 9 21:24:01 2010 +0000

    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!
---
 .../trinidad/share/io/InputStreamProvider.java     | 82 ++++++++++++++++++++++
 .../myfaces/trinidad/share/io/NameResolver.java    | 57 +++++++++++++++
 2 files changed, 139 insertions(+)

diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java
new file mode 100644
index 0000000..b521331
--- /dev/null
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/InputStreamProvider.java
@@ -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);
+}
diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java
new file mode 100644
index 0000000..fcd3094
--- /dev/null
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/share/io/NameResolver.java
@@ -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);
+}
+

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.