xml.setAttribute("name", g.getName()); xml.add(String.valueOf(g.getSoftwareVersion()), "softwareVersion"); xml.add(String.valueOf(g.getSoftwareSubVersion()), "softwareSubVersion"); if ( g.getDefaultRule() != null ) xml.add(g.getDefaultRule(), "default_rule", String.class); if ( g.getEncryption() != null ) xml.add(g.getEncryption(),"encryption",String.class); if ( !g.getMimeTypes().isEmpty() ) xml.add(g.getMimeTypes()); if ( !g.getMediaTypes().isEmpty() ) xml.add(g.getMediaTypes()); if ( !g.getCapabilities().isEmpty() ) xml.add(g.getCapabilities()); if ( !g.getClients().isEmpty() ) xml.add(g.getClients()); if ( !g.getOldRoles().isEmpty() )
for (JSGroup jsGroup : snapshot.getOldGroups()) for (JSRole jsRole : snapshot.getOldRoles()) for (JSUser jsuser : snapshot.getOldUsers()) for (JSPrincipal jsPrincipal : snapshot.getPrincipals())
for (JSPrincipal _user : snapshot.getPrincipals()) for (JSUser _user : snapshot.getOldUsers())
private void recreateProfilingRules(JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException JSProfilingRules rules = snapshot.getRules(); if ((rules != null) && (rules.size() > 0)) String defaultRuleID = snapshot.getDefaultRule(); if (defaultRuleID != null)
snapshot.setEncryption(getEncryptionString()); snapshot.getPrincipals().add(_tempPrincipal);
private void exportUserPrincipalRules(JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException { // get Rules for each user for (JSPrincipal _user : snapshot.getPrincipals()) { if (JetspeedPrincipalType.USER.equals(_user.getType())) { Principal principal = _user.getPrincipal(); if (principal != null) { for (PrincipalRule p1 : pm.getRulesForPrincipal(principal)) { JSPrincipalRule pr = new JSPrincipalRule(p1.getLocatorName(), p1.getProfilingRule().getId()); _user.getRules().add(pr); } } } } }
/** * extract the capabilities and save in snapshot file * * @throws SerializerException */ private void exportCapabilites(Refs refs, JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException { Iterator list = caps.getCapabilities(); while (list.hasNext()) { try { Capability _cp = (Capability) list.next(); JSCapability _jsC = new JSCapability(); _jsC.setName(_cp.getName()); refs.capabilityMap.put(_jsC.getName(), _jsC); refs.capabilityMapInt.put(new Integer(_cp.getCapabilityId()), _jsC); snapshot.getCapabilities().add(_jsC); } catch (Exception e) { throw new SerializerException( SerializerException.CREATE_SERIALIZED_OBJECT_FAILED .create(new String[] { "C", e.getMessage()})); } } return; }
/** * exstract the mime types anmd save in snapshot file * * @throws SerializerException */ private void exportMimeTypes(Refs refs, JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException { Iterator list = caps.getMimeTypes(); while (list.hasNext()) { try { MimeType _mt = (MimeType) list.next(); JSMimeType _jsM = new JSMimeType(); _jsM.setName(_mt.getName()); refs.mimeMap.put(_jsM.getName(), _jsM); refs.mimeMapInt.put(new Integer(_mt.getMimetypeId()), _jsM); snapshot.getMimeTypes().add(_jsM); } catch (Exception e) { throw new SerializerException( SerializerException.CREATE_SERIALIZED_OBJECT_FAILED .create(new String[] { "MimeType", e.getMessage()})); } } return; }
if (app != null) snapshot.getApplications().add(app);
/** * extract the current clients and save in the snapshot file * * @param list * @param caps * @return * @throws SerializerException */ private void exportClients(Refs refs, JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException { /** first the the mime types */ exportMimeTypes(refs, snapshot, settings, log); /** second get the capabilities */ this.exportCapabilites(refs, snapshot, settings, log); /** now get the clients */ Iterator _it = caps.getClients(); while (_it.hasNext()) { Client c = (Client) _it.next(); JSClient jsC = createJSClient(refs, c); if (jsC == null) throw new SerializerException( SerializerException.CREATE_SERIALIZED_OBJECT_FAILED .create(new String[] { "Client", "createClient returned NULL"})); refs.clientMap.put(jsC.getName(), jsC); snapshot.getClients().add(jsC); } return; }
snapshot.getMediaTypes().add(jsMediaType); } catch (Exception e)
/** * Establish whether incoming passwords are "clear" text or whether they are * to be decoded. That however depends on whether the passwords were encoded * with the current active provider or not. * * @return */ protected int compareCurrentSecurityProvider(JSSnapshot snapshot) { String _fileEncryption = snapshot.getEncryption(); if ((_fileEncryption == null) || (_fileEncryption.length() == 0)) return JetspeedSerializer.NO_DECODING; // passwords are in clear // text if (_fileEncryption.equals(getEncryptionString())) return JetspeedSerializer.PASSTHRU_REQUIRED; else return JetspeedSerializer.NO_DECODING; }
private void recreateCapabilities(JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException JSCapabilities capabilities = snapshot.getCapabilities(); if ((capabilities != null) && (capabilities.size() > 0))
private void recreateMimeTypes(JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException JSMimeTypes mimeTypes = snapshot.getMimeTypes(); if ((mimeTypes != null) && (mimeTypes.size() > 0))
private void importEntities(JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException { JSApplications applications = snapshot.getApplications(); if (applications == null) { return; } // import preferences for registered portlets if applications // have been registered; otherwise, import all preferences boolean importAll = registry.getPortletApplications().isEmpty(); if (!applications.isEmpty()) { Iterator it = applications.iterator(); while (it.hasNext()) { JSApplication app = (JSApplication) it.next(); PortletApplication portletApp = registry.getPortletApplication(app.getName()); if ((portletApp != null) || importAll) { importPA(app, portletApp, settings, log); } } } }
JSClients clients = snapshot.getClients(); if ((clients != null) && (clients.size() > 0))
JSMediaTypes mediaTypes = snapshot.getMediaTypes(); if ((mediaTypes != null) && (mediaTypes.size() > 0))