001package org.apache.maven.scm.provider.clearcase; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.maven.scm.CommandParameters; 023import org.apache.maven.scm.ScmException; 024import org.apache.maven.scm.ScmFileSet; 025import org.apache.maven.scm.command.blame.BlameScmResult; 026import org.apache.maven.scm.command.changelog.ChangeLogScmResult; 027import org.apache.maven.scm.command.checkin.CheckInScmResult; 028import org.apache.maven.scm.command.checkout.CheckOutScmResult; 029import org.apache.maven.scm.command.edit.EditScmResult; 030import org.apache.maven.scm.command.status.StatusScmResult; 031import org.apache.maven.scm.command.tag.TagScmResult; 032import org.apache.maven.scm.command.update.UpdateScmResult; 033import org.apache.maven.scm.provider.AbstractScmProvider; 034import org.apache.maven.scm.provider.ScmProviderRepository; 035import org.apache.maven.scm.provider.clearcase.command.blame.ClearCaseBlameCommand; 036import org.apache.maven.scm.provider.clearcase.command.changelog.ClearCaseChangeLogCommand; 037import org.apache.maven.scm.provider.clearcase.command.checkin.ClearCaseCheckInCommand; 038import org.apache.maven.scm.provider.clearcase.command.checkout.ClearCaseCheckOutCommand; 039import org.apache.maven.scm.provider.clearcase.command.edit.ClearCaseEditCommand; 040import org.apache.maven.scm.provider.clearcase.command.status.ClearCaseStatusCommand; 041import org.apache.maven.scm.provider.clearcase.command.tag.ClearCaseTagCommand; 042import org.apache.maven.scm.provider.clearcase.command.update.ClearCaseUpdateCommand; 043import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository; 044import org.apache.maven.scm.provider.clearcase.util.ClearCaseUtil; 045import org.apache.maven.scm.providers.clearcase.settings.Settings; 046import org.apache.maven.scm.repository.ScmRepositoryException; 047 048/** 049 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> 050 * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a> 051 * @author <a href="mailto:wim.deblauwe@gmail.com">Wim Deblauwe</a> 052 * 053 * @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="clearcase" 054 */ 055public class ClearCaseScmProvider 056 extends AbstractScmProvider 057{ 058 // ---------------------------------------------------------------------- 059 // ScmProvider Implementation 060 // ---------------------------------------------------------------------- 061 062 /** 063 * Contains parameters loaded from clearcase-settings.xml 064 */ 065 private Settings settings; 066 067 /** {@inheritDoc} */ 068 public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ) 069 throws ScmRepositoryException 070 { 071 settings = ClearCaseUtil.getSettings(); 072 return new ClearCaseScmProviderRepository( getLogger(), scmSpecificUrl, settings ); 073 } 074 075 /** {@inheritDoc} */ 076 public String getScmType() 077 { 078 return "clearcase"; 079 } 080 081 /** {@inheritDoc} */ 082 public boolean requiresEditMode() 083 { 084 return true; 085 } 086 087 /** {@inheritDoc} */ 088 public ChangeLogScmResult changelog( ScmProviderRepository repository, ScmFileSet fileSet, 089 CommandParameters parameters ) 090 throws ScmException 091 { 092 ClearCaseChangeLogCommand command = new ClearCaseChangeLogCommand(); 093 094 command.setLogger( getLogger() ); 095 096 return (ChangeLogScmResult) command.execute( repository, fileSet, parameters ); 097 } 098 099 /** {@inheritDoc} */ 100 public CheckInScmResult checkin( ScmProviderRepository repository, ScmFileSet fileSet, 101 CommandParameters parameters ) 102 throws ScmException 103 { 104 ClearCaseCheckInCommand command = new ClearCaseCheckInCommand(); 105 106 command.setLogger( getLogger() ); 107 108 return (CheckInScmResult) command.execute( repository, fileSet, parameters ); 109 } 110 111 /** {@inheritDoc} */ 112 public CheckOutScmResult checkout( ScmProviderRepository repository, ScmFileSet fileSet, 113 CommandParameters parameters ) 114 throws ScmException 115 { 116 ClearCaseCheckOutCommand command = new ClearCaseCheckOutCommand(); 117 118 command.setLogger( getLogger() ); 119 command.setSettings( settings ); 120 121 return (CheckOutScmResult) command.execute( repository, fileSet, parameters ); 122 } 123 124 /** {@inheritDoc} */ 125 protected UpdateScmResult update( ScmProviderRepository repository, ScmFileSet fileSet, 126 CommandParameters parameters ) 127 throws ScmException 128 { 129 ClearCaseUpdateCommand command = new ClearCaseUpdateCommand(); 130 131 command.setLogger( getLogger() ); 132 133 return (UpdateScmResult) command.execute( repository, fileSet, parameters ); 134 } 135 136 /** {@inheritDoc} */ 137 public TagScmResult tag( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) 138 throws ScmException 139 { 140 ClearCaseTagCommand command = new ClearCaseTagCommand(); 141 142 command.setLogger( getLogger() ); 143 144 return (TagScmResult) command.execute( repository, fileSet, parameters ); 145 } 146 147 /** {@inheritDoc} */ 148 protected StatusScmResult status( ScmProviderRepository repository, ScmFileSet fileSet, 149 CommandParameters parameters ) 150 throws ScmException 151 { 152 ClearCaseStatusCommand command = new ClearCaseStatusCommand(); 153 154 command.setLogger( getLogger() ); 155 156 return (StatusScmResult) command.execute( repository, fileSet, parameters ); 157 } 158 159 /** {@inheritDoc} */ 160 protected EditScmResult edit( ScmProviderRepository repository, ScmFileSet fileSet, 161 CommandParameters parameters ) 162 throws ScmException 163 { 164 ClearCaseEditCommand command = new ClearCaseEditCommand(); 165 166 command.setLogger( getLogger() ); 167 168 return (EditScmResult) command.execute( repository, fileSet, parameters ); 169 } 170 171 /** {@inheritDoc} */ 172 protected BlameScmResult blame( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) 173 throws ScmException 174 { 175 ClearCaseBlameCommand command = new ClearCaseBlameCommand(); 176 177 command.setLogger( getLogger() ); 178 179 return (BlameScmResult) command.execute( repository, fileSet, parameters ); 180 } 181}