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