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;
}
/**
* @see net.forwardfire.vasc.backend.VascBackend#isTotalSummary()
* @see net.forwardfire.vasc.backend.VascBackend#hasTotalSummary()
*/
public boolean isTotalSummary() {
public boolean hasTotalSummary() {
return false;
}
}

View file

@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
/**
* VascBackend provides stateless data access to a data source.
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
@ -48,7 +49,6 @@ public interface VascBackend {
public void delete(Object object) throws VascBackendException;
/**
* 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.
@ -96,10 +96,10 @@ public interface VascBackend {
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException;
public boolean isPageSummary();
public boolean hasPageSummary();
public Map<String,Object> executePageSummary();
public boolean isTotalSummary();
public boolean hasTotalSummary();
public Map<String,Object> executeTotalSummary();
/*

View file

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

View file

@ -168,13 +168,13 @@ public class VascServiceRemoteBackend implements VascBackend {
return (Map<String, Object>)result;
}
public boolean isPageSummary() {
public boolean hasPageSummary() {
Object[] args = new Object[0];
Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args);
return (Boolean)result;
}
public boolean isTotalSummary() {
public boolean hasTotalSummary() {
Object[] args = new Object[0];
Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args);
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() {
return backend.isPageSummary();
public boolean hasPageSummary() {
return backend.hasPageSummary();
}
/**
* @see net.forwardfire.vasc.backend.VascBackend#isTotalSummary()
* @see net.forwardfire.vasc.backend.VascBackend#hasTotalSummary()
*/
public boolean isTotalSummary() {
return backend.isTotalSummary();
public boolean hasTotalSummary() {
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.X4OReaderSession;
import org.x4o.xml.lang.X4OLanguageSession;
import org.x4o.xml.lang.X4OLanguageSessionLocal;
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.ElementException;
import org.x4o.xml.lang.phase.X4OPhase;
/**
* VascEntryFieldTypeElement
@ -56,7 +54,6 @@ public class VascEntryFieldTypeElement extends AbstractElement {
VascEntryFieldType type = field.getVascEntryFieldType();
setElementObject(type);
logger.info("Readding the element for reparsing");
X4OPhase startX4OPhase = getLanguageSession().getLanguage().getPhaseManager().getPhase("READ_CONFIG_ELEMENT"); // TODO: back to enum ?
getLanguageSession().addDirtyElement(this, startX4OPhase);
getLanguageSession().addDirtyElement(this);
}
}

View file

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

View file

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