Project

General

Profile

« Previous | Next » 

Revision 5c9343bd

Added by Cherian Mathew about 9 years ago

CdmTransientEntityCacher : comments and cleanup
MockCdmEntitySessionManager, MockCdmEntitySession : implementing new interface methods
renamed ISessionEventListener to ICdmEntitySessionEnabled
ICdmEntitySession, CdmEntitySession : added methods to register session observer and add change events
ICdmEntitySessionManager, CdmEntitySessionManager : added getActiveSession method
CdmServerInfo :: added possiblity to connect directly to dev eclipse cdm server

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java
51 51
    private final static String NAME_LOCALHOST = "localhost";
52 52
    private final static String NAME_LOCALHOST_MGD = "localhost mgd.";
53 53

  
54
    private final static String NAME_LOCALHOST_DEV = "localhost-dev";
55
    private final static String NAME_INSTANCE_LOCALHOST_DEV = "local-dev";
56
    private final static String SERVER_LOCALHOST_DEV = "localhost";
57
    private final static int PORT_LOCALHOST_DEV = 8080;
58
    private final static String BASEPATH_LOCALHOST_DEV = "";
59

  
54 60
    private final String name;
55 61
    private final String server;
56 62
    private final int port;
......
65 71
    }
66 72

  
67 73

  
74
    public CdmInstanceInfo addInstance(String name, String basePath) {
75
        CdmInstanceInfo cii = new CdmInstanceInfo(name, basePath);
76
        instances.add(cii);
77
        return cii;
78

  
79
    }
80

  
68 81
    public void refreshInstances() throws CDMServerException {
69 82
        String url = "http://" + server + ":" + String.valueOf(port) + "/cdmserver/instances.jsp";
70 83

  
......
111 124
                            // we need to remove the first (char) forward slash from
112 125
                            // the base path
113 126
                            String basePath = conf.getString("basePath").substring(1);
114
                            instances.add(new CdmInstanceInfo(instanceName, basePath));
127
                            addInstance(instanceName, basePath);
115 128
                            logger.info("Added instance with name : " + instanceName + ", basePath : " + basePath);
116 129
                        }
117 130
                    }
......
136 149
        return null;
137 150
    }
138 151

  
139
    public CdmRemoteSource getCdmRemoteSource(CdmInstanceInfo instance) {
152
    public ICdmRemoteSource getCdmRemoteSource(CdmInstanceInfo instance) {
140 153
        if(instance != null) {
141 154
            return CdmRemoteSource.NewInstance(name,
142 155
                    server,
......
160 173

  
161 174
    public boolean pingInstance(CdmInstanceInfo instance) throws CDMServerException  {
162 175

  
163
        CdmRemoteSource crs = getCdmRemoteSource(instance);
176
        ICdmRemoteSource crs = getCdmRemoteSource(instance);
164 177
        try {
165 178
            if(crs != null && crs.checkConnection()) {
166 179
                logger.info("[CDM-Server] Running @ " + server + ":" + port + " for instance " + instance);
......
204 217
        return instances;
205 218
    }
206 219

  
220
    public static ICdmRemoteSource getDevServerRemoteSource() {
221
        String value=System.getProperty("cdm.server.dev.activate");
222
        boolean available = false;
223
        CdmInstanceInfo devInstance = null;
224
        if(value != null && value.equals("true")) {
225
            CdmServerInfo devCii = new CdmServerInfo(NAME_LOCALHOST_DEV, SERVER_LOCALHOST_DEV, PORT_LOCALHOST_DEV);
226
            try {
227
                devInstance = devCii.addInstance(NAME_INSTANCE_LOCALHOST_DEV, BASEPATH_LOCALHOST_DEV);
228
                available = devCii.pingInstance(devInstance);
229
                if(available) {
230
                    return devCii.getCdmRemoteSource(devInstance);
231
                }
232
            } catch (Exception e) {
233

  
234
            }
235
        }
236
        return null;
237
    }
238

  
207 239
    public class CdmInstanceInfo {
208 240
        private final String name;
209 241
        private final String basePath;

Also available in: Unified diff