public void initialize() throws InternalErrorException { String synchronizerPrincipal = "perunSynchronizer"; this.sess = perun.getPerunSession( new PerunPrincipal(synchronizerPrincipal, ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL), new PerunClient()); }
public PerunInitializer(String outputFileName) throws InternalErrorException, FileNotFoundException { this.perunPrincipal = new PerunPrincipal("perunLdapInitializer", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL); this.springCtx = new ClassPathXmlApplicationContext("perun-ldapc-initializer.xml"); this.perunBl = springCtx.getBean("perun", PerunBl.class); this.perunSession = perunBl.getPerunSession(perunPrincipal, new PerunClient()); this.outputWriter = new BufferedWriter(this.getWriterForOutput(outputFileName)); }
public static PerunSession getPerunSession(PerunBl perun) throws InternalErrorException { if (session == null) { if (perun != null) { session = perun.getPerunSession( new PerunPrincipal("perunNotifications", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL), new PerunClient()); } else { throw new InternalErrorException("PerunBl is null"); } } return session; } }
private Author convertAuthorToAuthorWithAttributes(Author author) { try { if (session == null) { session = perun.getPerunSession(new PerunPrincipal("perunCabinet", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL), new PerunClient()); } User user = perun.getUsersManagerBl().getUserById(session, author.getId()); Attribute a = perun.getAttributesManagerBl().getAttribute(session, user, AttributesManager.NS_USER_ATTR_DEF + ":preferredMail"); Attribute b = perun.getAttributesManagerBl().getAttribute(session, user, AttributesManager.NS_USER_ATTR_DEF + ":organization"); author.setAttributes(Arrays.asList(a,b)); } catch (Exception ex) { log.error("Unable to get attributes for {}: {}", author, ex); } return author; }
protected void initialize() throws PerunException { // gets session for a system principal "perunRegistrar" final PerunPrincipal pp = new PerunPrincipal("perunRegistrar", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL); registrarSession = perun.getPerunSession(pp, new PerunClient()); // cache expires after 5 minutes from creation requestCache = ExpiringMap.builder().expiration(5, TimeUnit.MINUTES).expirationPolicy(ExpiringMap.ExpirationPolicy.CREATED).build(); }
/** * Init method, instantiate PerunSession * * @throws PerunException */ protected void initialize() throws PerunException { // gets session for a system principal "perunRegistrar" final PerunPrincipal pp = new PerunPrincipal("perunRegistrar", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL); registrarSession = perun.getPerunSession(pp, new PerunClient()); this.attrManager = perun.getAttributesManager(); this.membersManager = perun.getMembersManager(); this.usersManager = perun.getUsersManager(); this.groupsManager = perun.getGroupsManager(); }
/** * Checks if INTERNAL publication system is present in DB. If not, creates one. */ protected void initialize() throws CabinetException, InternalErrorException { // search for internal system try { getPublicationSystemManagerDao().getPublicationSystemByName("INTERNAL"); } catch (CabinetException ex) { if (ErrorCodes.PUBLICATION_SYSTEM_NOT_EXISTS.equals(ex.getType())) { PerunSession session = perunBl.getPerunSession(new PerunPrincipal("perunCabinet", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL), new PerunClient()); log.error("Internal PS not exists: {}", ex); // create internal if not exists PublicationSystem record = new PublicationSystem(); record.setFriendlyName("INTERNAL"); record.setLoginNamespace("empty"); record.setType("empty"); record.setUrl("empty"); record.setPassword(null); record.setUsername(null); createPublicationSystem(session, record); } } catch (Exception ex) { log.error("Unable to determine if Internal PS exists: {}", ex); } }
cabinetSession = perun.getPerunSession(pp, new PerunClient());
ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL); registrarSession = perun.getPerunSession(pp, new PerunClient());