IDEMPIERE-3043: 2pack of bundle install after server run don't run
This commit is contained in:
parent
8e34b8c463
commit
42b22108e9
|
@ -34,10 +34,12 @@ import org.compiere.util.Env;
|
||||||
import org.compiere.util.Trx;
|
import org.compiere.util.Trx;
|
||||||
import org.osgi.framework.BundleActivator;
|
import org.osgi.framework.BundleActivator;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.framework.FrameworkEvent;
|
||||||
|
import org.osgi.framework.FrameworkListener;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
||||||
|
|
||||||
public abstract class AbstractActivator implements BundleActivator, ServiceTrackerCustomizer<IDictionaryService, IDictionaryService> {
|
public abstract class AbstractActivator implements BundleActivator, ServiceTrackerCustomizer<IDictionaryService, IDictionaryService>, FrameworkListener{
|
||||||
|
|
||||||
protected final static CLogger logger = CLogger.getCLogger(AbstractActivator.class.getName());
|
protected final static CLogger logger = CLogger.getCLogger(AbstractActivator.class.getName());
|
||||||
protected BundleContext context;
|
protected BundleContext context;
|
||||||
|
@ -46,7 +48,8 @@ public abstract class AbstractActivator implements BundleActivator, ServiceTrack
|
||||||
private String trxName = null;
|
private String trxName = null;
|
||||||
private ProcessInfo m_processInfo = null;
|
private ProcessInfo m_processInfo = null;
|
||||||
private IProcessUI m_processUI = null;
|
private IProcessUI m_processUI = null;
|
||||||
|
public static boolean isFrameworkCompletedSrart = false;
|
||||||
|
|
||||||
protected boolean merge(File zipfile, String version) throws Exception {
|
protected boolean merge(File zipfile, String version) throws Exception {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
|
@ -184,5 +187,23 @@ public abstract class AbstractActivator implements BundleActivator, ServiceTrack
|
||||||
if (m_processInfo != null)
|
if (m_processInfo != null)
|
||||||
m_processInfo.setSummary(msg);
|
m_processInfo.setSummary(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void frameworkEvent(FrameworkEvent event) {
|
||||||
|
if (event.getType() == FrameworkEvent.STARTLEVEL_CHANGED) {
|
||||||
|
isFrameworkCompletedSrart = true;
|
||||||
|
frameworkStarted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void frameworkStarted();
|
||||||
|
|
||||||
|
protected void registryRunPackin() {
|
||||||
|
if (isFrameworkCompletedSrart) {
|
||||||
|
frameworkStarted ();
|
||||||
|
}else {
|
||||||
|
context.addFrameworkListener(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,19 +20,18 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.FrameworkEvent;
|
import org.osgi.framework.FrameworkEvent;
|
||||||
import org.osgi.framework.FrameworkListener;
|
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
public class AdempiereActivator extends AbstractActivator implements FrameworkListener {
|
public class AdempiereActivator extends AbstractActivator {
|
||||||
|
|
||||||
protected final static CLogger logger = CLogger.getCLogger(AdempiereActivator.class.getName());
|
protected final static CLogger logger = CLogger.getCLogger(AdempiereActivator.class.getName());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
registryRunPackin ();
|
||||||
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " starting...");
|
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " starting...");
|
||||||
context.addFrameworkListener(this);
|
|
||||||
serviceTracker = new ServiceTracker<IDictionaryService, IDictionaryService>(context, IDictionaryService.class.getName(), this);
|
serviceTracker = new ServiceTracker<IDictionaryService, IDictionaryService>(context, IDictionaryService.class.getName(), this);
|
||||||
serviceTracker.open();
|
serviceTracker.open();
|
||||||
start();
|
start();
|
||||||
|
@ -195,7 +194,7 @@ public class AdempiereActivator extends AbstractActivator implements FrameworkLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frameworkStarted() {
|
protected void frameworkStarted() {
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
if (Adempiere.getThreadPoolExecutor() != null) {
|
if (Adempiere.getThreadPoolExecutor() != null) {
|
||||||
Adempiere.getThreadPoolExecutor().execute(new Runnable() {
|
Adempiere.getThreadPoolExecutor().execute(new Runnable() {
|
||||||
|
|
|
@ -38,8 +38,6 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Trx;
|
import org.compiere.util.Trx;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.FrameworkEvent;
|
|
||||||
import org.osgi.framework.FrameworkListener;
|
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
|
@ -48,15 +46,15 @@ import org.osgi.util.tracker.ServiceTracker;
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Incremental2PackActivator extends AbstractActivator implements FrameworkListener {
|
public class Incremental2PackActivator extends AbstractActivator {
|
||||||
|
|
||||||
protected final static CLogger logger = CLogger.getCLogger(Incremental2PackActivator.class.getName());
|
protected final static CLogger logger = CLogger.getCLogger(Incremental2PackActivator.class.getName());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
registryRunPackin ();
|
||||||
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " starting...");
|
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " starting...");
|
||||||
context.addFrameworkListener(this);
|
|
||||||
serviceTracker = new ServiceTracker<IDictionaryService, IDictionaryService>(context, IDictionaryService.class.getName(), this);
|
serviceTracker = new ServiceTracker<IDictionaryService, IDictionaryService>(context, IDictionaryService.class.getName(), this);
|
||||||
serviceTracker.open();
|
serviceTracker.open();
|
||||||
start();
|
start();
|
||||||
|
@ -312,15 +310,9 @@ public class Incremental2PackActivator extends AbstractActivator implements Fram
|
||||||
serverContext.setProperty("#AD_Client_ID", "0");
|
serverContext.setProperty("#AD_Client_ID", "0");
|
||||||
ServerContext.setCurrentInstance(serverContext);
|
ServerContext.setCurrentInstance(serverContext);
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
|
||||||
public void frameworkEvent(FrameworkEvent event) {
|
|
||||||
if (event.getType() == FrameworkEvent.STARTLEVEL_CHANGED) {
|
|
||||||
frameworkStarted();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void frameworkStarted() {
|
@Override
|
||||||
|
protected void frameworkStarted() {
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
if (Adempiere.getThreadPoolExecutor() != null) {
|
if (Adempiere.getThreadPoolExecutor() != null) {
|
||||||
Adempiere.getThreadPoolExecutor().execute(new Runnable() {
|
Adempiere.getThreadPoolExecutor().execute(new Runnable() {
|
||||||
|
|
|
@ -42,12 +42,10 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.FrameworkEvent;
|
|
||||||
import org.osgi.framework.FrameworkListener;
|
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
public class PackInApplicationActivator extends AbstractActivator implements FrameworkListener {
|
public class PackInApplicationActivator extends AbstractActivator{
|
||||||
|
|
||||||
protected final static CLogger logger = CLogger.getCLogger(PackInApplicationActivator.class.getName());
|
protected final static CLogger logger = CLogger.getCLogger(PackInApplicationActivator.class.getName());
|
||||||
private List<File> filesToProcess = new ArrayList<>();
|
private List<File> filesToProcess = new ArrayList<>();
|
||||||
|
@ -395,13 +393,7 @@ public class PackInApplicationActivator extends AbstractActivator implements Fra
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void frameworkEvent(FrameworkEvent event) {
|
protected void frameworkStarted() {
|
||||||
if (event.getType() == FrameworkEvent.STARTLEVEL_CHANGED) {
|
|
||||||
frameworkStarted();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void frameworkStarted() {
|
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
if (Adempiere.getThreadPoolExecutor() != null) {
|
if (Adempiere.getThreadPoolExecutor() != null) {
|
||||||
Adempiere.getThreadPoolExecutor().execute(new Runnable() {
|
Adempiere.getThreadPoolExecutor().execute(new Runnable() {
|
||||||
|
|
|
@ -38,8 +38,6 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.FrameworkEvent;
|
|
||||||
import org.osgi.framework.FrameworkListener;
|
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
|
@ -48,7 +46,7 @@ import org.osgi.util.tracker.ServiceTracker;
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Version2PackActivator extends AbstractActivator implements FrameworkListener {
|
public class Version2PackActivator extends AbstractActivator{
|
||||||
|
|
||||||
protected final static CLogger logger = CLogger.getCLogger(Version2PackActivator.class.getName());
|
protected final static CLogger logger = CLogger.getCLogger(Version2PackActivator.class.getName());
|
||||||
|
|
||||||
|
@ -280,15 +278,9 @@ public class Version2PackActivator extends AbstractActivator implements Framewor
|
||||||
serverContext.setProperty("#AD_Client_ID", "0");
|
serverContext.setProperty("#AD_Client_ID", "0");
|
||||||
ServerContext.setCurrentInstance(serverContext);
|
ServerContext.setCurrentInstance(serverContext);
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
|
||||||
public void frameworkEvent(FrameworkEvent event) {
|
|
||||||
if (event.getType() == FrameworkEvent.STARTLEVEL_CHANGED) {
|
|
||||||
frameworkStarted();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void frameworkStarted() {
|
@Override
|
||||||
|
protected void frameworkStarted() {
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
if (Adempiere.getThreadPoolExecutor() != null) {
|
if (Adempiere.getThreadPoolExecutor() != null) {
|
||||||
Adempiere.getThreadPoolExecutor().execute(new Runnable() {
|
Adempiere.getThreadPoolExecutor().execute(new Runnable() {
|
||||||
|
|
Loading…
Reference in New Issue