View Javadoc

1   package org.apache.maven.scm.provider.synergy;
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.add.AddScmResult;
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.remove.RemoveScmResult;
31  import org.apache.maven.scm.command.status.StatusScmResult;
32  import org.apache.maven.scm.command.tag.TagScmResult;
33  import org.apache.maven.scm.command.update.UpdateScmResult;
34  import org.apache.maven.scm.provider.AbstractScmProvider;
35  import org.apache.maven.scm.provider.ScmProviderRepository;
36  import org.apache.maven.scm.provider.synergy.command.add.SynergyAddCommand;
37  import org.apache.maven.scm.provider.synergy.command.changelog.SynergyChangeLogCommand;
38  import org.apache.maven.scm.provider.synergy.command.checkin.SynergyCheckInCommand;
39  import org.apache.maven.scm.provider.synergy.command.checkout.SynergyCheckOutCommand;
40  import org.apache.maven.scm.provider.synergy.command.edit.SynergyEditCommand;
41  import org.apache.maven.scm.provider.synergy.command.remove.SynergyRemoveCommand;
42  import org.apache.maven.scm.provider.synergy.command.status.SynergyStatusCommand;
43  import org.apache.maven.scm.provider.synergy.command.tag.SynergyTagCommand;
44  import org.apache.maven.scm.provider.synergy.command.update.SynergyUpdateCommand;
45  import org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository;
46  import org.apache.maven.scm.repository.ScmRepositoryException;
47  
48  /**
49   * @author <a href="mailto:julien.henry@capgemini.com">Julien Henry</a>
50   *
51   * @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="synergy"
52   */
53  public class SynergyScmProvider
54      extends AbstractScmProvider
55  {
56  
57      /** {@inheritDoc} */
58      public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter )
59          throws ScmRepositoryException
60      {
61          getLogger().debug( "Creating SynergyScmProviderRepository..." );
62          return new SynergyScmProviderRepository( scmSpecificUrl );
63      }
64  
65      /** {@inheritDoc} */
66      public String getScmType()
67      {
68          return "synergy";
69      }
70  
71      /** {@inheritDoc} */
72      public boolean requiresEditMode()
73      {
74          return true;
75      }
76  
77      /** {@inheritDoc} */
78      public String getScmSpecificFilename()
79      {
80          return "_ccmwaid.inf";
81      }
82  
83      /** {@inheritDoc} */
84      public AddScmResult add( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
85          throws ScmException
86      {
87          SynergyAddCommand command = new SynergyAddCommand();
88  
89          command.setLogger( getLogger() );
90  
91          return (AddScmResult) command.execute( repository, fileSet, parameters );
92      }
93  
94      /** {@inheritDoc} */
95      public RemoveScmResult remove( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
96          throws ScmException
97      {
98          SynergyRemoveCommand command = new SynergyRemoveCommand();
99  
100         command.setLogger( getLogger() );
101 
102         return (RemoveScmResult) command.execute( repository, fileSet, parameters );
103     }
104 
105     /** {@inheritDoc} */
106     public ChangeLogScmResult changelog( ScmProviderRepository repository, ScmFileSet fileSet,
107                                          CommandParameters parameters )
108         throws ScmException
109     {
110         SynergyChangeLogCommand command = new SynergyChangeLogCommand();
111 
112         command.setLogger( getLogger() );
113 
114         return (ChangeLogScmResult) command.execute( repository, fileSet, parameters );
115     }
116 
117     /** {@inheritDoc} */
118     public CheckInScmResult checkin( ScmProviderRepository repository, ScmFileSet fileSet,
119                                      CommandParameters parameters )
120         throws ScmException
121     {
122         SynergyCheckInCommand command = new SynergyCheckInCommand();
123 
124         command.setLogger( getLogger() );
125 
126         return (CheckInScmResult) command.execute( repository, fileSet, parameters );
127     }
128 
129     /** {@inheritDoc} */
130     public CheckOutScmResult checkout( ScmProviderRepository repository, ScmFileSet fileSet,
131                                        CommandParameters parameters )
132         throws ScmException
133     {
134         SynergyCheckOutCommand command = new SynergyCheckOutCommand();
135 
136         command.setLogger( getLogger() );
137 
138         return (CheckOutScmResult) command.execute( repository, fileSet, parameters );
139     }
140 
141     /** {@inheritDoc} */
142     public EditScmResult edit( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
143         throws ScmException
144     {
145         SynergyEditCommand command = new SynergyEditCommand();
146 
147         command.setLogger( getLogger() );
148 
149         return (EditScmResult) command.execute( repository, fileSet, parameters );
150     }
151 
152     /** {@inheritDoc} */
153     public UpdateScmResult update( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
154         throws ScmException
155     {
156         SynergyUpdateCommand command = new SynergyUpdateCommand();
157 
158         command.setLogger( getLogger() );
159 
160         return (UpdateScmResult) command.execute( repository, fileSet, parameters );
161     }
162 
163     /** {@inheritDoc} */
164     public TagScmResult tag( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
165         throws ScmException
166     {
167         SynergyTagCommand command = new SynergyTagCommand();
168 
169         command.setLogger( getLogger() );
170 
171         return (TagScmResult) command.execute( repository, fileSet, parameters );
172     }
173 
174     /** {@inheritDoc} */
175     public StatusScmResult status( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
176         throws ScmException
177     {
178         SynergyStatusCommand command = new SynergyStatusCommand();
179 
180         command.setLogger( getLogger() );
181 
182         return (StatusScmResult) command.execute( repository, fileSet, parameters );
183     }
184 
185 }