View Javadoc

1   package org.apache.maven.scm.provider.clearcase;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.scm.CommandParameters;
23  import org.apache.maven.scm.ScmException;
24  import org.apache.maven.scm.ScmFileSet;
25  import org.apache.maven.scm.command.blame.BlameScmResult;
26  import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
27  import org.apache.maven.scm.command.checkin.CheckInScmResult;
28  import org.apache.maven.scm.command.checkout.CheckOutScmResult;
29  import org.apache.maven.scm.command.edit.EditScmResult;
30  import org.apache.maven.scm.command.status.StatusScmResult;
31  import org.apache.maven.scm.command.tag.TagScmResult;
32  import org.apache.maven.scm.command.update.UpdateScmResult;
33  import org.apache.maven.scm.provider.AbstractScmProvider;
34  import org.apache.maven.scm.provider.ScmProviderRepository;
35  import org.apache.maven.scm.provider.clearcase.command.blame.ClearCaseBlameCommand;
36  import org.apache.maven.scm.provider.clearcase.command.changelog.ClearCaseChangeLogCommand;
37  import org.apache.maven.scm.provider.clearcase.command.checkin.ClearCaseCheckInCommand;
38  import org.apache.maven.scm.provider.clearcase.command.checkout.ClearCaseCheckOutCommand;
39  import org.apache.maven.scm.provider.clearcase.command.edit.ClearCaseEditCommand;
40  import org.apache.maven.scm.provider.clearcase.command.status.ClearCaseStatusCommand;
41  import org.apache.maven.scm.provider.clearcase.command.tag.ClearCaseTagCommand;
42  import org.apache.maven.scm.provider.clearcase.command.update.ClearCaseUpdateCommand;
43  import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository;
44  import org.apache.maven.scm.provider.clearcase.util.ClearCaseUtil;
45  import org.apache.maven.scm.providers.clearcase.settings.Settings;
46  import org.apache.maven.scm.repository.ScmRepositoryException;
47  
48  /**
49   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
50   * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
51   * @author <a href="mailto:wim.deblauwe@gmail.com">Wim Deblauwe</a>
52   *
53   * @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="clearcase"
54   */
55  public class ClearCaseScmProvider
56      extends AbstractScmProvider
57  {
58      // ----------------------------------------------------------------------
59      // ScmProvider Implementation
60      // ----------------------------------------------------------------------
61  
62      /**
63       * Contains parameters loaded from clearcase-settings.xml
64       */
65      private Settings settings;
66  
67      /** {@inheritDoc} */
68      public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter )
69          throws ScmRepositoryException
70      {
71          settings = ClearCaseUtil.getSettings();
72          return new ClearCaseScmProviderRepository( getLogger(), scmSpecificUrl, settings );
73      }
74  
75      /** {@inheritDoc} */
76      public String getScmType()
77      {
78          return "clearcase";
79      }
80  
81      /** {@inheritDoc} */
82      public boolean requiresEditMode()
83      {
84          return true;
85      }
86  
87      /** {@inheritDoc} */
88      public ChangeLogScmResult changelog( ScmProviderRepository repository, ScmFileSet fileSet,
89                                           CommandParameters parameters )
90          throws ScmException
91      {
92          ClearCaseChangeLogCommand command = new ClearCaseChangeLogCommand();
93  
94          command.setLogger( getLogger() );
95  
96          return (ChangeLogScmResult) command.execute( repository, fileSet, parameters );
97      }
98  
99      /** {@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 }