Improve RCP
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 4 Sep 2011 21:05:30 +0000 (21:05 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 4 Sep 2011 21:05:30 +0000 (21:05 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@4714 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

demo/argeo_node_rcp.properties [new file with mode: 0644]
demo/argeo_node_web.properties
demo/log4j.properties
eclipse/runtime/org.argeo.eclipse.ui.jcr/src/main/java/org/argeo/eclipse/ui/jcr/browser/NodeContentProvider.java
osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/BundlesView.java
security/plugins/org.argeo.security.ui.rcp/META-INF/spring/application-osgi.xml [deleted file]
security/plugins/org.argeo.security.ui.rcp/META-INF/spring/application.xml [deleted file]
security/plugins/org.argeo.security.ui.rcp/plugin.xml
security/plugins/org.argeo.security.ui.rcp/src/main/java/org/argeo/security/ui/rcp/AbstractSecureApplication.java
server/modules/org.argeo.node.repo.jackrabbit/noderepo.properties
server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/jackrabbit/JackrabbitContainer.java

diff --git a/demo/argeo_node_rcp.properties b/demo/argeo_node_rcp.properties
new file mode 100644 (file)
index 0000000..cc86fd5
--- /dev/null
@@ -0,0 +1,15 @@
+argeo.osgi.start=\
+org.springframework.osgi.extender,\
+org.argeo.node.repofactory.jackrabbit,\
+org.argeo.node.repo.jackrabbit,\
+org.argeo.security.dao.jackrabbit,\
+org.argeo.security.services,\
+org.argeo.security.equinox,\
+
+org.argeo.security.ui.initialPerspective=org.argeo.osgi.ui.explorer.perspective
+
+#argeo.node.repo.uri=http://localhost:7070/org.argeo.jcr.webapp/remoting/node
+
+log4j.configuration=file:../../log4j.properties
+
+eclipse.application=org.argeo.security.ui.rcp.secureUi
index e602fa8a04d141d8009fb8134aee284bcbdf9583..5e544fd52aa3532e9bde5b4e9babebc52d165cf0 100644 (file)
@@ -15,10 +15,6 @@ org.argeo.server.rap.webapp,\
 org.argeo.server.ads.server,\
 org.springframework.osgi.web.extender,\
 
-#org.argeo.security.ui.initialPerspective=org.argeo.jcr.ui.explorer.perspective
 org.argeo.security.ui.initialPerspective=org.argeo.osgi.ui.explorer.perspective
 
-argeo.node.repo.home=~/.argeo/server_noderepo
-argeo.node.repo.dburl=jdbc:h2:file:~/.argeo/h2/server_noderepo_db
-
 log4j.configuration=file:../../log4j.properties
index 65ac43da124cbd8fcfe79868fc45956dd1244118..c4fba851e2ecd53f3e63b32376bf3aebe793becc 100644 (file)
@@ -3,18 +3,10 @@ log4j.rootLogger=WARN, development
 ## Levels
 log4j.logger.org.argeo=DEBUG
 log4j.logger.org.argeo.jackrabbit.remote.ExtendedDispatcherServlet=WARN
-
-log4j.logger.org.springframework.security=DEBUG
+log4j.logger.org.argeo.server.webextender.TomcatDeployer=WARN
 
 log4j.logger.org.apache.catalina=INFO
-log4j.logger.org.apache.coyote=INFO
-log4j.logger.org.apache.tomcat=INFO
-
-log4j.logger.org.apache.directory.server=INFO
-log4j.logger.org.apache.directory.server.core.partition=ERROR
-log4j.logger.org.apache.directory.server.core.schema.bootstrap.BootstrapAttributeTypeRegistry=ERROR
-
-log4j.logger.org.apache.jackrabbit=WARN
+log4j.logger.org.apache.directory.server=ERROR
 log4j.logger.org.apache.jackrabbit.core.query.lucene=ERROR
 
 ## Appenders
index 3e5bc1d8dd0fe0b1d879bc7e62d02caf43671cfe..bab3c95b02c3a836d487f309dcc499acff55dc55 100644 (file)
@@ -29,11 +29,17 @@ public class NodeContentProvider implements ITreeContentProvider {
                this.repositoryRegister = repositoryRegister;
        }
 
-       /** Sends back the first level of the Tree. Independent from inputElement that can be null*/
+       /**
+        * Sends back the first level of the Tree. Independent from inputElement
+        * that can be null
+        */
        public Object[] getElements(Object inputElement) {
                List<Object> objs = new ArrayList<Object>();
-               if (userSession != null)
-                       objs.add(JcrUtils.getUserHome(userSession));
+               if (userSession != null) {
+                       Node userHome = JcrUtils.getUserHome(userSession);
+                       if (userHome != null)
+                               objs.add(userHome);
+               }
                if (repositoryRegister != null)
                        objs.add(repositoryRegister);
                return objs.toArray();
@@ -73,8 +79,8 @@ public class NodeContentProvider implements ITreeContentProvider {
                try {
                        if (element instanceof Node) {
                                Node node = (Node) element;
-                               if(!node.getPath().equals("/"))
-                               return node.getParent();
+                               if (!node.getPath().equals("/"))
+                                       return node.getParent();
                                else
                                        return null;
                        }
index dd0dd1e29f48473128aca01e170c462990d608b2..19e463dee147a33c1e1664c7743c8fb27787c52e 100644 (file)
@@ -14,7 +14,6 @@ import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
 import org.eclipse.ui.part.ViewPart;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -60,7 +59,7 @@ public class BundlesView extends ViewPart {
 
                // State
                column = new TableViewerColumn(viewer, SWT.NONE);
-               column.getColumn().setWidth(16);
+               column.getColumn().setWidth(18);
                column.getColumn().setText("State");
                column.setLabelProvider(new StateLabelProvider());
                new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
diff --git a/security/plugins/org.argeo.security.ui.rcp/META-INF/spring/application-osgi.xml b/security/plugins/org.argeo.security.ui.rcp/META-INF/spring/application-osgi.xml
deleted file mode 100644 (file)
index d50070b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
-       xmlns:util="http://www.springframework.org/schema/util"\r
-       xsi:schemaLocation="http://www.springframework.org/schema/osgi  \r
-       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
-       http://www.springframework.org/schema/beans   \r
-       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.springframework.org/schema/util\r
-       http://www.springframework.org/schema/util/spring-util-2.5.xsd">\r
-\r
-       <!-- REFERENCE -->\r
-<!--   <reference id="authenticationManager" -->\r
-<!--           interface="org.springframework.security.AuthenticationManager" /> -->\r
-\r
-</beans:beans>
\ No newline at end of file
diff --git a/security/plugins/org.argeo.security.ui.rcp/META-INF/spring/application.xml b/security/plugins/org.argeo.security.ui.rcp/META-INF/spring/application.xml
deleted file mode 100644 (file)
index dbf3680..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-       <bean id="secureUi" class="org.argeo.security.ui.rcp.SecureRcp">
-<!--           <property name="authenticationManager" ref="authenticationManager" /> -->
-       </bean>
-</beans>
\ No newline at end of file
index 6a79da51082678faa38473ae31d5bfe602f9eb22..39b8c848ccb02c2dd701814c621e9536af44b8b0 100644 (file)
@@ -27,7 +27,7 @@
          thread="main"
          visible="true">
          <run
-               class="org.argeo.eclipse.spring.SpringExtensionFactory">
+               class="org.argeo.security.ui.rcp.SecureRcp">
          </run>
       </application>
    </extension>
index 26795f274ca9404f6ceb73135c47209c2d667807..7487567a8ba03c01557e95be665111c569f688d7 100644 (file)
@@ -29,11 +29,11 @@ public abstract class AbstractSecureApplication implements IApplication {
 
        public Object start(IApplicationContext context) throws Exception {
                // wait for the system to be initialized
-               try {
-                       Thread.sleep(3000);
-               } catch (Exception e2) {
-                       // silent
-               }
+//             try {
+//                     Thread.sleep(3000);
+//             } catch (Exception e2) {
+//                     // silent
+//             }
 
                // choose login context
                final ILoginContext loginContext;
index d817e1454fc1ec7054182246726e9c99c679e0ef..a6c5b4bdc917bb8df0bbf8a7bfc97dfc33c1c721 100644 (file)
@@ -2,11 +2,11 @@
 argeo.node.repo.workspace=dev
 
 # Repository base directory
-argeo.node.repo.home=${osgi.instance.area}/org/argeo/jackrabbit/node/repo
+argeo.node.repo.home=${osgi.instance.area}/node/repo
 
 ## H2 Embedded (DEFAULT)
 argeo.node.repo.configuration=osgibundle:repository-h2.xml
-argeo.node.repo.dburl=jdbc:h2:${osgi.instance.area}/org/argeo/jackrabbit/node/h2
+argeo.node.repo.dburl=jdbc:h2:${osgi.instance.area}/node/h2/repo
 argeo.node.repo.dbuser=sa
 argeo.node.repo.dbpassword=
 
index d9cf424e63e7155f433b034e2c10d2d5352ad25c..3b83941cfade149844b768a15dc56e1c6d4e4269 100644 (file)
@@ -115,6 +115,7 @@ public class JackrabbitContainer implements Repository, ResourceLoaderAware {
 
        /** Actually creates a new repository. */
        protected void createJackrabbitRepository() {
+               long begin = System.currentTimeMillis();
                try {
                        // remote repository
                        if (uri != null && !uri.trim().equals("")) {
@@ -122,7 +123,7 @@ public class JackrabbitContainer implements Repository, ResourceLoaderAware {
                                params.put(
                                                org.apache.jackrabbit.commons.JcrUtils.REPOSITORY_URI,
                                                uri);
-                               repository = (JackrabbitRepository) new Jcr2davRepositoryFactory()
+                               repository = new Jcr2davRepositoryFactory()
                                                .getRepository(params);
                                if (repository == null)
                                        throw new ArgeoException("Remote Davex repository " + uri
@@ -161,8 +162,10 @@ public class JackrabbitContainer implements Repository, ResourceLoaderAware {
                        else
                                repository = RepositoryImpl.create(repositoryConfig);
 
-                       log.info("Initialized Jackrabbit repository " + repository + " in "
-                                       + getHomeDirectory() + " with config " + configuration);
+                       double duration = ((double) (System.currentTimeMillis() - begin)) / 1000;
+                       log.info("Initialized Jackrabbit repository in " + duration
+                                       + " s, home: " + getHomeDirectory() + ", config: "
+                                       + configuration);
                } catch (Exception e) {
                        throw new ArgeoException("Cannot create Jackrabbit repository "
                                        + getHomeDirectory(), e);
@@ -232,31 +235,16 @@ public class JackrabbitContainer implements Repository, ResourceLoaderAware {
 
        /** Lazy init. */
        protected File getHomeDirectory() {
-               return homeDirectory;
-               // if (home != null)
-               // return home;
-               //
-               // try {
-               // String osgiData = System.getProperty("osgi.instance.area");
-               // if (osgiData != null)
-               // osgiData = osgiData.substring("file:".length());
-               // String path;
-               // if (homeDirectory == null)
-               // path = "./jackrabbit";
-               // else
-               // path = homeDirectory;
-               // if (path.startsWith(".") && osgiData != null) {
-               // home = new File(osgiData + '/' + path).getCanonicalFile();
-               // } else
-               // home = new File(path).getCanonicalFile();
-               // return home;
-               // } catch (Exception e) {
-               // throw new ArgeoException("Cannot define Jackrabbit home based on "
-               // + homeDirectory, e);
-               // }
+               try {
+                       return homeDirectory.getCanonicalFile();
+               } catch (IOException e) {
+                       throw new ArgeoException("Cannot get canonical file for "
+                                       + homeDirectory, e);
+               }
        }
 
        public void dispose() throws Exception {
+               long begin = System.currentTimeMillis();
                if (repository != null) {
                        if (repository instanceof JackrabbitRepository)
                                ((JackrabbitRepository) repository).shutdown();
@@ -274,11 +262,13 @@ public class JackrabbitContainer implements Repository, ResourceLoaderAware {
                                                        + getHomeDirectory());
                        }
 
+               double duration = ((double) (System.currentTimeMillis() - begin)) / 1000;
                if (uri != null && !uri.trim().equals(""))
                        log.info("Destroyed Jackrabbit repository with uri " + uri);
                else
-                       log.info("Destroyed Jackrabbit repository " + repository + " in "
-                                       + getHomeDirectory() + " with config " + configuration);
+                       log.info("Destroyed Jackrabbit repository in " + duration
+                                       + " s, home: " + getHomeDirectory() + ", config "
+                                       + configuration);
        }
 
        /**