2
0
Fork 0

renamed backend summary lines.

This commit is contained in:
Willem Cazander 2014-05-27 21:33:39 +02:00
parent a13719f008
commit 9a6227be5b
9 changed files with 108 additions and 78 deletions

View file

@ -133,16 +133,16 @@ abstract public class AbstractVascBackend implements VascBackend {
} }
/** /**
* @see net.forwardfire.vasc.backend.VascBackend#isPageSummary() * @see net.forwardfire.vasc.backend.VascBackend#hasPageSummary()
*/ */
public boolean isPageSummary() { public boolean hasPageSummary() {
return false; return false;
} }
/** /**
* @see net.forwardfire.vasc.backend.VascBackend#isTotalSummary() * @see net.forwardfire.vasc.backend.VascBackend#hasTotalSummary()
*/ */
public boolean isTotalSummary() { public boolean hasTotalSummary() {
return false; return false;
} }
} }

View file

@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* VascBackend provides stateless data access to a data source.
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Mar 21, 2007 * @version 1.0 Mar 21, 2007
@ -48,7 +49,6 @@ public interface VascBackend {
public void delete(Object object) throws VascBackendException; public void delete(Object object) throws VascBackendException;
/** /**
* Creates a new Field acces obj the the given field entry. * Creates a new Field acces obj the the given field entry.
* note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle. * note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle.
@ -96,10 +96,10 @@ public interface VascBackend {
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException; public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException;
public boolean isPageSummary(); public boolean hasPageSummary();
public Map<String,Object> executePageSummary(); public Map<String,Object> executePageSummary();
public boolean isTotalSummary(); public boolean hasTotalSummary();
public Map<String,Object> executeTotalSummary(); public Map<String,Object> executeTotalSummary();
/* /*

View file

@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger;
import net.forwardfire.vasc.backend.AbstractVascBackend; import net.forwardfire.vasc.backend.AbstractVascBackend;
import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendException;
@ -40,19 +41,20 @@ import com.novell.ldap.LDAPAttribute;
import com.novell.ldap.LDAPAttributeSet; import com.novell.ldap.LDAPAttributeSet;
import com.novell.ldap.LDAPConnection; import com.novell.ldap.LDAPConnection;
import com.novell.ldap.LDAPEntry; import com.novell.ldap.LDAPEntry;
import com.novell.ldap.LDAPException;
import com.novell.ldap.LDAPModification; import com.novell.ldap.LDAPModification;
import com.novell.ldap.LDAPSearchConstraints; import com.novell.ldap.LDAPSearchConstraints;
import com.novell.ldap.LDAPSearchResults; import com.novell.ldap.LDAPSearchResults;
/** /**
* Provides backend for ldap. * LdapVascBackend provides abstract data access for ldap.
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Sep 4, 2008 * @version 1.0 Sep 4, 2008
*/ */
public class LdapVascBackend extends AbstractVascBackend { public class LdapVascBackend extends AbstractVascBackend {
private Logger logger = Logger.getLogger(LdapVascBackend.class.getName());
private LdapConnectionProvider ldapConnectionProvider = null; private LdapConnectionProvider ldapConnectionProvider = null;
private String baseDN = null; private String baseDN = null;
private String keyAttribute = null; private String keyAttribute = null;
@ -62,14 +64,14 @@ public class LdapVascBackend extends AbstractVascBackend {
private boolean referralFollowing = true; private boolean referralFollowing = true;
/** /**
* @return the ldapConnectionProvider * @return the ldapConnectionProvider.
*/ */
public LdapConnectionProvider getLdapConnectionProvider() { public LdapConnectionProvider getLdapConnectionProvider() {
return ldapConnectionProvider; return ldapConnectionProvider;
} }
/** /**
* @param ldapConnectionProvider the ldapConnectionProvider to set * @param ldapConnectionProvider the ldapConnectionProvider to set.
*/ */
public void setLdapConnectionProvider(LdapConnectionProvider ldapConnectionProvider) { public void setLdapConnectionProvider(LdapConnectionProvider ldapConnectionProvider) {
this.ldapConnectionProvider = ldapConnectionProvider; this.ldapConnectionProvider = ldapConnectionProvider;
@ -121,16 +123,14 @@ public class LdapVascBackend extends AbstractVascBackend {
} }
result.add(map); result.add(map);
} }
} catch (Exception e) { } catch (LDAPException e) {
throw new VascBackendException(e); throw new VascBackendException(e);
} finally { } finally {
if (connection!=null) { safeDisconnect(connection);
connection.clone();
}
} }
return result; return result;
} }
/** /**
* @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object) * @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object)
*/ */
@ -205,15 +205,13 @@ public class LdapVascBackend extends AbstractVascBackend {
connection.modify(entry.getDN(), m); connection.modify(entry.getDN(), m);
return object; return object;
} catch (Exception e) { } catch (LDAPException e) {
throw new VascBackendException(e); throw new VascBackendException(e);
} finally { } finally {
if (connection!=null) { safeDisconnect(connection);
connection.clone();
}
} }
} }
/** /**
* @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object) * @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object)
*/ */
@ -242,12 +240,10 @@ public class LdapVascBackend extends AbstractVascBackend {
entry.getAttributeSet().add(attr); entry.getAttributeSet().add(attr);
} }
connection.add(entry); connection.add(entry);
} catch (Exception e) { } catch (LDAPException e) {
throw new VascBackendException(e); throw new VascBackendException(e);
} finally { } finally {
if (connection!=null) { safeDisconnect(connection);
connection.clone();
}
} }
} }
@ -276,12 +272,21 @@ public class LdapVascBackend extends AbstractVascBackend {
} }
LDAPEntry entry = searchResults.next(); LDAPEntry entry = searchResults.next();
connection.delete(entry.getDN()); connection.delete(entry.getDN());
} catch (Exception e) { } catch (LDAPException e) {
throw new VascBackendException(e); throw new VascBackendException(e);
} finally { } finally {
if (connection!=null) { safeDisconnect(connection);
connection.clone(); }
} }
private void safeDisconnect(LDAPConnection connection) {
if (connection==null) {
return;
}
try {
connection.disconnect();
} catch (LDAPException e) {
logger.warning("Error while disconnecting: "+e.getMessage());
} }
} }
@ -291,95 +296,95 @@ public class LdapVascBackend extends AbstractVascBackend {
public VascEntryRecordCreator provideVascEntryRecordCreator() { public VascEntryRecordCreator provideVascEntryRecordCreator() {
return new MapVascEntryRecordCreator(); return new MapVascEntryRecordCreator();
} }
/** /**
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue() * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue()
*/ */
public VascEntryFieldValue provideVascEntryFieldValue() { public VascEntryFieldValue provideVascEntryFieldValue() {
return new MapVascEntryFieldValue(); return new MapVascEntryFieldValue();
} }
/** /**
* @return the baseDN * @return the baseDN.
*/ */
public String getBaseDN() { public String getBaseDN() {
return baseDN; return baseDN;
} }
/** /**
* @param baseDN the baseDN to set * @param baseDN the baseDN to set.
*/ */
public void setBaseDN(String baseDN) { public void setBaseDN(String baseDN) {
this.baseDN = baseDN; this.baseDN = baseDN;
} }
/** /**
* @return the keyAttribute * @return the keyAttribute.
*/ */
public String getKeyAttribute() { public String getKeyAttribute() {
return keyAttribute; return keyAttribute;
} }
/** /**
* @param keyAttribute the keyAttribute to set * @param keyAttribute the keyAttribute to set.
*/ */
public void setKeyAttribute(String keyAttribute) { public void setKeyAttribute(String keyAttribute) {
this.keyAttribute = keyAttribute; this.keyAttribute = keyAttribute;
} }
/** /**
* @return the ldapFilter * @return the ldapFilter.
*/ */
public String getLdapFilter() { public String getLdapFilter() {
return ldapFilter; return ldapFilter;
} }
/** /**
* @param ldapFilter the ldapFilter to set * @param ldapFilter the ldapFilter to set.
*/ */
public void setLdapFilter(String ldapFilter) { public void setLdapFilter(String ldapFilter) {
this.ldapFilter = ldapFilter; this.ldapFilter = ldapFilter;
} }
/** /**
* @return the createObjectClass * @return the createObjectClass.
*/ */
public String getCreateObjectClass() { public String getCreateObjectClass() {
return createObjectClass; return createObjectClass;
} }
/** /**
* @param createObjectClass the createObjectClass to set * @param createObjectClass the createObjectClass to set.
*/ */
public void setCreateObjectClass(String createObjectClass) { public void setCreateObjectClass(String createObjectClass) {
this.createObjectClass = createObjectClass; this.createObjectClass = createObjectClass;
} }
/** /**
* @return the timeLimit * @return the timeLimit.
*/ */
public int getTimeLimit() { public int getTimeLimit() {
return timeLimit; return timeLimit;
} }
/** /**
* @param timeLimit the timeLimit to set * @param timeLimit the timeLimit to set.
*/ */
public void setTimeLimit(int timeLimit) { public void setTimeLimit(int timeLimit) {
this.timeLimit = timeLimit; this.timeLimit = timeLimit;
} }
/** /**
* @return the referralFollowing * @return the referralFollowing.
*/ */
public boolean isReferralFollowing() { public boolean isReferralFollowing() {
return referralFollowing; return referralFollowing;
} }
/** /**
* @param referralFollowing the referralFollowing to set * @param referralFollowing the referralFollowing to set.
*/ */
public void setReferralFollowing(boolean referralFollowing) { public void setReferralFollowing(boolean referralFollowing) {
this.referralFollowing = referralFollowing; this.referralFollowing = referralFollowing;
} }
} }

