001package org.apache.maven.scm.provider.synergy;
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.add.AddScmResult;
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.remove.RemoveScmResult;
031import org.apache.maven.scm.command.status.StatusScmResult;
032import org.apache.maven.scm.command.tag.TagScmResult;
033import org.apache.maven.scm.command.update.UpdateScmResult;
034import org.apache.maven.scm.provider.AbstractScmProvider;
035import org.apache.maven.scm.provider.ScmProviderRepository;
036import org.apache.maven.scm.provider.synergy.command.add.SynergyAddCommand;
037import org.apache.maven.scm.provider.synergy.command.changelog.SynergyChangeLogCommand;
038import org.apache.maven.scm.provider.synergy.command.checkin.SynergyCheckInCommand;
039import org.apache.maven.scm.provider.synergy.command.checkout.SynergyCheckOutCommand;
040import org.apache.maven.scm.provider.synergy.command.edit.SynergyEditCommand;
041import org.apache.maven.scm.provider.synergy.command.remove.SynergyRemoveCommand;
042import org.apache.maven.scm.provider.synergy.command.status.SynergyStatusCommand;
043import org.apache.maven.scm.provider.synergy.command.tag.SynergyTagCommand;
044import org.apache.maven.scm.provider.synergy.command.update.SynergyUpdateCommand;
045import org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository;
046import org.apache.maven.scm.repository.ScmRepositoryException;
047
048/**
049 * @author <a href="mailto:julien.henry@capgemini.com">Julien Henry</a>
050 *
051 * @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="synergy"
052 */
053public class SynergyScmProvider
054    extends AbstractScmProvider
055{
056
057    /** {@inheritDoc} */
058    public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter )
059        throws ScmRepositoryException
060    {
061        getLogger().debug( "Creating SynergyScmProviderRepository..." );
062        return new SynergyScmProviderRepository( scmSpecificUrl );
063    }
064
065    /** {@inheritDoc} */
066    public String getScmType()
067    {
068        return "synergy";
069    }
070
071    /** {@inheritDoc} */
072    public boolean requiresEditMode()
073    {
074        return true;
075    }
076
077    /** {@inheritDoc} */
078    public String getScmSpecificFilename()
079    {
080        return "_ccmwaid.inf";
081    }
082
083    /** {@inheritDoc} */
084    public AddScmResult add( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
085        throws ScmException
086    {
087        SynergyAddCommand command = new SynergyAddCommand();
088
089        command.setLogger( getLogger() );
090
091        return (AddScmResult) command.execute( repository, fileSet, parameters );
092    }
093
094    /** {@inheritDoc} */
095    public RemoveScmResult remove( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
096        throws ScmException
097    {
098        SynergyRemoveCommand command = new SynergyRemoveCommand();
099
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}