Adapt to changes in Commons
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 22 May 2016 11:54:50 +0000 (11:54 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 22 May 2016 11:54:50 +0000 (11:54 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@8933 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

14 files changed:
dep/org.argeo.slc.dep.backend/pom.xml
org.argeo.slc.agent/META-INF/spring/osgi.xml
org.argeo.slc.api/src/org/argeo/slc/SlcConstants.java
org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/editors/ProcessEditor.java
org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/JcrExecutionModulesView.java
org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/JcrResultListView.java
org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/JcrResultTreeView.java
org.argeo.slc.factory/src/org/argeo/slc/rpmfactory/core/RpmProxyServiceImpl.java
org.argeo.slc.node.jackrabbit/META-INF/spring/jackrabbit-osgi.xml
org.argeo.slc.node.jackrabbit/META-INF/spring/jackrabbit.xml
org.argeo.slc.repo/src/org/argeo/slc/repo/maven/MavenConventionsUtils.java
org.argeo.slc.repo/src/org/argeo/slc/repo/osgi/OsgiFactoryImpl.java
org.argeo.slc.server.repo/META-INF/spring/jcr.xml
pom.xml

index eac2815d58bae53b9e7d2f23d4db383745e53891..4f9af22ab5d61cba3ee431804c9f2269421fb206 100644 (file)
                        <scope>test</scope>
                </dependency>
 
-               <!-- Thrid parties (extras) -->
+               <!-- Third parties (extras) -->
+               <dependency>
+                       <groupId>org.argeo.tp.misc</groupId>
+                       <artifactId>biz.aQute.bnd</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.misc</groupId>
+                       <artifactId>org.junit</artifactId>
+               </dependency>
+
                <dependency>
                        <groupId>org.argeo.tp.extras</groupId>
                        <artifactId>net.sf.jxl</artifactId>
index 2b9dee6850f3382d4fe792709b1a1debea2850db..42ea0bc77210a04343186ae687d98f2116af0cd8 100644 (file)
@@ -48,7 +48,7 @@
 \r
        <beans:bean class="org.argeo.security.core.SimpleRoleRegistration"\r
                init-method="run">\r
-               <beans:property name="role" value="ROLE_SLC" />\r
+               <beans:property name="role" value="org.argeo.slc.user" />\r
                <beans:property name="userAdmin" ref="userAdmin" />\r
                <beans:property name="userTransaction" ref="userTransaction" />\r
 <!--           <beans:property name="userAdminService" ref="userAdminService" /> -->\r
index 2b26e878f1380d9059bc21c9860559a06d64f210..d11baf12c0bf78cdc299623abc239762700aa81b 100644 (file)
@@ -3,7 +3,7 @@ package org.argeo.slc;
 /** Constants useful across all SLC components */
 public interface SlcConstants {
        /** Read-write role. */
-       public final static String ROLE_SLC = "ROLE_SLC";
+       public final static String ROLE_SLC = "org.argeo.slc.user";
 
        /** Read only unlogged user */
        public final static String USER_ANONYMOUS = "anonymous";
index f70114fd08ab49def2f9d829887f28f0d8a8ec8e..b2cb8200a525f0e31d51e7a7b6c53fa8699b993f 100644 (file)
@@ -46,8 +46,11 @@ import org.eclipse.ui.forms.editor.FormEditor;
 
 /** Editor for an execution process. */
 public class ProcessEditor extends FormEditor implements SlcTypes, SlcNames {
+       private static final long serialVersionUID = 509589737739132467L;
+
        public final static String ID = ClientUiPlugin.ID + ".processEditor";
 
+       private Repository repository;
        private Session session;
        private Node processNode;
        private ProcessController processController;
@@ -60,6 +63,12 @@ public class ProcessEditor extends FormEditor implements SlcTypes, SlcNames {
        public void init(IEditorSite site, IEditorInput input)
                        throws PartInitException {
                super.init(site, input);
+               try {
+                       session = repository.login();
+               } catch (RepositoryException e1) {
+                       throw new SlcException("Cannot log in to repository");
+               }
+
                ProcessEditorInput pei = (ProcessEditorInput) input;
                String processPath = pei.getProcessPath();
                try {
@@ -250,27 +259,8 @@ public class ProcessEditor extends FormEditor implements SlcTypes, SlcNames {
                return false;
        }
 
-       // public void updateStatus(ExecutionProcess process, String oldStatus,
-       // String newStatus) {
-       // }
-       //
-       // public void addSteps(ExecutionProcess process, List<ExecutionStep> steps)
-       // {
-       // }
-
-       /** Expects one session per editor. */
-       @Deprecated
-       public void setSession(Session session) {
-               this.session = session;
-       }
-
        public void setRepository(Repository repository) {
-               try {
-                       session = repository.login();
-               } catch (RepositoryException re) {
-                       throw new SlcException("Unable to log in Repository " + repository,
-                                       re);
-               }
+               this.repository = repository;
        }
 
        public void setProcessController(ProcessController processController) {
index 71f291e8ac56b48e2757b7529fbb175870a62f1f..4340f93f2f83807aeba8fbdc18fee2421c80ea11 100644 (file)
@@ -71,21 +71,25 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
 
 /** JCR based view of the execution modules. */
-public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
-               SlcNames {
-       private final static Log log = LogFactory
-                       .getLog(JcrExecutionModulesView.class);
+public class JcrExecutionModulesView extends ViewPart implements SlcTypes, SlcNames {
+       private final static Log log = LogFactory.getLog(JcrExecutionModulesView.class);
 
-       public static final String ID = ClientUiPlugin.ID
-                       + ".jcrExecutionModulesView";
+       public static final String ID = ClientUiPlugin.ID + ".jcrExecutionModulesView";
 
        private TreeViewer viewer;
 
        /* DEPENDENCY INJECTION */
+       private Repository repository;
        private Session session;
        private ExecutionModulesManager modulesManager;
 
        public void createPartControl(Composite parent) {
+               try {
+                       session = repository.login();
+               } catch (RepositoryException e1) {
+                       throw new SlcException("Cannot log in to repository");
+               }
+
                viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
                EclipseUiSpecificUtils.enableToolTipSupport(viewer);
                ViewContentProvider contentProvider = new ViewContentProvider(session);
@@ -106,16 +110,11 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                viewer.addDragSupport(operations, tt, new ViewDragListener());
 
                try {
-                       String[] nodeTypes = { SlcTypes.SLC_AGENT,
-                                       SlcTypes.SLC_AGENT_FACTORY, SlcTypes.SLC_EXECUTION_MODULE };
-                       session.getWorkspace()
-                                       .getObservationManager()
-                                       .addEventListener(
-                                                       new VmAgentObserver(viewer.getTree().getDisplay()),
-                                                       Event.NODE_ADDED | Event.NODE_REMOVED
-                                                                       | Event.NODE_MOVED,
-                                                       SlcJcrConstants.VM_AGENT_FACTORY_PATH, true, null,
-                                                       nodeTypes, false);
+                       String[] nodeTypes = { SlcTypes.SLC_AGENT, SlcTypes.SLC_AGENT_FACTORY, SlcTypes.SLC_EXECUTION_MODULE };
+                       session.getWorkspace().getObservationManager().addEventListener(
+                                       new VmAgentObserver(viewer.getTree().getDisplay()),
+                                       Event.NODE_ADDED | Event.NODE_REMOVED | Event.NODE_MOVED, SlcJcrConstants.VM_AGENT_FACTORY_PATH,
+                                       true, null, nodeTypes, false);
                } catch (RepositoryException e) {
                        throw new SlcException("Cannot add observer", e);
                }
@@ -135,10 +134,10 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
 
        // Controllers
        class ViewContentProvider extends SimpleNodeContentProvider {
+               private static final long serialVersionUID = 5117887833174813672L;
 
                public ViewContentProvider(Session session) {
-                       super(session,
-                                       new String[] { SlcJcrConstants.VM_AGENT_FACTORY_PATH });
+                       super(session, new String[] { SlcJcrConstants.VM_AGENT_FACTORY_PATH });
                }
 
                @Override
@@ -150,16 +149,14 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                }
 
                @Override
-               protected List<Node> filterChildren(List<Node> children)
-                               throws RepositoryException {
+               protected List<Node> filterChildren(List<Node> children) throws RepositoryException {
                        for (Iterator<Node> it = children.iterator(); it.hasNext();) {
                                Node node = it.next();
                                // execution spec definitions
                                if (node.getName().equals(SLC_EXECUTION_SPECS))
                                        it.remove();
                                // flow values
-                               else if (node.getParent().isNodeType(
-                                               SlcTypes.SLC_EXECUTION_FLOW))
+                               else if (node.getParent().isNodeType(SlcTypes.SLC_EXECUTION_FLOW))
                                        it.remove();
                        }
                        return super.filterChildren(children);
@@ -193,14 +190,11 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                                        if (node2.getName().equals(SLC_EXECUTION_SPECS))
                                                return 100;
 
-                                       if (node1.isNodeType(SLC_EXECUTION_FLOW)
-                                                       && node2.isNodeType(SLC_EXECUTION_FLOW)) {
+                                       if (node1.isNodeType(SLC_EXECUTION_FLOW) && node2.isNodeType(SLC_EXECUTION_FLOW)) {
                                                return node1.getName().compareTo(node2.getName());
-                                       } else if (node1.isNodeType(SLC_EXECUTION_FLOW)
-                                                       && !node2.isNodeType(SLC_EXECUTION_FLOW)) {
+                                       } else if (node1.isNodeType(SLC_EXECUTION_FLOW) && !node2.isNodeType(SLC_EXECUTION_FLOW)) {
                                                return 1;
-                                       } else if (!node1.isNodeType(SLC_EXECUTION_FLOW)
-                                                       && node2.isNodeType(SLC_EXECUTION_FLOW)) {
+                                       } else if (!node1.isNodeType(SLC_EXECUTION_FLOW) && node2.isNodeType(SLC_EXECUTION_FLOW)) {
                                                return -1;
                                        } else {
                                                // TODO: check title
@@ -208,8 +202,7 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                                        }
                                }
                        } catch (RepositoryException e) {
-                               throw new ArgeoException("Cannot compare " + o1 + " and " + o2,
-                                               e);
+                               throw new ArgeoException("Cannot compare " + o1 + " and " + o2, e);
                        }
                        return 0;
                }
@@ -249,8 +242,7 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                                        if (session.itemExists(path)) {
                                                Node parentNode = session.getNode(path);// .getParent();
                                                if (log.isTraceEnabled())
-                                                       log.trace("Refresh " + parentNode + " after event "
-                                                                       + event);
+                                                       log.trace("Refresh " + parentNode + " after event " + event);
                                                viewer.refresh(parentNode);
                                        }
                                } catch (RepositoryException e) {
@@ -263,18 +255,16 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                }
        }
 
-       class ViewLabelProvider extends DefaultNodeLabelProvider implements
-                       ITableLabelProvider {
+       class ViewLabelProvider extends DefaultNodeLabelProvider implements ITableLabelProvider {
+               private static final long serialVersionUID = 2410754425574656399L;
 
                @Override
                protected String getText(Node node) throws RepositoryException {
-                       if (node.isNodeType(NodeType.MIX_TITLE)
-                                       && node.hasProperty(Property.JCR_TITLE))
+                       if (node.isNodeType(NodeType.MIX_TITLE) && node.hasProperty(Property.JCR_TITLE))
                                return node.getProperty(Property.JCR_TITLE).getString();
                        else if (node.getName().equals(SLC_EXECUTION_SPECS))
                                return "Execution Specifications";
-                       else if (node.getPath().equals(
-                                       SlcJcrConstants.VM_AGENT_FACTORY_PATH))
+                       else if (node.getPath().equals(SlcJcrConstants.VM_AGENT_FACTORY_PATH))
                                return "Internal Agents";
                        return super.getText(node);
                }
@@ -282,8 +272,7 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                @Override
                public Image getImage(Node node) throws RepositoryException {
                        // we try to optimize a bit by putting deeper nodes first
-                       if (node.getParent().isNodeType(
-                                       SlcTypes.SLC_EXECUTION_SPEC_ATTRIBUTE))
+                       if (node.getParent().isNodeType(SlcTypes.SLC_EXECUTION_SPEC_ATTRIBUTE))
                                return SlcImages.CHOICES;
                        else if (node.isNodeType(SlcTypes.SLC_EXECUTION_SPEC_ATTRIBUTE))
                                return SlcImages.EXECUTION_SPEC_ATTRIBUTE;
@@ -307,8 +296,7 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                }
 
                public String getToolTipText(Node node) throws RepositoryException {
-                       if (node.isNodeType(NodeType.MIX_TITLE)
-                                       && node.hasProperty(Property.JCR_DESCRIPTION))
+                       if (node.isNodeType(NodeType.MIX_TITLE) && node.hasProperty(Property.JCR_DESCRIPTION))
                                return node.getProperty(Property.JCR_DESCRIPTION).getString();
                        return super.getToolTipText(node);
                }
@@ -325,37 +313,30 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
 
        class ViewDoubleClickListener implements IDoubleClickListener {
                public void doubleClick(DoubleClickEvent evt) {
-                       Object obj = ((IStructuredSelection) evt.getSelection())
-                                       .getFirstElement();
+                       Object obj = ((IStructuredSelection) evt.getSelection()).getFirstElement();
                        try {
                                if (obj instanceof Node) {
                                        Node node = (Node) obj;
                                        if (node.isNodeType(SLC_EXECUTION_MODULE)) {
-                                               ClientUiPlugin.startStopExecutionModule(modulesManager,
-                                                               node);
+                                               ClientUiPlugin.startStopExecutionModule(modulesManager, node);
                                        } else {
                                                String path = node.getPath();
                                                // TODO factorize with editor
-                                               QueryManager qm = node.getSession().getWorkspace()
-                                                               .getQueryManager();
-                                               String statement = "SELECT * FROM ["
-                                                               + SlcTypes.SLC_EXECUTION_FLOW
-                                                               + "] WHERE ISDESCENDANTNODE(['" + path
-                                                               + "']) OR ISSAMENODE(['" + path + "'])";
+                                               QueryManager qm = node.getSession().getWorkspace().getQueryManager();
+                                               String statement = "SELECT * FROM [" + SlcTypes.SLC_EXECUTION_FLOW
+                                                               + "] WHERE ISDESCENDANTNODE(['" + path + "']) OR ISSAMENODE(['" + path + "'])";
                                                // log.debug(statement);
                                                Query query = qm.createQuery(statement, Query.JCR_SQL2);
 
                                                // order paths
                                                SortedSet<String> paths = new TreeSet<String>();
-                                               for (NodeIterator nit = query.execute().getNodes(); nit
-                                                               .hasNext();) {
+                                               for (NodeIterator nit = query.execute().getNodes(); nit.hasNext();) {
                                                        paths.add(nit.nextNode().getPath());
                                                }
 
-                                               IWorkbenchPage activePage = PlatformUI.getWorkbench()
-                                                               .getActiveWorkbenchWindow().getActivePage();
-                                               activePage.openEditor(new ProcessEditorInput(
-                                                               new ArrayList<String>(paths), true),
+                                               IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+                                                               .getActivePage();
+                                               activePage.openEditor(new ProcessEditorInput(new ArrayList<String>(paths), true),
                                                                ProcessEditor.ID);
                                        }
                                }
@@ -368,14 +349,14 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
 
        /** Listen to drags */
        class ViewDragListener extends DragSourceAdapter {
+               private static final long serialVersionUID = 250270504802674171L;
 
                // Check if the drag action should start.
                public void dragStart(DragSourceEvent event) {
                        // we only start drag if at least one of the selected elements is
                        // valid
                        boolean doIt = false;
-                       IStructuredSelection selection = (IStructuredSelection) viewer
-                                       .getSelection();
+                       IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
                        @SuppressWarnings("rawtypes")
                        Iterator it = selection.iterator();
                        try {
@@ -396,8 +377,7 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                }
 
                public void dragSetData(DragSourceEvent event) {
-                       IStructuredSelection selection = (IStructuredSelection) viewer
-                                       .getSelection();
+                       IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
                        StringBuilder buf = new StringBuilder();
                        @SuppressWarnings("rawtypes")
                        Iterator it = selection.iterator();
@@ -408,10 +388,9 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
 
                                        if (obj instanceof Node) {
                                                Node node = (Node) obj;
-                                               if ((node.isNodeType(SlcTypes.SLC_EXECUTION_FLOW) || node
-                                                               .isNodeType(SlcTypes.SLC_EXECUTION_MODULE))
-                                                               && TextTransfer.getInstance().isSupportedType(
-                                                                               event.dataType)) {
+                                               if ((node.isNodeType(SlcTypes.SLC_EXECUTION_FLOW)
+                                                               || node.isNodeType(SlcTypes.SLC_EXECUTION_MODULE))
+                                                               && TextTransfer.getInstance().isSupportedType(event.dataType)) {
                                                        buf.append(node.getPath()).append('\n');
                                                }
                                        }
@@ -440,17 +419,7 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
                this.modulesManager = modulesManager;
        }
 
-       @Deprecated
-       public void setSession(Session session) {
-               this.session = session;
-       }
-
        public void setRepository(Repository repository) {
-               try {
-                       session = repository.login();
-               } catch (RepositoryException re) {
-                       throw new SlcException("Unable to log in Repository " + repository,
-                                       re);
-               }
+               this.repository = repository;
        }
 }
\ No newline at end of file
index 4bfb57c194a00f4a8d3fdc07a7d4fbcd8813fe2d..7ff0e200269eec92fb6dbd7c42b62af563b25935 100644 (file)
@@ -65,15 +65,20 @@ public class JcrResultListView extends ViewPart implements SlcNames {
 
        private TableViewer viewer;
 
+       private Repository repository;
        private Session session;
 
        private EventListener resultsObserver;
 
-       private DateFormat dateFormat = new SimpleDateFormat(
-                       "EEE, dd MMM yyyy HH:mm:ss");
+       private DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss");
        private Integer queryLimit = 2000;
 
        public void createPartControl(Composite parent) {
+               try {
+                       session = repository.login();
+               } catch (RepositoryException e1) {
+                       throw new SlcException("Cannot log in to repository");
+               }
 
                Table table = createTable(parent);
                viewer = new TableViewer(table);
@@ -87,14 +92,11 @@ public class JcrResultListView extends ViewPart implements SlcNames {
 
                resultsObserver = new ResultObserver(viewer.getTable().getDisplay());
                try {
-                       ObservationManager observationManager = session.getWorkspace()
-                                       .getObservationManager();
+                       ObservationManager observationManager = session.getWorkspace().getObservationManager();
                        String[] nodeTypes = { SlcTypes.SLC_TEST_RESULT };
                        // FIXME Will not be notified if empty result is deleted
-                       observationManager.addEventListener(resultsObserver,
-                                       Event.PROPERTY_ADDED | Event.NODE_REMOVED,
-                                       SlcJcrResultUtils.getSlcResultsBasePath(session), true,
-                                       null, nodeTypes, false);
+                       observationManager.addEventListener(resultsObserver, Event.PROPERTY_ADDED | Event.NODE_REMOVED,
+                                       SlcJcrResultUtils.getSlcResultsBasePath(session), true, null, nodeTypes, false);
                } catch (RepositoryException e) {
                        throw new SlcException("Cannot register listeners", e);
                }
@@ -102,8 +104,7 @@ public class JcrResultListView extends ViewPart implements SlcNames {
        }
 
        protected Table createTable(Composite parent) {
-               int style = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
-                               | SWT.FULL_SELECTION | SWT.MULTI;
+               int style = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI;
                // does not work with RAP, commented for the time being
                // | SWT.HIDE_SELECTION;
 
@@ -135,18 +136,14 @@ public class JcrResultListView extends ViewPart implements SlcNames {
        }
 
        protected void processDoubleClick(DoubleClickEvent evt) {
-               Object obj = ((IStructuredSelection) evt.getSelection())
-                               .getFirstElement();
+               Object obj = ((IStructuredSelection) evt.getSelection()).getFirstElement();
                try {
                        if (obj instanceof Node) {
                                Node node = (Node) obj;
                                // FIXME: open a default result editor
                                if (node.isNodeType(SlcTypes.SLC_PROCESS)) {
-                                       IWorkbenchPage activePage = PlatformUI.getWorkbench()
-                                                       .getActiveWorkbenchWindow().getActivePage();
-                                       activePage.openEditor(
-                                                       new ProcessEditorInput(node.getPath()),
-                                                       ProcessEditor.ID);
+                                       IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+                                       activePage.openEditor(new ProcessEditorInput(node.getPath()), ProcessEditor.ID);
                                }
                        }
                } catch (Exception e) {
@@ -159,19 +156,17 @@ public class JcrResultListView extends ViewPart implements SlcNames {
        }
 
        class ViewContentProvider implements IStructuredContentProvider {
+               private static final long serialVersionUID = -4719077015405546260L;
 
                public Object[] getElements(Object inputElement) {
                        try {
                                // TODO filter, optimize with virtual table, ...
-                               String sql = "SELECT * from [" + SlcTypes.SLC_TEST_RESULT
-                                               + "] ORDER BY [jcr:lastModified] DESC";
-                               Query query = session.getWorkspace().getQueryManager()
-                                               .createQuery(sql, Query.JCR_SQL2);
+                               String sql = "SELECT * from [" + SlcTypes.SLC_TEST_RESULT + "] ORDER BY [jcr:lastModified] DESC";
+                               Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
                                // TODO paging
                                query.setLimit(queryLimit);
                                List<Node> nodes = new ArrayList<Node>();
-                               for (NodeIterator nit = query.execute().getNodes(); nit
-                                               .hasNext();) {
+                               for (NodeIterator nit = query.execute().getNodes(); nit.hasNext();) {
                                        nodes.add(nit.nextNode());
                                }
                                return nodes.toArray();
@@ -188,8 +183,8 @@ public class JcrResultListView extends ViewPart implements SlcNames {
 
        }
 
-       class ViewLabelProvider extends ColumnLabelProvider implements
-                       ITableLabelProvider {
+       class ViewLabelProvider extends ColumnLabelProvider implements ITableLabelProvider {
+               private static final long serialVersionUID = -6323202576386795247L;
 
                public Image getColumnImage(Object obj, int columnIndex) {
                        if (columnIndex != 0)
@@ -212,9 +207,7 @@ public class JcrResultListView extends ViewPart implements SlcNames {
 
                                case 0:
                                        if (node.hasProperty(SLC_COMPLETED)) {
-                                               return dateFormat
-                                                               .format(node.getProperty(SLC_COMPLETED)
-                                                                               .getDate().getTime());
+                                               return dateFormat.format(node.getProperty(SLC_COMPLETED).getDate().getTime());
                                        } else {
                                                return "OPEN";
                                        }
@@ -243,8 +236,7 @@ public class JcrResultListView extends ViewPart implements SlcNames {
                }
 
                @Override
-               protected Boolean willProcessInUiThread(List<Event> events)
-                               throws RepositoryException {
+               protected Boolean willProcessInUiThread(List<Event> events) throws RepositoryException {
                        for (Event event : events) {
                                // getLog().debug("Received event " + event);
                                int eventType = event.getType();
@@ -253,27 +245,20 @@ public class JcrResultListView extends ViewPart implements SlcNames {
                                String path = event.getPath();
                                int index = path.lastIndexOf('/');
                                String propertyName = path.substring(index + 1);
-                               if (propertyName.equals(SLC_COMPLETED)
-                                               || propertyName.equals(SLC_UUID)) {
+                               if (propertyName.equals(SLC_COMPLETED) || propertyName.equals(SLC_UUID)) {
                                        return true;
                                }
                        }
                        return false;
                }
 
-               protected void onEventInUiThread(List<Event> events)
-                               throws RepositoryException {
+               protected void onEventInUiThread(List<Event> events) throws RepositoryException {
                        if (getLog().isTraceEnabled())
                                getLog().trace("Refresh result list");
                        viewer.refresh();
                }
        }
 
-       @Deprecated
-       public void setSession(Session session) {
-               this.session = session;
-       }
-
        public void dispose() {
                JcrUtils.unregisterQuietly(session.getWorkspace(), resultsObserver);
                JcrUtils.logoutQuietly(session);
@@ -281,11 +266,6 @@ public class JcrResultListView extends ViewPart implements SlcNames {
        }
 
        public void setRepository(Repository repository) {
-               try {
-                       session = repository.login();
-               } catch (RepositoryException re) {
-                       throw new SlcException("Unable to log in Repository " + repository,
-                                       re);
-               }
+               this.repository = repository;
        }
 }
\ No newline at end of file
index 97f78e4bd6a05eb40e452898389669345da05522..1b1f85d403e0ade57de97376a924e89ba6decb95 100644 (file)
@@ -110,6 +110,7 @@ public class JcrResultTreeView extends ViewPart {
        // LogFactory.getLog(JcrResultTreeView.class);\r
 \r
        /* DEPENDENCY INJECTION */\r
+       private Repository repository;\r
        private Session session;\r
 \r
        // This page widgets\r
@@ -138,6 +139,12 @@ public class JcrResultTreeView extends ViewPart {
 \r
        @Override\r
        public void createPartControl(Composite parent) {\r
+               try {\r
+                       session = repository.login();\r
+               } catch (RepositoryException e1) {\r
+                       throw new SlcException("Cannot log in to repository");\r
+               }\r
+\r
                parent.setLayout(new FillLayout());\r
                // Main layout\r
                SashForm sashForm = new SashForm(parent, SWT.VERTICAL);\r
@@ -949,11 +956,6 @@ public class JcrResultTreeView extends ViewPart {
        }\r
 \r
        /* DEPENDENCY INJECTION */\r
-       @Deprecated\r
-       public void setSession(Session session) {\r
-               this.session = session;\r
-       }\r
-\r
        public void dispose() {\r
                // JcrUtils.unregisterQuietly(session.getWorkspace(), resultsObserver);\r
                JcrUtils.logoutQuietly(session);\r
@@ -961,11 +963,6 @@ public class JcrResultTreeView extends ViewPart {
        }\r
 \r
        public void setRepository(Repository repository) {\r
-               try {\r
-                       session = repository.login();\r
-               } catch (RepositoryException re) {\r
-                       throw new SlcException("Unable to log in Repository " + repository,\r
-                                       re);\r
-               }\r
+               this.repository = repository;\r
        }\r
 }
\ No newline at end of file
index 82d9e553b9613197fdead0ec30e00f2540f68f45..d331cc70a3152cfdcdedc02e79e5124978bfef37 100644 (file)
@@ -54,7 +54,7 @@ public class RpmProxyServiceImpl extends AbstractUrlProxy implements
                                        "jcr:all");
                } catch (AccessControlException e) {
                        if (log.isTraceEnabled())
-                               log.trace("Cannot give jcr:all privileges to ROLE_SLC");
+                               log.trace("Cannot give jcr:all privileges to "+SlcConstants.ROLE_SLC);
                }
 
                JcrUtils.mkdirsSafe(session, RepoConstants.PROXIED_REPOSITORIES);
index c037082066ed92c3e4b2a0f67a2dbe3606c4b27c..aca4422855cd3d41f862b889504e0bd74f50b70a 100644 (file)
        http://www.springframework.org/schema/util/spring-util-2.5.xsd">\r
 \r
        <!-- REFERENCES -->\r
-       <reference id="nodeRepository" interface="javax.jcr.Repository"\r
-               filter="(argeo.jcr.repository.alias=node)" />\r
+       <reference id="slcRepository" interface="javax.jcr.Repository"\r
+               filter="(argeo.jcr.repository.alias=slc)" />\r
 \r
 <!--   <reference id="authenticationManager" -->\r
 <!--           interface="org.springframework.security.authentication.AuthenticationManager" /> -->\r
 \r
        <!-- SERVICES -->\r
-       <service ref="jcrRepository" interface="javax.jcr.Repository">\r
-               <service-properties>\r
-                       <beans:entry key="argeo.jcr.repository.alias" value="slc" />\r
-               </service-properties>\r
-       </service>\r
+<!--   <service ref="jcrRepository" interface="javax.jcr.Repository"> -->\r
+<!--           <service-properties> -->\r
+<!--                   <beans:entry key="argeo.jcr.repository.alias" value="slc" /> -->\r
+<!--           </service-properties> -->\r
+<!--   </service> -->\r
 \r
 </beans:beans>
\ No newline at end of file
index f86c7d7ea2684befbcfe588907106b8d66b5844e..02e8b2e5ff507b8cba035e111cb26be882133502 100644 (file)
@@ -3,32 +3,33 @@
        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="jcrRepository" class="org.argeo.jackrabbit.JackrabbitWrapper"
-               init-method="init" destroy-method="destroy">
-               <property name="cndFiles">
-                       <list>
-                               <value>/org/argeo/slc/jcr/slc.cnd</value>
-                       </list>
-               </property>
-               <property name="repository" ref="nodeRepository" />
-               <property name="bundleContext" ref="bundleContext" />
-       </bean>
+       <!-- <bean id="jcrRepository" class="org.argeo.jackrabbit.JackrabbitWrapper" -->
+       <!-- init-method="init" destroy-method="destroy"> -->
+       <!-- <property name="cndFiles"> -->
+       <!-- <list> -->
+       <!-- <value>/org/argeo/slc/jcr/slc.cnd</value> -->
+       <!-- </list> -->
+       <!-- </property> -->
+       <!-- <property name="repository" ref="nodeRepository" /> -->
+       <!-- <property name="bundleContext" ref="bundleContext" /> -->
+       <!-- </bean> -->
 
        <!-- Security -->
-       <bean class="org.argeo.jackrabbit.JackrabbitAuthorizations"
+       <bean class="org.argeo.jcr.security.JcrAuthorizations"
                init-method="run">
                <property name="principalPrivileges">
                        <map>
-                               <entry key="jcr:all" value="ROLE_SLC" />
+                               <entry key="jcr:all" value="org.argeo.slc.user" />
                        </map>
                </property>
-               <property name="repository" ref="jcrRepository" />
+               <property name="repository" ref="slcRepository" />
        </bean>
 
        <bean
                class="org.argeo.security.core.AuthenticatedApplicationContextInitialization">
                <description><![CDATA[Executes initialization with a system authentication]]></description>
-<!--           <property name="authenticationManager" ref="authenticationManager" /> -->
+               <!-- <property name="authenticationManager" ref="authenticationManager" 
+                       /> -->
        </bean>
 
 </beans>
\ No newline at end of file
index 1ec361ac2d7089eff515d588b88bb593a4386db7..09827885cc271cc4f2fbbfaebb33f6f1f91d7d02 100644 (file)
@@ -37,8 +37,7 @@ import org.w3c.dom.NodeList;
  * based).
  */
 public class MavenConventionsUtils {
-       private final static Log log = LogFactory
-                       .getLog(MavenConventionsUtils.class);
+       private final static Log log = LogFactory.getLog(MavenConventionsUtils.class);
 
        /**
         * Path to the file identified by this artifact <b>without</b> using Maven
@@ -48,8 +47,8 @@ public class MavenConventionsUtils {
         * @see MavenConventionsUtils#artifactToFile(String, Artifact)
         */
        public static File artifactToFile(Artifact artifact) {
-               return artifactToFile(System.getProperty("user.home") + File.separator
-                               + ".m2" + File.separator + "repository", artifact);
+               return artifactToFile(System.getProperty("user.home") + File.separator + ".m2" + File.separator + "repository",
+                               artifact);
        }
 
        /**
@@ -62,81 +61,74 @@ public class MavenConventionsUtils {
         *            the artifact
         */
        public static File artifactToFile(String repositoryPath, Artifact artifact) {
-               return new File(repositoryPath + File.separator
-                               + artifact.getGroupId().replace('.', File.separatorChar)
-                               + File.separator + artifact.getArtifactId() + File.separator
-                               + artifact.getVersion() + File.separator
+               return new File(repositoryPath + File.separator + artifact.getGroupId().replace('.', File.separatorChar)
+                               + File.separator + artifact.getArtifactId() + File.separator + artifact.getVersion() + File.separator
                                + artifactFileName(artifact)).getAbsoluteFile();
        }
 
        /** The file name of this artifact when stored */
        public static String artifactFileName(Artifact artifact) {
-               return artifact.getArtifactId()
-                               + '-'
-                               + artifact.getVersion()
-                               + (artifact.getClassifier().equals("") ? "" : '-' + artifact
-                                               .getClassifier()) + '.' + artifact.getExtension();
+               return artifact.getArtifactId() + '-' + artifact.getVersion()
+                               + (artifact.getClassifier().equals("") ? "" : '-' + artifact.getClassifier()) + '.'
+                               + artifact.getExtension();
        }
 
        /** Absolute path to the file */
        public static String artifactPath(String artifactBasePath, Artifact artifact) {
-               return artifactParentPath(artifactBasePath, artifact) + '/'
-                               + artifactFileName(artifact);
+               return artifactParentPath(artifactBasePath, artifact) + '/' + artifactFileName(artifact);
+       }
+
+       /** Absolute path to the file */
+       public static String artifactUrl(String repoUrl, Artifact artifact) {
+               if (repoUrl.endsWith("/"))
+                       return repoUrl + artifactPath("/", artifact).substring(1);
+               else
+                       return repoUrl + artifactPath("/", artifact);
        }
 
        /** Absolute path to the directories where the files will be stored */
-       public static String artifactParentPath(String artifactBasePath,
-                       Artifact artifact) {
-               return artifactBasePath + (artifactBasePath.endsWith("/") ? "" : "/")
-                               + artifactParentPath(artifact);
+       public static String artifactParentPath(String artifactBasePath, Artifact artifact) {
+               return artifactBasePath + (artifactBasePath.endsWith("/") ? "" : "/") + artifactParentPath(artifact);
        }
 
        /** Absolute path to the directory of this group */
        public static String groupPath(String artifactBasePath, String groupId) {
-               return artifactBasePath + (artifactBasePath.endsWith("/") ? "" : "/")
-                               + groupId.replace('.', '/');
+               return artifactBasePath + (artifactBasePath.endsWith("/") ? "" : "/") + groupId.replace('.', '/');
        }
 
        /** Relative path to the directories where the files will be stored */
        public static String artifactParentPath(Artifact artifact) {
-               return artifact.getGroupId().replace('.', '/') + '/'
-                               + artifact.getArtifactId() + '/' + artifact.getBaseVersion();
+               return artifact.getGroupId().replace('.', '/') + '/' + artifact.getArtifactId() + '/'
+                               + artifact.getBaseVersion();
        }
 
-       public static String artifactsAsDependencyPom(Artifact pomArtifact,
-                       Set<Artifact> artifacts, Artifact parent) {
+       public static String artifactsAsDependencyPom(Artifact pomArtifact, Set<Artifact> artifacts, Artifact parent) {
                StringBuffer p = new StringBuffer();
 
                // XML header
                p.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
-               p.append("<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\">\n");
+               p.append(
+                               "<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\">\n");
                p.append("<modelVersion>4.0.0</modelVersion>\n");
 
                // Artifact
                if (parent != null) {
                        p.append("<parent>\n");
-                       p.append("<groupId>").append(parent.getGroupId())
-                                       .append("</groupId>\n");
-                       p.append("<artifactId>").append(parent.getArtifactId())
-                                       .append("</artifactId>\n");
-                       p.append("<version>").append(parent.getVersion())
-                                       .append("</version>\n");
+                       p.append("<groupId>").append(parent.getGroupId()).append("</groupId>\n");
+                       p.append("<artifactId>").append(parent.getArtifactId()).append("</artifactId>\n");
+                       p.append("<version>").append(parent.getVersion()).append("</version>\n");
                        p.append("</parent>\n");
                }
-               p.append("<groupId>").append(pomArtifact.getGroupId())
-                               .append("</groupId>\n");
-               p.append("<artifactId>").append(pomArtifact.getArtifactId())
-                               .append("</artifactId>\n");
-               p.append("<version>").append(pomArtifact.getVersion())
-                               .append("</version>\n");
+               p.append("<groupId>").append(pomArtifact.getGroupId()).append("</groupId>\n");
+               p.append("<artifactId>").append(pomArtifact.getArtifactId()).append("</artifactId>\n");
+               p.append("<version>").append(pomArtifact.getVersion()).append("</version>\n");
                p.append("<packaging>pom</packaging>\n");
 
                // Dependencies
                p.append("<dependencies>\n");
                for (Artifact a : artifacts) {
                        p.append("\t<dependency>");
-                       p.append("<artifactId>").append(a.getArtifactId())
-                                       .append("</artifactId>");
+                       p.append("<artifactId>").append(a.getArtifactId()).append("</artifactId>");
                        p.append("<groupId>").append(a.getGroupId()).append("</groupId>");
                        if (!a.getExtension().equals("jar"))
                                p.append("<type>").append(a.getExtension()).append("</type>");
@@ -149,8 +141,7 @@ public class MavenConventionsUtils {
                p.append("<dependencies>\n");
                for (Artifact a : artifacts) {
                        p.append("\t<dependency>");
-                       p.append("<artifactId>").append(a.getArtifactId())
-                                       .append("</artifactId>");
+                       p.append("<artifactId>").append(a.getArtifactId()).append("</artifactId>");
                        p.append("<version>").append(a.getVersion()).append("</version>");
                        p.append("<groupId>").append(a.getGroupId()).append("</groupId>");
                        if (a.getExtension().equals("pom")) {
@@ -177,15 +168,14 @@ public class MavenConventionsUtils {
         * meant to migrate existing pom registering a lot of artifacts, not to
         * replace Maven resolving.
         */
-       public static void gatherPomDependencies(AetherTemplate aetherTemplate,
-                       Set<Artifact> artifacts, Artifact pomArtifact) {
+       public static void gatherPomDependencies(AetherTemplate aetherTemplate, Set<Artifact> artifacts,
+                       Artifact pomArtifact) {
                if (log.isDebugEnabled())
                        log.debug("Gather dependencies for " + pomArtifact);
 
                try {
                        File file = aetherTemplate.getResolvedFile(pomArtifact);
-                       DocumentBuilder documentBuilder = DocumentBuilderFactory
-                                       .newInstance().newDocumentBuilder();
+                       DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                        Document doc = documentBuilder.parse(file);
 
                        // properties
@@ -197,8 +187,7 @@ public class MavenConventionsUtils {
                                for (int i = 0; i < propertiesElems.getLength(); i++) {
                                        if (propertiesElems.item(i) instanceof Element) {
                                                Element property = (Element) propertiesElems.item(i);
-                                               props.put(property.getNodeName(),
-                                                               property.getTextContent());
+                                               props.put(property.getNodeName(), property.getTextContent());
                                        }
                                }
                        }
@@ -207,34 +196,25 @@ public class MavenConventionsUtils {
                        NodeList dependencies = doc.getElementsByTagName("dependency");
                        for (int i = 0; i < dependencies.getLength(); i++) {
                                Element dependency = (Element) dependencies.item(i);
-                               String groupId = dependency.getElementsByTagName("groupId")
-                                               .item(0).getTextContent().trim();
-                               String artifactId = dependency
-                                               .getElementsByTagName("artifactId").item(0)
-                                               .getTextContent().trim();
-                               String version = dependency.getElementsByTagName("version")
-                                               .item(0).getTextContent().trim();
+                               String groupId = dependency.getElementsByTagName("groupId").item(0).getTextContent().trim();
+                               String artifactId = dependency.getElementsByTagName("artifactId").item(0).getTextContent().trim();
+                               String version = dependency.getElementsByTagName("version").item(0).getTextContent().trim();
                                if (version.startsWith("${")) {
-                                       String versionKey = version.substring(0,
-                                                       version.length() - 1).substring(2);
+                                       String versionKey = version.substring(0, version.length() - 1).substring(2);
                                        if (!props.containsKey(versionKey))
-                                               throw new SlcException("Cannot interpret version "
-                                                               + version);
+                                               throw new SlcException("Cannot interpret version " + version);
                                        version = props.getProperty(versionKey);
                                }
                                NodeList scopes = dependency.getElementsByTagName("scope");
-                               if (scopes.getLength() > 0
-                                               && scopes.item(0).getTextContent().equals("import")) {
+                               if (scopes.getLength() > 0 && scopes.item(0).getTextContent().equals("import")) {
                                        // recurse
                                        gatherPomDependencies(aetherTemplate, artifacts,
-                                                       new DefaultArtifact(groupId, artifactId, "pom",
-                                                                       version));
+                                                       new DefaultArtifact(groupId, artifactId, "pom", version));
                                } else {
                                        // TODO: deal with scope?
                                        // TODO: deal with type
                                        String type = "jar";
-                                       Artifact artifact = new DefaultArtifact(groupId,
-                                                       artifactId, type, version);
+                                       Artifact artifact = new DefaultArtifact(groupId, artifactId, type, version);
                                        artifacts.add(artifact);
                                }
                        }
index 0f918fdc334d5bee424d190a54d706351b5a3089..92389339eba8817284724865f1e75d49d4a01443 100644 (file)
@@ -45,7 +45,8 @@ public class OsgiFactoryImpl implements OsgiFactory, SlcNames {
        private Map<String, List<String>> mirrors = new HashMap<String, List<String>>();
 
        private List<String> mavenRepositories = new ArrayList<String>();
-       private String mavenProxyBase = "/mavenProxy";
+       private String downloadBase = "/download";
+       private String mavenProxyBase = downloadBase + "/maven";
 
        public void init() {
                if (workspace == null)
@@ -63,19 +64,14 @@ public class OsgiFactoryImpl implements OsgiFactory, SlcNames {
                try {
                        // TODO rather user a JavaRepoManager that will also implicitely
                        // manage the indexing of newly created nodes.
-                       javaSession = JcrUtils.loginOrCreateWorkspace(javaRepository,
-                                       workspace);
-                       distSession = JcrUtils.loginOrCreateWorkspace(distRepository,
-                                       workspace);
+                       javaSession = JcrUtils.loginOrCreateWorkspace(javaRepository, workspace);
+                       distSession = JcrUtils.loginOrCreateWorkspace(distRepository, workspace);
 
                        // Privileges
-                       JcrUtils.addPrivilege(javaSession, "/", SlcConstants.ROLE_SLC,
-                                       "jcr:all");
-                       JcrUtils.addPrivilege(distSession, "/", SlcConstants.ROLE_SLC,
-                                       "jcr:all");
+                       JcrUtils.addPrivilege(javaSession, "/", SlcConstants.ROLE_SLC, "jcr:all");
+                       JcrUtils.addPrivilege(distSession, "/", SlcConstants.ROLE_SLC, "jcr:all");
                } catch (RepositoryException e) {
-                       throw new SlcException("Cannot initialize OSGi Factory "
-                                       + workspace, e);
+                       throw new SlcException("Cannot initialize OSGi Factory " + workspace, e);
                } finally {
                        JcrUtils.logoutQuietly(javaSession);
                        JcrUtils.logoutQuietly(distSession);
@@ -100,19 +96,16 @@ public class OsgiFactoryImpl implements OsgiFactory, SlcNames {
                }
        }
 
-       public Node getMaven(Session distSession, String coords)
-                       throws RepositoryException {
+       public Node getMaven(Session distSession, String coords) throws RepositoryException {
                Artifact artifact = new DefaultArtifact(coords);
-               String path = MavenConventionsUtils.artifactPath(mavenProxyBase,
-                               artifact);
+               String path = MavenConventionsUtils.artifactPath(mavenProxyBase, artifact);
 
                // exists
                if (distSession.itemExists(path))
                        return distSession.getNode(path);
 
                for (String mavenRepo : mavenRepositories) {
-                       String url = mavenRepo
-                                       + MavenConventionsUtils.artifactPath("/", artifact);
+                       String url = MavenConventionsUtils.artifactUrl(mavenRepo, artifact);
                        try {
                                Node node = loadUrlToPath(url, distSession, path);
                                if (node != null) {
@@ -123,8 +116,7 @@ public class OsgiFactoryImpl implements OsgiFactory, SlcNames {
                                                // silent
                                        }
                                        try {
-                                               loadUrlToPath(url + ".sha1", distSession, path
-                                                               + ".sha1");
+                                               loadUrlToPath(url + ".sha1", distSession, path + ".sha1");
                                        } catch (FileNotFoundException e) {
                                                // silent
                                        }
@@ -132,16 +124,14 @@ public class OsgiFactoryImpl implements OsgiFactory, SlcNames {
                                }
                        } catch (FileNotFoundException e) {
                                if (log.isDebugEnabled())
-                                       log.debug("Maven " + coords
-                                                       + " could not be downloaded from " + url);
+                                       log.debug("Maven " + coords + " could not be downloaded from " + url);
                        }
                }
                throw new SlcException("Could not download Maven " + coords);
        }
 
-       public Node getDist(Session distSession, String uri)
-                       throws RepositoryException {
-               String distPath = '/' + JcrUtils.urlAsPath(uri);
+       public Node getDist(Session distSession, String uri) throws RepositoryException {
+               String distPath = downloadBase + '/' + JcrUtils.urlAsPath(uri);
 
                // already retrieved
                if (distSession.itemExists(distPath))
@@ -174,8 +164,7 @@ public class OsgiFactoryImpl implements OsgiFactory, SlcNames {
                                return loadUrlToPath(url, distSession, distPath);
                        } catch (FileNotFoundException e) {
                                if (log.isDebugEnabled())
-                                       log.debug("Cannot download " + url
-                                                       + ", trying another mirror");
+                                       log.debug("Cannot download " + url + ", trying another mirror");
                        }
                }
 
@@ -190,8 +179,7 @@ public class OsgiFactoryImpl implements OsgiFactory, SlcNames {
 
                InputStream in = null;
                URLConnection conn = null;
-               Node folderNode = JcrUtils.mkfolders(distSession,
-                               JcrUtils.parentPath(path));
+               Node folderNode = JcrUtils.mkfolders(distSession, JcrUtils.parentPath(path));
                try {
                        URL u = new URL(url);
                        conn = u.openConnection();
@@ -200,8 +188,7 @@ public class OsgiFactoryImpl implements OsgiFactory, SlcNames {
                        // byte[] arr = IOUtils.toByteArray(in);
                        // Node fileNode = JcrUtils.copyBytesAsFile(folderNode,
                        // JcrUtils.nodeNameFromPath(path), arr);
-                       Node fileNode = JcrUtils.copyStreamAsFile(folderNode,
-                                       JcrUtils.nodeNameFromPath(path), in);
+                       Node fileNode = JcrUtils.copyStreamAsFile(folderNode, JcrUtils.nodeNameFromPath(path), in);
                        fileNode.addMixin(SlcTypes.SLC_KNOWN_ORIGIN);
                        Node origin = fileNode.addNode(SLC_ORIGIN, SlcTypes.SLC_PROXIED);
                        JcrUtils.urlToAddressProperties(origin, url);
index bf901dacb9641f68e1fd7e2d5682446434c7521c..7ba658464da5b2eff082868bb65348b1cebbbec4 100644 (file)
@@ -4,22 +4,30 @@
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
 \r
        <!-- JCR repositories -->\r
-<!--   <bean id="javaRepository" parent="template.jcrRepository"> -->\r
-<!--           <property name="homeDirectory" value="${slc.repo.jcr.reposBase}/java" /> -->\r
-<!--           <property name="configuration" value="${slc.repo.jcr.configuration.java}" /> -->\r
-<!--   </bean> -->\r
-<!--   <bean id="distRepository" parent="template.jcrRepository"> -->\r
-<!--           <property name="homeDirectory" value="${slc.repo.jcr.reposBase}/dist" /> -->\r
-<!--           <property name="configuration" value="${slc.repo.jcr.configuration.dist}" /> -->\r
-<!--   </bean> -->\r
-<!--   <bean id="rpmRepository" parent="template.jcrRepository"> -->\r
-<!--           <property name="homeDirectory" value="${slc.repo.jcr.reposBase}/rpm" /> -->\r
-<!--           <property name="configuration" value="${slc.repo.jcr.configuration.rpm}" /> -->\r
-<!--   </bean> -->\r
-<!--   <bean id="docsRepository" parent="template.jcrRepository"> -->\r
-<!--           <property name="homeDirectory" value="${slc.repo.jcr.reposBase}/docs" /> -->\r
-<!--           <property name="configuration" value="${slc.repo.jcr.configuration.docs}" /> -->\r
-<!--   </bean> -->\r
+       <!-- <bean id="javaRepository" parent="template.jcrRepository"> -->\r
+       <!-- <property name="homeDirectory" value="${slc.repo.jcr.reposBase}/java" \r
+               /> -->\r
+       <!-- <property name="configuration" value="${slc.repo.jcr.configuration.java}" \r
+               /> -->\r
+       <!-- </bean> -->\r
+       <!-- <bean id="distRepository" parent="template.jcrRepository"> -->\r
+       <!-- <property name="homeDirectory" value="${slc.repo.jcr.reposBase}/dist" \r
+               /> -->\r
+       <!-- <property name="configuration" value="${slc.repo.jcr.configuration.dist}" \r
+               /> -->\r
+       <!-- </bean> -->\r
+       <!-- <bean id="rpmRepository" parent="template.jcrRepository"> -->\r
+       <!-- <property name="homeDirectory" value="${slc.repo.jcr.reposBase}/rpm" \r
+               /> -->\r
+       <!-- <property name="configuration" value="${slc.repo.jcr.configuration.rpm}" \r
+               /> -->\r
+       <!-- </bean> -->\r
+       <!-- <bean id="docsRepository" parent="template.jcrRepository"> -->\r
+       <!-- <property name="homeDirectory" value="${slc.repo.jcr.reposBase}/docs" \r
+               /> -->\r
+       <!-- <property name="configuration" value="${slc.repo.jcr.configuration.docs}" \r
+               /> -->\r
+       <!-- </bean> -->\r
 \r
        <!-- JCR authorizations -->\r
        <bean parent="template.jcrAuthorizations">\r
        </bean>\r
 \r
        <!-- Templates -->\r
-<!--   <bean id="template.jcrRepository" abstract="true" -->\r
-<!--           class="org.argeo.jackrabbit.JackrabbitContainer" init-method="init" -->\r
-<!--           destroy-method="destroy"> -->\r
-<!--           <property name="variables" value="osgibundle:/repo.properties" /> -->\r
-<!--           <property name="cndFiles"> -->\r
-<!--                   <list> -->\r
-<!--                           <value>/org/argeo/jcr/argeo.cnd</value> -->\r
-<!--                           <value>/org/argeo/slc/jcr/slc.cnd</value> -->\r
-<!--                           <value>/org/argeo/slc/repo/repo.cnd</value> -->\r
-<!--                   </list> -->\r
-<!--           </property> -->\r
-<!--           <property name="bundleContext" ref="bundleContext" /> -->\r
-<!--           <property name="forceCndImport" value="${slc.repo.jcr.forceCndImport}" /> -->\r
-<!--   </bean> -->\r
+       <!-- <bean id="template.jcrRepository" abstract="true" -->\r
+       <!-- class="org.argeo.jackrabbit.JackrabbitContainer" init-method="init" -->\r
+       <!-- destroy-method="destroy"> -->\r
+       <!-- <property name="variables" value="osgibundle:/repo.properties" /> -->\r
+       <!-- <property name="cndFiles"> -->\r
+       <!-- <list> -->\r
+       <!-- <value>/org/argeo/jcr/argeo.cnd</value> -->\r
+       <!-- <value>/org/argeo/slc/jcr/slc.cnd</value> -->\r
+       <!-- <value>/org/argeo/slc/repo/repo.cnd</value> -->\r
+       <!-- </list> -->\r
+       <!-- </property> -->\r
+       <!-- <property name="bundleContext" ref="bundleContext" /> -->\r
+       <!-- <property name="forceCndImport" value="${slc.repo.jcr.forceCndImport}" \r
+               /> -->\r
+       <!-- </bean> -->\r
 \r
        <bean id="template.jcrAuthorizations" abstract="true"\r
-               class="org.argeo.jackrabbit.JackrabbitAuthorizations" init-method="run">\r
+               class="org.argeo.jcr.security.JcrAuthorizations" init-method="run">\r
                <property name="principalPrivileges">\r
                        <map>\r
-                               <entry key="jcr:all" value="ROLE_SLC" />\r
+                               <entry key="jcr:all" value="org.argeo.slc.user" />\r
                        </map>\r
                </property>\r
                <property name="workspace" value="*" />\r
diff --git a/pom.xml b/pom.xml
index ca239d327407260d75b8972d80f9e4d6544cfd32..ac4ff9d156af4c806480719eeb3e5106cecdb37b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,5 @@
-<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.commons</groupId>
@@ -13,7 +14,7 @@
        <properties>
                <developmentCycle.slc>2.1</developmentCycle.slc>
                <developmentCycle.startDate>2015-02-12</developmentCycle.startDate>
-               <version.slc>2.1.2</version.slc>
+               <version.slc>2.1.2-SNAPSHOT</version.slc>
                <!-- Libraries versions -->
                <version.argeo-tp-extras>2.1.7</version.argeo-tp-extras>
        </properties>
@@ -175,16 +176,25 @@ limitations under the License.
                        <repositories>
                                <repository>
                                        <id>argeo-tp</id>
-                                       <url>http://localhost:7080/data/public/java/argeo-tp-${developmentCycle.argeo-commons}/</url>
+                                       <url>http://localhost:7070/data/public/java/argeo-${developmentCycle.argeo-commons}</url>
                                        <releases>
                                                <enabled>true</enabled>
                                                <updatePolicy>daily</updatePolicy>
                                                <checksumPolicy>warn</checksumPolicy>
                                        </releases>
                                </repository>
+<!--                           <repository> -->
+<!--                                   <id>argeo-tp-extras</id> -->
+<!--                                   <url>http://localhost:7080/data/public/java/argeo-tp-extras-2.1</url> -->
+<!--                                   <releases> -->
+<!--                                           <enabled>true</enabled> -->
+<!--                                           <updatePolicy>daily</updatePolicy> -->
+<!--                                           <checksumPolicy>warn</checksumPolicy> -->
+<!--                                   </releases> -->
+<!--                           </repository> -->
                                <repository>
-                                       <id>argeo-tp-extras</id>
-                                       <url>http://localhost:7080/data/public/java/argeo-tp-extras-2.1</url>
+                                       <id>argeo-commons</id>
+                                       <url>http://localhost:7070/data/public/java/argeo-${developmentCycle.argeo-commons}</url>
                                        <releases>
                                                <enabled>true</enabled>
                                                <updatePolicy>daily</updatePolicy>