KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > service > cmr > repository > Content


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.service.cmr.repository;
18
19 import org.alfresco.service.transaction.TransactionService;
20
21
22 /**
23  * A <tt>Content</tt> is a handle onto a specific content location.
24  *
25  * @author Derek Hulley
26  */

27 public interface Content
28 {
29     /**
30      * Use this method to register any interest in events against underlying
31      * content streams.
32      * {@link #getContentOutputStream() output stream}.
33      * <p>
34      * This method can only be used before the content stream has been retrieved.
35      * <p>
36      * When the stream has been closed, all listeners will be called
37      * within a {@link #setTransactionService(TransactionService) transaction} -
38      * to this end, a {@link TransactionService} must have been set as well.
39      *
40      * @param listener a listener that will be called for output stream
41      * event notification
42      *
43      * @see #setTransactionService(TransactionService)
44      */

45     public void addListener(ContentStreamListener listener);
46     
47     /**
48      * Set the transaction provider that will be used when stream listeners are called.
49      *
50      * @param transactionService a transaction provider
51      */

52     public void setTransactionService(TransactionService transactionService);
53     
54     /**
55      * @return Returns a URL identifying the specific location of the content.
56      * The URL must identify, within the context of the originating content
57      * store, the exact location of the content.
58      * @throws ContentIOException
59      */

60     public String JavaDoc getContentUrl() throws ContentIOException;
61     
62     /**
63      * Gets content's mimetype.
64      *
65      * @return Returns a standard mimetype for the content or null if the mimetype
66      * is unkown
67      */

68     public String JavaDoc getMimetype();
69     
70     /**
71      * Sets the content's mimetype.
72      *
73      * @param mimetype the standard mimetype for the content - may be null
74      */

75     public void setMimetype(String JavaDoc mimetype);
76     
77     /**
78      * Gets the content's encoding.
79      *
80      * @return Returns a valid Java encoding, typically a character encoding, or
81      * null if the encoding is unkown
82      */

83     public String JavaDoc getEncoding();
84     
85     /**
86      * Sets the content's encoding.
87      *
88      * @param encoding a valid Java encoding, typically a character encoding -
89      * may be null
90      */

91     public void setEncoding(String JavaDoc encoding);
92 }
93
Popular Tags