01: package org.drools.resource;
02:
03: import java.io.ByteArrayOutputStream;
04:
05: import org.drools.resource.exception.ResourceAccessDeniedException;
06: import org.drools.resource.exception.ResourceTypeNotSupportedException;
07: import org.drools.resource.exception.ResourceUrlNotFoundException;
08:
09: /**
10: * Resource handler for interace that all implementations must provide.
11: * Subversion is the first implementation of this interface. The interface
12: * may need to be changed/extended to accomodate advanced line items, like
13: * resource locking/deployment.
14: *
15: * @author James Williams (james.williams@redhat.com)
16: *
17: */
18: public interface ResourceHandler {
19:
20: /**
21: * Get the URL contents.
22: *
23: * This method should also be smart enough to pull the specific version
24: * if specified in the RepositoryBean version attribute.
25: *
26: * @param aRepositoryBean
27: * @return
28: */
29: public ByteArrayOutputStream getResourceStream(
30: RepositoryBean aRepositoryBean)
31: throws ResourceUrlNotFoundException,
32: ResourceTypeNotSupportedException,
33: ResourceAccessDeniedException;
34:
35: /**
36: * Get the latest version of the resource from the repository if no version
37: * is specified.
38: *
39: * This method should also be smart enough to pull the specific version
40: * if specified in the RepositoryBean version attribute.
41: *
42: * @param aRepositoryBean
43: * @return
44: * @throws ResourceTypeNotSupportedException
45: */
46: public String getResourceURL(RepositoryBean aRepositoryBean)
47: throws ResourceTypeNotSupportedException;
48:
49: /**
50: * Authenticate the user based on his/her credentials, typically a
51: * username/password combo.
52: *
53: * @param url
54: * @return
55: */
56: public boolean authenticate(String url);
57:
58: /**
59: * Set the credentials for the resource handler calls. Typically called
60: * before the user attempts to get any resources.
61: *
62: * @param username
63: * @param password
64: */
65: public void setCredentials(String username, String password);
66:
67: public void setRepositoryUrl(String url);
68:
69: //resource types that need to be supported
70: // public static final int DRL_FILE = 1;
71: // public static final int RULE = 2;
72: // public static final int FUNCTION = 3;
73: // public static final int DSL_FILE = 4;
74: // public static final int XLS_FILE = 5;
75:
76: }
|