View file

@ -168,13 +168,13 @@ public class VascServiceRemoteBackend implements VascBackend {
return (Map<String, Object>)result; return (Map<String, Object>)result;
} }
public boolean isPageSummary() { public boolean hasPageSummary() {
Object[] args = new Object[0]; Object[] args = new Object[0];
Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args); Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args);
return (Boolean)result; return (Boolean)result;
} }
public boolean isTotalSummary() { public boolean hasTotalSummary() {
Object[] args = new Object[0]; Object[] args = new Object[0];
Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args); Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args);
return (Boolean)result; return (Boolean)result;

View file

@ -208,16 +208,16 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
} }
/** /**
* @see net.forwardfire.vasc.backend.VascBackend#isPageSummary() * @see net.forwardfire.vasc.backend.VascBackend#hasPageSummary()
*/ */
public boolean isPageSummary() { public boolean hasPageSummary() {
return backend.isPageSummary(); return backend.hasPageSummary();
} }
/** /**
* @see net.forwardfire.vasc.backend.VascBackend#isTotalSummary() * @see net.forwardfire.vasc.backend.VascBackend#hasTotalSummary()
*/ */
public boolean isTotalSummary() { public boolean hasTotalSummary() {
return backend.isTotalSummary(); return backend.hasTotalSummary();
} }
} }

