You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2012/01/17 03:01:42 UTC
svn commit: r1232263 [1/2] - in /openejb/trunk/sandbox/release-tools: ./
src/main/java/org/apache/openejb/tools/release/
src/main/java/org/apache/openejb/tools/release/cmd/
src/main/java/org/apache/openejb/tools/release/util/ src/main/resources/
Author: dblevins
Date: Tue Jan 17 02:01:40 2012
New Revision: 1232263
URL: http://svn.apache.org/viewvc?rev=1232263&view=rev
Log:
Three days of work to hopefully save weeks over the next year.
Here's to releasing more frequently.
Added:
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Command.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DateAdapter.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Nexus.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Release.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Repository.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/StagingRepositories.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Binaries.java (contents, props changed)
- copied, changed from r1228755, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DownloadDirectory.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Close.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Deploy.java (contents, props changed)
- copied, changed from r1231717, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Deploy.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Help.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Legal.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/ReleaseNotes.java (contents, props changed)
- copied, changed from r1229494, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/ReleaseNotes.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tag.java (contents, props changed)
- copied, changed from r1231717, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Tag.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tck.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Vote.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Base64.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/CircularReferencesException.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Commands.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Exec.java (contents, props changed)
- copied, changed from r1231717, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Exec.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Files.java (contents, props changed)
- copied, changed from r1231717, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Files.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/IO.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/JarLocation.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Join.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Log4jLog.java (contents, props changed)
- copied, changed from r1228755, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Log4jLog.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/ObjectList.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Options.java (contents, props changed)
- copied, changed from r1228755, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Options.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Pipe.java (contents, props changed)
- copied, changed from r1231717, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Pipe.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/References.java
openejb/trunk/sandbox/release-tools/src/main/resources/vote.vm
Removed:
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Deploy.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DownloadDirectory.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Exec.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Files.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Log4jLog.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Options.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Pipe.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/ReleaseNotes.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Tag.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/UpdateTckRepo.java
Modified:
openejb/trunk/sandbox/release-tools/pom.xml
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Main.java
openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Upgrades.java
Modified: openejb/trunk/sandbox/release-tools/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/pom.xml?rev=1232263&r1=1232262&r2=1232263&view=diff
==============================================================================
--- openejb/trunk/sandbox/release-tools/pom.xml (original)
+++ openejb/trunk/sandbox/release-tools/pom.xml Tue Jan 17 02:01:40 2012
@@ -37,6 +37,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <slf4j-version>1.5.6</slf4j-version>
</properties>
<build>
@@ -78,7 +79,24 @@
</build>
<dependencies>
-
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j-version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j-version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl104-over-slf4j</artifactId>
+ <version>${slf4j-version}</version>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>org.codehaus.swizzle</groupId>
<artifactId>swizzle-stream</artifactId>
@@ -109,6 +127,30 @@
<version>3.10-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>3.2</version>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ <version>3.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.sonatype.nexus</groupId>
+ <artifactId>nexus-rest-api</artifactId>
+ <version>1.9.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+
+
</dependencies>
</project>
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Command.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Command.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Command.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Command.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,12 @@
+package org.apache.openejb.tools.release;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
+public @interface Command {
+ String value() default "";
+
+ Class[] dependsOn() default {};
+}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DateAdapter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DateAdapter.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DateAdapter.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DateAdapter.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DateAdapter extends XmlAdapter<String, Date> {
+
+ // Sun Jan 15 23:22:43 UTC 2012
+ private SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
+
+ @Override
+ public String marshal(Date v) throws Exception {
+ return dateFormat.format(v);
+ }
+
+ @Override
+ public Date unmarshal(String v) throws Exception {
+ if ("n/a".equals(v)) return null;
+ return dateFormat.parse(v);
+ }
+
+}
Modified: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Main.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Main.java?rev=1232263&r1=1232262&r2=1232263&view=diff
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Main.java (original)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Main.java Tue Jan 17 02:01:40 2012
@@ -20,8 +20,13 @@ import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
+import org.apache.openejb.tools.release.util.Commands;
+import org.apache.openejb.tools.release.util.JarLocation;
+import org.apache.xbean.finder.AnnotationFinder;
+import org.apache.xbean.finder.archive.ClasspathArchive;
-import java.lang.reflect.Method;
+import java.io.File;
+import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@@ -37,12 +42,20 @@ public class Main {
root.setLevel(Level.INFO);
}
- private static Map<String, Class> commands = new HashMap<String, Class>();
+ public static Map<String, Class<?>> commands = new HashMap<String, Class<?>>();
static {
- commands.put("download", DownloadDirectory.class);
- commands.put("legal", org.apache.rat.tentacles.Main.class);
- commands.put("notes", ReleaseNotes.class);
+ try {
+ final File file = JarLocation.jarLocation(Main.class);
+ final AnnotationFinder finder = new AnnotationFinder(ClasspathArchive.archive(Main.class.getClassLoader(), file.toURI().toURL()));
+
+ for (Class<?> clazz : finder.findAnnotatedClasses(Command.class)) {
+
+ commands.put(Commands.name(clazz), clazz);
+ }
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
}
public static void main(String[] args) throws Exception {
@@ -66,8 +79,7 @@ public class Main {
final Class clazz = commands.get(command);
- final Method main = clazz.getMethod("main", String[].class);
- main.invoke(null, new Object[]{args});
+ Commands.run(args, clazz);
}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Nexus.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Nexus.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Nexus.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Nexus.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.openejb.tools.release.util.Base64;
+import org.apache.openejb.tools.release.util.IO;
+import org.apache.openejb.tools.release.util.ObjectList;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Nexus {
+ private final String authorization;
+ private final DefaultHttpClient client;
+
+ public Nexus(String user, String pass) {
+ final String s = user + ":" + pass;
+ final byte[] bytes = Base64.encodeBase64(s.getBytes());
+
+ authorization = "Basic " + new String(bytes);
+ client = new DefaultHttpClient();
+ }
+
+ public ObjectList<Repository> getRepositories() throws IOException, JAXBException {
+
+ final HttpGet get = new HttpGet("https://repository.apache.org/service/local/staging/profile_repositories");
+ get.setHeader("Authorization", authorization);
+
+ final HttpResponse response = client.execute(get);
+ final InputStream in = response.getEntity().getContent();
+ final JAXBContext context = JAXBContext.newInstance(StagingRepositories.class);
+ final Unmarshaller unmarshaller = context.createUnmarshaller();
+
+ final StagingRepositories stagingRepositories = (StagingRepositories) unmarshaller.unmarshal(in);
+
+ return stagingRepositories.getRepositories();
+ }
+
+ public void close(String repository) throws IOException {
+ close(repository, "");
+ }
+
+ public void close(String repository, String description) throws IOException {
+ bulk("close", repository, description);
+ }
+
+ public void drop(String repository) throws IOException {
+ drop(repository, "");
+ }
+
+ public void drop(String repository, String description) throws IOException {
+ bulk("drop", repository, description);
+ }
+
+ private void bulk(String operation, String repository, String description) throws IOException {
+
+ final HttpPost post = new HttpPost("https://repository.apache.org/service/local/staging/bulk/" + operation + "?undefined");
+ post.addHeader("Authorization", authorization);
+ post.addHeader("Content-Type", "application/json");
+
+ final String data = String.format("{\"data\":{\"stagedRepositoryIds\":[\"%s\"],\"description\":\"%s\"}}", repository, description);
+ post.setEntity(new StringEntity(data));
+
+ final HttpResponse execute = client.execute(post);
+
+ String message = IO.slurp(execute.getEntity().getContent());
+
+ System.out.println(message);
+
+ final int statusCode = execute.getStatusLine().getStatusCode();
+ if (statusCode != 200 && statusCode != 201) {
+ throw new IOException(String.format("%s\n%s", execute.getStatusLine().toString(), message));
+ }
+ }
+
+}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Release.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Release.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Release.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Release.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release;
+
+import org.apache.openejb.tools.release.util.Options;
+
+import java.lang.reflect.Field;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Release {
+
+ public static String openejbVersion = "openejb-4.0.0-beta-2";
+ public static String tomeeVersion = "tomee-1.0.0-beta-2";
+
+ public static String branches = "https://svn.apache.org/repos/asf/openejb/branches/";
+ public static String tags = "https://svn.apache.org/repos/asf/openejb/tags/";
+ public static String tckBranches = "https://svn.apache.org/repos/tck/openejb-tck/branches/";
+ public static String tckTrunk = "https://svn.apache.org/repos/tck/openejb-tck/trunk";
+ public static String staging = "https://repository.apache.org/content/repositories/orgapacheopenejb-075";
+ public static String downloads = "/tmp/downloads";
+ public static String workdir = "/tmp/release";
+ public static String mavenOpts = "-Xmx2048m -XX:MaxPermSize=1024m";
+ public static String from = "dblevins@apache.org";
+// public static String to = from;
+ public static String to = "dev@openejb.apache.org";
+
+ public static String user = System.getProperty("user.name");
+
+ static {
+ final Options options = new Options(System.getProperties());
+
+ for (Field field : Release.class.getFields()) {
+ try {
+ final Object value = options.get(field.getName(), field.get(null));
+ field.set(null, value);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ System.out.println("openejbVersion = " + openejbVersion);
+ System.out.println("staging = " + staging);
+ }
+}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Repository.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Repository.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Repository.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Repository.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.net.URI;
+import java.util.Date;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Repository {
+
+ public Repository() {
+ }
+
+ // 4f527aa7ac8ab3
+ private String profileId;
+
+ // org.apache.openejb
+ private String profileName;
+
+ // repository
+ private String profileType;
+
+ // orgapacheopenejb-072
+ private String repositoryId;
+
+ // org.apache.openejb-072 (u:dblevins, a:76.175.195.209)
+ private String repositoryName;
+
+ // open
+ private String type;
+
+ // release
+ private String policy;
+
+ // dblevins
+ private String userId;
+
+ // Apache-Maven/3.0.3 (Java 1.6.0_26; Mac OS X 10.7.2)
+ private String userAgent;
+
+ // 76.175.195.209
+ private String ipAddress;
+
+ // https://repository.apache.org/content/repositories/orgapacheopenejb-072
+ private URI repositoryURI;
+
+ // Sun Jan 15 23:22:43 UTC 2012
+ @XmlJavaTypeAdapter(DateAdapter.class)
+ private Date createdDate;
+
+ // n/a
+ @XmlJavaTypeAdapter(DateAdapter.class)
+ private Date closedDate;
+
+ // maven2
+ private String provider;
+
+ // releases
+ private String releaseRepositoryId;
+
+ // Releases
+ private String releaseRepositoryName;
+
+
+ public String getProfileId() {
+ return profileId;
+ }
+
+ public void setProfileId(String profileId) {
+ this.profileId = profileId;
+ }
+
+ public String getProfileName() {
+ return profileName;
+ }
+
+ public void setProfileName(String profileName) {
+ this.profileName = profileName;
+ }
+
+ public String getProfileType() {
+ return profileType;
+ }
+
+ public void setProfileType(String profileType) {
+ this.profileType = profileType;
+ }
+
+ public String getRepositoryId() {
+ return repositoryId;
+ }
+
+ public void setRepositoryId(String repositoryId) {
+ this.repositoryId = repositoryId;
+ }
+
+ public String getRepositoryName() {
+ return repositoryName;
+ }
+
+ public void setRepositoryName(String repositoryName) {
+ this.repositoryName = repositoryName;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getPolicy() {
+ return policy;
+ }
+
+ public void setPolicy(String policy) {
+ this.policy = policy;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getUserAgent() {
+ return userAgent;
+ }
+
+ public void setUserAgent(String userAgent) {
+ this.userAgent = userAgent;
+ }
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ public URI getRepositoryURI() {
+ return repositoryURI;
+ }
+
+ public void setRepositoryURI(URI repositoryURI) {
+ this.repositoryURI = repositoryURI;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public Date getClosedDate() {
+ return closedDate;
+ }
+
+ public void setClosedDate(Date closedDate) {
+ this.closedDate = closedDate;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getReleaseRepositoryId() {
+ return releaseRepositoryId;
+ }
+
+ public void setReleaseRepositoryId(String releaseRepositoryId) {
+ this.releaseRepositoryId = releaseRepositoryId;
+ }
+
+ public String getReleaseRepositoryName() {
+ return releaseRepositoryName;
+ }
+
+ public void setReleaseRepositoryName(String releaseRepositoryName) {
+ this.releaseRepositoryName = releaseRepositoryName;
+ }
+
+ @Override
+ public String toString() {
+ return "Repository{" +
+ "repositoryId='" + repositoryId + '\'' +
+ ", type='" + type + '\'' +
+ ", createdDate=" + createdDate +
+ '}';
+ }
+}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/StagingRepositories.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/StagingRepositories.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/StagingRepositories.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/StagingRepositories.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release;
+
+import org.apache.openejb.tools.release.util.ObjectList;
+
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@XmlRootElement
+public class StagingRepositories {
+
+ @XmlElementWrapper(name = "data")
+ private final ObjectList<Repository> stagingProfileRepository = new ObjectList<Repository>();
+
+ public ObjectList<Repository> getRepositories() {
+ return stagingProfileRepository;
+ }
+}
Modified: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Upgrades.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Upgrades.java?rev=1232263&r1=1232262&r2=1232263&view=diff
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Upgrades.java (original)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Upgrades.java Tue Jan 17 02:01:40 2012
@@ -16,6 +16,7 @@
*/
package org.apache.openejb.tools.release;
+import org.apache.openejb.tools.release.util.Options;
import org.codehaus.swizzle.jira.Issue;
import org.codehaus.swizzle.jira.Jira;
import org.codehaus.swizzle.jira.JiraRss;
@@ -23,10 +24,8 @@ import org.codehaus.swizzle.jira.MapObje
import org.codehaus.swizzle.jira.Project;
import org.codehaus.swizzle.jira.Version;
-import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
/**
@@ -67,7 +66,7 @@ public class Upgrades {
final Version ver = jira.getVersion(project, version);
if (ver == null) {
- missing.add(project+":"+version);
+ missing.add(project + ":" + version);
continue;
}
Copied: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Binaries.java (from r1228755, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DownloadDirectory.java)
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Binaries.java?p2=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Binaries.java&p1=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DownloadDirectory.java&r1=1228755&r2=1232263&rev=1232263&view=diff
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/DownloadDirectory.java (original)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Binaries.java Tue Jan 17 02:01:40 2012
@@ -14,9 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.openejb.tools.release;
+package org.apache.openejb.tools.release.cmd;
-import org.apache.log4j.Logger;
+import org.apache.openejb.tools.release.Command;
+import org.apache.openejb.tools.release.Release;
import org.apache.rat.tentacles.NexusClient;
import org.apache.xbean.finder.UriSet;
@@ -26,16 +27,16 @@ import java.net.URI;
/**
* Little utility that downloads the binaries into
*/
-public class DownloadDirectory {
+@Command(dependsOn = Close.class)
+public class Binaries {
public static void main(String[] args) throws Exception {
final NexusClient client = new NexusClient();
- final Options options = new Options(System.getProperties());
- options.setLogger(new Log4jLog(Logger.getLogger(DownloadDirectory.class)));
+ final File dir = new File(Release.downloads + File.separator + Release.openejbVersion);
+ final URI repo = URI.create(Release.staging);
- final File dir = options.get("dir", new File("/tmp/openejb-4.0.0-beta-2"));
- final URI repo = options.get("staging", URI.create("https://repository.apache.org/content/repositories/orgapacheopenejb-029/"));
+ System.out.println("Downloads: " + dir.getAbsolutePath());
if (!dir.exists() && !dir.mkdirs()) throw new IllegalStateException("Cannot make directory: " + dir.getAbsolutePath());
@@ -45,8 +46,10 @@ public class DownloadDirectory {
UriSet binaries = all.include(".*\\.(zip|gz|war).*");
binaries = binaries.exclude(".*\\.asc\\.(sha1|md5)");
+
for (URI uri : binaries.include(".*\\/(openejb-standalone|openejb-tomcat|apache-tomee|examples)-.*|.*source-release.*")) {
final File file = new File(dir, uri.getPath().replaceAll(".*/", ""));
+ System.out.println("Downloading " + file.getName());
client.download(uri, file);
}
}
Propchange: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Binaries.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Close.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Close.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Close.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Close.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release.cmd;
+
+import org.apache.openejb.tools.release.Command;
+import org.apache.openejb.tools.release.Nexus;
+import org.apache.openejb.tools.release.Release;
+import org.apache.openejb.tools.release.Repository;
+import org.apache.openejb.tools.release.util.Files;
+import org.apache.openejb.tools.release.util.IO;
+import org.apache.openejb.tools.release.util.ObjectList;
+import org.codehaus.swizzle.stream.StreamLexer;
+
+import java.io.File;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command(dependsOn = Deploy.class)
+public class Close {
+
+ public static void main(String[] args) throws Exception {
+
+ final File settingsXml = Files.file(System.getProperty("user.home"), ".m2", "settings.xml");
+ final StreamLexer lexer = new StreamLexer(IO.read(settingsXml));
+
+ while (lexer.readAndMark("<server>", "</server>")) {
+ if (lexer.peek("<id>apache.releases.https</id>") != null) break;
+ lexer.unmark();
+ }
+
+ final String user = lexer.peek("<username>", "</");
+ final String pass = lexer.peek("<password>", "</");
+
+ final Nexus nexus = new Nexus(user, pass);
+
+ ObjectList<Repository> repositories = nexus.getRepositories();
+ repositories = repositories.equals("profileName", "org.apache.openejb");
+ repositories = repositories.descending("createdDate");
+
+ for (Repository repository : repositories) {
+ System.out.println(repository.getRepositoryURI());
+ }
+
+ repositories = repositories.equals("type", "open");
+
+ if (repositories.size() == 0) return;
+
+ final Repository repository = repositories.get(0);
+
+ nexus.close(repository.getRepositoryId());
+
+ System.out.println(repository.getRepositoryURI());
+
+ Release.staging = repository.getRepositoryURI().toString();
+ }
+
+}
Copied: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Deploy.java (from r1231717, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Deploy.java)
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Deploy.java?p2=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Deploy.java&p1=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Deploy.java&r1=1231717&r2=1232263&rev=1232263&view=diff
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Deploy.java (original)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Deploy.java Tue Jan 17 02:01:40 2012
@@ -14,7 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.openejb.tools.release;
+package org.apache.openejb.tools.release.cmd;
+
+import org.apache.openejb.tools.release.Command;
+import org.apache.openejb.tools.release.Release;
+import org.apache.openejb.tools.release.util.Exec;
+import org.apache.openejb.tools.release.util.Files;
import java.io.File;
@@ -23,24 +28,24 @@ import static java.lang.String.format;
/**
* @version $Rev$ $Date$
*/
+@Command
public class Deploy {
public static void main(String... args) throws Exception {
// TODO Look for gpg on the path, report error if not found
- final String version = "openejb-4.0.0-beta-2";
- final String tag = "https://svn.apache.org/repos/asf/openejb/tags/" + version;
+ final String tag = Release.tags + Release.openejbVersion;
- final File dir = new File("/tmp/release");
+ final File dir = new File(Release.workdir);
Files.mkdir(dir);
Exec.cd(dir);
Exec.exec("svn", "co", tag);
- Exec.cd(new File(dir + "/" + version));
+ Exec.cd(new File(dir + File.separator + Release.openejbVersion));
- Exec.export("MAVEN_OPTS", "-Xmx2048m -XX:MaxPermSize=1024m");
+ Exec.export("MAVEN_OPTS", Release.mavenOpts);
Exec.exec("mvn",
"-Darguments=-Dmaven.test.skip=true -DfailIfNoTests=false",
"release:perform",
Propchange: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Deploy.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Help.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Help.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Help.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Help.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release.cmd;
+
+import org.apache.openejb.tools.release.Command;
+import org.apache.openejb.tools.release.Main;
+import org.apache.openejb.tools.release.Release;
+import org.apache.openejb.tools.release.util.Commands;
+import org.apache.openejb.tools.release.util.Join;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command
+public class Help {
+ public static void main(String[] args) {
+ System.out.println("Commands: ");
+ System.out.printf(" %-20s %s", "", "(depends on)");
+ System.out.println();
+
+ final List<Class<?>> commands = Commands.order(new ArrayList<Class<?>>(Main.commands.values()));
+
+ for (Class<?> command : commands) {
+ final List<String> dependencies = Commands.dependencies(command);
+ System.out.printf(" %-20s %s", Commands.name(command), Join.join(", ", dependencies));
+ System.out.println();
+ }
+
+ System.out.println();
+ System.out.println("Properties: ");
+ System.out.printf(" %-20s %s", "", "(default)");
+ System.out.println();
+
+ for (Field field : Release.class.getFields()) {
+ try {
+ System.out.printf(" %-20s %s", field.getName(), field.get(null));
+ System.out.println();
+ } catch (IllegalAccessException e) {
+ }
+ }
+
+ }
+}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Legal.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Legal.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Legal.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Legal.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release.cmd;
+
+import org.apache.openejb.tools.release.Command;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command(dependsOn = {Close.class})
+public class Legal {
+
+ public static void main(String[] args) throws Exception {
+ org.apache.rat.tentacles.Main.main(args);
+ }
+}
Copied: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/ReleaseNotes.java (from r1229494, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/ReleaseNotes.java)
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/ReleaseNotes.java?p2=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/ReleaseNotes.java&p1=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/ReleaseNotes.java&r1=1229494&r2=1232263&rev=1232263&view=diff
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/ReleaseNotes.java (original)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/ReleaseNotes.java Tue Jan 17 02:01:40 2012
@@ -14,11 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.openejb.tools.release;
+package org.apache.openejb.tools.release.cmd;
+
+import org.apache.openejb.tools.release.Command;
/**
* @version $Rev$ $Date$
*/
+@Command
public class ReleaseNotes {
public static void main(String[] args) throws Throwable {
Propchange: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/ReleaseNotes.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tag.java (from r1231717, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Tag.java)
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tag.java?p2=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tag.java&p1=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Tag.java&r1=1231717&r2=1232263&rev=1232263&view=diff
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Tag.java (original)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tag.java Tue Jan 17 02:01:40 2012
@@ -14,26 +14,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.openejb.tools.release;
+package org.apache.openejb.tools.release.cmd;
+
+import org.apache.openejb.tools.release.Command;
+import org.apache.openejb.tools.release.Release;
import static java.lang.String.format;
-import static org.apache.openejb.tools.release.Exec.exec;
+import static org.apache.openejb.tools.release.util.Exec.exec;
/**
* @version $Rev$ $Date$
*/
+@Command
public class Tag {
public static void main(String... args) throws Exception {
- final String version = "openejb-4.0.0-beta-2";
- final String branch = "https://svn.apache.org/repos/asf/openejb/branches/" + version;
- final String tag = "https://svn.apache.org/repos/asf/openejb/tags/" + version;
+ final String branch = Release.branches + Release.openejbVersion;
+ final String tag = Release.tags + Release.openejbVersion;
if (exec("svn", "info", tag) == 0) {
- exec("svn", "-m", format("recreating tag for %s", version), "rm", tag);
+ exec("svn", "-m", format("[release-tools] recreating tag for %s", Release.openejbVersion), "rm", tag);
}
- exec("svn", "-m", format("recreating tag for %s", version), "cp", branch, tag);
+ exec("svn", "-m", format("[release-tools] creating tag for %s", Release.openejbVersion), "cp", branch, tag);
}
+
}
Propchange: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tag.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tck.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tck.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tck.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Tck.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release.cmd;
+
+import org.apache.openejb.tools.release.Command;
+import org.apache.openejb.tools.release.Release;
+import org.apache.openejb.tools.release.util.Files;
+import org.apache.openejb.tools.release.util.IO;
+import org.codehaus.swizzle.stream.DelimitedTokenReplacementInputStream;
+import org.codehaus.swizzle.stream.ReplaceStringInputStream;
+import org.codehaus.swizzle.stream.StringTokenHandler;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import static java.lang.String.format;
+import static org.apache.openejb.tools.release.util.Exec.cd;
+import static org.apache.openejb.tools.release.util.Exec.exec;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command(dependsOn = Close.class)
+public class Tck {
+
+ public static void main(String... args) throws Exception {
+
+ // https://svn.apache.org/repos/tck/openejb-tck/branches/tomee-1.0.0-beta-2
+
+ final File dir = new File("/tmp/release/tck");
+ Files.mkdir(dir);
+
+ cd(dir);
+
+ final String branch = Release.tckBranches + Release.tomeeVersion;
+
+ // Make the branch
+ if (exec("svn", "info", branch) != 0) {
+
+ exec("svn", "-m", format("[release-tools] tck branch for %s", Release.tomeeVersion), "cp", Release.tckTrunk.toString(), branch);
+ }
+
+ // Checkout the branch
+ exec("svn", "co", branch);
+
+ final File tck = cd(new File(dir + "/" + Release.tomeeVersion));
+
+ updatePom(Release.staging, new File(tck, "pom.xml"));
+
+ updateWebProfile(branch, tck, Release.tomeeVersion);
+
+ exec("svn", "-m", "[release-tools] update staging repo for " + Release.tomeeVersion, "ci");
+ }
+
+ private static void updateWebProfile(final String branch, final File dir, String version) throws IOException {
+ final File properties = new File(dir, "webprofile.properties");
+
+ InputStream in = IO.read(properties);
+ in = replaceProperty(in, "project.scmUrl", String.format("scm:svn:%s", branch));
+ in = replaceProperty(in, "project.version", version);
+
+ update(properties, in);
+ }
+
+ private static DelimitedTokenReplacementInputStream replaceProperty(InputStream in, final String property, final String value) {
+ final String n = System.getProperty("line.separator");
+ return new DelimitedTokenReplacementInputStream(in, property, n, new StringTokenHandler() {
+ @Override
+ public String handleToken(String token) throws IOException {
+ return String.format("%s = %s%s", property, value, n);
+ }
+ });
+ }
+
+ private static void updatePom(String staging, File pom) throws IOException {
+
+ System.out.println(pom.getAbsolutePath());
+
+ final String n = System.getProperty("line.separator");
+
+ final String repositoryDefinition = " <repository>" + n +
+ " <id>nexus-staging</id>" + n +
+ " <name>Nexus Staging Repository</name>" + n +
+ " <url>" + staging + "</url>" + n +
+ " <layout>default</layout>" + n +
+ " <snapshots>" + n +
+ " <enabled>false</enabled>" + n +
+ " </snapshots>" + n +
+ " <releases>" + n +
+ " <enabled>true</enabled>" + n +
+ " <checksumPolicy>ignore</checksumPolicy>" + n +
+ " </releases>" + n +
+ " </repository>";
+
+ InputStream in = IO.read(pom);
+
+ // Yank any existing nexus-staging repo
+ in = new DelimitedTokenReplacementInputStream(in, "<repository>", "</repository>", new StringTokenHandler() {
+ @Override
+ public String handleToken(String token) throws IOException {
+ if (token.contains("<id>nexus-staging</id>")) {
+ return "";
+ }
+
+ return "<repository>" + token + "</repository>";
+ }
+ });
+
+ // add the new one
+ in = new ReplaceStringInputStream(in, "<repositories>", "<repositories>" + n + repositoryDefinition);
+
+ // Yank SNAPSHOT
+ in = new ReplaceStringInputStream(in, "-SNAPSHOT", "");
+
+ update(pom, in);
+ }
+
+ private static void update(File dest, InputStream in) throws IOException {
+ final File tmp = new File(dest.getAbsolutePath() + "~");
+
+ final OutputStream out = IO.write(tmp);
+
+ int i = -1;
+ while ((i = in.read()) != -1) {
+ out.write(i);
+ }
+ out.close();
+ if (!tmp.renameTo(dest)) throw new RuntimeException(String.format("Rename failed: mv \"%s\" \"%s\"", tmp.getAbsolutePath(), dest.getAbsolutePath()));
+ }
+}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Vote.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Vote.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Vote.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/cmd/Vote.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release.cmd;
+
+import org.apache.openejb.tools.release.Command;
+import org.apache.openejb.tools.release.Release;
+import org.apache.openejb.tools.release.util.Exec;
+import org.apache.rat.tentacles.Templates;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command(dependsOn = {Legal.class, Binaries.class})
+public class Vote {
+
+ public static void main(String[] args) throws IOException {
+
+ final Templates.Builder template = Templates.template("vote.vm");
+
+ for (Field field : Release.class.getFields()) {
+ try {
+ template.add(field.getName(), field.get(null));
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ template.add("build", Release.staging.replaceAll(".*-", ""));
+
+ final String email = template.apply();
+
+ System.out.println(email);
+
+ final OutputStream out = Exec.open("ssh", "people.apache.org", "/usr/sbin/sendmail -it");
+ out.write(email.getBytes());
+ out.flush();
+ out.close();
+ }
+}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Base64.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Base64.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Base64.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Base64.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,566 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+
+/**
+ * Provides Base64 encoding and decoding as defined by RFC 2045.
+ *
+ * <p>This class implements section <cite>6.8. Base64 Content-Transfer-Encoding</cite>
+ * from RFC 2045 <cite>Multipurpose Internet Mail Extensions (MIME) Part One:
+ * Format of Internet Message Bodies</cite> by Freed and Borenstein.</p>
+ *
+ * @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
+ * @author Apache Software Foundation
+ * @since 1.0-dev
+ * @version $Id: Base64.java 1153797 2011-08-04 09:09:44Z rmannibucau $
+ */
+public class Base64 {
+
+ /**
+ * Chunk size per RFC 2045 section 6.8.
+ *
+ * <p>The {@value} character limit does not count the trailing CRLF, but counts
+ * all other characters, including any equal signs.</p>
+ *
+ * @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 6.8</a>
+ */
+ static final int CHUNK_SIZE = 76;
+
+ /**
+ * Chunk separator per RFC 2045 section 2.1.
+ *
+ * @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 2.1</a>
+ */
+ static final byte[] CHUNK_SEPARATOR = "\r\n".getBytes();
+
+ /**
+ * The base length.
+ */
+ static final int BASELENGTH = 255;
+
+ /**
+ * Lookup length.
+ */
+ static final int LOOKUPLENGTH = 64;
+
+ /**
+ * Used to calculate the number of bits in a byte.
+ */
+ static final int EIGHTBIT = 8;
+
+ /**
+ * Used when encoding something which has fewer than 24 bits.
+ */
+ static final int SIXTEENBIT = 16;
+
+ /**
+ * Used to determine how many bits data contains.
+ */
+ static final int TWENTYFOURBITGROUP = 24;
+
+ /**
+ * Used to get the number of Quadruples.
+ */
+ static final int FOURBYTE = 4;
+
+ /**
+ * Used to test the sign of a byte.
+ */
+ static final int SIGN = -128;
+
+ /**
+ * Byte used to pad output.
+ */
+ static final byte PAD = (byte) '=';
+
+ /**
+ * Contains the Base64 values <code>0</code> through <code>63</code> accessed by using character encodings as
+ * indices.
+ * <p>
+ * For example, <code>base64Alphabet['+']</code> returns <code>62</code>.
+ * </p>
+ * <p>
+ * The value of undefined encodings is <code>-1</code>.
+ * </p>
+ */
+ private static byte[] base64Alphabet = new byte[BASELENGTH];
+
+ /**
+ * <p>
+ * Contains the Base64 encodings <code>A</code> through <code>Z</code>, followed by <code>a</code> through
+ * <code>z</code>, followed by <code>0</code> through <code>9</code>, followed by <code>+</code>, and
+ * <code>/</code>.
+ * </p>
+ * <p>
+ * This array is accessed by using character values as indices.
+ * </p>
+ * <p>
+ * For example, <code>lookUpBase64Alphabet[62] </code> returns <code>'+'</code>.
+ * </p>
+ */
+ private static byte[] lookUpBase64Alphabet = new byte[LOOKUPLENGTH];
+
+ // Populating the lookup and character arrays
+ static {
+ for (int i = 0; i < BASELENGTH; i++) {
+ base64Alphabet[i] = (byte) -1;
+ }
+ for (int i = 'Z'; i >= 'A'; i--) {
+ base64Alphabet[i] = (byte) (i - 'A');
+ }
+ for (int i = 'z'; i >= 'a'; i--) {
+ base64Alphabet[i] = (byte) (i - 'a' + 26);
+ }
+ for (int i = '9'; i >= '0'; i--) {
+ base64Alphabet[i] = (byte) (i - '0' + 52);
+ }
+
+ base64Alphabet['+'] = 62;
+ base64Alphabet['/'] = 63;
+
+ for (int i = 0; i <= 25; i++) {
+ lookUpBase64Alphabet[i] = (byte) ('A' + i);
+ }
+
+ for (int i = 26, j = 0; i <= 51; i++, j++) {
+ lookUpBase64Alphabet[i] = (byte) ('a' + j);
+ }
+
+ for (int i = 52, j = 0; i <= 61; i++, j++) {
+ lookUpBase64Alphabet[i] = (byte) ('0' + j);
+ }
+
+ lookUpBase64Alphabet[62] = (byte) '+';
+ lookUpBase64Alphabet[63] = (byte) '/';
+ }
+
+ /**
+ * Returns whether or not the <code>octect</code> is in the base 64 alphabet.
+ *
+ * @param octect The value to test
+ * @return <code>true</code> if the value is defined in the the base 64 alphabet, <code>false</code> otherwise.
+ */
+ private static boolean isBase64(byte octect) {
+ if (octect == PAD) {
+ return true;
+ } else if (octect < 0 || base64Alphabet[octect] == -1) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ * Tests a given byte array to see if it contains
+ * only valid characters within the Base64 alphabet.
+ *
+ * @param arrayOctect byte array to test
+ * @return <code>true</code> if all bytes are valid characters in the Base64
+ * alphabet or if the byte array is empty; false, otherwise
+ */
+ public static boolean isArrayByteBase64(byte[] arrayOctect) {
+
+ arrayOctect = discardWhitespace(arrayOctect);
+
+ int length = arrayOctect.length;
+ if (length == 0) {
+ // shouldn't a 0 length array be valid base64 data?
+ // return false;
+ return true;
+ }
+ for (int i = 0; i < length; i++) {
+ if (!isBase64(arrayOctect[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Encodes binary data using the base64 algorithm but
+ * does not chunk the output.
+ *
+ * @param binaryData binary data to encode
+ * @return Base64 characters
+ */
+ public static byte[] encodeBase64(byte[] binaryData) {
+ return encodeBase64(binaryData, false);
+ }
+
+ /**
+ * Encodes binary data using the base64 algorithm and chunks
+ * the encoded output into 76 character blocks
+ *
+ * @param binaryData binary data to encode
+ * @return Base64 characters chunked in 76 character blocks
+ */
+ public static byte[] encodeBase64Chunked(byte[] binaryData) {
+ return encodeBase64(binaryData, true);
+ }
+
+
+ /**
+ * Decodes an Object using the base64 algorithm. This method
+ * is provided in order to satisfy the requirements of the
+ * Decoder interface, and will throw a DecoderException if the
+ * supplied object is not of type byte[].
+ *
+ * @param pObject Object to decode
+ * @return An object (of type byte[]) containing the
+ * binary data which corresponds to the byte[] supplied.
+ * @throws IOException if the parameter supplied is not
+ * of type byte[]
+ */
+ public Object decode(Object pObject) throws IOException {
+ if (!(pObject instanceof byte[])) {
+ throw new IOException("Parameter supplied to Base64 decode is not a byte[]");
+ }
+ return decode((byte[]) pObject);
+ }
+
+ /**
+ * Decodes a byte[] containing containing
+ * characters in the Base64 alphabet.
+ *
+ * @param pArray A byte array containing Base64 character data
+ * @return a byte array containing binary data
+ */
+ public byte[] decode(byte[] pArray) {
+ return decodeBase64(pArray);
+ }
+
+ /**
+ * Encodes binary data using the base64 algorithm, optionally
+ * chunking the output into 76 character blocks.
+ *
+ * @param binaryData Array containing binary data to encode.
+ * @param isChunked if <code>true</code> this encoder will chunk
+ * the base64 output into 76 character blocks
+ * @return Base64-encoded data.
+ */
+ public static byte[] encodeBase64(byte[] binaryData, boolean isChunked) {
+ int lengthDataBits = binaryData.length * EIGHTBIT;
+ int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
+ int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
+ byte encodedData[] = null;
+ int encodedDataLength = 0;
+ int nbrChunks = 0;
+
+ if (fewerThan24bits != 0) {
+ //data not divisible by 24 bit
+ encodedDataLength = (numberTriplets + 1) * 4;
+ } else {
+ // 16 or 8 bit
+ encodedDataLength = numberTriplets * 4;
+ }
+
+ // If the output is to be "chunked" into 76 character sections,
+ // for compliance with RFC 2045 MIME, then it is important to
+ // allow for extra length to account for the separator(s)
+ if (isChunked) {
+
+ nbrChunks =
+ (CHUNK_SEPARATOR.length == 0 ? 0 : (int) Math.ceil((float) encodedDataLength / CHUNK_SIZE));
+ encodedDataLength += nbrChunks * CHUNK_SEPARATOR.length;
+ }
+
+ encodedData = new byte[encodedDataLength];
+
+ byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
+
+ int encodedIndex = 0;
+ int dataIndex = 0;
+ int i = 0;
+ int nextSeparatorIndex = CHUNK_SIZE;
+ int chunksSoFar = 0;
+
+ //log.debug("number of triplets = " + numberTriplets);
+ for (i = 0; i < numberTriplets; i++) {
+ dataIndex = i * 3;
+ b1 = binaryData[dataIndex];
+ b2 = binaryData[dataIndex + 1];
+ b3 = binaryData[dataIndex + 2];
+
+ //log.debug("b1= " + b1 +", b2= " + b2 + ", b3= " + b3);
+
+ l = (byte) (b2 & 0x0f);
+ k = (byte) (b1 & 0x03);
+
+ byte val1 =
+ ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+ byte val2 =
+ ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
+ byte val3 =
+ ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc);
+
+ encodedData[encodedIndex] = lookUpBase64Alphabet[val1];
+ //log.debug( "val2 = " + val2 );
+ //log.debug( "k4 = " + (k<<4) );
+ //log.debug( "vak = " + (val2 | (k<<4)) );
+ encodedData[encodedIndex + 1] =
+ lookUpBase64Alphabet[val2 | (k << 4)];
+ encodedData[encodedIndex + 2] =
+ lookUpBase64Alphabet[(l << 2) | val3];
+ encodedData[encodedIndex + 3] = lookUpBase64Alphabet[b3 & 0x3f];
+
+ encodedIndex += 4;
+
+ // If we are chunking, let's put a chunk separator down.
+ if (isChunked) {
+ // this assumes that CHUNK_SIZE % 4 == 0
+ if (encodedIndex == nextSeparatorIndex) {
+ System.arraycopy(
+ CHUNK_SEPARATOR,
+ 0,
+ encodedData,
+ encodedIndex,
+ CHUNK_SEPARATOR.length);
+ chunksSoFar++;
+ nextSeparatorIndex =
+ (CHUNK_SIZE * (chunksSoFar + 1)) +
+ (chunksSoFar * CHUNK_SEPARATOR.length);
+ encodedIndex += CHUNK_SEPARATOR.length;
+ }
+ }
+ }
+
+ // form integral number of 6-bit groups
+ dataIndex = i * 3;
+
+ if (fewerThan24bits == EIGHTBIT) {
+ b1 = binaryData[dataIndex];
+ k = (byte) (b1 & 0x03);
+ //log.debug("b1=" + b1);
+ //log.debug("b1<<2 = " + (b1>>2) );
+ byte val1 =
+ ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+ encodedData[encodedIndex] = lookUpBase64Alphabet[val1];
+ encodedData[encodedIndex + 1] = lookUpBase64Alphabet[k << 4];
+ encodedData[encodedIndex + 2] = PAD;
+ encodedData[encodedIndex + 3] = PAD;
+ } else if (fewerThan24bits == SIXTEENBIT) {
+
+ b1 = binaryData[dataIndex];
+ b2 = binaryData[dataIndex + 1];
+ l = (byte) (b2 & 0x0f);
+ k = (byte) (b1 & 0x03);
+
+ byte val1 =
+ ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+ byte val2 =
+ ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
+
+ encodedData[encodedIndex] = lookUpBase64Alphabet[val1];
+ encodedData[encodedIndex + 1] =
+ lookUpBase64Alphabet[val2 | (k << 4)];
+ encodedData[encodedIndex + 2] = lookUpBase64Alphabet[l << 2];
+ encodedData[encodedIndex + 3] = PAD;
+ }
+
+ if (isChunked) {
+ // we also add a separator to the end of the final chunk.
+ if (chunksSoFar < nbrChunks) {
+ System.arraycopy(
+ CHUNK_SEPARATOR,
+ 0,
+ encodedData,
+ encodedDataLength - CHUNK_SEPARATOR.length,
+ CHUNK_SEPARATOR.length);
+ }
+ }
+
+ return encodedData;
+ }
+
+ /**
+ * Decodes Base64 data into octects
+ *
+ * @param base64Data Byte array containing Base64 data
+ * @return Array containing decoded data.
+ */
+ public static byte[] decodeBase64(byte[] base64Data) {
+ // RFC 2045 requires that we discard ALL non-Base64 characters
+ base64Data = discardNonBase64(base64Data);
+
+ // handle the edge case, so we don't have to worry about it later
+ if (base64Data.length == 0) {
+ return new byte[0];
+ }
+
+ int numberQuadruple = base64Data.length / FOURBYTE;
+ byte decodedData[] = null;
+ byte b1 = 0, b2 = 0, b3 = 0, b4 = 0, marker0 = 0, marker1 = 0;
+
+ // Throw away anything not in base64Data
+
+ int encodedIndex = 0;
+ int dataIndex = 0;
+ {
+ // this sizes the output array properly - rlw
+ int lastData = base64Data.length;
+ // ignore the '=' padding
+ while (base64Data[lastData - 1] == PAD) {
+ if (--lastData == 0) {
+ return new byte[0];
+ }
+ }
+ decodedData = new byte[lastData - numberQuadruple];
+ }
+
+ for (int i = 0; i < numberQuadruple; i++) {
+ dataIndex = i * 4;
+ marker0 = base64Data[dataIndex + 2];
+ marker1 = base64Data[dataIndex + 3];
+
+ b1 = base64Alphabet[base64Data[dataIndex]];
+ b2 = base64Alphabet[base64Data[dataIndex + 1]];
+
+ if (marker0 != PAD && marker1 != PAD) {
+ //No PAD e.g 3cQl
+ b3 = base64Alphabet[marker0];
+ b4 = base64Alphabet[marker1];
+
+ decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
+ decodedData[encodedIndex + 1] =
+ (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+ decodedData[encodedIndex + 2] = (byte) (b3 << 6 | b4);
+ } else if (marker0 == PAD) {
+ //Two PAD e.g. 3c[Pad][Pad]
+ decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
+ } else if (marker1 == PAD) {
+ //One PAD e.g. 3cQ[Pad]
+ b3 = base64Alphabet[marker0];
+
+ decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
+ decodedData[encodedIndex + 1] =
+ (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+ }
+ encodedIndex += 3;
+ }
+ return decodedData;
+ }
+
+ /**
+ * Discards any whitespace from a base-64 encoded block.
+ *
+ * @param data The base-64 encoded data to discard the whitespace
+ * from.
+ * @return The data, less whitespace (see RFC 2045).
+ */
+ static byte[] discardWhitespace(byte[] data) {
+ byte groomedData[] = new byte[data.length];
+ int bytesCopied = 0;
+
+ for (int i = 0; i < data.length; i++) {
+ switch (data[i]) {
+ case (byte) ' ':
+ case (byte) '\n':
+ case (byte) '\r':
+ case (byte) '\t':
+ break;
+ default:
+ groomedData[bytesCopied++] = data[i];
+ }
+ }
+
+ byte packedData[] = new byte[bytesCopied];
+
+ System.arraycopy(groomedData, 0, packedData, 0, bytesCopied);
+
+ return packedData;
+ }
+
+ /**
+ * Discards any characters outside of the base64 alphabet, per
+ * the requirements on page 25 of RFC 2045 - "Any characters
+ * outside of the base64 alphabet are to be ignored in base64
+ * encoded data."
+ *
+ * @param data The base-64 encoded data to groom
+ * @return The data, less non-base64 characters (see RFC 2045).
+ */
+ static byte[] discardNonBase64(byte[] data) {
+ byte groomedData[] = new byte[data.length];
+ int bytesCopied = 0;
+
+ for (int i = 0; i < data.length; i++) {
+ if (isBase64(data[i])) {
+ groomedData[bytesCopied++] = data[i];
+ }
+ }
+
+ byte packedData[] = new byte[bytesCopied];
+
+ System.arraycopy(groomedData, 0, packedData, 0, bytesCopied);
+
+ return packedData;
+ }
+
+
+ // Implementation of the Encoder Interface
+
+ /**
+ * Encodes an Object using the base64 algorithm. This method
+ * is provided in order to satisfy the requirements of the
+ * Encoder interface, and will throw an EncoderException if the
+ * supplied object is not of type byte[].
+ *
+ * @param pObject Object to encode
+ * @return An object (of type byte[]) containing the
+ * base64 encoded data which corresponds to the byte[] supplied.
+ * @throws IOException if the parameter supplied is not
+ * of type byte[]
+ */
+ public Object encode(Object pObject) throws IOException {
+ if (!(pObject instanceof byte[])) {
+ throw new IOException(
+ "Parameter supplied to Base64 encode is not a byte[]");
+ }
+ return encode((byte[]) pObject);
+ }
+
+ /**
+ * Encodes a byte[] containing binary data, into a byte[] containing
+ * characters in the Base64 alphabet.
+ *
+ * @param pArray a byte array containing binary data
+ * @return A byte array containing only Base64 character data
+ */
+ public byte[] encode(byte[] pArray) {
+ return encodeBase64(pArray, false);
+ }
+
+}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/CircularReferencesException.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/CircularReferencesException.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/CircularReferencesException.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/CircularReferencesException.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release.util;
+
+import java.util.List;
+
+/**
+ * @version $Rev: 1153797 $ $Date: 2011-08-04 02:09:44 -0700 (Thu, 04 Aug 2011) $
+ */
+public class CircularReferencesException extends RuntimeException {
+ private final List<List> circuits;
+
+ public CircularReferencesException(List<List> circuits) {
+ this.circuits = circuits;
+ }
+
+ public List<List> getCircuits() {
+ return circuits;
+ }
+}
Added: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Commands.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Commands.java?rev=1232263&view=auto
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Commands.java (added)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Commands.java Tue Jan 17 02:01:40 2012
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.tools.release.util;
+
+import org.apache.openejb.tools.release.Command;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Commands {
+
+ public static String name(Class<?> clazz) {
+ final Command command = clazz.getAnnotation(Command.class);
+ String name = command.value();
+ if (name.length() == 0) name = clazz.getSimpleName().toLowerCase();
+ return name;
+ }
+
+ public static void run(String[] args, Class clazz) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ final Method main = clazz.getMethod("main", String[].class);
+ main.invoke(null, new Object[]{args});
+ }
+
+ public static List<String> dependencies(Class<?> clazz) {
+ List<String> list = new ArrayList<String>();
+ final Command command = clazz.getAnnotation(Command.class);
+ for (Class dep : command.dependsOn()) {
+ list.add(name(dep));
+ }
+
+ return list;
+ }
+
+ public static List<Class<?>> order(List<Class<?>> commands) {
+ return References.sort(commands, new References.Visitor<Class<?>>() {
+ @Override
+ public String getName(Class<?> aClass) {
+ return name(aClass);
+ }
+
+ @Override
+ public Set<String> getReferences(Class<?> aClass) {
+
+ return new HashSet<String>(dependencies(aClass));
+ }
+ });
+ }
+}
Copied: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Exec.java (from r1231717, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Exec.java)
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Exec.java?p2=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Exec.java&p1=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Exec.java&r1=1231717&r2=1232263&rev=1232263&view=diff
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Exec.java (original)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Exec.java Tue Jan 17 02:01:40 2012
@@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.openejb.tools.release;
+package org.apache.openejb.tools.release.util;
+import java.io.BufferedOutputStream;
import java.io.File;
import java.io.IOException;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -57,7 +59,7 @@ public class Exec {
command.addAll(Arrays.asList(args));
final ProcessBuilder builder = new ProcessBuilder();
- builder.directory(new File(dir.getAbsolutePath()));
+ if (dir != null) builder.directory(new File(dir.getAbsolutePath()));
builder.command(command);
builder.environment().put("PATH", "/opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R6/bin:/usr/local/bin:/Users/dblevins/bin");
builder.environment().putAll(env);
@@ -73,4 +75,27 @@ public class Exec {
}
}
+ public static OutputStream open(String program, String... args) throws RuntimeException {
+ try {
+ final List<String> command = new ArrayList<String>();
+ command.add(program);
+ command.addAll(Arrays.asList(args));
+
+ final ProcessBuilder builder = new ProcessBuilder();
+ if (dir != null) builder.directory(new File(dir.getAbsolutePath()));
+ builder.command(command);
+ builder.environment().put("PATH", "/opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R6/bin:/usr/local/bin:/Users/dblevins/bin");
+ builder.environment().putAll(env);
+ final Process process = builder.start();
+
+ Pipe.pipe(process.getInputStream(), System.out);
+ Pipe.pipe(process.getErrorStream(), System.err);
+
+ return new BufferedOutputStream(process.getOutputStream());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
}
Propchange: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Exec.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Files.java (from r1231717, openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Files.java)
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Files.java?p2=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Files.java&p1=openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Files.java&r1=1231717&r2=1232263&rev=1232263&view=diff
==============================================================================
--- openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/Files.java (original)
+++ openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Files.java Tue Jan 17 02:01:40 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.openejb.tools.release;
+package org.apache.openejb.tools.release.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -45,6 +45,27 @@ import java.util.regex.Pattern;
*/
public class Files {
+ public static File file(String... parts) {
+ File dir = null;
+ for (String part : parts) {
+ if (dir == null) {
+ dir = new File(part);
+ } else {
+ dir = new File(dir, part);
+ }
+ }
+
+ return dir;
+ }
+
+ public static File file(File dir, String... parts) {
+ for (String part : parts) {
+ dir = new File(dir, part);
+ }
+
+ return dir;
+ }
+
public static List<File> collect(final File dir, final String regex) {
return collect(dir, Pattern.compile(regex));
}
Propchange: openejb/trunk/sandbox/release-tools/src/main/java/org/apache/openejb/tools/release/util/Files.java
------------------------------------------------------------------------------
svn:eol-style = native