org.apache.jsieve.mailet.ResourceLocator Maven / Gradle / Ivy
Show all versions of apache-jsieve-mailet Show documentation
/****************************************************************
* 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.jsieve.mailet;
import java.io.IOException;
import java.io.InputStream;
/**
* Experimental API locates resources.
* Used to load Sieve scripts. The base for relative URLs
* should be taken to be the root of the James configuration.
*
* Required schemas:
*
*
* - User sieve scripts - the relative URL scheme
*
//user@host/sieve will be used to
* obtain the script
*
*
* The advantage of using URI
s
* and verbs (for example GET
, POST
)
* are their uniformity. The same API can be used to interface radically
* different resource types and protocols. This allows concise, minimal,
* powerful APIs to be created. Their simplicity is easy to preserved
* across versions.
*
* The disadvantage is that this free decouple means that there is
* no gaurantee that the implementations decoupled by this interface
* actually support the same scheme. Issues will be caught only
* at deployment and not at compile time.
* This places a larger burden on the deployer.
*
* Either an understanding or a consistent URL mapping scheme may be
* required. For example, //john.smith@localhost/sieve
* may need to be resolved to ../apps/james/var/sieve/[email protected]
* when using the file system to store scripts. Note that names MUST
* be normalised before resolving on a file system.
*
*/
public interface ResourceLocator {
/**
* GET verb locates and loads a resource.
* @param uri identifies the Sieve script
* @return not null
* @throws IOException when the resource cannot be located
*/
public InputStream get(String uri) throws IOException;
}