View Javadoc

1   package com.atlassian.plugin.manager;
2   
3   import static com.google.common.base.Preconditions.checkNotNull;
4   
5   import com.atlassian.plugin.ModuleDescriptor;
6   import com.atlassian.plugin.Plugin;
7   import com.atlassian.plugin.PluginAccessor;
8   import com.atlassian.plugin.PluginParseException;
9   import com.atlassian.plugin.PluginRestartState;
10  import com.atlassian.plugin.predicate.ModuleDescriptorPredicate;
11  import com.atlassian.plugin.predicate.PluginPredicate;
12  
13  import java.io.InputStream;
14  import java.util.Collection;
15  import java.util.List;
16  
17  /**
18   * Simple forwarding delegate for a {@link PluginAccessor}.
19   * 
20   * @since 2.7.0
21   */
22  abstract class ForwardingPluginAccessor implements PluginAccessor
23  {
24      protected final PluginAccessor delegate;
25  
26      ForwardingPluginAccessor(final PluginAccessor delegate)
27      {
28          this.delegate = checkNotNull(delegate);
29      }
30  
31      public ClassLoader getClassLoader()
32      {
33          return delegate.getClassLoader();
34      }
35  
36      public InputStream getDynamicResourceAsStream(final String resourcePath)
37      {
38          return delegate.getDynamicResourceAsStream(resourcePath);
39      }
40  
41      public <D extends ModuleDescriptor<?>> List<D> getEnabledModuleDescriptorsByClass(final Class<D> descriptorClazz)
42      {
43          return delegate.getEnabledModuleDescriptorsByClass(descriptorClazz);
44      }
45  
46      public <M> List<M> getEnabledModulesByClass(final Class<M> moduleClass)
47      {
48          return delegate.getEnabledModulesByClass(moduleClass);
49      }
50  
51      public Plugin getEnabledPlugin(final String pluginKey) throws IllegalArgumentException
52      {
53          return delegate.getEnabledPlugin(pluginKey);
54      }
55  
56      public ModuleDescriptor<?> getEnabledPluginModule(final String completeKey)
57      {
58          return delegate.getEnabledPluginModule(completeKey);
59      }
60  
61      public Collection<Plugin> getEnabledPlugins()
62      {
63          return delegate.getEnabledPlugins();
64      }
65  
66      public <M> Collection<ModuleDescriptor<M>> getModuleDescriptors(final ModuleDescriptorPredicate<M> moduleDescriptorPredicate)
67      {
68          return delegate.getModuleDescriptors(moduleDescriptorPredicate);
69      }
70  
71      public <M> Collection<M> getModules(final ModuleDescriptorPredicate<M> moduleDescriptorPredicate)
72      {
73          return delegate.getModules(moduleDescriptorPredicate);
74      }
75  
76      public Plugin getPlugin(final String key) throws IllegalArgumentException
77      {
78          return delegate.getPlugin(key);
79      }
80  
81      public ModuleDescriptor<?> getPluginModule(final String completeKey)
82      {
83          return delegate.getPluginModule(completeKey);
84      }
85  
86      public PluginRestartState getPluginRestartState(final String key)
87      {
88          return delegate.getPluginRestartState(key);
89      }
90  
91      public Collection<Plugin> getPlugins()
92      {
93          return delegate.getPlugins();
94      }
95  
96      public Collection<Plugin> getPlugins(final PluginPredicate pluginPredicate)
97      {
98          return delegate.getPlugins(pluginPredicate);
99      }
100 
101     public boolean isPluginEnabled(final String key) throws IllegalArgumentException
102     {
103         return delegate.isPluginEnabled(key);
104     }
105 
106     public boolean isPluginModuleEnabled(final String completeKey)
107     {
108         return delegate.isPluginModuleEnabled(completeKey);
109     }
110 
111     public boolean isSystemPlugin(final String key)
112     {
113         return delegate.isSystemPlugin(key);
114     }
115 
116     //
117     // deprecated methods
118     //
119 
120     @Deprecated
121     public Class<?> getDynamicPluginClass(final String className) throws ClassNotFoundException
122     {
123         return delegate.getDynamicPluginClass(className);
124     }
125 
126     @Deprecated
127     public <D extends ModuleDescriptor<?>> List<D> getEnabledModuleDescriptorsByClass(final Class<D> descriptorClazz, final boolean verbose)
128     {
129         return delegate.getEnabledModuleDescriptorsByClass(descriptorClazz, verbose);
130     }
131 
132     @Deprecated
133     public <M> List<ModuleDescriptor<M>> getEnabledModuleDescriptorsByType(final String type) throws PluginParseException
134     {
135         return delegate.<M> getEnabledModuleDescriptorsByType(type);
136     }
137 
138     @Deprecated
139     public <M> List<M> getEnabledModulesByClassAndDescriptor(final Class<ModuleDescriptor<M>> descriptorClass, final Class<M> moduleClass)
140     {
141         return delegate.getEnabledModulesByClassAndDescriptor(descriptorClass, moduleClass);
142     }
143 
144     @Deprecated
145     public <M> List<M> getEnabledModulesByClassAndDescriptor(final Class<ModuleDescriptor<M>>[] descriptorClazz, final Class<M> moduleClass)
146     {
147         return delegate.getEnabledModulesByClassAndDescriptor(descriptorClazz, moduleClass);
148     }
149 
150     @Deprecated
151     public InputStream getPluginResourceAsStream(final String pluginKey, final String resourcePath)
152     {
153         return delegate.getPluginResourceAsStream(pluginKey, resourcePath);
154     }
155 }