001 /* 002 * file CcTypeBase.java 003 * 004 * Licensed Materials - Property of IBM 005 * Restricted Materials of IBM 006 * 007 * 008 * com.ibm.rational.wvcm.stp.cc.CcTypeBase 009 * 010 * © Copyright IBM Corporation 2004, 2008. All Rights Reserved. 011 * Note to U.S. Government Users Restricted Rights: Use, duplication or 012 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 013 */ 014 015 016 package com.ibm.rational.wvcm.stp.cc; 017 018 import static com.ibm.rational.wvcm.stpex.StpExBase.PROPERTY_NAMESPACE; 019 020 import javax.wvcm.WvcmException; 021 import javax.wvcm.PropertyNameList.PropertyName; 022 023 import com.ibm.rational.wvcm.stpex.StpExBase; 024 import com.ibm.rational.wvcm.stpex.StpExEnumeration; 025 import com.ibm.rational.wvcm.stpex.StpExEnumerationBase; 026 027 /** 028 * <p>Base interface for all ClearCase "type" interfaces - branch type, 029 * label type, etc. A type object controls certain aspects of the creation and 030 * behavior of instances of that type. For instance, the name of a label 031 * instance is determined by it's label type. Changing the name of a label type 032 * changes the names of all instances of that type. 033 * </p> 034 */ 035 public interface CcTypeBase extends CcVobResource 036 { 037 /** 038 * Scope of a ClearCase type object. 039 * A type object's scope determines it's sphere of influence. Scope is one of 040 * <bl> 041 * <li>None. The scope of this type object is limited to instances in the 042 * VOB in which this type resides. 043 * </li> 044 * <li>Local. This type object is a VOB-local instance of a global type. 045 * While it controls the behavior of instances in its local VOB, it is 046 * essentially a local copy of a global type. 047 * </li> 048 * <li>Global. This type object controls behavior of instances in all VOBs 049 * for which this type object's VOB serves as an "admin" VOB. It uses 050 * "local" types as proxies in VOBs other than its own. 051 * </li> 052 * </bl> 053 * <p> 054 * For more information, see the ClearCase Administrator's Guide. 055 */ 056 enum Scope implements StpExEnumeration 057 { 058 /** This is a global type. */ 059 GLOBAL, 060 061 /** This is a local instance of a global type. */ 062 LOCAL, 063 064 /** This is neither a global type nor a local instance. */ 065 NONE; 066 } 067 068 /** 069 * The scope of this type object. 070 */ 071 PropertyName<Scope> SCOPE = 072 new PropertyName<Scope>(PROPERTY_NAMESPACE, "vob-type-scope"); 073 074 /** 075 * Get the value of this proxy's {@link #SCOPE} property. 076 * @return this type object's scope 077 * @throws WvcmException if this proxy doesn't define a value for this property. 078 */ 079 Scope getScope() throws WvcmException; 080 081 /** 082 * Set the value of this proxy's {@link #SCOPE} property. 083 * This property can only be set at type creation time. 084 * @param scope The new scope 085 */ 086 void setScope(Scope scope); 087 088 /** 089 * Instance constraint of a ClearCase type object. 090 * A type object's instance constraint determines where the type may be applied. 091 * Some metatypes do not support all (or any) instance constraints. 092 * Instance constraint is one of 093 * <bl> 094 * <li>None. There are no special constraints on this metatype beyond the default behaviour 095 * for the type. 096 * </li> 097 * <li>Element. Type instance may only occur once per element, 098 * </li> 099 * </li> 100 * <li>Branch. Type instances may occur on multiple branches, but only once per branch, 101 * </li> 102 * </li> 103 * <li>Version. Type instance may only be attached to versions, but may be attached to 104 * as many versions as desired 105 * </li> 106 * </bl> 107 * <p> 108 * For more information, see the ClearCase Administrator's Guide. 109 */ 110 enum InstanceConstraint implements StpExEnumeration 111 { 112 /** Default constraint for this type. */ 113 NONE, 114 115 /** Once per element. */ 116 ELEMENT, 117 118 /** Once per branch. */ 119 BRANCH, 120 121 /** Versions only, as many as desired. */ 122 VERSION; 123 124 private InstanceConstraint() {} 125 126 /** 127 * Returns the InstanceConstraint enumerator defined by the given Object 128 * 129 * @param tag The Object for which an enumerator is sought 130 * 131 * @return An InstanceConstraint object that is based on the given Object. Will 132 * be <b>null</b> if no such enumerator exists. 133 */ 134 135 public static InstanceConstraint byTag(Object tag) 136 { 137 return StpExEnumerationBase.getByTag(InstanceConstraint.class, tag); 138 } 139 } 140 141 /** 142 * The instance constraint of this type object. 143 */ 144 PropertyName<InstanceConstraint> INSTANCE_CONSTRAINT = 145 new PropertyName<InstanceConstraint>(PROPERTY_NAMESPACE, "vob-type-instance-constraint"); 146 147 /** 148 * Get the value of this proxy's {@link #INSTANCE_CONSTRAINT} property. 149 * @return this type object's instance constraint 150 * @throws WvcmException if this proxy doesn't define a value for this property. 151 */ 152 InstanceConstraint getInstanceConstraint() throws WvcmException; 153 154 /** 155 * Set the value of this proxy's {@link #INSTANCE_CONSTRAINT} property. 156 * This property can only be set at type creation time. 157 * @param constraint The new instance constraint 158 */ 159 void setInstanceConstraint(InstanceConstraint constraint); 160 161 /** 162 * Does this type object have shared mastership? If true, instances of this 163 * type can be created in any VOB replica in this type object's VOB family. 164 * Otherwise, instances of this type can only be created in the VOB replica 165 * that is the current master of this type object. For more information, see 166 * the ClearCase Administrator's Guide. 167 */ 168 PropertyName<Boolean> HAS_SHARED_MASTERSHIP = 169 new PropertyName<Boolean>(PROPERTY_NAMESPACE, "has-shared-mastership"); //$NON-NLS-1$ 170 171 /** 172 * Get the value of this proxy's {@link #HAS_SHARED_MASTERSHIP} property. 173 * @return true if this type object has shared mastership, else false 174 * @throws WvcmException if this proxy doesn't define a value for this property. 175 */ 176 boolean getHasSharedMastership() throws WvcmException; 177 178 /** 179 * Set the value of this proxy's {@link #HAS_SHARED_MASTERSHIP} property. 180 * This property can only be set at type creation time. 181 * @param hasSharedMastership true if this type is to have shared mastership, else false 182 */ 183 void setHasSharedMastership(boolean hasSharedMastership); 184 185 /** Enum for the doCreateResource method */ 186 enum TypeCreateFlag implements StpExEnumeration { 187 188 /** 189 * Acquire eclipsing types 190 */ 191 ACQUIRE("acquire"); 192 193 private String m_name; 194 195 private TypeCreateFlag(String name) { m_name = name; } 196 197 /* (non-Javadoc) 198 * @see java.lang.Object#toString() 199 */ 200 public String toString() { return m_name; } 201 } 202 }