KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > media > registry > ManagedMediaFormatRegistry


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package org.jboss.media.registry;
9
10 import java.util.Iterator JavaDoc;
11 import java.util.Map JavaDoc;
12
13 import javax.emb.FormatAlreadyBoundException;
14 import javax.emb.FormatNotFoundException;
15 import javax.emb.MediaFormat;
16
17 import org.jboss.system.ServiceMBeanSupport;
18
19 /**
20  * A managed implementation of a MediaFormat registry.
21  *
22  * @version <tt>$Revision: 1.1 $</tt>
23  * @author <a HREF="mailto:spyridon_samothrakis@yahoo.com">Spyridon Samothrakis</a>
24  *
25  * @jmx.mbean extends="org.jboss.system.ServiceMBean"
26  */

27 public class ManagedMediaFormatRegistry
28    extends ServiceMBeanSupport
29    implements ManagedMediaFormatRegistryMBean
30 {
31    private SimpleMediaFormatRegistry mediaFormatRegistry;
32
33    /**
34     * Public Constructor.
35     */

36    public ManagedMediaFormatRegistry()
37    {
38    }
39
40    /**
41     * @jmx.managed-operation
42     */

43    public void bind(String JavaDoc fileExtension, MediaFormat mediaFormat)
44       throws FormatAlreadyBoundException
45    {
46       mediaFormatRegistry.bind(fileExtension, mediaFormat);
47    }
48
49    /**
50     * @jmx.managed-operation
51     */

52    public void rebind(String JavaDoc fileExtension, MediaFormat mediaFormat)
53    {
54       mediaFormatRegistry.rebind(fileExtension, mediaFormat);
55    }
56
57    /**
58     * @jmx.managed-operation
59     */

60    public void unbind(String JavaDoc fileExtension) throws FormatNotFoundException
61    {
62       mediaFormatRegistry.unbind(fileExtension);
63    }
64
65    /**
66     * @jmx.managed-operation
67     */

68    public MediaFormat lookup(String JavaDoc fileExtension)
69       throws FormatNotFoundException
70    {
71       return mediaFormatRegistry.lookup(fileExtension);
72    }
73
74    /**
75     * @jmx.managed-operation
76     */

77    public Iterator JavaDoc fileExtensions()
78    {
79       return mediaFormatRegistry.fileExtensions();
80    }
81
82    /**
83     * @see org.jboss.system.ServiceMBeanSupport#createService()
84     */

85    protected void createService() throws Exception JavaDoc
86    {
87       Map JavaDoc mediaFormats = JBossMediaFormatRegistry.createMediaFormats();
88       mediaFormatRegistry = new SimpleMediaFormatRegistry(mediaFormats);
89    }
90
91    /**
92     * @see org.jboss.system.ServiceMBeanSupport#destroyService()
93     */

94    protected void destroyService() throws Exception JavaDoc
95    {
96    }
97
98    /**
99     * @see org.jboss.system.ServiceMBeanSupport#startService()
100     */

101    protected void startService() throws Exception JavaDoc
102    {
103    }
104
105    /**
106     * @see org.jboss.system.ServiceMBeanSupport#stopService()
107     */

108    protected void stopService() throws Exception JavaDoc
109    {
110    }
111 }
112
Popular Tags