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.2.0 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 has completed local decommissioning. 063 */ 064 public static final Status DECOMMISSIONED = new Status( "decommissioned" ); 065 066 /** 067 * The provider is decommissioned not longer available. 068 */ 069 public static final Status DISPOSED = new Status( "disposed" ); 070 071 /** 072 * Array of static status enumeration values. 073 */ 074 private static final Status[] ENUM_VALUES = 075 new Status[]{INSTANTIATED, COMMISSIONING, AVAILABLE, DECOMMISSIONING, DECOMMISSIONED, DISPOSED}; 076 077 /** 078 * Returns an array of activation enum values. 079 * @return the activation policies array 080 */ 081 public static Status[] values() 082 { 083 return ENUM_VALUES; 084 } 085 086 /** 087 * Internal constructor. 088 * @param label the enumeration label. 089 */ 090 private Status( String label ) 091 { 092 super( label ); 093 } 094 095 /** 096 * Parse the supplied name. 097 * @param value the value to parse 098 * @return the collection policy 099 */ 100 public static Status parse( String value ) 101 { 102 if( INSTANTIATED.getName().equalsIgnoreCase( value ) ) 103 { 104 return INSTANTIATED; 105 } 106 else if( COMMISSIONING.getName().equalsIgnoreCase( value ) ) 107 { 108 return COMMISSIONING; 109 } 110 else if( AVAILABLE.getName().equalsIgnoreCase( value ) ) 111 { 112 return AVAILABLE; 113 } 114 else if( DECOMMISSIONING.getName().equalsIgnoreCase( value ) ) 115 { 116 return DECOMMISSIONING; 117 } 118 else if( DECOMMISSIONED.getName().equalsIgnoreCase( value ) ) 119 { 120 return DECOMMISSIONED; 121 } 122 else if( DISPOSED.getName().equalsIgnoreCase( value ) ) 123 { 124 return DISPOSED; 125 } 126 else 127 { 128 final String error = 129 "Unrecognized status argument [" + value + "]"; 130 throw new IllegalArgumentException( error ); 131 } 132 } 133 }