View Javadoc

1   /*
2    * Copyright 2006-2008 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.osgi.bundle;
18  
19  import org.springframework.core.enums.StaticLabeledEnum;
20  
21  /**
22   * Enum-like class for the {@link org.osgi.framework.Bundle} actions supported
23   * by {@link BundleFactoryBean}.
24   * 
25   * @author Costin Leau
26   * 
27   */
28  public class BundleAction extends StaticLabeledEnum {
29  
30  	private static final long serialVersionUID = 3723986124669884703L;
31  
32  	/**
33  	 * Install bundle. This action is implied by {@link #START} and
34  	 * {@link #UPDATE} in case no bundle is found in the existing OSGi
35  	 * BundleContext.
36  	 * 
37  	 * @see org.osgi.framework.BundleContext#installBundle(String)
38  	 */
39  	public static final BundleAction INSTALL = new BundleAction(1, "install");
40  
41  	/**
42  	 * Start bundle. If no bundle is found, it will try first to install one
43  	 * based on the existing configuration.
44  	 * 
45  	 * @see org.osgi.framework.Bundle#start()
46  	 */
47  	public static final BundleAction START = new BundleAction(2, "start");
48  
49  	/**
50  	 * Update bundle. If no bundle is found, it will try first to install one
51  	 * based on the existing configuration.
52  	 * 
53  	 * @see org.osgi.framework.Bundle#update()
54  	 */
55  	public static final BundleAction UPDATE = new BundleAction(3, "update");
56  
57  	/**
58  	 * Stop bundle. If no bundle is found, this action does nothing (it will
59  	 * trigger loading).
60  	 * 
61  	 * @see org.osgi.framework.Bundle#stop()
62  	 */
63  	public static final BundleAction STOP = new BundleAction(4, "stop");
64  
65  	/**
66  	 * Uninstall bundle. If no bundle is found, this action does nothing (it
67  	 * will trigger loading).
68  	 * 
69  	 * @see org.osgi.framework.Bundle#uninstall()
70  	 */
71  	public static final BundleAction UNINSTALL = new BundleAction(5, "uninstall");
72  
73  
74  	/**
75  	 * Constructs a new <code>BundleAction</code> instance.
76  	 * 
77  	 * @param code
78  	 * @param label
79  	 */
80  	private BundleAction(int code, String label) {
81  		super(code, label);
82  	}
83  }