Source Code Cross Referenced for P4Sync.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » perforce » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.taskdefs.optional.perforce 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         *
017:         */
018:        /*
019:         * Portions of this software are based upon public domain software
020:         * originally written at the National Center for Supercomputing Applications,
021:         * University of Illinois, Urbana-Champaign.
022:         */
023:
024:        package org.apache.tools.ant.taskdefs.optional.perforce;
025:
026:        import org.apache.tools.ant.BuildException;
027:        import org.apache.tools.ant.Project;
028:
029:        /** Synchronize client space to a Perforce depot view.
030:         *
031:         *  The API allows additional functionality of the "p4 sync" command
032:         * (such as "p4 sync -f //...#have" or other exotic invocations).</P>
033:         *
034:         * <b>Example Usage:</b>
035:         * <table border="1">
036:         * <th>Function</th><th>Command</th>
037:         * <tr><td>Sync to head using P4USER, P4PORT and P4CLIENT settings specified</td>
038:         * <td>&lt;P4Sync <br>P4view="//projects/foo/main/source/..." <br>
039:         * P4User="fbloggs" <br>P4Port="km01:1666" <br>P4Client="fbloggsclient" /&gt;</td></tr>
040:         * <tr><td>Sync to head using P4USER, P4PORT and P4CLIENT settings defined in environment</td>
041:         * <td>&lt;P4Sync P4view="//projects/foo/main/source/..." /&gt;</td></tr>
042:         * <tr><td>Force a re-sync to head, refreshing all files</td>
043:         * <td>&lt;P4Sync force="yes" P4view="//projects/foo/main/source/..." /&gt;</td></tr>
044:         * <tr><td>Sync to a label</td><td>&lt;P4Sync label="myPerforceLabel" /&gt;</td></tr>
045:         * </table>
046:         *
047:         * @todo Add decent label error handling for non-exsitant labels
048:         *
049:         * @ant.task category="scm"
050:         */
051:        public class P4Sync extends P4Base {
052:
053:            // CheckStyle:VisibilityModifier OFF - bc
054:            String label;
055:            private String syncCmd = "";
056:
057:            // CheckStyle:VisibilityModifier ON
058:
059:            /**
060:             * Label to sync client to; optional.
061:             * @param label name of a label against which one want to sync
062:             * @throws BuildException if label is null or empty string
063:             */
064:            public void setLabel(String label) throws BuildException {
065:                if (label == null || label.equals("")) {
066:                    throw new BuildException(
067:                            "P4Sync: Labels cannot be Null or Empty");
068:                }
069:
070:                this .label = label;
071:
072:            }
073:
074:            /**
075:             * force a refresh of files, if this attribute is set; false by default.
076:             * @param force sync all files, whether they are supposed to be already uptodate or not.
077:             * @throws BuildException if a label is set and force is null
078:             */
079:            public void setForce(String force) throws BuildException {
080:                if (force == null && !label.equals("")) {
081:                    throw new BuildException(
082:                            "P4Sync: If you want to force, set force to non-null string!");
083:                }
084:                P4CmdOpts = "-f";
085:            }
086:
087:            /**
088:             * do the work
089:             * @throws BuildException if an error occurs during the execution of the Perforce command
090:             * and failOnError is set to true
091:             */
092:            public void execute() throws BuildException {
093:
094:                if (P4View != null) {
095:                    syncCmd = P4View;
096:                }
097:
098:                if (label != null && !label.equals("")) {
099:                    syncCmd = syncCmd + "@" + label;
100:                }
101:
102:                log("Execing sync " + P4CmdOpts + " " + syncCmd,
103:                        Project.MSG_VERBOSE);
104:
105:                execP4Command("-s sync " + P4CmdOpts + " " + syncCmd,
106:                        new SimpleP4OutputHandler(this));
107:            }
108:        }
ww_w._j__av_a_2_s__.c___o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.