-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the judgment of whether to enable the plugin to each advice. (#2…
…9754) * Move the judgment of whether to enable the plugin to each advice. * Improve agent plugins * Update doc of AgentPluginEnable * Update doc of AgentPluginEnable * Update doc of AgentPluginEnable * Update doc of AgentPluginEnable * Update doc of AgentPluginEnable * Refactor AgentPluginEnable
- Loading branch information
Showing
31 changed files
with
214 additions
and
158 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
agent/api/src/main/java/org/apache/shardingsphere/agent/api/plugin/AgentPluginEnable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.shardingsphere.agent.api.plugin; | ||
|
||
public interface AgentPluginEnable { | ||
|
||
/** | ||
* Is the plugin enabled. | ||
* | ||
* @return true or false | ||
*/ | ||
default boolean isPluginEnabled() { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginContextTest.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
...java/org/apache/shardingsphere/agent/plugin/core/advice/AbstractInstanceMethodAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.shardingsphere.agent.plugin.core.advice; | ||
|
||
import org.apache.shardingsphere.agent.api.plugin.AgentPluginEnable; | ||
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; | ||
import org.apache.shardingsphere.agent.plugin.core.context.PluginContext; | ||
|
||
public abstract class AbstractInstanceMethodAdvice implements InstanceMethodAdvice, AgentPluginEnable { | ||
|
||
@Override | ||
public boolean isPluginEnabled() { | ||
return PluginContext.getInstance().isPluginEnabled(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...n/java/org/apache/shardingsphere/agent/plugin/core/advice/AbstractStaticMethodAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.shardingsphere.agent.plugin.core.advice; | ||
|
||
import org.apache.shardingsphere.agent.api.plugin.AgentPluginEnable; | ||
import org.apache.shardingsphere.agent.api.advice.type.StaticMethodAdvice; | ||
import org.apache.shardingsphere.agent.plugin.core.context.PluginContext; | ||
|
||
public abstract class AbstractStaticMethodAdvice implements StaticMethodAdvice, AgentPluginEnable { | ||
|
||
@Override | ||
public boolean isPluginEnabled() { | ||
return PluginContext.getInstance().isPluginEnabled(); | ||
} | ||
} |
Oops, something went wrong.