KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > setup > sources > ConfigurationSource


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema.setup.sources;
5
6 import com.tc.config.schema.setup.ConfigurationSetupException;
7
8 import java.io.File JavaDoc;
9 import java.io.IOException JavaDoc;
10 import java.io.InputStream JavaDoc;
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 JavaDoc getInputStream(long maxTimeoutMillis) throws IOException JavaDoc, ConfigurationSetupException;
23
24   /**
25    * Returns the directory from which the configuration was loaded, <em>if</em> such a thing exists. For example, when
26    * data is loaded from URLs or resources, this will be <code>null</code>; however, when loaded from files, this
27    * will return a valid value.
28    */

29   File JavaDoc directoryLoadedFrom();
30
31   /**
32    * Returns true iff the source was a TCProtocolConfigurationSource.
33    */

34   boolean isTrusted();
35 }
36
Popular Tags