geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lin...@apache.org
Subject svn commit: r582950 - in /geronimo/devtools/j2g/trunk: configurator/src/org/apache/geronimo/devtools/ configurator/src/org/apache/geronimo/devtools/j2g/ configurator/src/org/apache/geronimo/j2g/ src/main/resources/compatibility/org.apache.geronimo.devt...
Date Mon, 08 Oct 2007 19:55:05 GMT
Author: linsun
Date: Mon Oct  8 12:55:04 2007
New Revision: 582950

URL: http://svn.apache.org/viewvc?rev=582950&view=rev
Log:
more update to configurator, src dir -  for GERONIMODEVTOOLS-221.  The generated files can
be deleted once we figure out why it was there in the first place and how it can be generated.

Added:
    geronimo/devtools/j2g/trunk/configurator/src/org/apache/geronimo/devtools/
    geronimo/devtools/j2g/trunk/configurator/src/org/apache/geronimo/devtools/j2g/
    geronimo/devtools/j2g/trunk/configurator/src/org/apache/geronimo/devtools/j2g/Configurator.java
  (with props)
    geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/
      - copied from r582946, geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.j2g.sources.dependence.compatibility/
Removed:
    geronimo/devtools/j2g/trunk/configurator/src/org/apache/geronimo/j2g/
    geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.j2g.sources.dependence.compatibility/
Modified:
    geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Anybody.java
    geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/DigestCallback.java
    geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoLoginModule.java
    geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoSimpleGroup.java
    geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Nobody.java
    geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/PasswordHasher.java

Added: geronimo/devtools/j2g/trunk/configurator/src/org/apache/geronimo/devtools/j2g/Configurator.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/configurator/src/org/apache/geronimo/devtools/j2g/Configurator.java?rev=582950&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/configurator/src/org/apache/geronimo/devtools/j2g/Configurator.java
(added)
+++ geronimo/devtools/j2g/trunk/configurator/src/org/apache/geronimo/devtools/j2g/Configurator.java
Mon Oct  8 12:55:04 2007
@@ -0,0 +1,151 @@
+/**
+ *  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.geronimo.devtools.j2g;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Prepares j2g for following work.
+ */
+public class Configurator {
+
+	/**
+	 * Eclipse config filename.
+	 */
+	public static final String CONFIG_FILE = "config.ini";
+
+	/**
+	 * Config.ini parameter. Eclipse install area.
+	 */
+	public static final String INSTALL_AREA = "osgi.install.area";
+
+	/**
+	 * Config.ini parameter. Bundles which will be included to the Eclipse runtime.
+	 */
+	public static final String BUNDLES_KEY = "osgi.bundles";
+
+	/**
+	 * J2g plug-ins path.
+	 */
+	public static String LOCAL_ECLIPSE_PLUGINS = "plugins";
+	
+	/**
+	 * J2g configuration path.
+	 */
+
+	public static String LOCAL_ECLIPSE_CONFIG = "configuration";
+	/**
+	 * Pattern for external bundles.
+	 */
+	public static final String BUNDLES_PATTERN = "reference:file:";
+
+	/**
+	 * Default Eclipse bundles.
+	 */
+	public static final String DEFAULT_BUNDLES = "org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@2:start,org.eclipse.update.configurator@3:start";
+
+	/**
+	 * Eclipse shared configuration parameter name
+	 */
+	public static final String SHARED_CONFIG = "osgi.sharedConfiguration.area";
+
+	/**
+	 * Adds j2g plugins full paths to the Eclipse platform config.ini file.
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		if (args.length != 0) {
+			try {
+				
+				Properties config = new Properties();
+				String home = args[0];
+				if (home != null) {
+					String eclipseDir = home.replace('\\', '/');
+					LOCAL_ECLIPSE_CONFIG = eclipseDir + File.separator + LOCAL_ECLIPSE_CONFIG;
+					LOCAL_ECLIPSE_PLUGINS = eclipseDir + File.separator + LOCAL_ECLIPSE_PLUGINS;
+					File confDir = new File(LOCAL_ECLIPSE_CONFIG);
+					if(!confDir.exists())
+					{
+						confDir.mkdir();
+					}
+					String filename = LOCAL_ECLIPSE_CONFIG + File.separator + CONFIG_FILE;
+					File file = new File(filename);
+					if (file.exists())
+					{
+						byte byteArray[] = null;
+						int filelen = (int)file.length();
+						byteArray = new byte[filelen];
+						int status = -1;
+						FileInputStream inBak = new FileInputStream(file);
+						status = inBak.read(byteArray);
+						FileWriter outBak = new FileWriter(LOCAL_ECLIPSE_CONFIG + File.separator + "config.bak");
+						String fileString = new String(byteArray);
+						outBak.write(fileString);
+						outBak.close();
+					}
+					else
+						file.createNewFile();
+					/*
+					 * Open file for read
+					 * Read properties existing from file
+					 * Close the file
+					 */
+					FileInputStream infile = new FileInputStream(file);
+					config.load(infile);
+					infile.close();
+					
+					config.setProperty(INSTALL_AREA, eclipseDir);
+					String bundles = DEFAULT_BUNDLES;
+					File pluginsDir = new File(LOCAL_ECLIPSE_PLUGINS);
+					File[] plugins = pluginsDir.listFiles();
+					for (int i = 0; i < plugins.length; i++) {
+						String path = plugins[i].getAbsolutePath().replace('\\', '/');
+						bundles = bundles + "," + BUNDLES_PATTERN + path;
+					}
+					config.setProperty(BUNDLES_KEY, bundles);
+					config.setProperty(SHARED_CONFIG, "./");
+					/*
+					 * Open file for output
+					 * Write properties to the file
+					 * Close the file
+					 */
+					FileOutputStream out = new FileOutputStream(file);
+					config.store(out, "Eclipse configuration file.");
+					out.close();
+					System.out.println("A backup of your configuration file has been written to "+LOCAL_ECLIPSE_CONFIG
+ File.separator + "config.bak");
+					System.out.println(" ");
+					System.out.println("Configuration complete.");
+				}
+				else {
+					System.out.println("System environment variable ECLIPSE_HOME is not set.");
+				}
+			} catch (IOException e) {
+				System.out.println("Cannot create config.ini file. Please, make sure that it is not open
and try once again. ");
+				e.printStackTrace();
+			}
+		}
+		else {
+			System.out.println("System environment variable ECLIPSE_HOME is not set.");
+		}
+
+	}
+}

