Changeset 365
- Timestamp:
- 03/13/07 07:53:51 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/org/apache/maven/artifact/handler/mvnDefaultArtifactHandler.php
r364 r365 33 33 * @subpackage artifact_handler 34 34 */ 35 class DefaultArtifactHandler implementsArtifactHandler35 class mvnDefaultArtifactHandler implements mvnArtifactHandler 36 36 { 37 37 /** … … 143 143 } 144 144 145 return packaging;145 return $this->packaging; 146 146 } 147 147 trunk/src/main/php/org/apache/maven/artifact/mvnArtifact.php
r364 r365 44 44 * latest version 45 45 */ 46 const LATEST_VERSION = "LATEST";46 const LATEST_VERSION = 'LATEST'; 47 47 /** 48 48 * snapshot version 49 49 */ 50 const SNAPSHOT_VERSION = "SNAPSHOT";50 const SNAPSHOT_VERSION = 'SNAPSHOT'; 51 51 /** 52 52 * scope: compile 53 53 */ 54 const SCOPE_COMPILE = "compile";54 const SCOPE_COMPILE = 'compile'; 55 55 /** 56 56 * scope: test 57 57 */ 58 const SCOPE_TEST = "test";58 const SCOPE_TEST = 'test'; 59 59 /** 60 60 * scope: runtime 61 61 */ 62 const SCOPE_RUNTIME = "runtime";62 const SCOPE_RUNTIME = 'runtime'; 63 63 /** 64 64 * scope: provided 65 65 */ 66 const SCOPE_PROVIDED = "provided";66 const SCOPE_PROVIDED = 'provided'; 67 67 /** 68 68 * scope: system 69 69 */ 70 const SCOPE_SYSTEM = "system";70 const SCOPE_SYSTEM = 'system'; 71 71 /** 72 72 * release version 73 73 */ 74 const RELEASE_VERSION = "RELEASE"; 74 const RELEASE_VERSION = 'RELEASE'; 75 76 /** 77 * sets the group id 78 * 79 * @param string $groupId 80 */ 81 public function setGroupId($groupId); 75 82 76 83 /** … … 82 89 83 90 /** 91 * sets the artifact id 92 * 93 * @param string $artifactId 94 */ 95 public function setArtifactId($artifactId); 96 97 /** 84 98 * returns the artifact id 85 99 * … … 89 103 90 104 /** 91 * returns the version of the artifact 92 * 93 * @return string 94 */ 95 public function getVersion(); 96 97 /** 98 * set the version of the artifact 99 * 100 * @param string $version 101 */ 102 public function setVersion($version); 105 * sets the base version 106 */ 107 public function setBaseVersion($baseVersion); 108 109 /** 110 * returns the base version 111 * 112 * @return string 113 */ 114 public function getBaseVersion(); 115 116 /** 117 * returns the type of the artifact 118 * 119 * @return string 120 */ 121 public function getType(); 122 123 /** 124 * check whether artifact has a classifier or not 125 * 126 * @return bool 127 */ 128 public function hasClassifier(); 129 130 /** 131 * returns the classifier 132 * 133 * @return string 134 */ 135 public function getClassifier(); 136 137 /** 138 * sets the scope of the artifact 139 * 140 * @param string $scope 141 */ 142 public function setScope($scope); 103 143 104 144 /** … … 115 155 116 156 /** 117 * returns the type of the artifact 118 * 119 * @return string 120 */ 121 public function getType(); 122 123 /** 124 * returns the classifier 125 * 126 * @return string 127 */ 128 public function getClassifier(); 129 130 /** 131 * check whether artifact has a classifier or not 132 * 133 * @return bool 134 */ 135 public function hasClassifier(); 157 * sets the file for the artifact 158 * 159 * @param string (File) $file 160 */ 161 public function setFile($file); 136 162 137 163 /** … … 143 169 144 170 /** 145 * sets the file for the artifact 146 * 147 * @param string (File) $file 148 */ 149 public function setFile($file); 150 151 /** 152 * returns the base version 153 * 154 * @return string 155 */ 156 public function getBaseVersion(); 157 158 /** 159 * sets the base version 160 */ 161 public function setBaseVersion($baseVersion); 162 163 /** 164 * returns an id 165 * 166 * @return string 167 */ 168 public function getId(); 169 170 /** 171 * returns a unique id 172 * 173 * @return string 174 */ 175 public function getDependencyConflictId(); 176 177 /** 178 * adds metadata 179 * 180 * @param mvnArtifactMetadata $metadata 181 */ 182 public function addMetadata(mvnArtifactMetadata $metadata); 183 184 /** 185 * returns the meta data 186 * 171 * sets the repository of the artifact 172 * 173 * @param mvnArtifactRepository $repository 174 */ 175 public function setRepository(mvnArtifactRepository $repository); 176 177 /** 178 * returns the repository of the artifact 179 * 180 * @return mvnArtifactRepository 181 */ 182 public function getRepository(); 183 184 /** 185 * set the download url 186 * 187 * @param string $downloadUrl 188 */ 189 public function setDownloadUrl($downloadUrl); 190 191 /** 192 * returns the download url 193 * 194 * @return string 195 */ 196 public function getDownloadUrl(); 197 198 /** 199 * sets the dependency filter 200 * 201 * @param mvnArtifactFilter $artifactFilter 202 */ 203 public function setDependencyFilter(mvnArtifactFilter $artifactFilter); 204 205 /** 206 * returns the dependency filter 207 * 208 * @return mvnArtifactFilter 209 */ 210 public function getDependencyFilter(); 211 212 /** 213 * sets the artifact handler 214 * 215 * @param mvnArtifactHandler $artifactHandler 216 */ 217 public function setArtifactHandler(mvnArtifactHandler $artifactHandler); 218 219 /** 220 * returns the artifact handler 221 * 222 * @return mvnArtifactHandler 223 */ 224 public function getArtifactHandler(); 225 226 /** 227 * sets the dependency trail 228 * 229 * @param array $dependencyTrail 230 */ 231 public function setDependencyTrail(array $dependencyTrail); 232 233 /** 234 * returns the dependency trail 235 * 187 236 * @return array 188 237 */ 189 public function getMetadataList(); 190 191 /** 192 * sets the repository of the artifact 193 * 194 * @param mvnArtifactRepository $repository 195 */ 196 public function setRepository(mvnArtifactRepository $repository); 197 198 /** 199 * returns the repository of the artifact 200 * 201 * @return mvnArtifactRepository 202 */ 203 public function getRepository(); 238 public function getDependencyTrail(); 239 240 /** 241 * set the version of the artifact 242 * 243 * @param string $version 244 */ 245 public function setVersion($version); 246 247 /** 248 * sets the resolved version 249 * 250 * @param string $version 251 */ 252 public function setResolvedVersion($version); 253 254 /** 255 * selects the version 256 * 257 * @param string $version 258 */ 259 public function selectVersion($version); 260 261 /** 262 * returns the version of the artifact 263 * 264 * @return string 265 */ 266 public function getVersion(); 267 268 /** 269 * sets the version range of the artifact 270 * 271 * @param mvnVersionRange $versionRange 272 */ 273 public function setVersionRange(mvnVersionRange $versionRange); 274 275 /** 276 * returns the version range of the artifact 277 * 278 * @return mvnVersionRange 279 */ 280 public function getVersionRange(); 281 282 /** 283 * returns the selected version of the artifact 284 * 285 * @return string 286 * @throws mvnOverConstrainedVersionException 287 */ 288 public function getSelectedVersion(); 289 290 /** 291 * checks whether the selected version is known 292 * 293 * @return bool 294 * @throws mvnOverConstrainedVersionException 295 */ 296 public function isSelectedVersionKnown(); 204 297 205 298 /** … … 212 305 213 306 /** 214 * returns the download url 215 * 216 * @return string 217 */ 218 public function getDownloadUrl(); 219 220 /** 221 * set the download url 222 * 223 * @param string $downloadUrl 224 */ 225 public function setDownloadUrl($downloadUrl); 226 227 /** 228 * returns the dependency filter 229 * 230 * @return mvnArtifactFilter 231 */ 232 public function getDependencyFilter(); 233 234 /** 235 * sets the dependency filter 236 * 237 * @param mvnArtifactFilter $artifactFilter 238 */ 239 public function setDependencyFilter(mvnArtifactFilter $artifactFilter); 240 241 /** 242 * returns the artifact handler 243 * 244 * @return mvnArtifactHandler 245 */ 246 public function getArtifactHandler(); 247 248 /** 249 * returns the dependency trail 250 * 307 * checks whether this artifact is a snapshot or not 308 * 309 * @return bool 310 */ 311 public function isSnapshot(); 312 313 /** 314 * sets resolved 315 * 316 * @param bool $resolved 317 */ 318 public function setResolved($resolved); 319 320 /** 321 * checks whether this artifact is resolved or not 322 * 323 * @return bool 324 */ 325 public function isResolved(); 326 327 /** 328 * sets whether to use the latest release or not 329 * 330 * @param bool $release 331 */ 332 public function setRelease($release); 333 334 /** 335 * checks whether to use the latest release or not 336 * 337 * @return bool 338 */ 339 public function isRelease(); 340 341 /** 342 * sets the list of available versions 343 * 344 * @param array $availableVersions 345 */ 346 public function setAvailableVersions(array $availableVersions); 347 348 /** 349 * returns the list of available versions 350 * 251 351 * @return array 252 352 */ 253 public function getDependencyTrail(); 254 255 /** 256 * sets the dependency trail 257 * 258 * @param array $dependencyTrail 259 */ 260 public function setDependencyTrail(array $dependencyTrail); 261 262 /** 263 * sets the scope of the artifact 264 * 265 * @param string $scope 266 */ 267 public function setScope($scope); 268 269 /** 270 * returns the version range of the artifact 271 * 272 * @return mvnVersionRange 273 */ 274 public function getVersionRange(); 275 276 /** 277 * sets the version range of the artifact 278 * 279 * @param mvnVersionRange $versionRange 280 */ 281 public function setVersionRange(mvnVersionRange $versionRange); 282 283 /** 284 * selects the version 285 * 286 * @param string $version 287 */ 288 public function selectVersion($version); 289 290 /** 291 * sets the group id 292 * 293 * @param string $groupId 294 */ 295 public function setGroupId($groupId); 296 297 /** 298 * sets the artifact id 299 * 300 * @param string $artifactId 301 */ 302 public function setArtifactId($artifactId); 303 304 /** 305 * checks whether this artifact is a snapshot or not 306 * 307 * @return bool 308 */ 309 public function isSnapshot(); 310 311 /** 312 * sets resolved 313 * 314 * @param bool $resolved 315 */ 316 public function setResolved($resolved); 317 318 /** 319 * checks whether this artifact is resolved or not 320 * 321 * @return bool 322 */ 323 public function isResolved(); 324 325 /** 326 * sets the resolved version 327 * 328 * @param string $version 329 */ 330 public function setResolvedVersion($version); 331 332 /** 333 * sets the artifact handler 334 * 335 * @param mvnArtifactHandler $artifactHandler 336 */ 337 public function setArtifactHandler(mvnArtifactHandler $artifactHandler); 338 339 /** 340 * checks whether to use the latest release or not 341 * 342 * @return bool 343 */ 344 public function isRelease(); 345 346 /** 347 * sets whether to use the latest release or not 348 * 349 * @param bool $release 350 */ 351 public function setRelease($release); 352 353 /** 354 * returns the list of available versions 353 public function getAvailableVersions(); 354 355 /** 356 * adds metadata 357 * 358 * @param mvnArtifactMetadata $metadata 359 */ 360 public function addMetadata(mvnArtifactMetadata $metadata); 361 362 /** 363 * returns the meta data 355 364 * 356 365 * @return array 357 366 */ 358 public function get AvailableVersions();359 360 /** 361 * sets the list of available versions362 * 363 * @param array $availableVersions364 */ 365 public function set AvailableVersions(array $availableVersions);367 public function getMetadataList(); 368 369 /** 370 * sets whether this artifact is optional or not 371 * 372 * @param bool $optional 373 */ 374 public function setOptional($optional); 366 375 367 376 /** … … 371 380 */ 372 381 public function isOptional(); 373 374 /** 375 * sets whether this artifact is optional or not 376 * 377 * @param bool $optional 378 */ 379 public function setOptional($optional); 380 381 /** 382 * returns the selected version of the artifact 383 * 384 * @return string 385 * @throws mvnOverConstrainedVersionException 386 */ 387 public function getSelectedVersion(); 388 389 /** 390 * checks whether the selected version is known 391 * 392 * @return bool 393 * @throws mvnOverConstrainedVersionException 394 */ 395 public function isSelectedVersionKnown(); 382 383 /** 384 * returns an id 385 * 386 * @return string 387 */ 388 public function getId(); 389 390 /** 391 * returns a unique id 392 * 393 * @return string 394 */ 395 public function getDependencyConflictId(); 396 396 } 397 397 ?> trunk/src/main/php/org/apache/maven/artifact/mvnDefaultArtifact.php
r364 r365 163 163 public function __construct($groupId, $artifactId, mvnVersionRange $versionRange = null, $scope = null, $type = null, $classifier = null, mvnArtifactHandler $artifactHandler = null, $optional = false) 164 164 { 165 $this->groupId = $groupId; 166 $this->artifactId = $artifactId; 167 $this->versionRange = $versionRange; 168 $this->selectVersionFromNewRangeIfAvailable(); 165 $this->groupId = $groupId; 166 $this->artifactId = $artifactId; 167 $this->setVersionRange($versionRange); 169 168 $this->artifactHandler = $artifactHandler; 170 169 $this->scope = $scope; … … 176 175 $this->classifier = $classifier; 177 176 $this->optional = $optional; 178 $this->validateIdentity(); 179 } 180 181 /** 182 * validates the identity of the artifact 183 * 184 * @throws mvnInvalidArtifactRTException 185 */ 186 private function validateIdentity() 187 { 188 if ($this->isEmpty($this->groupId) == true) { 177 if (null == $this->groupId || strlen(trim($this->groupId)) < 1) { 189 178 throw new mvnInvalidArtifactRTException($this->groupId, $this->artifactId, $this->getVersion(), $this->type, 'The groupId cannot be empty.'); 190 179 } 191 180 192 if ( $this->isEmpty($this->artifactId) == true) {181 if (null == $this->artifactId || strlen(trim($this->artifactId)) < 1) { 193 182 throw new mvnInvalidArtifactRTException($this->groupId, $this->artifactId, $this->getVersion(), $this->type, 'The artifactId cannot be empty.'); 194 183 } … … 204 193 205 194 /** 206 * check if a value is empty 207 * 208 * @param string $value 209 */ 210 private function isEmpty($value) 211 { 212 return (null == $value || strlen(trim($value)) < 1); 195 * sets the group id 196 * 197 * @param string $groupId 198 */ 199 public function setGroupId($groupId) 200 { 201 $this->groupId = $groupId; 202 } 203 204 /** 205 * returns the group id of the artifact 206 * 207 * @return string 208 */ 209 public function getGroupId() 210 { 211 return $this->groupId; 212 } 213 214 /** 215 * returns the artifact id 216 * 217 * @return function 218 */ 219 public function getArtifactId() 220 { 221 return $this->artifactId; 222 } 223 224 /** 225 * sets the artifact id 226 * 227 * @param string $artifactId 228 */ 229 public function setArtifactId($artifactId) 230 { 231 $this->artifactId = $artifactId; 232 } 233 234 /** 235 * sets the base version 236 */ 237 public function setBaseVersion($baseVersion) 238 { 239 $this->baseVersion = $baseVersion; 240 } 241 242 /** 243 * returns the base version 244 * 245 * @return string 246 */ 247 public function getBaseVersion() 248 { 249 if (null == $this->baseVersion) { 250 if (null == $this->version) { 251 throw new NullPointerException('version was null for ' . $this->groupId . ':' . $this->artifactId); 252 } 253 254 $this->baseVersion = $this->version; 255 } 256 257 return $this->baseVersion; 258 } 259 260 /** 261 * returns the type of the artifact 262 * 263 * @return string 264 */ 265 public function getType() 266 { 267 return $this->type; 268 } 269 270 /** 271 * check whether artifact has a classifier or not 272 * 273 * @return bool 274 */ 275 public function hasClassifier() 276 { 277 return (false == $this->isEmpty($this->classifier)); 213 278 } 214 279 … … 224 289 225 290 /** 226 * check whether artifact has a classifier or not227 * 228 * @ return bool229 */ 230 public function hasClassifier()231 { 232 return (false == $this->isEmpty($this->classifier));291 * sets the scope of the artifact 292 * 293 * @param string $scope 294 */ 295 public function setScope($scope) 296 { 297 $this->scope = $scope; 233 298 } 234 299 … … 249 314 250 315 /** 251 * returns the group id of the artifact 252 * 253 * @return string 254 */ 255 public function getGroupId() 256 { 257 return $this->groupId; 258 } 259 260 /** 261 * returns the artifact id 262 * 263 * @return function 264 */ 265 public function getArtifactId() 266 { 267 return $this->artifactId; 268 } 269 270 /** 271 * returns the version of the artifact 272 * 273 * @return string 274 */ 275 public function getVersion() 276 { 277 return $this->version; 316 * sets the file for the artifact 317 * 318 * @param string (File) $file 319 */ 320 public function setFile($file) 321 { 322 $this->file = $file; 323 } 324 325 /** 326 * returns the file of the artifact 327 * 328 * @return string 329 */ 330 public function getFile() 331 { 332 return $this->file; 333 } 334 335 /** 336 * sets the repository of the artifact 337 * 338 * @param mvnArtifactRepository $repository 339 */ 340 public function setRepository(mvnArtifactRepository $repository) 341 { 342 $this->repository = $repository; 343 } 344 345 /** 346 * returns the repository of the artifact 347 * 348 * @return mvnArtifactRepository 349 */ 350 public function getRepository() 351 { 352 return $this->repository; 353 } 354 355 /** 356 * set the download url 357 * 358 * @param string $downloadUrl 359 */ 360 public function setDownloadUrl($downloadUrl) 361 { 362 $this->downloadUrl = $downloadUrl; 363 } 364 365 /** 366 * returns the download url 367 * 368 * @return string 369 */ 370 public function getDownloadUrl() 371 { 372 return $this->downloadUrl; 373 } 374 375 /** 376 * sets the dependency filter 377 * 378 * @param mvnArtifactFilter $artifactFilter 379 */ 380 public function setDependencyFilter(mvnArtifactFilter $artifactFilter) 381 { 382 $this->dependencyFilter = $artifactFilter; 383 } 384 385 /** 386 * returns the dependency filter 387 * 388 * @return mvnArtifactFilter 389 */ 390 public function getDependencyFilter() 391 { 392 return $this->dependencyFilter; 393 } 394 395 /** 396 * sets the artifact handler 397 * 398 * @param mvnArtifactHandler $artifactHandler 399 */ 400 public function setArtifactHandler(mvnArtifactHandler $artifactHandler) 401 { 402 $this->artifactHandler = $artifactHandler; 403 } 404 405 /** 406 * returns the artifact handler 407 * 408 * @return mvnArtifactHandler 409 */ 410 public function getArtifactHandler() 411 { 412 return $this->artifactHandler; 413 } 414 415 /** 416 * sets the dependency trail 417 * 418 * @param array $dependencyTrail 419 */ 420 public function setDependencyTrail(array $dependencyTrail) 421 { 422 $this->dependencyTrail = $dependencyTrail; 423 } 424 425 /** 426 * returns the dependency trail 427 * 428 * @return array 429 */ 430 public function getDependencyTrail() 431 { 432 return $this->dependencyTrail; 278 433 } 279 434 … … 291 446 292 447 /** 293 * returns the type of the artifact 294 * 295 * @return string 296 */ 297 public function getType() 298 { 299 return $this->type; 300 } 301 302 /** 303 * sets the file for the artifact 304 * 305 * @param string (File) $file 306 */ 307 public function setFile($file) 308 { 309 $this->file = $file; 310 } 311 312 /** 313 * returns the file of the artifact 314 * 315 * @return string 316 */ 317 public function getFile() 318 { 319 return $this->file; 320 } 321 322 /** 323 * returns the repository of the artifact 324 * 325 * @return mvnArtifactRepository 326 */ 327 public function getRepository() 328 { 329 return $this->repository; 330 } 331 332 /** 333 * sets the repository of the artifact 334 * 335 * @param mvnArtifactRepository $repository 336 */ 337 public function setRepository(mvnArtifactRepository $repository) 338 { 339 $this->repository = $repository; 340 } 341 342 // ---------------------------------------------------------------------- 343 // 344 // ---------------------------------------------------------------------- 345 346 /** 347 * returns an id 348 * 349 * @return string 350 */ 351 public function getId() 352 { 353 return $this->getDependencyConflictId() . ':' . $this->getBaseVersion(); 354 } 355 356 /** 357 * returns a unique id 358 * 359 * @return string 360 */ 361 public function getDependencyConflictId() 362 { 363 return $this->appendArtifactTypeClassifierString($this->getGroupId() . ':'); 364 } 365 366 /** 367 * returns the conflict id with the type classifier 368 * 369 * @param string $conflictId 370 * @return string 371 */ 372 private function appendArtifactTypeClassifierString($conflictId) 373 { 374 $conflictId .= $this->getArtifactId() . ':' . $this->getType(); 375 if ($this->hasClassifier() == true) { 376 $conflictId .= ':' . $this->getClassifier(); 377 } 378 379 return $conflictId; 448 * sets the resolved version 449 * 450 * @param string $version 451 */ 452 public function setResolvedVersion($version) 453 { 454 $this->version = $version; 455 // retain baseVersion 456 } 457 458 /** 459 * selects the version 460 * 461 * @param string $version 462 */ 463 public function selectVersion($version) 464 { 465 $this->version = $version; 466 $this->baseVersion = $version; 467 } 468 469 /** 470 * returns the version of the artifact 471 * 472 * @return string 473 */ 474 public function getVersion() 475 { 476 return $this->version; 477 } 478 479 /** 480 * sets the version range of the artifact 481 * 482 * @param mvnVersionRange $versionRange optional 483 */ 484 public function setVersionRange(mvnVersionRange $versionRange = null) 485 { 486 $this->versionRange = $versionRange; 487 if (null != $this->versionRange && $this->versionRange->getRecommendedVersion() != null) { 488 $this->selectVersion($this->versionRange->getRecommendedVersion()); 489 } else { 490 $this->version = null; 491 $this->baseVersion = null; 492 } 493 } 494 495 /** 496 * returns the version range of the artifact 497 * 498 * @return mvnVersionRange 499 */ 500 public function getVersionRange() 501 { 502 return $this->versionRange; 503 } 504 505 /** 506 * checks whether the selected version is known 507 * 508 * @return bool 509 * @throws mvnOverConstrainedVersionException 510 */ 511 public function isSelectedVersionKnown() 512 { 513 return $this->versionRange->isSelectedVersionKnown($this); 514 } 515 516 /** 517 * returns the selected version of the artifact 518 * 519 * @return string 520 * @throws mvnOverConstrainedVersionException 521 */ 522 public function getSelectedVersion() 523 { 524 return $this->versionRange->getSelectedVersion($this); 525 } 526 527 /** 528 * updates the version 529 * 530 * @param string $version 531 * @param mvnArtifactRepository $localRepository 532 */ 533 public function updateVersion($version, mvnArtifactRepository $localRepository) 534 { 535 $this->setResolvedVersion($version); 536 $this->setFile($localRepository->getBasedir() . '/' . $localRepository->pathOf($this)); 537 } 538 539 /** 540 * checks whether this artifact is a snapshot or not 541 * 542 * @return bool 543 */ 544 public function isSnapshot() 545 { 546 if (null != $this->version || null != $this->baseVersion) { 547 $matches = array(); 548 if (preg_match_all('^(.*)-([0-9]{8}.[0-9]{6})-([0-9]+)$', $this->getBaseVersion(), $matches) !== false) { 549 $this->setBaseVersion($matches[1] . '-' . self::SNAPSHOT_VERSION); 550 return true; 551 } 552 553 return ((substr($this->getBaseVersion(), -1, strlen(self::SNAPSHOT_VERSION)) == self::SNAPSHOT_VERSION) || ($this->getBaseVersion() == self::LATEST_VERSION)); 554 } 555 556 return false; 557 } 558 559 /** 560 * sets resolved 561 * 562 * @param bool $resolved 563 */ 564 public function setResolved($resolved) 565 { 566 $this->resolved = $resolved; 567 } 568 569 /** 570 * checks whether this artifact is resolved or not 571 * 572 * @return bool 573 */ 574 public function isResolved() 575 { 576 return $this->resolved; 577 } 578 579 /** 580 * sets whether to use the latest release or not 581 * 582 * @param bool $release 583 */ 584 public function setRelease($release) 585 { 586 $this->release = $release; 587 } 588 589 /** 590 * checks whether to use the latest release or not 591 * 592 * @return bool 593 */ 594 public function isRelease() 595 { 596 return $this->release; 597 } 598 599 /** 600 * sets the list of available versions 601 * 602 * @param array $availableVersions 603 */ 604 public function setAvailableVersions(array $availableVersions) 605 { 606 $this->availableVersions = $availableVersions; 607 } 608 609 /** 610 * returns the list of available versions 611 * 612 * @return array 613 */ 614 public function getAvailableVersions() 615 { 616 return $this->availableVersions; 380 617 } 381 618 … … 402 639 { 403 640 return $this->metadataMap; 641 } 642 643 /** 644 * sets whether this artifact is optional or not 645 * 646 * @param bool $optional 647 */ 648 public function setOptional($optional) 649 { 650 $this->optional = $optional; 651 } 652 653 /** 654 * sets whether the artifact is optional or not 655 * 656 * @return bool 657 */ 658 public function isOptional() 659 { 660 return $this->optional; 661 } 662 663 /** 664 * returns an id 665 * 666 * @return string 667 */ 668 public function getId() 669 { 670 return $this->getDependencyConflictId() . ':' . $this->getBaseVersion(); 671 } 672 673 /** 674 * returns a unique id 675 * 676 * @return string 677 */ 678 public function getDependencyConflictId() 679 { 680 $conflictId .= $this->getGroupId() . ':' . $this->getArtifactId() . ':' . $this->getType(); 681 if ($this->hasClassifier() == true) { 682 $conflictId .= ':' . $this->getClassifier(); 683 } 684 685 return $conflictId; 404 686 } 405 687 … … 472 754 473 755 /** 474 * returns the base version475 *476 * @return string477 */478 public function getBaseVersion()479 {480 if (null == $this->baseVersion) {481 if (null == $this->version) {482 throw new NullPointerException('version was null for ' . $this->groupId . ':' . $this->artifactId);483 }484 485 &
