You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2020/02/24 16:52:58 UTC

[jspwiki] 16/38: use Engine instead of WikiEngine

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 79af4e4d09fabb52ac7013427d02bcac47a0544d
Author: juanpablo <ju...@apache.org>
AuthorDate: Thu Feb 20 20:19:23 2020 +0100

    use Engine instead of WikiEngine
---
 .../apache/wiki/workflow/DefaultWorkflowManager.java  | 19 ++++++++++---------
 .../org/apache/wiki/workflow/WorkflowManager.java     |  4 ++--
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/workflow/DefaultWorkflowManager.java b/jspwiki-main/src/main/java/org/apache/wiki/workflow/DefaultWorkflowManager.java
index fac5361..0ace9d9 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/workflow/DefaultWorkflowManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/workflow/DefaultWorkflowManager.java
@@ -18,9 +18,10 @@
  */
 package org.apache.wiki.workflow;
 
-import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiSession;
+import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.exceptions.WikiException;
+import org.apache.wiki.auth.AuthorizationManager;
 import org.apache.wiki.auth.acl.UnresolvedPrincipal;
 import org.apache.wiki.event.WikiEvent;
 import org.apache.wiki.event.WorkflowEvent;
@@ -44,10 +45,10 @@ import java.util.concurrent.CopyOnWriteArrayList;
 public class DefaultWorkflowManager implements WorkflowManager {
 
     private final DecisionQueue m_queue = new DecisionQueue();
-    private final Set<Workflow> m_workflows;
-    private final Map<String, Principal> m_approvers;
-    private final List<Workflow> m_completed;
-    private WikiEngine m_engine = null;
+    private final Set< Workflow > m_workflows;
+    private final Map< String, Principal > m_approvers;
+    private final List< Workflow > m_completed;
+    private Engine m_engine = null;
 
     /**
      * Constructs a new WorkflowManager, with an empty workflow cache. New Workflows are automatically assigned unique identifiers,
@@ -93,7 +94,7 @@ public class DefaultWorkflowManager implements WorkflowManager {
      * {@inheritDoc}
      */
     @Override
-    public void initialize( final WikiEngine engine, final Properties props ) {
+    public void initialize( final Engine engine, final Properties props ) {
         m_engine = engine;
 
         // Identify the workflows requiring approvals
@@ -134,7 +135,7 @@ public class DefaultWorkflowManager implements WorkflowManager {
         // Try to resolve UnresolvedPrincipals
         if ( approver instanceof UnresolvedPrincipal ) {
             final String name = approver.getName();
-            approver = m_engine.getAuthorizationManager().resolvePrincipal( name );
+            approver = m_engine.getManager( AuthorizationManager.class ).resolvePrincipal( name );
 
             // If still unresolved, throw exception; otherwise, freshen our cache
             if ( approver instanceof UnresolvedPrincipal ) {
@@ -151,7 +152,7 @@ public class DefaultWorkflowManager implements WorkflowManager {
      *
      * @return the wiki engine
      */
-    protected WikiEngine getEngine() {
+    protected Engine getEngine() {
         if ( m_engine == null ) {
             throw new IllegalStateException( "WikiEngine cannot be null; please initialize WorkflowManager first." );
         }
@@ -163,7 +164,7 @@ public class DefaultWorkflowManager implements WorkflowManager {
      *
      * @return the decision queue
      */
-    public DecisionQueue getDecisionQueue()
+    @Override public DecisionQueue getDecisionQueue()
     {
         return m_queue;
     }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/workflow/WorkflowManager.java b/jspwiki-main/src/main/java/org/apache/wiki/workflow/WorkflowManager.java
index e82e02c..60858db 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/workflow/WorkflowManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/workflow/WorkflowManager.java
@@ -18,8 +18,8 @@
  */
 package org.apache.wiki.workflow;
 
-import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiSession;
+import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.event.WikiEventListener;
 
@@ -108,7 +108,7 @@ public interface WorkflowManager extends WikiEventListener {
      * @param engine the wiki engine to associate with this WorkflowManager
      * @param props the wiki engine's properties
      */
-    void initialize( WikiEngine engine, Properties props );
+    void initialize( Engine engine, Properties props );
 
     /**
      * Returns <code>true</code> if a workflow matching a particular key contains an approval step.