Propchange: geronimo/devtools/j2g/trunk/configurator/src/org/apache/geronimo/devtools/j2g/Configurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Anybody.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Anybody.java?rev=582950&r1=582946&r2=582950&view=diff
==============================================================================
--- geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Anybody.java
(original)
+++ geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Anybody.java
Mon Oct  8 12:55:04 2007
@@ -17,7 +17,7 @@
 /*
  * Auto-generated by J2G Migration. 
  */
-package org.apache.geronimo.j2g.sources.dependence.compatibility;
+package org.apache.geronimo.devtools.j2g.sources.dependence.compatibility;
 
 import java.security.Principal;
 

Modified: geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/DigestCallback.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/DigestCallback.java?rev=582950&r1=582946&r2=582950&view=diff
==============================================================================
--- geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/DigestCallback.java
(original)
+++ geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/DigestCallback.java
Mon Oct  8 12:55:04 2007
@@ -17,7 +17,7 @@
 /*
  * Auto-generated by J2G Migration. 
  */
-package org.apache.geronimo.j2g.sources.dependence.compatibility;
+package org.apache.geronimo.devtools.j2g.sources.dependence.compatibility;
 
 import java.security.MessageDigest;
 import java.util.Map;

Modified: geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoLoginModule.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoLoginModule.java?rev=582950&r1=582946&r2=582950&view=diff
==============================================================================
--- geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoLoginModule.java
(original)
+++ geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoLoginModule.java
Mon Oct  8 12:55:04 2007
@@ -17,7 +17,7 @@
 /*
  * Auto-generated by J2G Migration. 
  */
-package org.apache.geronimo.j2g.sources.dependence.compatibility;
+package org.apache.geronimo.devtools.j2g.sources.dependence.compatibility;
 
 import java.io.IOException;
 import java.lang.reflect.Constructor;

Modified: geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoSimpleGroup.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoSimpleGroup.java?rev=582950&r1=582946&r2=582950&view=diff
==============================================================================
--- geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoSimpleGroup.java
(original)
+++ geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/GeronimoSimpleGroup.java
Mon Oct  8 12:55:04 2007
@@ -17,7 +17,7 @@
  /*
  * Auto-generated by J2G Migration. 
  */
-package org.apache.geronimo.j2g.sources.dependence.compatibility;
+package org.apache.geronimo.devtools.j2g.sources.dependence.compatibility;
 
 import java.security.Principal;
 import java.security.acl.Group;

Modified: geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Nobody.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Nobody.java?rev=582950&r1=582946&r2=582950&view=diff
==============================================================================
--- geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Nobody.java
(original)
+++ geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/Nobody.java
Mon Oct  8 12:55:04 2007
@@ -17,7 +17,7 @@
  /*
  * Auto-generated by J2G Migration. 
  */
-package org.apache.geronimo.j2g.sources.dependence.compatibility;
+package org.apache.geronimo.devtools.j2g.sources.dependence.compatibility;
 
 import java.security.Principal;
 

Modified: geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/PasswordHasher.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/PasswordHasher.java?rev=582950&r1=582946&r2=582950&view=diff
==============================================================================
--- geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/PasswordHasher.java
(original)
+++ geronimo/devtools/j2g/trunk/src/main/resources/compatibility/org.apache.geronimo.devtools.j2g.sources.dependence.compatibility/PasswordHasher.java
Mon Oct  8 12:55:04 2007
@@ -17,7 +17,7 @@
  /*
  * Auto-generated by J2G Migration. 
  */
-package org.apache.geronimo.j2g.sources.dependence.compatibility;
+package org.apache.geronimo.devtools.j2g.sources.dependence.compatibility;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;



Mime
View raw message