001 /* 002 * Copyright 2006 Stephen J. McConnell. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 013 * implied. 014 * 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package net.dpml.component; 020 021 import net.dpml.lang.Enum; 022 023 /** 024 * Provider deployment status enumeration. 025 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a> 026 * @version 1.0.4 027 */ 028 public final class Status extends Enum 029 { 030 //------------------------------------------------------------------- 031 // static 032 //------------------------------------------------------------------- 033 034 /** 035 * Serial version identifier. 036 */ 037 static final long serialVersionUID = 1L; 038 039 /** 040 * The provider has been instantiated but remains uncommissioned. 041 */ 042 public static final Status INSTANTIATED = new Status( "instantiated" ); 043 044 /** 045 * The provider is in the process of commissioning its internal structure 046 * following which the provider will attempt to establish a instance value 047 * and transition to AVAILABLE. 048 */ 049 public static final Status COMMISSIONING = new Status( "commissioning" ); 050 051 /** 052 * The provider has successfully established the target instance. 053 */ 054 public static final Status AVAILABLE = new Status( "available" ); 055 056 /** 057 * The provider is in the process of decommissioning it's internal parts. 058 */ 059 public static final Status DECOMMISSIONING = new Status( "decommissioning" ); 060 061 /** 062 * The provider is not longer available. 063 */ 064 public static final Status DISPOSED = new Status( "disposed" ); 065 066 /** 067 * Array of static status enumeration values. 068 */ 069 private static final Status[] ENUM_VALUES = 070 new Status[]{INSTANTIATED, COMMISSIONING, AVAILABLE, DECOMMISSIONING, DISPOSED}; 071 072 /** 073 * Returns an array of activation enum values. 074 * @return the activation policies array 075 */ 076 public static Status[] values() 077 { 078 return ENUM_VALUES; 079 } 080 081 /** 082 * Internal constructor. 083 * @param label the enumeration label. 084 */ 085 private Status( String label ) 086 { 087 super( label ); 088 } 089 090 /** 091 * Parse the supplied name. 092 * @param value the value to parse 093 * @return the collection policy 094 */ 095 public static Status parse( String value ) 096 { 097 if( INSTANTIATED.getName().equalsIgnoreCase( value ) ) 098 { 099 return INSTANTIATED; 100 } 101 else if( COMMISSIONING.getName().equalsIgnoreCase( value ) ) 102 { 103 return COMMISSIONING; 104 } 105 else if( AVAILABLE.getName().equalsIgnoreCase( value ) ) 106 { 107 return AVAILABLE; 108 } 109 else if( DECOMMISSIONING.getName().equalsIgnoreCase( value ) ) 110 { 111 return DECOMMISSIONING; 112 } 113 else if( DISPOSED.getName().equalsIgnoreCase( value ) ) 114 { 115 return DISPOSED; 116 } 117 else 118 { 119 final String error = 120 "Unrecognized status argument [" + value + "]"; 121 throw new IllegalArgumentException( error ); 122 } 123 } 124 }