01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.config.schema.setup.sources;
05:
06: import com.tc.config.schema.setup.ConfigurationSetupException;
07:
08: import java.io.File;
09: import java.io.IOException;
10: import java.io.InputStream;
11:
12: /**
13: * Knows how to fetch configuration — just as an {@link InputStream} — from some source.
14: */
15: public interface ConfigurationSource {
16:
17: /**
18: * This method should throw an {@link IOException} if it tried to get the data but couldn't, but it's possible that it
19: * might be able to in the future (for example, URLs). It should throw a {@link ConfigurationSetupException} if it
20: * tried to get the data but couldn't, and will never be able to (for example, files).
21: */
22: InputStream getInputStream(long maxTimeoutMillis)
23: throws IOException, ConfigurationSetupException;
24:
25: /**
26: * Returns the directory from which the configuration was loaded, <em>if</em> such a thing exists. For example, when
27: * data is loaded from URLs or resources, this will be <code>null</code>; however, when loaded from files, this
28: * will return a valid value.
29: */
30: File directoryLoadedFrom();
31:
32: /**
33: * Returns true iff the source was a TCProtocolConfigurationSource.
34: */
35: boolean isTrusted();
36: }
|