Introduce Eclipse support
authorMathieu Baudier <mbaudier@argeo.org>
Sat, 31 Jul 2010 19:03:19 +0000 (19:03 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Sat, 31 Jul 2010 19:03:19 +0000 (19:03 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@3737 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

eclipse/plugins/org.argeo.eclipse.ui/pom.xml [new file with mode: 0644]
eclipse/plugins/pom.xml [new file with mode: 0644]
eclipse/pom.xml [new file with mode: 0644]
pom.xml
security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/activemq/SecuredActiveMqConnectionFactory.java

diff --git a/eclipse/plugins/org.argeo.eclipse.ui/pom.xml b/eclipse/plugins/org.argeo.eclipse.ui/pom.xml
new file mode 100644 (file)
index 0000000..b03db81
--- /dev/null
@@ -0,0 +1,31 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons.eclipse</groupId>
+               <version>0.2.1-SNAPSHOT</version>
+               <artifactId>plugins</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>org.argeo.eclipse.ui</artifactId>
+       <name>Commons Eclipse UI</name>
+       <packaging>jar</packaging>
+       <dependencies>
+               <dependency>
+                       <groupId>org.eclipse.ui</groupId>
+                       <artifactId>org.eclipse.ui</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.eclipse.core</groupId>
+                       <artifactId>org.eclipse.core.runtime</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>com.ibm.icu</groupId>
+                       <artifactId>com.ibm.icu</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>org.springframework.context</artifactId>
+               </dependency>
+       </dependencies>
+</project>
diff --git a/eclipse/plugins/pom.xml b/eclipse/plugins/pom.xml
new file mode 100644 (file)
index 0000000..eae64b5
--- /dev/null
@@ -0,0 +1,59 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons</groupId>
+               <version>0.2.1-SNAPSHOT</version>
+               <artifactId>eclipse</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <groupId>org.argeo.commons.eclipse</groupId>
+       <artifactId>plugins</artifactId>
+       <name>Commons Eclipse plugins</name>
+       <packaging>pom</packaging>
+       <modules>
+               <module>org.argeo.eclipse.ui</module>
+       </modules>
+       <build>
+               <resources>
+                       <resource>
+                               <directory>.</directory>
+                               <includes>
+                                       <include>plugin.xml</include>
+                                       <include>META-INF/**</include>
+                               </includes>
+                       </resource>
+               </resources>
+               <plugins>
+                       <plugin>
+                               <artifactId>maven-jar-plugin</artifactId>
+                               <configuration>
+                                       <archive>
+                                               <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+                                       </archive>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-source-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>attach-sources</id>
+                                               <phase>package</phase>
+                                               <goals>
+                                                       <goal>jar</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-surefire-plugin</artifactId>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
diff --git a/eclipse/pom.xml b/eclipse/pom.xml
new file mode 100644 (file)
index 0000000..febfcd1
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons</groupId>
+               <version>0.2.1-SNAPSHOT</version>
+               <artifactId>argeo-commons</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>eclipse</artifactId>
+       <name>Commons Eclipse</name>
+       <packaging>pom</packaging>
+       <modules>
+               <module>plugins</module>
+       </modules>
+</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 1f4dcc3dd803a8718c9dad8d435cf19aec0edc37..e538b0602b6df16b2e3bfa24132297bc967032de 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
                <groupId>org.argeo</groupId>
@@ -15,7 +16,7 @@
                <developmentCycle>0.2</developmentCycle>
                <version.argeo-distribution>1.1.0-SNAPSHOT</version.argeo-distribution>
                <version.argeo-ria>0.12.4</version.argeo-ria>
-               <version.maven-argeo-osgi>0.1.28</version.maven-argeo-osgi>
+               <version.maven-argeo-osgi>0.1.29-SNAPSHOT</version.maven-argeo-osgi>
                <version.maven-bundle-plugin>2.0.1</version.maven-bundle-plugin>
                <version.maven-argeo-qooxdoo>1.1.0-SNAPSHOT</version.maven-argeo-qooxdoo>
                <site.repoBase>file:///var/argeo/projects/commons/www/site</site.repoBase>
@@ -71,6 +72,7 @@ limitations under the License.
                <module>osgi</module>
                <module>server</module>
                <module>security</module>
+               <module>eclipse</module>
                <module>sandbox</module>
        </modules>
        <build>
index 26a05b3d60b8af88973e7cc10ae4c200cc761a71..95e6a6945c834618a417ae8c3baa480ff3ed4f0d 100644 (file)
@@ -46,7 +46,8 @@ public class SecuredActiveMqConnectionFactory implements ConnectionFactory,
        public final static String AUTHMODE_UI = "ui";
        public final static String AUTHMODE_OS = "os";
        public final static String AUTHMODE_DEFAULT = AUTHMODE_OS;
-//     private final static String LOGIN_CONFIG_PROPERTY = "java.security.auth.login.config";
+       // private final static String LOGIN_CONFIG_PROPERTY =
+       // "java.security.auth.login.config";
 
        private final static Log log = LogFactory
                        .getLog(SecuredActiveMqConnectionFactory.class);
@@ -77,6 +78,7 @@ public class SecuredActiveMqConnectionFactory implements ConnectionFactory,
                uccfa.setTargetConnectionFactory(activeMQSslConnectionFactory);
                cachingConnectionFactory = new CachingConnectionFactory();
                cachingConnectionFactory.setTargetConnectionFactory(uccfa);
+               cachingConnectionFactory.setCacheConsumers(false);
 
                initConnectionFactoryCredentials(uccfa);
                cachingConnectionFactory.initConnection();
@@ -92,64 +94,64 @@ public class SecuredActiveMqConnectionFactory implements ConnectionFactory,
                        authenticationMode = AUTHMODE_DEFAULT;
 
                if (AUTHMODE_OS.equals(authenticationMode)) {
-//                     if (false) {
-//                             // Cache previous value of login conf location
-//                             String oldLoginConfLocation = System
-//                                             .getProperty(LOGIN_CONFIG_PROPERTY);
-//                             // Find OS family
-//                             String osName = System.getProperty("os.name");
-//                             final String auth;
-//                             if (osName.startsWith("Windows"))
-//                                     auth = "Windows";
-//                             else if (osName.startsWith("SunOS")
-//                                             || osName.startsWith("Solaris"))
-//                                     auth = "Solaris";
-//                             else
-//                                     auth = "Unix";
-//
-//                             Subject subject;
-//                             // see http://old.nabble.com/osgi-and-jaas-td23485885.html
-//                             ClassLoader ccl = Thread.currentThread()
-//                                             .getContextClassLoader();
-//                             try {
-//                                     Thread.currentThread().setContextClassLoader(
-//                                                     getClass().getClassLoader());
-//                                     URL url = getClass().getResource(
-//                                                     "/org/argeo/security/activemq/osLogin.conf");
-//
-//                                     System.setProperty(LOGIN_CONFIG_PROPERTY, url.toString());
-//                                     LoginContext lc = new LoginContext(auth);
-//                                     lc.login();
-//                                     subject = lc.getSubject();
-//                             } catch (LoginException le) {
-//                                     throw new ArgeoException("OS authentication failed", le);
-//                             } finally {
-//                                     if (oldLoginConfLocation != null)
-//                                             System.setProperty(LOGIN_CONFIG_PROPERTY,
-//                                                             oldLoginConfLocation);
-//                                     Thread.currentThread().setContextClassLoader(ccl);
-//                             }
-//                             // Extract user name
-//                             String osUsername = null;
-//                             for (Principal principal : subject.getPrincipals()) {
-//                                     String className = principal.getClass().getName();
-//                                     if ("Unix".equals(auth)
-//                                                     && "com.sun.security.auth.UnixPrincipal"
-//                                                                     .equals(className))
-//                                             osUsername = principal.getName();
-//                                     else if ("Windows".equals(auth)
-//                                                     && "com.sun.security.auth.NTUserPrincipal"
-//                                                                     .equals(className))
-//                                             osUsername = principal.getName();
-//                                     else if ("Solaris".equals(auth)
-//                                                     && "com.sun.security.auth.SolarisPrincipal"
-//                                                                     .equals(className))
-//                                             osUsername = principal.getName();
-//                             }
-//
-//                             if (osUsername == null)
-//                                     throw new ArgeoException("Could not find OS user name");
-//                     }
+                       // if (false) {
+                       // // Cache previous value of login conf location
+                       // String oldLoginConfLocation = System
+                       // .getProperty(LOGIN_CONFIG_PROPERTY);
+                       // // Find OS family
+                       // String osName = System.getProperty("os.name");
+                       // final String auth;
+                       // if (osName.startsWith("Windows"))
+                       // auth = "Windows";
+                       // else if (osName.startsWith("SunOS")
+                       // || osName.startsWith("Solaris"))
+                       // auth = "Solaris";
+                       // else
+                       // auth = "Unix";
+                       //
+                       // Subject subject;
+                       // // see http://old.nabble.com/osgi-and-jaas-td23485885.html
+                       // ClassLoader ccl = Thread.currentThread()
+                       // .getContextClassLoader();
+                       // try {
+                       // Thread.currentThread().setContextClassLoader(
+                       // getClass().getClassLoader());
+                       // URL url = getClass().getResource(
+                       // "/org/argeo/security/activemq/osLogin.conf");
+                       //
+                       // System.setProperty(LOGIN_CONFIG_PROPERTY, url.toString());
+                       // LoginContext lc = new LoginContext(auth);
+                       // lc.login();
+                       // subject = lc.getSubject();
+                       // } catch (LoginException le) {
+                       // throw new ArgeoException("OS authentication failed", le);
+                       // } finally {
+                       // if (oldLoginConfLocation != null)
+                       // System.setProperty(LOGIN_CONFIG_PROPERTY,
+                       // oldLoginConfLocation);
+                       // Thread.currentThread().setContextClassLoader(ccl);
+                       // }
+                       // // Extract user name
+                       // String osUsername = null;
+                       // for (Principal principal : subject.getPrincipals()) {
+                       // String className = principal.getClass().getName();
+                       // if ("Unix".equals(auth)
+                       // && "com.sun.security.auth.UnixPrincipal"
+                       // .equals(className))
+                       // osUsername = principal.getName();
+                       // else if ("Windows".equals(auth)
+                       // && "com.sun.security.auth.NTUserPrincipal"
+                       // .equals(className))
+                       // osUsername = principal.getName();
+                       // else if ("Solaris".equals(auth)
+                       // && "com.sun.security.auth.SolarisPrincipal"
+                       // .equals(className))
+                       // osUsername = principal.getName();
+                       // }
+                       //
+                       // if (osUsername == null)
+                       // throw new ArgeoException("Could not find OS user name");
+                       // }
 
                        uccfa.setUsername(System.getProperty("user.name"));
                        uccfa.setPassword(null);
@@ -201,7 +203,7 @@ public class SecuredActiveMqConnectionFactory implements ConnectionFactory,
                                        new SecureRandom());
                } catch (Exception e) {
                        throw new ArgeoException(
-                                       "Cannot initailize JMS conneciton factory", e);
+                                       "Cannot initialize JMS connection factory", e);
                }
 
        }