View file

@ -40,7 +40,6 @@ import org.x4o.xml.element.Element;
import org.x4o.xml.io.X4OConnectionException; import org.x4o.xml.io.X4OConnectionException;
import org.x4o.xml.io.X4OReaderSession; import org.x4o.xml.io.X4OReaderSession;
import org.x4o.xml.lang.X4OLanguageSession; import org.x4o.xml.lang.X4OLanguageSession;
import org.x4o.xml.lang.X4OLanguageSessionLocal;
import org.x4o.xml.lang.phase.X4OPhaseException; import org.x4o.xml.lang.phase.X4OPhaseException;
/** /**

View file

@ -30,8 +30,6 @@ import net.forwardfire.vasc.core.VascEntryFieldType;
import org.x4o.xml.element.AbstractElement; import org.x4o.xml.element.AbstractElement;
import org.x4o.xml.element.ElementException; import org.x4o.xml.element.ElementException;
import org.x4o.xml.lang.phase.X4OPhase;
/** /**
* VascEntryFieldTypeElement * VascEntryFieldTypeElement
@ -56,7 +54,6 @@ public class VascEntryFieldTypeElement extends AbstractElement {
VascEntryFieldType type = field.getVascEntryFieldType(); VascEntryFieldType type = field.getVascEntryFieldType();
setElementObject(type); setElementObject(type);
logger.info("Readding the element for reparsing"); logger.info("Readding the element for reparsing");
X4OPhase startX4OPhase = getLanguageSession().getLanguage().getPhaseManager().getPhase("READ_CONFIG_ELEMENT"); // TODO: back to enum ? getLanguageSession().addDirtyElement(this);
getLanguageSession().addDirtyElement(this, startX4OPhase);
} }
} }

View file

@ -34,6 +34,8 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.x4o.xml.io.X4OReader; import org.x4o.xml.io.X4OReader;
@ -65,11 +67,32 @@ public class VascControllerService {
private Logger logger = null; private Logger logger = null;
private VascController vascController = null; private VascController vascController = null;
private Timer delayedI18nTimer;
private I18NVascEventControllerListener i18nGenerator;
private static final long TASK_DELAY = 1000*13;
int bootDone = 20;
public VascControllerService() { public VascControllerService() {
logger = Logger.getLogger(VascControllerService.class.getName()); logger = Logger.getLogger(VascControllerService.class.getName());
i18nGenerator = new I18NVascEventControllerListener();
delayedI18nTimer = new Timer("i18n-generator");
delayedI18nTimer.schedule(new DelayedTask(), TASK_DELAY + TASK_DELAY);
} }
class DelayedTask extends TimerTask {
@Override
public void run() {
if (i18nGenerator.generateRequest!=0) {
i18nGenerator.generateBundle();
i18nGenerator.generateRequest=0;
}
bootDone--;
if (bootDone > 0) {
delayedI18nTimer.schedule(new DelayedTask(), TASK_DELAY);
}
}
};
public void start() { public void start() {
logger.finer("Starting vascmanager"); logger.finer("Starting vascmanager");
if (vascController!=null) { if (vascController!=null) {
@ -81,16 +104,17 @@ public class VascControllerService {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
// Inject our i18n listener for hot deploy demo
VascEventChannelControllerLocal ev = (VascEventChannelControllerLocal)vascController.getVascEventChannelController(); VascEventChannelControllerLocal ev = (VascEventChannelControllerLocal)vascController.getVascEventChannelController();
ev.addVascEventControllerListener(new I18NVascEventControllerListener()); ev.addVascEventControllerListener(i18nGenerator);
} }
public void stop() { public void stop() {
if (vascController==null) { if (vascController==null) {
return; return;
} }
delayedI18nTimer.cancel();
VascBackendControllerLocal backends = (VascBackendControllerLocal)vascController.getVascBackendController(); VascBackendControllerLocal backends = (VascBackendControllerLocal)vascController.getVascBackendController();
backends.clearAndStopBackends(); backends.clearAndStopBackends();
@ -122,7 +146,9 @@ public class VascControllerService {
} }
class I18NVascEventControllerListener implements VascEventControllerListener { class I18NVascEventControllerListener implements VascEventControllerListener {
public long generateRequest = 0;
@Override @Override
public VascEventControllerType[] getVascEventControllerTypes() { public VascEventControllerType[] getVascEventControllerTypes() {
return new VascEventControllerType[] {VascEventControllerType.LOAD_ENTRIES_AFTER}; return new VascEventControllerType[] {VascEventControllerType.LOAD_ENTRIES_AFTER};
@ -130,7 +156,10 @@ public class VascControllerService {
@Override @Override
public void controllerEvent(VascEventControllerType type,Object eventObject) { public void controllerEvent(VascEventControllerType type,Object eventObject) {
generateRequest = System.currentTimeMillis();
}
public void generateBundle() {
logger.info("Regenerating resource bundle keys..."); logger.info("Regenerating resource bundle keys...");
Map<String,String> keys = new HashMap<String,String>(300); Map<String,String> keys = new HashMap<String,String>(300);

View file

@ -89,7 +89,7 @@ public class JndiVascDeployer {
scanThread.start(); scanThread.start();
} }
public void stop() { public void stop() {
if (autoDeployManager==null) { if (autoDeployManager==null) {
return; return;
} }
@ -116,7 +116,6 @@ public class JndiVascDeployer {
} }
} }
} }
private void hotDeployVasc() throws NoSuchAlgorithmException, IOException { private void hotDeployVasc() throws NoSuchAlgorithmException, IOException {
int deployed = 0; int deployed = 0;
@ -165,7 +164,7 @@ public class JndiVascDeployer {
//fireChangeEvent(); //fireChangeEvent();
} }
} }
protected class AutoDeployManager implements Runnable { protected class AutoDeployManager implements Runnable {
private volatile boolean run = true; private volatile boolean run = true;
public void run() { public void run() {
@ -211,6 +210,7 @@ public class JndiVascDeployer {
logger.info("AutoDeployManager stoped"); logger.info("AutoDeployManager stoped");
} }
} }
public void stop() { public void stop() {
run = false; run = false;
this.notify(); this.notify();