- public String toString() {
- return "CMS Session " + userDn + " local=" + localSessionId + ", uuid=" + uuid;
- }
-
- public static CmsSessionImpl getByLocalId(String localId) {
- Collection<ServiceReference<CmsSession>> sr;
- try {
- sr = bc.getServiceReferences(CmsSession.class, "(" + CmsSession.SESSION_LOCAL_ID + "=" + localId + ")");
- } catch (InvalidSyntaxException e) {
- throw new CmsException("Cannot get CMS session for id " + localId, e);
- }
- ServiceReference<CmsSession> cmsSessionRef;
- if (sr.size() == 1) {
- cmsSessionRef = sr.iterator().next();
- return (CmsSessionImpl) bc.getService(cmsSessionRef);
- } else if (sr.size() == 0) {
- return null;
- } else
- throw new CmsException(sr.size() + " CMS sessions registered for " + localId);
-
- }
-
- public static CmsSessionImpl getByUuid(Object uuid) {
- Collection<ServiceReference<CmsSession>> sr;
- try {
- sr = bc.getServiceReferences(CmsSession.class, "(" + CmsSession.SESSION_UUID + "=" + uuid + ")");
- } catch (InvalidSyntaxException e) {
- throw new CmsException("Cannot get CMS session for uuid " + uuid, e);
- }
- ServiceReference<CmsSession> cmsSessionRef;
- if (sr.size() == 1) {
- cmsSessionRef = sr.iterator().next();
- return (CmsSessionImpl) bc.getService(cmsSessionRef);
- } else if (sr.size() == 0) {
- return null;
- } else
- throw new CmsException(sr.size() + " CMS sessions registered for " + uuid);
-
+ @Override
+ public void registerView(String uid, Object view) {
+ checkValid();
+ if (views.containsKey(uid))
+ throw new IllegalArgumentException("View " + uid + " is already registered.");
+ views.put(uid, view);