mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-23 03:59:51 +00:00
Plugin:
-default siteSupportedNames now returns array with getHost LazyXPlugin/LazyXPluginCache: -updated getSitesSupported to return array with getHost if none set -updated setSitesSupported to avoid storing default generated array of Plugin -updated write to avoid storing default generated array of Plugin git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49763 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: 314fd77661a866152138aad5922364a85234c5c0
This commit is contained in:
parent
6ff28242df
commit
68e7f78e71
@ -1057,7 +1057,7 @@ public abstract class Plugin implements ActionListener {
|
||||
* @return
|
||||
*/
|
||||
public String[] siteSupportedNames() {
|
||||
return null;
|
||||
return new String[] { getHost() };
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,6 +32,10 @@ public class LazyCrawlerPlugin extends LazyPlugin<PluginForDecrypt> {
|
||||
return hasConfig;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setFeatures(LazyPlugin.FEATURE[] features) {
|
||||
super.setFeatures(features);
|
||||
@ -61,11 +65,22 @@ public class LazyCrawlerPlugin extends LazyPlugin<PluginForDecrypt> {
|
||||
private String[] sitesSupported = null;
|
||||
|
||||
public String[] getSitesSupported() {
|
||||
return sitesSupported;
|
||||
final String[] sitesSupported = this.sitesSupported;
|
||||
if (sitesSupported != null) {
|
||||
return sitesSupported;
|
||||
} else {
|
||||
return new String[] { getHost() };
|
||||
}
|
||||
}
|
||||
|
||||
protected void setSitesSupported(String[] sitesSupported) {
|
||||
this.sitesSupported = sitesSupported;
|
||||
protected void setSitesSupported(final String[] sitesSupported) {
|
||||
if (sitesSupported == null || sitesSupported.length == 0) {
|
||||
this.sitesSupported = null;
|
||||
} else if (sitesSupported.length == 1 && getHost().equals(sitesSupported[0])) {
|
||||
this.sitesSupported = null;
|
||||
} else {
|
||||
this.sitesSupported = sitesSupported;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateCrawlRuntime(long r) {
|
||||
|
@ -170,7 +170,11 @@ public class LazyCrawlerPluginCache {
|
||||
if (plugin.isHasConfig() && plugin.getConfigInterface() != null) {
|
||||
os.writeString(plugin.getConfigInterface());
|
||||
}
|
||||
final String[] sitesSupported = plugin.getSitesSupported();
|
||||
String[] sitesSupported = plugin.getSitesSupported();
|
||||
if (sitesSupported != null && sitesSupported.length == 1 && plugin.getHost().equals(sitesSupported[0])) {
|
||||
// memory optimization to avoid storing of default value
|
||||
sitesSupported = null;
|
||||
}
|
||||
os.writeShort(sitesSupported == null ? 0 : sitesSupported.length);
|
||||
if (sitesSupported != null) {
|
||||
for (String siteSupported : sitesSupported) {
|
||||
|
@ -2,6 +2,7 @@ package org.jdownloader.plugins.controller.host;
|
||||
|
||||
import jd.plugins.PluginForHost;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
import org.jdownloader.plugins.controller.LazyPluginClass;
|
||||
import org.jdownloader.plugins.controller.PluginClassLoader.PluginClassLoaderChild;
|
||||
@ -72,11 +73,22 @@ public class LazyHostPlugin extends LazyPlugin<PluginForHost> {
|
||||
private String[] sitesSupported = null;
|
||||
|
||||
public String[] getSitesSupported() {
|
||||
return sitesSupported;
|
||||
final String[] sitesSupported = this.sitesSupported;
|
||||
if (sitesSupported != null) {
|
||||
return sitesSupported;
|
||||
} else {
|
||||
return new String[] { getHost() };
|
||||
}
|
||||
}
|
||||
|
||||
protected void setSitesSupported(String[] sitesSupported) {
|
||||
this.sitesSupported = sitesSupported;
|
||||
protected void setSitesSupported(final String[] sitesSupported) {
|
||||
if (sitesSupported == null || sitesSupported.length == 0) {
|
||||
this.sitesSupported = null;
|
||||
} else if (sitesSupported.length == 1 && getHost().equals(sitesSupported[0])) {
|
||||
this.sitesSupported = null;
|
||||
} else {
|
||||
this.sitesSupported = sitesSupported;
|
||||
}
|
||||
}
|
||||
|
||||
protected synchronized final void setProperty(final boolean b, final PROPERTY property) {
|
||||
|
@ -211,7 +211,11 @@ public class LazyHostPluginCache {
|
||||
if (plugin.isHasConfig() && plugin.getConfigInterface() != null) {
|
||||
os.writeString(plugin.getConfigInterface());
|
||||
}
|
||||
final String[] sitesSupported = plugin.getSitesSupported();
|
||||
String[] sitesSupported = plugin.getSitesSupported();
|
||||
if (sitesSupported != null && sitesSupported.length == 1 && plugin.getHost().equals(sitesSupported[0])) {
|
||||
// memory optimization to avoid storing of default value
|
||||
sitesSupported = null;
|
||||
}
|
||||
os.writeShort(sitesSupported == null ? 0 : sitesSupported.length);
|
||||
if (sitesSupported != null) {
|
||||
for (String siteSupported : sitesSupported) {
|
||||
|
Loading…
Reference in New Issue
Block a user