rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
final Object[] args = new Object[this.queryAttributes.size()]; for (int index = 0; index < args.length; index++) { final String attrName = (String) this.queryAttributes.get(index); args[index] = seed.get(attrName); } final NamingEnumeration userlist = this.ldapContext.search(this.baseDN, this.query, args, sc); try { if (userlist.hasMoreElements()) { final Map rowResults = new HashMap(); final SearchResult result = (SearchResult) userlist.next(); if (userlist.hasMoreElements()) { throw new IncorrectResultSizeDataAccessException("More than one result for ldap person attribute search.", 1, -1); } final Attributes ldapAttributes = result.getAttributes(); for (final Iterator ldapAttrIter = this.ldapAttributesToPortalAttributes.keySet().iterator(); ldapAttrIter.hasNext();) { final String ldapAttributeName = (String) ldapAttrIter.next(); final Attribute attribute = ldapAttributes.get(ldapAttributeName); if (attribute != null) { for (final NamingEnumeration attrValueEnum = attribute.getAll(); attrValueEnum.hasMore();) { Object attributeValue = attrValueEnum.next(); if (!(attributeValue instanceof byte[])) { attributeValue = attributeValue.toString(); } Set attributeNames = (Set) ldapAttributesToPortalAttributes.get(ldapAttributeName); if (attributeNames == null) attributeNames = Collections.singleton(ldapAttributeName); for (final Iterator attrNameItr = attributeNames .iterator(); attrNameItr.hasNext();) { final String attributeName = (String) attrNameItr .next(); MultivaluedPersonAttributeUtils.addResult(rowResults, attributeName, attributeValue); } } } } return rowResults; } else { return null; } } finally { try { userlist.close(); } catch (final NamingException ne) { log.warn("Error closing ldap person attribute search results.", ne); } } } catch (final Throwable t) { throw new DataAccessResourceFailureException("LDAP person attribute lookup failure.", t); }
final SearchExecutor se = new QuerySearchExecutor(this.baseDN, this.query, args, this.searchControls); final CollectingSearchResultCallbackHandler srch = this.ldapTemplate.new AttributesMapperCallbackHandler(this.attributesMapper); this.ldapTemplate.search(se, srch); final List results = srch.getList(); return (Map)DataAccessUtils.uniqueResult(results);
public Map getUserAttributes(final Map seed) { // Checks to make sure the argument & state is valid if (seed == null) throw new IllegalArgumentException("The query seed Map cannot be null."); if (this.ldapContext == null) throw new IllegalStateException("LDAP context is null"); if (this.query == null) throw new IllegalStateException("query is null"); // Ensure the data needed to run the query is avalable if (!((queryAttributes != null && seed.keySet().containsAll(queryAttributes)) || (queryAttributes == null && seed.containsKey(this.getDefaultAttributeName())))) { return null; } try { // Search for the userid in the usercontext subtree of the directory // Use the uidquery substituting username for {0}, {1}, ... final SearchControls sc = new SearchControls(); sc.setSearchScope(SearchControls.SUBTREE_SCOPE); sc.setTimeLimit(this.timeLimit); // Can't just to a toArray here since the order of the keys in the Map // may not match the order of the keys in the List and it is important to // the query. final Object[] args = new Object[this.queryAttributes.size()]; for (int index = 0; index < args.length; index++) { final String attrName = (String) this.queryAttributes.get(index); args[index] = seed.get(attrName); } // Search the LDAP final NamingEnumeration userlist = this.ldapContext.search(this.baseDN, this.query, args, sc); try { if (userlist.hasMoreElements()) { final Map rowResults = new HashMap(); final SearchResult result = (SearchResult) userlist.next(); // Only allow one result for the query, do the check here to // save on attribute processing time. if (userlist.hasMoreElements()) { throw new IncorrectResultSizeDataAccessException("More than one result for ldap person attribute search.", 1, -1); } final Attributes ldapAttributes = result.getAttributes(); // Iterate through the attributes for (final Iterator ldapAttrIter = this.ldapAttributesToPortalAttributes.keySet().iterator(); ldapAttrIter.hasNext();) { final String ldapAttributeName = (String) ldapAttrIter.next(); final Attribute attribute = ldapAttributes.get(ldapAttributeName); // The attribute exists if (attribute != null) { for (final NamingEnumeration attrValueEnum = attribute.getAll(); attrValueEnum.hasMore();) { Object attributeValue = attrValueEnum.next(); // Convert everything except byte[] to String // TODO should we be doing this conversion? if (!(attributeValue instanceof byte[])) { attributeValue = attributeValue.toString(); } // See if the ldap attribute is mapped Set attributeNames = (Set) ldapAttributesToPortalAttributes.get(ldapAttributeName); // No mapping was found, just use the ldap attribute name if (attributeNames == null) attributeNames = Collections.singleton(ldapAttributeName); // Run through the mapped attribute names for (final Iterator attrNameItr = attributeNames .iterator(); attrNameItr.hasNext();) { final String attributeName = (String) attrNameItr .next(); MultivaluedPersonAttributeUtils.addResult(rowResults, attributeName, attributeValue); } } } } return rowResults; } else { return null; } } finally { try { userlist.close(); } catch (final NamingException ne) { log.warn("Error closing ldap person attribute search results.", ne); } } } catch (final Throwable t) { throw new DataAccessResourceFailureException("LDAP person attribute lookup failure.", t); } }
this.ldapAttributesToPortalAttributes = MultivaluedPersonAttributeUtils.parseAttributeToAttributeMapping(ldapAttributesToPortalAttributesArg); final Collection userAttributeCol = MultivaluedPersonAttributeUtils.flattenCollection(this.ldapAttributesToPortalAttributes.values());
final Map ldapAttributesToPortalAttributes = MultivaluedPersonAttributeUtils.parseAttributeToAttributeMapping(ldapAttributesToPortalAttributesArg); this.attributesMapper = new PersonAttributesMapper(ldapAttributesToPortalAttributes); final Collection userAttributeCol = MultivaluedPersonAttributeUtils.flattenCollection(ldapAttributesToPortalAttributes.values());
public void setLdapAttributesToPortalAttributes(final Map ldapAttributesToPortalAttributesArg) { this.ldapAttributesToPortalAttributes = MultivaluedPersonAttributeUtils.parseAttributeToAttributeMapping(ldapAttributesToPortalAttributesArg); final Collection userAttributeCol = MultivaluedPersonAttributeUtils.flattenCollection(this.ldapAttributesToPortalAttributes.values()); this.possibleUserAttributeNames = Collections.unmodifiableSet(new HashSet(userAttributeCol)); }
this.searchControls.setTimeLimit(this.timeLimit);
public void setTimeLimit(int timeLimit) { this.timeLimit = timeLimit; }
sb.append("ldapContext=").append(this.ldapContext);
sb.append("contextSource=").append(this.contextSource);
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(super.toString()); sb.append("["); sb.append("ldapContext=").append(this.ldapContext); sb.append(", timeLimit=").append(this.timeLimit); sb.append(", baseDN=").append(this.baseDN); sb.append(", query=").append(this.query); sb.append(", queryAttributes=").append(this.queryAttributes); sb.append(", ldapAttributesToPortalAttributes=").append(this.ldapAttributesToPortalAttributes); sb.append("]"); return sb.toString(); }
sb.append(", ldapAttributesToPortalAttributes=").append(this.ldapAttributesToPortalAttributes);
sb.append(", ldapAttributesToPortalAttributes=").append(this.getLdapAttributesToPortalAttributes());
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(super.toString()); sb.append("["); sb.append("ldapContext=").append(this.ldapContext); sb.append(", timeLimit=").append(this.timeLimit); sb.append(", baseDN=").append(this.baseDN); sb.append(", query=").append(this.query); sb.append(", queryAttributes=").append(this.queryAttributes); sb.append(", ldapAttributesToPortalAttributes=").append(this.ldapAttributesToPortalAttributes); sb.append("]"); return sb.toString(); }
return new URL((URL)source, info.getInfoURL());
URL context = new URL("jar", "", source.toString() +"!/"); return new URL(context, info.getInfoURL());
public URL getInfoURL() { if (info != null && info.getInfoURL() != null && source instanceof URL) { try { return new URL((URL)source, info.getInfoURL()); } catch (Exception exc) { return null; } } else { return null; } }
exc.printStackTrace();
public URL getInfoURL() { if (info != null && info.getInfoURL() != null && source instanceof URL) { try { return new URL((URL)source, info.getInfoURL()); } catch (Exception exc) { return null; } } else { return null; } }
path.append(mainApp.getIWCacheManager().IW_ROOT_CACHE_DIRECTORY)
path.append(IWCacheManager.IW_ROOT_CACHE_DIRECTORY)
public String getRealPathToReportFile(String fileName, String extension) { IWMainApplication mainApp = getIWApplicationContext().getApplication(); String separator = FileUtil.getFileSeparator(); StringBuffer path = new StringBuffer(mainApp.getApplicationRealPath()); path.append(mainApp.getIWCacheManager().IW_ROOT_CACHE_DIRECTORY) .append(separator) .append(REPORT_FOLDER); // check if the folder exists create it if necessary // usually the folder should be already be there. // the folder is never deleted by this class String folderPath = path.toString(); FileUtil.createFolder(folderPath); path.append(separator) .append(fileName) .append(DOT) .append(extension); return path.toString(); }
String separator = FileUtil.getFileSeparator();
String separator = "/";
private String getURIToReport(String reportName, String extension) { IWMainApplication mainApp = getIWApplicationContext().getApplication(); String separator = FileUtil.getFileSeparator(); String appContextURI = mainApp.getApplicationContextURI(); StringBuffer uri = new StringBuffer(appContextURI); if(!appContextURI.endsWith(separator)){ uri.append(separator); } uri.append(mainApp.getIWCacheManager().IW_ROOT_CACHE_DIRECTORY) .append(separator) .append(REPORT_FOLDER) .append(separator) .append(reportName) .append(DOT) .append(extension); return uri.toString(); }
uri.append(mainApp.getIWCacheManager().IW_ROOT_CACHE_DIRECTORY)
uri.append(IWCacheManager.IW_ROOT_CACHE_DIRECTORY)
private String getURIToReport(String reportName, String extension) { IWMainApplication mainApp = getIWApplicationContext().getApplication(); String separator = FileUtil.getFileSeparator(); String appContextURI = mainApp.getApplicationContextURI(); StringBuffer uri = new StringBuffer(appContextURI); if(!appContextURI.endsWith(separator)){ uri.append(separator); } uri.append(mainApp.getIWCacheManager().IW_ROOT_CACHE_DIRECTORY) .append(separator) .append(REPORT_FOLDER) .append(separator) .append(reportName) .append(DOT) .append(extension); return uri.toString(); }
form.initFields();
initFields(form);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.assignAddingCategory(true); return "continue"; }
logger.error(section.getName()+":"+section.getContents());
logger.debug(section.getName()+":"+section.getContents());
public void report(String message, Throwable e, List sections) throws IOException{ if (e.getCause() != null) { logger.error(message, e.getCause()); } logger.error(message, e); Iterator it = sections.iterator(); while(it.hasNext()) { Section section = (Section)it.next(); logger.error(section.getName()+":"+section.getContents()); } }
public static AbstractNode getLessOrEqualNode(AbstractNode root, Location loc) { AbstractNode smallestSoFar = null; AbstractNode current = root; boolean greater = false; while (current != null && !greater) { if (current.getStart().compareTo(loc) <= 0) smallestSoFar = current; else greater = true; current = getNextNode(current);
public static AbstractNode getLessOrEqualNode(AbstractNode root, int offset, IDocument doc) { try { int line = doc.getLineOfOffset(offset); IRegion r = doc.getLineInformation(line); return getLessOrEqualNode(root, new Location(line, offset - r.getOffset())); } catch (BadLocationException e) { PydevPlugin.log(IStatus.WARNING, "getScopeByOffset failed", e);
public static AbstractNode getLessOrEqualNode(AbstractNode root, Location loc) { AbstractNode smallestSoFar = null; AbstractNode current = root; boolean greater = false; while (current != null && !greater) { if (current.getStart().compareTo(loc) <= 0) smallestSoFar = current; else greater = true; current = getNextNode(current); } return smallestSoFar; }
return smallestSoFar;
return null;
public static AbstractNode getLessOrEqualNode(AbstractNode root, Location loc) { AbstractNode smallestSoFar = null; AbstractNode current = root; boolean greater = false; while (current != null && !greater) { if (current.getStart().compareTo(loc) <= 0) smallestSoFar = current; else greater = true; current = getNextNode(current); } return smallestSoFar; }
public synchronized String getDateString() {
public String getDateString() {
public synchronized String getDateString() { Formatters fmt = getFormatters(); return fmt.shortDateFormatter.format(cal.getTime()); }
return fmt.shortDateFormatter.format(cal.getTime());
synchronized (fmt) { return fmt.shortDateFormatter.format(cal.getTime()); }
public synchronized String getDateString() { Formatters fmt = getFormatters(); return fmt.shortDateFormatter.format(cal.getTime()); }
Formatters fmt = (Formatters)formattersTbl.get(loc); if (fmt == null) { fmt = new Formatters(loc); formattersTbl.put(loc, fmt); } return fmt;
return getFormatters(loc);
private Formatters getFormatters() { Locale loc = calInfo.getLocale(); Formatters fmt = (Formatters)formattersTbl.get(loc); if (fmt == null) { fmt = new Formatters(loc); formattersTbl.put(loc, fmt); } return fmt; }
public synchronized String getLongDateString() {
public String getLongDateString() {
public synchronized String getLongDateString() { Formatters fmt = getFormatters(); return fmt.longDateFormatter.format(cal.getTime()); }
return fmt.longDateFormatter.format(cal.getTime());
synchronized (fmt) { return fmt.longDateFormatter.format(cal.getTime()); }
public synchronized String getLongDateString() { Formatters fmt = getFormatters(); return fmt.longDateFormatter.format(cal.getTime()); }
public synchronized String getMonthName() {
public String getMonthName() {
public synchronized String getMonthName() { Formatters fmt = getFormatters(); FieldPosition f = new FieldPosition(DateFormat.MONTH_FIELD); StringBuffer s = fmt.longDateFormatter.format(cal.getTime(), new StringBuffer(), f); return s.substring(f.getBeginIndex(), f.getEndIndex()); }
StringBuffer s = fmt.longDateFormatter.format(cal.getTime(), new StringBuffer(), f); return s.substring(f.getBeginIndex(), f.getEndIndex());
synchronized (fmt) { StringBuffer s = fmt.longDateFormatter.format(cal.getTime(), new StringBuffer(), f); return s.substring(f.getBeginIndex(), f.getEndIndex()); }
public synchronized String getMonthName() { Formatters fmt = getFormatters(); FieldPosition f = new FieldPosition(DateFormat.MONTH_FIELD); StringBuffer s = fmt.longDateFormatter.format(cal.getTime(), new StringBuffer(), f); return s.substring(f.getBeginIndex(), f.getEndIndex()); }
public synchronized String getTimeString() {
public String getTimeString() {
public synchronized String getTimeString() { Formatters fmt = getFormatters(); return fmt.shortTimeFormatter.format(cal.getTime()); }
return fmt.shortTimeFormatter.format(cal.getTime());
synchronized (fmt) { return fmt.shortTimeFormatter.format(cal.getTime()); }
public synchronized String getTimeString() { Formatters fmt = getFormatters(); return fmt.shortTimeFormatter.format(cal.getTime()); }
globals.ownersTbl.put(entity);
public void end(String ns, String name) throws Exception { BwUser entity = (BwUser)pop(); globals.users++; if (globals.config.getFrom2p3px()) { entity.setCategoryAccess(globals.getDefaultPersonalAccess()); entity.setLocationAccess(globals.getDefaultPersonalAccess()); entity.setSponsorAccess(globals.getDefaultPersonalAccess()); entity.setQuota(globals.syspars.getDefaultUserQuota()); } globals.usersTbl.put(entity); try { if (globals.rintf != null) { globals.rintf.restoreUser(entity); } } catch (Throwable t) { throw new Exception(t); } }
Object[] options = new String[3]; options[0] = "Replace"; options[1] = "Choose Again"; options[2] = "Cancel"; int n = JOptionPane.showOptionDialog(display,
String[] options = {"Yes", "No", "Choose again"}; int n = JOptionPane.showOptionDialog(null,
private String chooseOutputFile(String extension) { final JFileChooser fc; if (lastSaveLocation != null) { fc = new JFileChooser(lastSaveLocation); } else { fc = new JFileChooser(); } String extensions[] = new String[1]; extensions[0] = extension; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("Save to File"); fc.setSelectedFile(new File("output."+extension)); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); lastSaveLocation = file.getParentFile(); String newExtension = file.getName().substring(file.getName().lastIndexOf(".")+1); if ( ! newExtension.equalsIgnoreCase(extension)) { // add extension to end file = new File(file.getAbsolutePath()+"."+extension); } if (file.exists()) { Object[] options = new String[3]; options[0] = "Replace"; options[1] = "Choose Again"; options[2] = "Cancel"; int n = JOptionPane.showOptionDialog(display, "File "+file.getName()+" exists, replace?", "File Exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, //don't use a custom Icon options, //the titles of buttons options[0]); //default button title); if (n == JOptionPane.CANCEL_OPTION) { return null; } else if (n == JOptionPane.CANCEL_OPTION) { return chooseOutputFile(extension); } // ok to replace... } String fileName = file.getAbsolutePath(); return file.getAbsolutePath(); } else { //log.append("Open command cancelled by user."); } return null; }
null, options, options[0]); if (n == JOptionPane.CANCEL_OPTION) {
null, options, options[0]); if (n == JOptionPane.NO_OPTION) {
private String chooseOutputFile(String extension) { final JFileChooser fc; if (lastSaveLocation != null) { fc = new JFileChooser(lastSaveLocation); } else { fc = new JFileChooser(); } String extensions[] = new String[1]; extensions[0] = extension; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("Save to File"); fc.setSelectedFile(new File("output."+extension)); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); lastSaveLocation = file.getParentFile(); String newExtension = file.getName().substring(file.getName().lastIndexOf(".")+1); if ( ! newExtension.equalsIgnoreCase(extension)) { // add extension to end file = new File(file.getAbsolutePath()+"."+extension); } if (file.exists()) { Object[] options = new String[3]; options[0] = "Replace"; options[1] = "Choose Again"; options[2] = "Cancel"; int n = JOptionPane.showOptionDialog(display, "File "+file.getName()+" exists, replace?", "File Exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, //don't use a custom Icon options, //the titles of buttons options[0]); //default button title); if (n == JOptionPane.CANCEL_OPTION) { return null; } else if (n == JOptionPane.CANCEL_OPTION) { return chooseOutputFile(extension); } // ok to replace... } String fileName = file.getAbsolutePath(); return file.getAbsolutePath(); } else { //log.append("Open command cancelled by user."); } return null; }
String fileName = file.getAbsolutePath();
private String chooseOutputFile(String extension) { final JFileChooser fc; if (lastSaveLocation != null) { fc = new JFileChooser(lastSaveLocation); } else { fc = new JFileChooser(); } String extensions[] = new String[1]; extensions[0] = extension; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("Save to File"); fc.setSelectedFile(new File("output."+extension)); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); lastSaveLocation = file.getParentFile(); String newExtension = file.getName().substring(file.getName().lastIndexOf(".")+1); if ( ! newExtension.equalsIgnoreCase(extension)) { // add extension to end file = new File(file.getAbsolutePath()+"."+extension); } if (file.exists()) { Object[] options = new String[3]; options[0] = "Replace"; options[1] = "Choose Again"; options[2] = "Cancel"; int n = JOptionPane.showOptionDialog(display, "File "+file.getName()+" exists, replace?", "File Exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, //don't use a custom Icon options, //the titles of buttons options[0]); //default button title); if (n == JOptionPane.CANCEL_OPTION) { return null; } else if (n == JOptionPane.CANCEL_OPTION) { return chooseOutputFile(extension); } // ok to replace... } String fileName = file.getAbsolutePath(); return file.getAbsolutePath(); } else { //log.append("Open command cancelled by user."); } return null; }
} else {
private String chooseOutputFile(String extension) { final JFileChooser fc; if (lastSaveLocation != null) { fc = new JFileChooser(lastSaveLocation); } else { fc = new JFileChooser(); } String extensions[] = new String[1]; extensions[0] = extension; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("Save to File"); fc.setSelectedFile(new File("output."+extension)); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); lastSaveLocation = file.getParentFile(); String newExtension = file.getName().substring(file.getName().lastIndexOf(".")+1); if ( ! newExtension.equalsIgnoreCase(extension)) { // add extension to end file = new File(file.getAbsolutePath()+"."+extension); } if (file.exists()) { Object[] options = new String[3]; options[0] = "Replace"; options[1] = "Choose Again"; options[2] = "Cancel"; int n = JOptionPane.showOptionDialog(display, "File "+file.getName()+" exists, replace?", "File Exists", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, //don't use a custom Icon options, //the titles of buttons options[0]); //default button title); if (n == JOptionPane.CANCEL_OPTION) { return null; } else if (n == JOptionPane.CANCEL_OPTION) { return chooseOutputFile(extension); } // ok to replace... } String fileName = file.getAbsolutePath(); return file.getAbsolutePath(); } else { //log.append("Open command cancelled by user."); } return null; }
final int numOfSeis = numSeis; final JDialog dialog = new JDialog(); dialog.getContentPane().setLayout(new BorderLayout()); dialog.setTitle("Printing Options"); dialog.setModal(true); JLabel information = new JLabel("Seismograms per page: "); Integer[] numbers = new Integer[numOfSeis]; for(int i = 0; i < numOfSeis; i++){ numbers[i] = new Integer(i + 1); } final JComboBox options = new JComboBox(numbers); options.setEditable(true); options.setMaximumSize(options.getMinimumSize()); options.setPreferredSize(options.getMinimumSize()); if(numOfSeis < imagesPerPage){ imagesPerPage = numOfSeis; } options.setSelectedIndex(imagesPerPage-1); JButton next = new JButton("Next"); next.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected can be at most " + numOfSeis, "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber);
if(!seisPerPageSet){ final int numOfSeis = numSeis; final JDialog dialog = new JDialog(); dialog.getContentPane().setLayout(new BorderLayout()); dialog.setTitle("Printing Options"); dialog.setModal(true); JLabel information = new JLabel("Seismograms per page: "); Integer[] numbers = new Integer[numOfSeis]; for(int i = 0; i < numOfSeis; i++){ numbers[i] = new Integer(i + 1); } final JComboBox options = new JComboBox(numbers); options.setEditable(true); options.setMaximumSize(options.getMinimumSize()); options.setPreferredSize(options.getMinimumSize()); if(numOfSeis < imagesPerPage){ imagesPerPage = numOfSeis; } options.setSelectedIndex(imagesPerPage-1); JButton next = new JButton("Next"); next.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected can be at most " + numOfSeis, "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){
private void getImagesPerPage(int numSeis){ final int numOfSeis = numSeis; final JDialog dialog = new JDialog(); dialog.getContentPane().setLayout(new BorderLayout()); dialog.setTitle("Printing Options"); dialog.setModal(true); JLabel information = new JLabel("Seismograms per page: "); Integer[] numbers = new Integer[numOfSeis];//to initialize the combo box with correct values for(int i = 0; i < numOfSeis; i++){ numbers[i] = new Integer(i + 1); } final JComboBox options = new JComboBox(numbers); options.setEditable(true); options.setMaximumSize(options.getMinimumSize()); options.setPreferredSize(options.getMinimumSize()); if(numOfSeis < imagesPerPage){ imagesPerPage = numOfSeis; } options.setSelectedIndex(imagesPerPage-1); JButton next = new JButton("Next"); next.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected can be at most " + numOfSeis, "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dialog.dispose(); } }); JPanel north = new JPanel(new BorderLayout()); north.setBorder(EMPTY_BORDER); north.add(information, BorderLayout.WEST); north.add(options, BorderLayout.EAST); JPanel south = new JPanel(new BorderLayout()); south.setBorder(EMPTY_BORDER); south.add(cancel, BorderLayout.WEST); south.add(next, BorderLayout.EAST); dialog.getContentPane().add(north, BorderLayout.NORTH); dialog.getContentPane().add(south, BorderLayout.SOUTH); Toolkit tk = Toolkit.getDefaultToolkit(); dialog.setLocation(tk.getScreenSize().width/2, tk.getScreenSize().height/2); dialog.pack(); dialog.show(); }
} }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dialog.dispose(); } }); JPanel north = new JPanel(new BorderLayout()); north.setBorder(EMPTY_BORDER); north.add(information, BorderLayout.WEST); north.add(options, BorderLayout.EAST); JPanel south = new JPanel(new BorderLayout()); south.setBorder(EMPTY_BORDER); south.add(cancel, BorderLayout.WEST); south.add(next, BorderLayout.EAST); dialog.getContentPane().add(north, BorderLayout.NORTH); dialog.getContentPane().add(south, BorderLayout.SOUTH); Toolkit tk = Toolkit.getDefaultToolkit(); dialog.setLocation(tk.getScreenSize().width/2, tk.getScreenSize().height/2); dialog.pack(); dialog.show();
}); JPanel north = new JPanel(new BorderLayout()); north.setBorder(EMPTY_BORDER); north.add(information, BorderLayout.WEST); north.add(options, BorderLayout.EAST); JPanel south = new JPanel(new BorderLayout()); south.setBorder(EMPTY_BORDER); south.add(cancel, BorderLayout.WEST); south.add(next, BorderLayout.EAST); dialog.getContentPane().add(north, BorderLayout.NORTH); dialog.getContentPane().add(south, BorderLayout.SOUTH); dialog.pack(); Toolkit tk = Toolkit.getDefaultToolkit(); dialog.setLocation((tk.getScreenSize().width - dialog.getWidth())/2, (tk.getScreenSize().height - dialog.getHeight())/2); dialog.show(); }
private void getImagesPerPage(int numSeis){ final int numOfSeis = numSeis; final JDialog dialog = new JDialog(); dialog.getContentPane().setLayout(new BorderLayout()); dialog.setTitle("Printing Options"); dialog.setModal(true); JLabel information = new JLabel("Seismograms per page: "); Integer[] numbers = new Integer[numOfSeis];//to initialize the combo box with correct values for(int i = 0; i < numOfSeis; i++){ numbers[i] = new Integer(i + 1); } final JComboBox options = new JComboBox(numbers); options.setEditable(true); options.setMaximumSize(options.getMinimumSize()); options.setPreferredSize(options.getMinimumSize()); if(numOfSeis < imagesPerPage){ imagesPerPage = numOfSeis; } options.setSelectedIndex(imagesPerPage-1); JButton next = new JButton("Next"); next.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected can be at most " + numOfSeis, "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ dialog.dispose(); } }); JPanel north = new JPanel(new BorderLayout()); north.setBorder(EMPTY_BORDER); north.add(information, BorderLayout.WEST); north.add(options, BorderLayout.EAST); JPanel south = new JPanel(new BorderLayout()); south.setBorder(EMPTY_BORDER); south.add(cancel, BorderLayout.WEST); south.add(next, BorderLayout.EAST); dialog.getContentPane().add(north, BorderLayout.NORTH); dialog.getContentPane().add(south, BorderLayout.SOUTH); Toolkit tk = Toolkit.getDefaultToolkit(); dialog.setLocation(tk.getScreenSize().width/2, tk.getScreenSize().height/2); dialog.pack(); dialog.show(); }
int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected can be at most " + numOfSeis, "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose();
int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected can be at most " + numOfSeis, "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); }
public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected can be at most " + numOfSeis, "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } }
}
public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected can be at most " + numOfSeis, "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } }
semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.ProfileContentsEditPart.VISUAL_ID);
semanticHint = UMLVisualIDRegistry.getType(ProfileContentsEditPart.VISUAL_ID);
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { if (semanticHint == null) { semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.ProfileContentsEditPart.VISUAL_ID); view.setType(semanticHint); } super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); setupCompartmentTitle(view); setupCompartmentCollapsed(view); if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", ProfileEditPart.MODEL_ID); //$NON-NLS-1$ view.getEAnnotations().add(shortcutAnnotation); } }
if (event == null) { event = new BwEventObj(); eventInfo = new EventInfo(event); } return event;
return getEditEvent();
public BwEvent getEvent() { if (event == null) { event = new BwEventObj(); eventInfo = new EventInfo(event); } return event; }
event = val; try { if (val == null) { getEventDates().setNewEvent(getEvent(), fetchSvci().getTimezones()); } else { getEventDates().setFromEvent(getEvent(), fetchSvci().getTimezones()); } } catch (Throwable t) { err.emit(t); } if (debug) { debugMsg("setEvent(), dates=" + getEventDates()); } resetEvent();
setEditEvent(val);
public void setEvent(BwEvent val) { event = val; try { if (val == null) { getEventDates().setNewEvent(getEvent(), fetchSvci().getTimezones()); } else { getEventDates().setFromEvent(getEvent(), fetchSvci().getTimezones()); } } catch (Throwable t) { err.emit(t); } if (debug) { debugMsg("setEvent(), dates=" + getEventDates()); } resetEvent(); }
this(name, description, false, false, index);
this.name = name; this.description = description; this.abstractPriv = abstractPriv; this.denial = denial; setIndex(index);
public Privilege(String name, String description, int index) { this(name, description, false, false, index); }
public void addContainedPrivilege(Privilege val) {
void addContainedPrivilege(Privilege val) {
public void addContainedPrivilege(Privilege val) { containedPrivileges.add(val); }
if(file.isDirectory()) {
if(batch) { finished = processBatchRefTek(file, verbose, conn, ncFile, jdbcSeisFile, chanTable); } else if(file.isDirectory()) {
public static void main(String[] args) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); boolean verbose = false; boolean finished = false; NCFile ncFile = null; for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; } } for(int i = 1; i < args.length - 1; i++) { if(args[i].equals("-nc")) { String ncFileLocation = args[i + 1]; ncFile = new NCFile(ncFileLocation); } } if(args.length > 0) { ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); String fileLoc = args[args.length - 1]; File file = new File(fileLoc); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCChannel chanTable = new JDBCChannel(conn); if(file.isDirectory()) { finished = readEntireDirectory(fileLoc, verbose, conn, ncFile, fileLoc, jdbcSeisFile, chanTable); } else { File seismogramFile = new File(fileLoc); File dataStream = new File(seismogramFile.getParent()); File unitId = new File(dataStream.getParent()); finished = readSingleFile(fileLoc, verbose, conn, ncFile, unitId.getAbsolutePath(), jdbcSeisFile, chanTable); } } if(finished) { System.out.println(); System.out.println("Database population complete."); System.out.println(); } else { printHelp(); } }
fileLoc,
public static void main(String[] args) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); boolean verbose = false; boolean finished = false; NCFile ncFile = null; for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; } } for(int i = 1; i < args.length - 1; i++) { if(args[i].equals("-nc")) { String ncFileLocation = args[i + 1]; ncFile = new NCFile(ncFileLocation); } } if(args.length > 0) { ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); String fileLoc = args[args.length - 1]; File file = new File(fileLoc); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCChannel chanTable = new JDBCChannel(conn); if(file.isDirectory()) { finished = readEntireDirectory(fileLoc, verbose, conn, ncFile, fileLoc, jdbcSeisFile, chanTable); } else { File seismogramFile = new File(fileLoc); File dataStream = new File(seismogramFile.getParent()); File unitId = new File(dataStream.getParent()); finished = readSingleFile(fileLoc, verbose, conn, ncFile, unitId.getAbsolutePath(), jdbcSeisFile, chanTable); } } if(finished) { System.out.println(); System.out.println("Database population complete."); System.out.println(); } else { printHelp(); } }
chanTable);
chanTable, props);
public static void main(String[] args) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); boolean verbose = false; boolean finished = false; NCFile ncFile = null; for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; } } for(int i = 1; i < args.length - 1; i++) { if(args[i].equals("-nc")) { String ncFileLocation = args[i + 1]; ncFile = new NCFile(ncFileLocation); } } if(args.length > 0) { ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); String fileLoc = args[args.length - 1]; File file = new File(fileLoc); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCChannel chanTable = new JDBCChannel(conn); if(file.isDirectory()) { finished = readEntireDirectory(fileLoc, verbose, conn, ncFile, fileLoc, jdbcSeisFile, chanTable); } else { File seismogramFile = new File(fileLoc); File dataStream = new File(seismogramFile.getParent()); File unitId = new File(dataStream.getParent()); finished = readSingleFile(fileLoc, verbose, conn, ncFile, unitId.getAbsolutePath(), jdbcSeisFile, chanTable); } } if(finished) { System.out.println(); System.out.println("Database population complete."); System.out.println(); } else { printHelp(); } }
File seismogramFile = new File(fileLoc); File dataStream = new File(seismogramFile.getParent()); File unitId = new File(dataStream.getParent());
public static void main(String[] args) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); boolean verbose = false; boolean finished = false; NCFile ncFile = null; for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; } } for(int i = 1; i < args.length - 1; i++) { if(args[i].equals("-nc")) { String ncFileLocation = args[i + 1]; ncFile = new NCFile(ncFileLocation); } } if(args.length > 0) { ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); String fileLoc = args[args.length - 1]; File file = new File(fileLoc); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCChannel chanTable = new JDBCChannel(conn); if(file.isDirectory()) { finished = readEntireDirectory(fileLoc, verbose, conn, ncFile, fileLoc, jdbcSeisFile, chanTable); } else { File seismogramFile = new File(fileLoc); File dataStream = new File(seismogramFile.getParent()); File unitId = new File(dataStream.getParent()); finished = readSingleFile(fileLoc, verbose, conn, ncFile, unitId.getAbsolutePath(), jdbcSeisFile, chanTable); } } if(finished) { System.out.println(); System.out.println("Database population complete."); System.out.println(); } else { printHelp(); } }
unitId.getAbsolutePath(),
public static void main(String[] args) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); boolean verbose = false; boolean finished = false; NCFile ncFile = null; for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; } } for(int i = 1; i < args.length - 1; i++) { if(args[i].equals("-nc")) { String ncFileLocation = args[i + 1]; ncFile = new NCFile(ncFileLocation); } } if(args.length > 0) { ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); String fileLoc = args[args.length - 1]; File file = new File(fileLoc); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCChannel chanTable = new JDBCChannel(conn); if(file.isDirectory()) { finished = readEntireDirectory(fileLoc, verbose, conn, ncFile, fileLoc, jdbcSeisFile, chanTable); } else { File seismogramFile = new File(fileLoc); File dataStream = new File(seismogramFile.getParent()); File unitId = new File(dataStream.getParent()); finished = readSingleFile(fileLoc, verbose, conn, ncFile, unitId.getAbsolutePath(), jdbcSeisFile, chanTable); } } if(finished) { System.out.println(); System.out.println("Database population complete."); System.out.println(); } else { printHelp(); } }
} else { printHelp();
public static void main(String[] args) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); boolean verbose = false; boolean finished = false; NCFile ncFile = null; for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; } } for(int i = 1; i < args.length - 1; i++) { if(args[i].equals("-nc")) { String ncFileLocation = args[i + 1]; ncFile = new NCFile(ncFileLocation); } } if(args.length > 0) { ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); String fileLoc = args[args.length - 1]; File file = new File(fileLoc); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCChannel chanTable = new JDBCChannel(conn); if(file.isDirectory()) { finished = readEntireDirectory(fileLoc, verbose, conn, ncFile, fileLoc, jdbcSeisFile, chanTable); } else { File seismogramFile = new File(fileLoc); File dataStream = new File(seismogramFile.getParent()); File unitId = new File(dataStream.getParent()); finished = readSingleFile(fileLoc, verbose, conn, ncFile, unitId.getAbsolutePath(), jdbcSeisFile, chanTable); } } if(finished) { System.out.println(); System.out.println("Database population complete."); System.out.println(); } else { printHelp(); } }
System.out.println(" -rt | Batch process of RT130 data"); System.out.println(" | No other types of data can be processed");
private static void printHelp() { System.out.println(); System.out.println(" The last argument must be a directory or file location."); System.out.println(" The default SOD properties file is server.properties."); System.out.println(" The default database properties file is server.properties."); System.out.println(); System.out.println(" -props | Accepts alternate SOD properties file"); System.out.println(" -hsql | Accepts alternate database properties file"); System.out.println(" -v | Turn verbose messages on"); System.out.println(); System.out.println(" Props file time format | yyyy-MM-dd'T'HH:mm:ss.SSSZ"); System.out.println(); System.out.println("Program finished before database population was completed."); System.out.println(); }
String absoluteBaseDirectory,
private static boolean readEntireDirectory(String baseDirectory, boolean verbose, Connection conn, NCFile ncFile, String absoluteBaseDirectory, JDBCSeismogramFiles jdbcSeisFile, JDBCChannel chanTable) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { File[] files = new File(baseDirectory).listFiles(); for(int i = 0; i < files.length; i++) { if(files[i].isDirectory()) { readEntireDirectory(baseDirectory + files[i].getName() + "/", verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } else { readSingleFile(files[i].getAbsolutePath(), verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } } return true; }
JDBCChannel chanTable)
JDBCChannel chanTable, Properties props)
private static boolean readEntireDirectory(String baseDirectory, boolean verbose, Connection conn, NCFile ncFile, String absoluteBaseDirectory, JDBCSeismogramFiles jdbcSeisFile, JDBCChannel chanTable) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { File[] files = new File(baseDirectory).listFiles(); for(int i = 0; i < files.length; i++) { if(files[i].isDirectory()) { readEntireDirectory(baseDirectory + files[i].getName() + "/", verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } else { readSingleFile(files[i].getAbsolutePath(), verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } } return true; }
absoluteBaseDirectory,
private static boolean readEntireDirectory(String baseDirectory, boolean verbose, Connection conn, NCFile ncFile, String absoluteBaseDirectory, JDBCSeismogramFiles jdbcSeisFile, JDBCChannel chanTable) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { File[] files = new File(baseDirectory).listFiles(); for(int i = 0; i < files.length; i++) { if(files[i].isDirectory()) { readEntireDirectory(baseDirectory + files[i].getName() + "/", verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } else { readSingleFile(files[i].getAbsolutePath(), verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } } return true; }
chanTable);
chanTable, props);
private static boolean readEntireDirectory(String baseDirectory, boolean verbose, Connection conn, NCFile ncFile, String absoluteBaseDirectory, JDBCSeismogramFiles jdbcSeisFile, JDBCChannel chanTable) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { File[] files = new File(baseDirectory).listFiles(); for(int i = 0; i < files.length; i++) { if(files[i].isDirectory()) { readEntireDirectory(baseDirectory + files[i].getName() + "/", verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } else { readSingleFile(files[i].getAbsolutePath(), verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } } return true; }
readSingleFile(files[i].getAbsolutePath(),
readSingleFile(files[i].getCanonicalPath(),
private static boolean readEntireDirectory(String baseDirectory, boolean verbose, Connection conn, NCFile ncFile, String absoluteBaseDirectory, JDBCSeismogramFiles jdbcSeisFile, JDBCChannel chanTable) throws FissuresException, IOException, SeedFormatException, SQLException, NotFound { File[] files = new File(baseDirectory).listFiles(); for(int i = 0; i < files.length; i++) { if(files[i].isDirectory()) { readEntireDirectory(baseDirectory + files[i].getName() + "/", verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } else { readSingleFile(files[i].getAbsolutePath(), verbose, conn, ncFile, absoluteBaseDirectory, jdbcSeisFile, chanTable); } } return true; }
String absoluteBaseDirectory,
private static boolean readSingleFile(String fileLoc, boolean verbose, Connection conn, NCFile ncFile, String absoluteBaseDirectory, JDBCSeismogramFiles jdbcSeisFile, JDBCChannel chanTable) throws IOException, FissuresException, SeedFormatException, SQLException, NotFound { boolean finished = false; StringTokenizer t = new StringTokenizer(fileLoc, "/\\"); String fileName = ""; while(t.hasMoreTokens()) { fileName = t.nextToken(); } if(fileName.length() == 18 && fileName.charAt(9) == '_') { finished = processRefTek(jdbcSeisFile, conn, fileLoc, fileName, verbose, ncFile, absoluteBaseDirectory, chanTable); } else if(fileName.endsWith(".mseed")) { finished = processMSeed(jdbcSeisFile, fileLoc, fileName, verbose); } else if(fileName.endsWith(".sac")) { finished = processSac(jdbcSeisFile, fileLoc, fileName, verbose); } else if(fileName.equals("SOH.RT")) { if(verbose) { System.out.println("Ignoring State of Health file " + fileName + "."); } } else { if(verbose) { System.out.println(fileName + " can not be processed because it's file" + " name is not formatted correctly, and therefore" + " is assumed to be an invalid file format. If" + " the data file format is valid (mini seed, sac, rt130)" + " try renaming the file."); } } return finished; }
JDBCChannel chanTable)
JDBCChannel chanTable, Properties props)
private static boolean readSingleFile(String fileLoc, boolean verbose, Connection conn, NCFile ncFile, String absoluteBaseDirectory, JDBCSeismogramFiles jdbcSeisFile, JDBCChannel chanTable) throws IOException, FissuresException, SeedFormatException, SQLException, NotFound { boolean finished = false; StringTokenizer t = new StringTokenizer(fileLoc, "/\\"); String fileName = ""; while(t.hasMoreTokens()) { fileName = t.nextToken(); } if(fileName.length() == 18 && fileName.charAt(9) == '_') { finished = processRefTek(jdbcSeisFile, conn, fileLoc, fileName, verbose, ncFile, absoluteBaseDirectory, chanTable); } else if(fileName.endsWith(".mseed")) { finished = processMSeed(jdbcSeisFile, fileLoc, fileName, verbose); } else if(fileName.endsWith(".sac")) { finished = processSac(jdbcSeisFile, fileLoc, fileName, verbose); } else if(fileName.equals("SOH.RT")) { if(verbose) { System.out.println("Ignoring State of Health file " + fileName + "."); } } else { if(verbose) { System.out.println(fileName + " can not be processed because it's file" + " name is not formatted correctly, and therefore" + " is assumed to be an invalid file format. If" + " the data file format is valid (mini seed, sac, rt130)" + " try renaming the file."); } } return finished; }
finished = processRefTek(jdbcSeisFile, conn, fileLoc, fileName, verbose, ncFile, absoluteBaseDirectory, chanTable);
finished = processSingleRefTek(jdbcSeisFile, conn, fileLoc, fileName, verbose, ncFile, chanTable, props);
private static boolean readSingleFile(String fileLoc, boolean verbose, Connection conn, NCFile ncFile, String absoluteBaseDirectory, JDBCSeismogramFiles jdbcSeisFile, JDBCChannel chanTable) throws IOException, FissuresException, SeedFormatException, SQLException, NotFound { boolean finished = false; StringTokenizer t = new StringTokenizer(fileLoc, "/\\"); String fileName = ""; while(t.hasMoreTokens()) { fileName = t.nextToken(); } if(fileName.length() == 18 && fileName.charAt(9) == '_') { finished = processRefTek(jdbcSeisFile, conn, fileLoc, fileName, verbose, ncFile, absoluteBaseDirectory, chanTable); } else if(fileName.endsWith(".mseed")) { finished = processMSeed(jdbcSeisFile, fileLoc, fileName, verbose); } else if(fileName.endsWith(".sac")) { finished = processSac(jdbcSeisFile, fileLoc, fileName, verbose); } else if(fileName.equals("SOH.RT")) { if(verbose) { System.out.println("Ignoring State of Health file " + fileName + "."); } } else { if(verbose) { System.out.println(fileName + " can not be processed because it's file" + " name is not formatted correctly, and therefore" + " is assumed to be an invalid file format. If" + " the data file format is valid (mini seed, sac, rt130)" + " try renaming the file."); } } return finished; }
} else if(fileName.equals("SOH.RT")) { if(verbose) { System.out.println("Ignoring State of Health file " + fileName + "."); } } else { if(verbose) {
} else if(verbose) { if(fileName.equals("SOH.RT")) { System.out.println("Ignoring file: " + fileName + "."); } else if(fileName.equals(".DS_Store")) { System.out.println("Ignoring Mac OS X file: " + fileName + "."); } else {
private static boolean readSingleFile(String fileLoc, boolean verbose, Connection conn, NCFile ncFile, String absoluteBaseDirectory, JDBCSeismogramFiles jdbcSeisFile, JDBCChannel chanTable) throws IOException, FissuresException, SeedFormatException, SQLException, NotFound { boolean finished = false; StringTokenizer t = new StringTokenizer(fileLoc, "/\\"); String fileName = ""; while(t.hasMoreTokens()) { fileName = t.nextToken(); } if(fileName.length() == 18 && fileName.charAt(9) == '_') { finished = processRefTek(jdbcSeisFile, conn, fileLoc, fileName, verbose, ncFile, absoluteBaseDirectory, chanTable); } else if(fileName.endsWith(".mseed")) { finished = processMSeed(jdbcSeisFile, fileLoc, fileName, verbose); } else if(fileName.endsWith(".sac")) { finished = processSac(jdbcSeisFile, fileLoc, fileName, verbose); } else if(fileName.equals("SOH.RT")) { if(verbose) { System.out.println("Ignoring State of Health file " + fileName + "."); } } else { if(verbose) { System.out.println(fileName + " can not be processed because it's file" + " name is not formatted correctly, and therefore" + " is assumed to be an invalid file format. If" + " the data file format is valid (mini seed, sac, rt130)" + " try renaming the file."); } } return finished; }
public void saveSeismogramToDatabase(Channel channel,
public void saveSeismogramToDatabase(ChannelId channelId,
public void saveSeismogramToDatabase(Channel channel, LocalSeismogramImpl seis, String fileLocation, SeismogramFileTypes filetype) throws SQLException { // Get absolute file path out of the file path given File seismogramFile = new File(fileLocation); String absoluteFilePath = seismogramFile.getPath(); insert.setInt(1, chanTable.put(channel)); insert.setInt(2, timeTable.put(seis.getBeginTime().getFissuresTime())); insert.setInt(3, timeTable.put(seis.getEndTime().getFissuresTime())); insert.setString(4, absoluteFilePath); insert.setInt(5, filetype.getIntValue()); insert.executeUpdate(); }
throws SQLException {
throws SQLException, IOException { int channel_id = chanTable.put(channelId); int begin_time_id = timeTable.put(seis.getBeginTime().getFissuresTime()); int end_time_id = timeTable.put(seis.getEndTime().getFissuresTime());
public void saveSeismogramToDatabase(Channel channel, LocalSeismogramImpl seis, String fileLocation, SeismogramFileTypes filetype) throws SQLException { // Get absolute file path out of the file path given File seismogramFile = new File(fileLocation); String absoluteFilePath = seismogramFile.getPath(); insert.setInt(1, chanTable.put(channel)); insert.setInt(2, timeTable.put(seis.getBeginTime().getFissuresTime())); insert.setInt(3, timeTable.put(seis.getEndTime().getFissuresTime())); insert.setString(4, absoluteFilePath); insert.setInt(5, filetype.getIntValue()); insert.executeUpdate(); }
String absoluteFilePath = seismogramFile.getPath(); insert.setInt(1, chanTable.put(channel)); insert.setInt(2, timeTable.put(seis.getBeginTime().getFissuresTime())); insert.setInt(3, timeTable.put(seis.getEndTime().getFissuresTime())); insert.setString(4, absoluteFilePath); insert.setInt(5, filetype.getIntValue()); insert.executeUpdate();
String absoluteFilePath = seismogramFile.getCanonicalPath(); int fileTypeInt = filetype.getIntValue(); selectSeismogram.setInt(1, channel_id); selectSeismogram.setString(2, absoluteFilePath); ResultSet results = selectSeismogram.executeQuery(); if(results.next()) { } else { insert.setInt(1, channel_id); insert.setInt(2, begin_time_id); insert.setInt(3, end_time_id); insert.setString(4, absoluteFilePath); insert.setInt(5, fileTypeInt); insert.executeUpdate(); }
public void saveSeismogramToDatabase(Channel channel, LocalSeismogramImpl seis, String fileLocation, SeismogramFileTypes filetype) throws SQLException { // Get absolute file path out of the file path given File seismogramFile = new File(fileLocation); String absoluteFilePath = seismogramFile.getPath(); insert.setInt(1, chanTable.put(channel)); insert.setInt(2, timeTable.put(seis.getBeginTime().getFissuresTime())); insert.setInt(3, timeTable.put(seis.getEndTime().getFissuresTime())); insert.setString(4, absoluteFilePath); insert.setInt(5, filetype.getIntValue()); insert.executeUpdate(); }
Object val) throws CalFacadeException {
Object val, boolean debug) throws CalFacadeException {
public void initialise(String userid, CallBack cb, Object val) throws CalFacadeException { throw new CalFacadeException("Method not accessible"); }
mailer = (MailerIntf)CalEnv.getGlobalObject("mailerclass",
mailer = (MailerIntf)CalEnvFactory.getEnv(null, debug).getGlobalObject("mailerclass",
public MailerIntf getMailer() { if (mailer != null) { return mailer; } try { mailer = (MailerIntf)CalEnv.getGlobalObject("mailerclass", MailerIntf.class); mailer.init(svci, debug); } catch (Throwable t) { error(t); } return mailer; }
taggedEntityId("owner", entity.getOwner());
ownerKey(entity.getOwner());
protected void ownedEntityTags(BwOwnedDbentity entity) throws Throwable { taggedEntityId(entity); taggedEntityId("owner", entity.getOwner()); taggedVal("public", entity.getPublick()); }
taggedVal("owner-account", val.getAccount()); taggedVal("owner-kind", val.getKind());
tagStart("owner-key"); taggedVal("account", val.getAccount()); taggedVal("kind", val.getKind()); tagEnd("owner-key");
protected void ownerKey(BwPrincipal val) throws Throwable { taggedVal("owner-account", val.getAccount()); taggedVal("owner-kind", val.getKind()); }
ical = new Calendar();
ical = IcalTranslator.newIcal();
public void setFreeBusy(BwFreeBusy fb) throws WebdavIntfException { try { VFreeBusy vfreeBusy = VFreeUtil.toVFreeBusy(fb); if (vfreeBusy != null) { ical = new Calendar(); ical.getComponents().add(vfreeBusy); vfreeBusyString = ical.toString(); contentLen = vfreeBusyString.length(); } else { vfreeBusyString = null; contentLen = 0; } allowsGet = true; } catch (Throwable t) { if (debug) { error(t); } throw new WebdavIntfException(t); } }
sess.getTransaction().commit();
private synchronized void closeSess() throws Throwable {// sess.commit(); try { if (sess != null) { sess.close(); // sess.disconnect(); } // } catch (Throwable t) { // Discard session if we get errors on close.// sess = null; } finally { sess = null; } }
openSess(); closeSess();
public void open() throws Throwable { openSess(); /* This doesn't work - at least with mysql Connection conn = sess.connection(); PreparedStatement ps = null; ps = conn.prepareStatement("SET REFERENTIAL_INTEGRITY FALSE"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from bedework_settings"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from adminGroupMembers"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from adminGroups"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from alarms"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from alarm_attendees"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from attendees"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from auth"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from authprefcalendars"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from authprefCategories"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from authprefLocations"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from authprefs"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from authprefSponsors"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from calendars"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from categories"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from eventrrules"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from events"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from event_attendees"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from event_categories"); ps.executeUpdate(); if (globals.from2p3px) { ps = conn.prepareStatement("delete from filters"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from filter_categories"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from filter_creators"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from filter_locations"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from filter_sponsors"); ps.executeUpdate(); ps.close(); } ps = conn.prepareStatement("delete from locations"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from organizers"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from preferences"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from sponsors"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from subscriptions"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from synchdata"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from synchinfo"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from synchstate"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from timezones"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from todos"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from users"); ps.executeUpdate(); ps.close(); ps = conn.prepareStatement("delete from user_subscriptions"); ps.executeUpdate(); ps.close(); /* ps = conn.prepareStatement("delete from lastmods"); ps.executeUpdate(); ps.close(); * / ps = conn.prepareStatement("SET REFERENTIAL_INTEGRITY TRUE"); ps.executeUpdate(); ps.close(); */ closeSess(); }
entry.setMember((BwPrincipal)it.next());
entry.setMember(pr);
public void restoreAdminGroup(BwAdminGroup o) throws Throwable { openSess(); if (globals.from2p3px) { // No id assigned o.setId(adminGroupId); adminGroupId++; } save(o); log.debug("Saved admin group " + o); closeSess(); /* Save members. */ Collection c = o.getGroupMembers(); Iterator it = c.iterator(); while (it.hasNext()) { openSess(); BwAdminGroupEntry entry = new BwAdminGroupEntry(); entry.setGrp(o); entry.setMember((BwPrincipal)it.next()); log.debug("About to save " + entry); save(entry); closeSess(); } }
if (!checkOnlyUser(o)) { return; }
public void restoreAlarm(BwAlarm o) throws Throwable { openHibSess(); hibSave(o); closeHibSess(); }
if (globals.onlyUsers && (globals.onlyUsersMap.get(o.getUser().getAccount()) == null)) { return; }
public void restoreAuthUser(BwAuthUser o) throws Throwable { openHibSess();// if (o.getId() <= 0) {// o.setId(o.getUser().getId());// } hibSave(o); closeHibSess(); }
if (!checkOnlyUser(o)) { return; }
public void restoreCalendar(BwCalendar o) throws Throwable { openSess(); restoreCalendar(o, sess.connection()); closeSess(); }
if (!checkOnlyUser(o)) { return; }
public void restoreCalendars(BwCalendar o) throws Throwable { openSess(); restoreCalendars(o, sess.connection()); sess.update(o); closeSess(); }
if (!checkOnlyUser(o)) { return; }
public void restoreCategory(BwCategory o) throws Throwable { openSess(); save(o); closeSess(); }
if (!checkOnlyUser(o)) { return; }
public void restoreEvent(BwEvent o) throws Throwable { openHibSess(); hibSave(o); closeHibSess(); }
if (!checkOnlyUser(o)) { return null; }
public Integer restoreLocation(BwLocation o) throws Throwable { openSess(); StringBuffer sb = new StringBuffer(); sb.append("select ent.id from "); sb.append(BwLocation.class.getName()); sb.append(" ent where ent.address=:address and ent.owner=:owner"); Query q = sess.createQuery(sb.toString()); q.setString("address", o.getAddress()); q.setEntity("owner", o.getOwner()); Integer i = (Integer)q.uniqueResult(); if (i == null) { // no entry with that key save(o); } closeSess(); return i; }
if (!checkOnlyUser(o)) { return null; }
public Integer restoreSponsor(BwSponsor o) throws Throwable { openSess(); StringBuffer sb = new StringBuffer(); sb.append("select ent.id from "); sb.append(BwSponsor.class.getName()); sb.append(" ent where ent.name=:name and ent.owner=:owner"); Query q = sess.createQuery(sb.toString()); q.setString("name", o.getName()); q.setEntity("owner", o.getOwner()); Integer i = (Integer)q.uniqueResult(); if (i == null) { // no entry with that key save(o); } closeSess(); return i; }
if (!checkOnlyUser(o)) { return; }
public void restoreTimezone(BwTimeZone o) throws Throwable { openSess(); save(o); closeSess(); }
if (globals.onlyUsers && (globals.onlyUsersMap.get(o.getAccount()) == null)) { return; }
public void restoreUser(BwUser o) throws Throwable { try { openSess(); //sess.save(o, new Integer(o.getId())); save(o); closeSess(); } catch (Throwable t) { log.error("Exception restoring user " + o); throw t; } }
if (globals.onlyUsers && (globals.onlyUsersMap.get(o.getUser().getAccount()) == null)) { return; }
public void restoreUserInfo(BwUserInfo o) throws Throwable { openSess(); save(o); closeSess(); }
if (!checkOnlyUser(o)) { return; }
public void restoreUserPrefs(BwPreferences o) throws Throwable { openHibSess(); /* Unset the subscription id - hibernate cascades cause an error * We'll just have to go with a new id */ Iterator it = o.iterateSubscriptions(); while (it.hasNext()) { BwSubscription sub = (BwSubscription)it.next(); sub.setId(CalFacadeDefs.unsavedItemKey); globals.subscriptions++; } /* Same for views */ it = o.iterateViews(); while (it.hasNext()) { BwView view = (BwView)it.next(); view.setId(CalFacadeDefs.unsavedItemKey); globals.views++; } hibSave(o); closeHibSess(); }
if (!checkOnlyUser(o)) { return; }
public void update(BwEvent o) throws Throwable { openHibSess(); hibSess.update(o); closeHibSess(); }
String appPrefix = null; if (pars.getPublicAdmin()) { appPrefix = CalEnv.webAdminAppPrefix; } else if (pars.isGuest()) { if (pars.getCaldav()) { appPrefix = CalEnv.caldavPublicAppPrefix; } else { appPrefix = CalEnv.webPublicAppPrefix; } } else { if (pars.getCaldav()) { appPrefix = CalEnv.caldavPersonalAppPrefix; } else { appPrefix = CalEnv.webPersonalAppPrefix; } } env = new CalEnv(appPrefix, debug);
env = new CalEnv(pars.getEnvPrefix(), debug);
public void init(CalSvcIPars parsParam) throws CalFacadeException { pars = (CalSvcIPars)parsParam.clone(); debug = pars.getDebug(); //if (userAuth != null) { // userAuth.reinitialise(getUserAuthCallBack()); //} if (userGroups != null) { userGroups.init(getGroupsCallBack()); } if (adminGroups != null) { adminGroups.init(getGroupsCallBack()); } try { String appPrefix = null; if (pars.getPublicAdmin()) { appPrefix = CalEnv.webAdminAppPrefix; } else if (pars.isGuest()) { if (pars.getCaldav()) { appPrefix = CalEnv.caldavPublicAppPrefix; } else { appPrefix = CalEnv.webPublicAppPrefix; } } else { if (pars.getCaldav()) { appPrefix = CalEnv.caldavPersonalAppPrefix; } else { appPrefix = CalEnv.webPersonalAppPrefix; } } env = new CalEnv(appPrefix, debug); //publicUserAccount = CalEnv.getGlobalProperty("public.user"); if (pars.isGuest() && (pars.getUser() == null)) { pars.setUser(env.getAppProperty("run.as.user")); } if (pars.getPublicAdmin()) { //adminAutoDeleteSponsors = env.getAppBoolProperty("app.autodeletesponsors"); //adminAutoDeleteLocations = env.getAppBoolProperty("app.autodeletelocations"); adminCanEditAllPublicCategories = env.getAppBoolProperty("app.allowEditAllCategories"); adminCanEditAllPublicLocations = env.getAppBoolProperty("app.allowEditAllLocations"); adminCanEditAllPublicSponsors = env.getAppBoolProperty("app.allowEditAllSponsors"); } timezones = getCal().getTimezones(); /* Nominate our timezone registry */ System.setProperty("net.fortuna.ical4j.timezone.registry", "org.bedework.icalendar.TimeZoneRegistryFactoryImpl"); } catch (CalFacadeException cfe) { throw cfe; } catch (Throwable t) { throw new CalFacadeException(t); } }
adminCanEditAllPublicCategories = env.getAppBoolProperty("app.allowEditAllCategories"); adminCanEditAllPublicLocations = env.getAppBoolProperty("app.allowEditAllLocations"); adminCanEditAllPublicSponsors = env.getAppBoolProperty("app.allowEditAllSponsors");
adminCanEditAllPublicCategories = env.getAppBoolProperty("allowEditAllCategories"); adminCanEditAllPublicLocations = env.getAppBoolProperty("allowEditAllLocations"); adminCanEditAllPublicSponsors = env.getAppBoolProperty("allowEditAllSponsors");
public void init(CalSvcIPars parsParam) throws CalFacadeException { pars = (CalSvcIPars)parsParam.clone(); debug = pars.getDebug(); //if (userAuth != null) { // userAuth.reinitialise(getUserAuthCallBack()); //} if (userGroups != null) { userGroups.init(getGroupsCallBack()); } if (adminGroups != null) { adminGroups.init(getGroupsCallBack()); } try { String appPrefix = null; if (pars.getPublicAdmin()) { appPrefix = CalEnv.webAdminAppPrefix; } else if (pars.isGuest()) { if (pars.getCaldav()) { appPrefix = CalEnv.caldavPublicAppPrefix; } else { appPrefix = CalEnv.webPublicAppPrefix; } } else { if (pars.getCaldav()) { appPrefix = CalEnv.caldavPersonalAppPrefix; } else { appPrefix = CalEnv.webPersonalAppPrefix; } } env = new CalEnv(appPrefix, debug); //publicUserAccount = CalEnv.getGlobalProperty("public.user"); if (pars.isGuest() && (pars.getUser() == null)) { pars.setUser(env.getAppProperty("run.as.user")); } if (pars.getPublicAdmin()) { //adminAutoDeleteSponsors = env.getAppBoolProperty("app.autodeletesponsors"); //adminAutoDeleteLocations = env.getAppBoolProperty("app.autodeletelocations"); adminCanEditAllPublicCategories = env.getAppBoolProperty("app.allowEditAllCategories"); adminCanEditAllPublicLocations = env.getAppBoolProperty("app.allowEditAllLocations"); adminCanEditAllPublicSponsors = env.getAppBoolProperty("app.allowEditAllSponsors"); } timezones = getCal().getTimezones(); /* Nominate our timezone registry */ System.setProperty("net.fortuna.ical4j.timezone.registry", "org.bedework.icalendar.TimeZoneRegistryFactoryImpl"); } catch (CalFacadeException cfe) { throw cfe; } catch (Throwable t) { throw new CalFacadeException(t); } }
al.add(new CalendarData(CaldavTags.calendarData, debug));
public Collection getProperties(String ns) throws WebdavIntfException { init(true); ArrayList al = new ArrayList(); getVevent(); // init comp if (comp == null) { throw new WebdavIntfException("getProperties, comp == null"); } addProp(al, ICalTags.summary, name); addProp(al, ICalTags.dtstart, comp.getDtstart()); addProp(al, ICalTags.dtend, comp.getDtend()); addProp(al, ICalTags.duration, comp.getDuration()); addProp(al, ICalTags.transp, comp.getTransp()); addProp(al, ICalTags.due, comp.getDue());// addProp(v, ICalTags.completed, | date-time from RFC2518 addProp(al, ICalTags.status, comp.getStatus());// addProp(v, ICalTags.priority, | integer// addProp(v, ICalTags.percentComplete, | integer addProp(al, ICalTags.uid, comp.getUid()); addProp(al, ICalTags.sequence, comp.getSequence());// addProp(v, ICalTags.recurrenceId, | date-time from RFC2518// addProp(v, ICalTags.trigger, | see below TODO// FIXME FIX FIX addProp(al, ICalTags.hasRecurrence, "0"); addProp(al, ICalTags.hasAlarm, "0"); addProp(al, ICalTags.hasAttachment, "0"); return al; }
idea.setDescription(getDescription()); idea.setUrl(getUrl());
public Idea clone() { Idea idea = new Idea(getText()); idea.setAngle(getAngle()); idea.setLength(getLength()); idea.setNotes(getNotes()); idea.setV(getV()); for (Idea subIdea : this.subIdeas) { idea.add(subIdea.clone()); } return idea; }
repaint();
public void componentResized(ComponentEvent e) { resize(); }
repaint();
public void componentShown(ComponentEvent e) { resize(); }
repaint();
protected void resize() { Insets insets = getInsets(); Dimension d = getSize(); displaySize = new Dimension(d.width - insets.left - insets.right, d.height - insets.top - insets.bottom); if(displaySize.height < 0 || displaySize.width < 0){ return; } timeScaleMap.setTotalPixels(displaySize.width); ampScaleMap.setTotalPixels(displaySize.height); repaint(); }
String showClass=(String) getSessionObject(request, UMLBrowserFormConstants.CLASS_VIEW);
String showClass = null; if (getSessionObject(request, UMLBrowserFormConstants.CLASS_VIEW) != null) showClass=getSessionObject(request, UMLBrowserFormConstants.CLASS_VIEW).toString();
public ActionForward resetPkgOptions( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { DynaActionForm dynaForm = (DynaActionForm) form; String projectId = ((String) dynaForm.get(UMLBrowserFormConstants.PROJECT_IDSEQ)).trim(); String subprojId = ((String) dynaForm.get(UMLBrowserFormConstants.SUB_PROJECT_IDSEQ)).trim(); if (subprojId == null || subprojId.length() == 0) { // if subProject is ALL, set package options by project setPackageOptionsForProjectId(request, projectId); } else { SubProject subproject = null; Collection<SubProject> allSubProjects = (Collection) getSessionObject(request, UMLBrowserFormConstants.ALL_SUBPROJECTS); for (Iterator subprojIter =allSubProjects.iterator(); subprojIter.hasNext(); ) { subproject = (SubProject) subprojIter.next(); if (subproject.getId().equalsIgnoreCase(subprojId)) break; } if (subproject != null ){ setSessionObject(request, UMLBrowserFormConstants.PACKAGE_OPTIONS, subproject.getUMLPackageMetadataCollection(), true); } } String showClass=(String) getSessionObject(request, UMLBrowserFormConstants.CLASS_VIEW); if (showClass == null || showClass.equalsIgnoreCase("true")) return mapping.findForward("umlSearch"); return mapping.findForward("showAttributes"); }
Calendar cal = bldr.build(new StringReader(val), true);
UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); Calendar cal = bldr.build(ufrdr);
public Collection toVEvent(String val) throws CalFacadeException { try { CalendarBuilder bldr = new CalendarBuilder(new CalendarParserImpl()); Calendar cal = bldr.build(new StringReader(val), true); Vector evs = new Vector(); if (cal == null) { return evs; } ComponentList clist = cal.getComponents(); Iterator it = clist.iterator(); while (it.hasNext()) { Object o = it.next(); if (o instanceof VEvent) { evs.add(o); } } return evs; } catch (Throwable t) { throw new CalFacadeException(t); } }
throw new XIllegalOperation("Field " + name_.getText().asNativeText().javaValue + " cannot be set.");
throw new XIllegalOperation("Field " + name_.base_getText().asNativeText().javaValue + " cannot be set.");
public ATObject base_setValue(ATObject newValue) throws NATException { // certain fields may not have setters if(setter_ != null) return getter_.base_apply(new NATTable(new ATObject[] { newValue })); throw new XIllegalOperation("Field " + name_.getText().asNativeText().javaValue + " cannot be set."); }
return NATText.atValue("<native field:"+name_.getText().asNativeText().javaValue+">");
return NATText.atValue("<native field:"+name_.base_getText().asNativeText().javaValue+">");
public NATText meta_print() throws XTypeMismatch { return NATText.atValue("<native field:"+name_.getText().asNativeText().javaValue+">"); }
public XMLDataSetAccess(DocumentBuilder docBuilder, Element config) { this.docBuilder = docBuilder; this.config = config;
public XMLDataSetAccess(DocumentBuilder docBuilder, String id, String name, String Owner) { Document doc = docBuilder.newDocument(); config = doc.createElement("dataset"); Element nameE = doc.createElement("name"); Element ownerE = doc.createElement("owner"); config.setAttribute("datasetid", id); config.appendChild(nameE); config.appendChild(ownerE);
public XMLDataSetAccess(DocumentBuilder docBuilder, Element config) { this.docBuilder = docBuilder; this.config = config; }
evalNodeList(config, "dataset[@datasetid="+dquote+id+dquote+"]");
evalNodeList(config, "
public DataSetAccess getDataSet(String id) { NodeList nList = evalNodeList(config, "dataset[@datasetid="+dquote+id+dquote+"]"); if (nList != null && nList.getLength() != 0) { System.out.println("got "+nList.getLength()); Node n = nList.item(0); if (n instanceof Element) { return new XMLDataSetAccess(docBuilder, (Element)n); } } // not an embedded dataset, try datasetRef nList = evalNodeList(config, "datasetRef[@datasetid="+dquote+id+dquote+"]"); if (nList != null && nList.getLength() != 0) { System.out.println("got "+nList.getLength()); Node n = nList.item(0); if (n instanceof Element) { try { SimpleXLink sl = new SimpleXLink(docBuilder, (Element)n); return new XMLDataSetAccess(docBuilder, sl.retrieve()); } catch (Exception e) { logger.error("Couldn't get datasetRef", e); } // end of try-catch } } // can't find it return null; }
System.out.println("got "+nList.getLength());
public DataSetAccess getDataSet(String id) { NodeList nList = evalNodeList(config, "dataset[@datasetid="+dquote+id+dquote+"]"); if (nList != null && nList.getLength() != 0) { System.out.println("got "+nList.getLength()); Node n = nList.item(0); if (n instanceof Element) { return new XMLDataSetAccess(docBuilder, (Element)n); } } // not an embedded dataset, try datasetRef nList = evalNodeList(config, "datasetRef[@datasetid="+dquote+id+dquote+"]"); if (nList != null && nList.getLength() != 0) { System.out.println("got "+nList.getLength()); Node n = nList.item(0); if (n instanceof Element) { try { SimpleXLink sl = new SimpleXLink(docBuilder, (Element)n); return new XMLDataSetAccess(docBuilder, sl.retrieve()); } catch (Exception e) { logger.error("Couldn't get datasetRef", e); } // end of try-catch } } // can't find it return null; }
return getAllAsStrings("dataset/@datasetid");
return getAllAsStrings("*/@datasetid");
public String[] getDataSetIds() { return getAllAsStrings("dataset/@datasetid"); }
System.out.println("got "+nList.getLength());
public Element getParamter(String name) { NodeList nList = evalNodeList(config, "dataset/parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { System.out.println("got "+nList.getLength()); Node n = nList.item(0); if (n instanceof Element) { return (Element)n; } } // not a parameter, try parameterRef nList = evalNodeList(config, "dataset/parameterRef[text()="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { System.out.println("got "+nList.getLength()); Node n = nList.item(0); if (n instanceof Element) { SimpleXLink sl = new SimpleXLink(docBuilder, (Element)n); try { return sl.retrieve(); } catch (Exception e) { logger.error("can't get paramterRef", e); } // end of try-catch } } //can't find that name??? return null; }
evalNodeList(config, "dataset/SacSeismogram[name="+dquote+name+dquote+"]");
evalNodeList(config, "SacSeismogram[name="+dquote+name+dquote+"]");
public LocalSeismogramImpl getSeismogram(String name) { NodeList nList = evalNodeList(config, "dataset/SacSeismogram[name="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { try { System.out.println("got "+nList.getLength()); Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; URL sacURL = new URL(e.getAttribute("xlink:href")); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); NodeList propList = evalNodeList(e, "property"); if (propList != null && propList.getLength() != 0) { Property[] props = seis.getProperties(); Property[] newProps = new Property[1+props.length+nList.getLength()]; System.arraycopy(props, 0, newProps, 0, props.length); for (int i=0; i<propList.getLength(); i++) { Element propElement = (Element)propList.item(i); newProps[props.length+i] = new Property(xpath.eval(propElement, "name/text()").str(), xpath.eval(propElement, "value/text()").str()); } // end of for newProps[newProps.length-1] = new Property("name", name); seis.setProperties(newProps); } return seis; } } catch (Exception e) { logger.error("Couldn't get seismogram", e); } // end of try-catch } return null; }
System.out.println("got "+nList.getLength());
public LocalSeismogramImpl getSeismogram(String name) { NodeList nList = evalNodeList(config, "dataset/SacSeismogram[name="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { try { System.out.println("got "+nList.getLength()); Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; URL sacURL = new URL(e.getAttribute("xlink:href")); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); NodeList propList = evalNodeList(e, "property"); if (propList != null && propList.getLength() != 0) { Property[] props = seis.getProperties(); Property[] newProps = new Property[1+props.length+nList.getLength()]; System.arraycopy(props, 0, newProps, 0, props.length); for (int i=0; i<propList.getLength(); i++) { Element propElement = (Element)propList.item(i); newProps[props.length+i] = new Property(xpath.eval(propElement, "name/text()").str(), xpath.eval(propElement, "value/text()").str()); } // end of for newProps[newProps.length-1] = new Property("name", name); seis.setProperties(newProps); } return seis; } } catch (Exception e) { logger.error("Couldn't get seismogram", e); } // end of try-catch } return null; }
return getAllAsStrings("dataset/SacSeismogram/name/text()");
return getAllAsStrings("SacSeismogram/name/text()");
public String[] getSeismogramNames() { return getAllAsStrings("dataset/SacSeismogram/name/text()"); }
for (int i=0; i<nList.getLength(); i++) { Node n = nList.item(i); if (n instanceof Element) { Element nodeElement = (Element)n; System.out.println(nodeElement.getTagName()+" {"+nodeElement.getAttribute("xlink:href")+"}"); if (nodeElement.getTagName().equals("dataset")) { System.out.println("######dataset yes"); dataset = new XMLDataSet(docBuilder, nodeElement); System.out.println(nodeElement.getTagName()+" {"+nodeElement.getAttribute("datasetid")+"}"); } if (nodeElement.getTagName().equals("datasetRef")) { System.out.println("datasetRef yes"); SimpleXLink sxlink = new SimpleXLink(docBuilder, nodeElement); Element e = sxlink.retrieve(); dataset = new XMLDataSet(docBuilder, e); System.out.println(e.getTagName()+" {"+e.getAttribute("datasetid")+"}"); }
if (docElement.getTagName().equals("dataset")) { System.out.println("dataset yes"); dataset = new XMLDataSet(docBuilder, docElement); System.out.println(docElement.getTagName()+" {"+docElement.getAttribute("datasetid")+"}"); testDataSet(dataset, " "); }
public static void main (String[] args) { try { BasicConfigurator.configure(); System.out.println("Starting.."); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); // just for testing Document doc = docBuilder.parse(args[0]); Element docElement = doc.getDocumentElement(); NodeList nList = docElement.getChildNodes(); XMLDataSetAccess dataset = null; for (int i=0; i<nList.getLength(); i++) {// Node m = nList.item(i);// NodeList mList = m.getChildNodes();// for (int j=0; j<mList.getLength(); j++) {// Node n = mList.item(j); Node n = nList.item(i); if (n instanceof Element) { Element nodeElement = (Element)n; System.out.println(nodeElement.getTagName()+" {"+nodeElement.getAttribute("xlink:href")+"}"); if (nodeElement.getTagName().equals("dataset")) { System.out.println("######dataset yes"); dataset = new XMLDataSet(docBuilder, nodeElement); System.out.println(nodeElement.getTagName()+" {"+nodeElement.getAttribute("datasetid")+"}"); } if (nodeElement.getTagName().equals("datasetRef")) { System.out.println("datasetRef yes"); SimpleXLink sxlink = new SimpleXLink(docBuilder, nodeElement); Element e = sxlink.retrieve(); dataset = new XMLDataSet(docBuilder, e); System.out.println(e.getTagName()+" {"+e.getAttribute("datasetid")+"}"); } // end of if (nodeElement.getTagName().equals("dataset")) if (dataset != null) { String[] names = dataset.getSeismogramNames(); for (int num=0; num<names.length; num++) { System.out.println("Seismogram name="+names[num]); LocalSeismogramImpl seis = dataset.getSeismogram(names[num]); System.out.println(seis.getNumPoints()+" "+seis.getMinValue()); } // end of for (int num=0; num<names.length; num++) } // end of if (dataset != null) } // end of if (node instanceof Element) // } // end of for (int i=0; i<nList.getLength(); i++) } } catch (Exception e) { e.printStackTrace(); } // end of try-catch } // end of main ()
if (dataset != null) { String[] names = dataset.getSeismogramNames(); for (int num=0; num<names.length; num++) { System.out.println("Seismogram name="+names[num]); LocalSeismogramImpl seis = dataset.getSeismogram(names[num]); System.out.println(seis.getNumPoints()+" "+seis.getMinValue()); } } } }
public static void main (String[] args) { try { BasicConfigurator.configure(); System.out.println("Starting.."); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); // just for testing Document doc = docBuilder.parse(args[0]); Element docElement = doc.getDocumentElement(); NodeList nList = docElement.getChildNodes(); XMLDataSetAccess dataset = null; for (int i=0; i<nList.getLength(); i++) {// Node m = nList.item(i);// NodeList mList = m.getChildNodes();// for (int j=0; j<mList.getLength(); j++) {// Node n = mList.item(j); Node n = nList.item(i); if (n instanceof Element) { Element nodeElement = (Element)n; System.out.println(nodeElement.getTagName()+" {"+nodeElement.getAttribute("xlink:href")+"}"); if (nodeElement.getTagName().equals("dataset")) { System.out.println("######dataset yes"); dataset = new XMLDataSet(docBuilder, nodeElement); System.out.println(nodeElement.getTagName()+" {"+nodeElement.getAttribute("datasetid")+"}"); } if (nodeElement.getTagName().equals("datasetRef")) { System.out.println("datasetRef yes"); SimpleXLink sxlink = new SimpleXLink(docBuilder, nodeElement); Element e = sxlink.retrieve(); dataset = new XMLDataSet(docBuilder, e); System.out.println(e.getTagName()+" {"+e.getAttribute("datasetid")+"}"); } // end of if (nodeElement.getTagName().equals("dataset")) if (dataset != null) { String[] names = dataset.getSeismogramNames(); for (int num=0; num<names.length; num++) { System.out.println("Seismogram name="+names[num]); LocalSeismogramImpl seis = dataset.getSeismogram(names[num]); System.out.println(seis.getNumPoints()+" "+seis.getMinValue()); } // end of for (int num=0; num<names.length; num++) } // end of if (dataset != null) } // end of if (node instanceof Element) // } // end of for (int i=0; i<nList.getLength(); i++) } } catch (Exception e) { e.printStackTrace(); } // end of try-catch } // end of main ()
System.out.println("index = "+ index);
public void goToPrevious() { try { int index = previousURLs.size() - 1; System.out.println("index = "+ index); if (index >= 0) { URL prev = (URL)previousURLs.get(index); previousURLs.remove(index); URL current = getPage(); nextURLs.add(current); setPage(prev); } } catch (Exception exc) { showError(new Exception(Messages.getString("HTMLPane.COULD_NOT_LOAD_PREVIOUS_PAGE"))); //$NON-NLS-1$ } }
setText("<center>"+ t.getLocalizedMessage() +"</center>");
public void showError(Throwable t) { try { super.setPage(resourceToURL("htmlerror.html")); // bad workaround: setText("<center>"+ t.getLocalizedMessage() +"</center>");// does not work -- why??// HTMLDocument doc = (HTMLDocument)getDocument();// Element msgElem = doc.getElement("message");// doc.setInnerHTML(msgElem, Messages.getString("HTMLPane.LOAD_ERROR"));// Element stacktraceElem = doc.getElement("stacktrace");// doc.setInnerHTML(stacktraceElem, Util.exceptionToString(t));// super.setDocument(doc); } catch (Exception exc) { exc.printStackTrace(); } setCaretPosition(0); }