rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
System.out.println("link initially " + link);
public void startElement(String namespaceURI, String sName, // simple name (localName) String qName, // qualified name Attributes attrs) throws SAXException { if ("outline".equals(qName)) { if (attrs != null) { String type = attrs.getValue("type"); if (type != null) { type = type.toUpperCase(); } else { type = ""; } String url = attrs.getValue("url"); if (url == null) { url = ""; } if (!url.startsWith("#")) { String text = attrs.getValue("text"); Idea i = new Idea(text); i.setUrl(url); String id = attrs.getValue("id"); if ((id != null) && (id.length() > 0)) { ideaIndex.put(new Integer(id), i); } String notes = attrs.getValue("notes"); if (notes == null) { notes = ""; } i.setNotes(notes); String description = attrs.getValue("description"); if (description == null) { description = ""; } i.setDescription(description); String angleString = attrs.getValue("angle"); if ((angleString != null) && (angleString.length() > 0)) { i.setAngle(Double.valueOf(angleString)); anglesRead = true; } if (idea == null) { idea = i; } else if (current != null) { current.add(i); } else { Idea i2 = new Idea("root"); i2.add(idea); idea = i2; stack.push(idea); idea.add(i); } current = i; stack.push(current); } else { String indexNo = url.substring(1); System.out.println("linking from " + current); System.out.println("current class = " + current.getClass()); IdeaLink link = new IdeaLink(current, null); System.out.println("link initially " + link); String description = attrs.getValue("description"); if (description == null) { description = ""; } link.setDescription(description); links.add(link); linkTos.add(new Integer(indexNo)); stack.push(null); } } } }
TimeSeriesDataSel dataSel = new TimeSeriesDataSel();
LocalSeismogramImpl outSeis;
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
dataSel.sht_values(outS);
outSeis = new LocalSeismogramImpl(seis, outS);
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
dataSel.int_values(outI);
outSeis = new LocalSeismogramImpl(seis, outI); logger.debug("out num_points="+seis.num_points+" out data length="+outI.length);
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
dataSel.flt_values(outF);
outSeis = new LocalSeismogramImpl(seis, outF);
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
dataSel.dbl_values(outD); }
outSeis = new LocalSeismogramImpl(seis, outD); }
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
return new LocalSeismogramImpl(seis, dataSel);
return outSeis;
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
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.assignAddingLocation(false); return "continue"; }
public void addParameter(Element param) { config.appendChild(param);
public void addParameter(String name, Object param) { parameterCache.put(name, param); if (param instanceof Element) { config.appendChild((Element)param); } else { logger.warn("Parameter is only stored in memory."); }
public void addParameter(Element param) { config.appendChild(param); }
public Element getParamter(String name) {
public Object getParamter(String name) { if (parameterCache.containsKey(name)) { return parameterCache.get(name); }
public Element getParamter(String name) { NodeList nList = evalNodeList(config, "dataset/parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { 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) { 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; }
return sl.retrieve();
Element e = sl.retrieve(); parameterCache.put(name, e); return e;
public Element getParamter(String name) { NodeList nList = evalNodeList(config, "dataset/parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { 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) { 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; }
File outFile = new File(sacFile.getParent(), ChannelIdUtil.toString(seis.channel_id));
String chanFileName = ChannelIdUtil.toString(seis.channel_id); chanFileName = chanFileName.replace(' ', '_'); File outFile = new File(sacFile.getParent(), chanFileName);
void loadSacFile(File sacFile) throws IOException, FissuresException { if (excludes.contains(sacFile.getName())) { return; } // end of if (excludes.contains(sacFile.getName())) if (paramRefs.containsValue(sacFile.getName())) { return; } // end of if (excludes.contains(sacFile.getName())) SacTimeSeries sac = new SacTimeSeries(); sac.read(sacFile.getCanonicalPath()); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName+" via SacDirToDataSet", "seismogram loaded from "+sacFile.getCanonicalPath()); URL seisURL = new URL(dirURL, sacFile.getName()); // System.out.println(" the seisURL is "+seisURL.toString()); // DataInputStream dis = new DataInputStream(new BufferedInputStream(seisURL.openStream())); // SacTimeSeries sac = new SacTimeSeries(); //sac.read(dis); edu.iris.Fissures.seismogramDC.LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); System.out.println("The PATH is "+sacFile.getParent()); edu.sc.seis.fissuresUtil.cache.CacheEvent event = SacToFissures.getEvent(sac); if (event != null && dataset.getParameter(EVENT) == null) { String eventName = event.get_attributes().name; String eName = eventName.replace(' ', '_'); // add event File outFile = new File(sacFile.getParent(), eName); OutputStream fos = new BufferedOutputStream(new FileOutputStream(outFile)); AuditInfo[] eventAudit = new AuditInfo[1]; eventAudit[0] = new AuditInfo(System.getProperty("user.name"), "event loaded from sac file."); XMLParameter.write(fos, event); fos.close(); dataset.addParameterRef( new URL("file:"+eName), EVENT, event,eventAudit); edu.sc.seis.fissuresUtil.cache.CacheEvent cacheEvent = (edu.sc.seis.fissuresUtil.cache.CacheEvent)((XMLDataSet)dataset).getParameter(EVENT); if(cacheEvent == null){ System.out.println("CACHE EVENT IS NULL"); System.exit(0); } else System.out.println("CACHE EVENT IS NOT NULL"); } // end of if (event != null) Channel channel = SacToFissures.getChannel(sac); String channelParamName = CHANNEL+ChannelIdUtil.toString(seis.channel_id); if (channel != null && dataset.getParameter(channelParamName) == null) { File outFile = new File(sacFile.getParent(), ChannelIdUtil.toString(seis.channel_id)); BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(outFile)); // add event AuditInfo[] chanAudit = new AuditInfo[1]; chanAudit[0] = new AuditInfo(System.getProperty("user.name"), "channel loaded from sac file."); XMLParameter.write(fos, channel); fos.close(); dataset.addParameterRef(new URL("file:"+ChannelIdUtil.toString(seis.channel_id)), channelParamName, channel, chanAudit); } String seisName = sacFile.getName(); if (seisName.endsWith(".SAC")) { seisName = seisName.substring(0,seisName.length()-4); } // end of if (seisName.endsWith(".SAC")) seis.setName(seisName); dataset.addSeismogramRef(seis, seisURL, seisName, new Property[0], new ParameterRef[0], audit); }
if (debug) { trace("------------Using calendar " + calendar.getPath()); }
private void doCalendarEntities(boolean setUser, BwCalendar calendar, boolean allCalendars) throws CalFacadeException { HibSession sess = getSess(); if (setUser) { sess.setEntity("user", getUser()); } if (calendar != null) { if (calendar.getCalendarCollection()) { // Single leaf calendar - always include sess.setEntity("calendar", calendar); } else { // Non leaf - add entities setCalendarEntities(calendar, new CalTerm(), allCalendars); } } }
if (debug) { trace("------------Using calendar " + calendar.getPath()); }
private void setCalendarEntities(BwCalendar calendar, CalTerm calTerm, boolean allCalendars) throws CalFacadeException { if (calendar.getCalendarCollection()) { if (allCalendars || (calendar.getCalType() == BwCalendar.calTypeCollection)) { // leaf calendar getSess().setEntity("calendar" + calTerm.i, calendar); calTerm.i++; } } else { Iterator it = calendar.getChildren().iterator(); while (it.hasNext()) { setCalendarEntities((BwCalendar)it.next(), calTerm, allCalendars); } } }
res.setStatus(getStatus());
public BwEvent makeFreeBusyEvent() { BwEvent res = new BwEvent(); res.setDtend(getDtend()); res.setDtstart(getDtstart()); res.setDuration(getDuration()); res.setEndType(getEndType()); res.setGuid(getGuid()); res.setTransparency(getTransparency()); return res; }
form.getErr().emit("org.bedework.client.missingfield", "name");
form.getErr().emit("org.bedework.client.error.missingfield", "name");
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.notfound", name); return "notFound"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
form.getErr().emit("org.bedework.client.notfound", name);
form.getErr().emit("org.bedework.client.error.notfound", name);
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.notfound", name); return "notFound"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
fldval.substring(17, 19);
fldval.substring(17, 19) + "Z";
protected String isoDateTimeFld() throws Exception { if (fldval == null) { throw new Exception("No value for " + tagName); } /** Value should be of form yyyy-MM-dd hh:mm:ss.0 or yyyy-MM-dd hh:mm:ss, convert to yyyyMMddThhmmss */ if ((fldval.length() < 21) || (fldval.charAt(4) != '-') || (fldval.charAt(7) != '-') || (fldval.charAt(10) != ' ') || (fldval.charAt(13) != ':') || (fldval.charAt(16) != ':')) { throw new Exception("Bad value " + fldval + " for " + tagName); } String dtval = fldval.substring(0, 4) + fldval.substring(5, 7) + fldval.substring(8, 10) + "T" + fldval.substring(11, 13) + fldval.substring(14, 16) + fldval.substring(17, 19); return dtval; }
this.registrar = registrar;
public ParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar, boolean advancedOption) { this.registrar = registrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, registrar); vAmpScaleMap = new AmpScaleMapper(50, 4, registrar); ScaleBorder scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); Border titleBorder = BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder); Border bevelBorder = BorderFactory.createRaisedBevelBorder(); Border bevelTitleBorder = BorderFactory.createCompoundBorder(bevelBorder, titleBorder); Border lowBevelBorder = BorderFactory.createLoweredBevelBorder(); Border scaleBevelBorder = BorderFactory.createCompoundBorder(scaleBorder, lowBevelBorder); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder(bevelTitleBorder, scaleBevelBorder)); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); if(registrar != null) { registrar.addListener((AmpListener)this); registrar.addListener((TimeListener)this); } addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, advancedOption, true, this); t.execute(); initialized = t.getCompletion(); }
advancedOption, true,
public ParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar, boolean advancedOption) { this.registrar = registrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, registrar); vAmpScaleMap = new AmpScaleMapper(50, 4, registrar); ScaleBorder scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); Border titleBorder = BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder); Border bevelBorder = BorderFactory.createRaisedBevelBorder(); Border bevelTitleBorder = BorderFactory.createCompoundBorder(bevelBorder, titleBorder); Border lowBevelBorder = BorderFactory.createLoweredBevelBorder(); Border scaleBevelBorder = BorderFactory.createCompoundBorder(scaleBorder, lowBevelBorder); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder(bevelTitleBorder, scaleBevelBorder)); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); if(registrar != null) { registrar.addListener((AmpListener)this); registrar.addListener((TimeListener)this); } addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, advancedOption, true, this); t.execute(); initialized = t.getCompletion(); }
if(!advancedOption) { formRadioSetPanel(); } else { formCheckBoxPanel(); } setInitialButton();
public ParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar, boolean advancedOption) { this.registrar = registrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, registrar); vAmpScaleMap = new AmpScaleMapper(50, 4, registrar); ScaleBorder scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); Border titleBorder = BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder); Border bevelBorder = BorderFactory.createRaisedBevelBorder(); Border bevelTitleBorder = BorderFactory.createCompoundBorder(bevelBorder, titleBorder); Border lowBevelBorder = BorderFactory.createLoweredBevelBorder(); Border scaleBevelBorder = BorderFactory.createCompoundBorder(scaleBorder, lowBevelBorder); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder(bevelTitleBorder, scaleBevelBorder)); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); if(registrar != null) { registrar.addListener((AmpListener)this); registrar.addListener((TimeListener)this); } addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, advancedOption, true, this); t.execute(); initialized = t.getCompletion(); }
this.registrar = registrar; boolean buttonPanel = this.displayButtonPanel; displayButtonPanel = false;
public synchronized void addParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar) { this.registrar = registrar; boolean buttonPanel = this.displayButtonPanel; displayButtonPanel = false; ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, false, buttonPanel, this); t.execute(); }
false, buttonPanel,
public synchronized void addParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar) { this.registrar = registrar; boolean buttonPanel = this.displayButtonPanel; displayButtonPanel = false; ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, false, buttonPanel, this); t.execute(); }
impl.setLdapContext(ldapContext);
impl.setContextSource(this.contextSource);
protected AbstractDefaultQueryPersonAttributeDao getAbstractDefaultQueryPersonAttributeDao() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); return impl; }
Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap: this.ldapContext = new InitialLdapContext(env, null);
this.contextSource = new LdapContextSource(); this.contextSource.setUrl("ldap: this.contextSource.setBase("o=yale.edu"); this.contextSource.afterPropertiesSet();
protected void setUp() throws Exception { super.setUp(); Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://mrfrumble.its.yale.edu:389/o=yale.edu"); this.ldapContext = new InitialLdapContext(env, null); }
this.ldapContext = null;
this.contextSource = null;
protected void tearDown() throws Exception { super.tearDown(); this.ldapContext = null; }
impl.setLdapContext(ldapContext);
impl.setContextSource(this.contextSource);
public void testDefaultAttrMap() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", null); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "awp9"); Map attribs = impl.getUserAttributes(queryMap); assertEquals("[email protected]", attribs.get("mail")); }
impl.setLdapContext(ldapContext);
impl.setContextSource(this.contextSource);
public void testInsufficientAttrQuery() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr1, "awp9"); queryMap.put("email", "[email protected]"); Map attribs = impl.getUserAttributes(queryMap); assertNull(attribs); }
impl.setLdapContext(ldapContext);
impl.setContextSource(this.contextSource);
public void testInvalidAttrMap() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("email", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "awp9"); Map attribs = impl.getUserAttributes(queryMap); assertNull(attribs.get("email")); }
impl.setLdapContext(ldapContext);
impl.setContextSource(this.contextSource);
public void testMultiAttrQuery() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr1, "awp9"); queryMap.put(queryAttr2, "andrew.petro"); queryMap.put("email", "[email protected]"); Map attribs = impl.getUserAttributes(queryMap); assertEquals("[email protected]", attribs.get("email")); }
impl.setLdapContext(ldapContext);
impl.setContextSource(this.contextSource);
public void testNotFoundQuery() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "unknown"); Map attribs = impl.getUserAttributes(queryMap); assertNull(attribs); }
impl.setLdapContext(ldapContext);
impl.setContextSource(this.contextSource);
public void testNullContext() { LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); impl.setLdapContext(ldapContext); try { impl.getUserAttributes(Collections.singletonMap("dummy", "seed")); fail("IllegalStateException should have been thrown with no query configured"); } catch (IllegalStateException ise) { //expected } }
assertNull(impl.getLdapContext()); impl.setLdapContext(ldapContext); assertEquals(ldapContext, impl.getLdapContext());
assertNull(impl.getContextSource()); impl.setContextSource(this.contextSource); assertEquals(contextSource, impl.getContextSource());
public void testProperties() { LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); assertEquals("", impl.getBaseDN()); impl.setBaseDN("BaseDN"); assertEquals("BaseDN", impl.getBaseDN()); impl.setBaseDN(null); assertEquals("", impl.getBaseDN()); assertEquals(Collections.EMPTY_MAP, impl.getLdapAttributesToPortalAttributes()); Map attrMap = new HashMap(); attrMap.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(attrMap); Map expectedAttrMap = new HashMap(attrMap); expectedAttrMap.put("mail", Collections.singleton("email")); assertEquals(expectedAttrMap, impl.getLdapAttributesToPortalAttributes()); assertNull(impl.getLdapContext()); impl.setLdapContext(ldapContext); assertEquals(ldapContext, impl.getLdapContext()); impl.setLdapAttributesToPortalAttributes(null); assertEquals(Collections.EMPTY_SET, impl.getPossibleUserAttributeNames()); impl.setLdapAttributesToPortalAttributes(attrMap); assertEquals(Collections.singleton("email"), impl.getPossibleUserAttributeNames()); assertNull(impl.getQuery()); impl.setQuery("QueryString"); assertEquals("QueryString", impl.getQuery()); assertEquals(Collections.EMPTY_LIST, impl.getQueryAttributes()); impl.setQueryAttributes(Collections.singletonList("QAttr")); assertEquals(Collections.singletonList("QAttr"), impl.getQueryAttributes()); assertEquals(0, impl.getTimeLimit()); impl.setTimeLimit(1337); assertEquals(1337, impl.getTimeLimit()); }
impl.setLdapContext(ldapContext);
impl.setContextSource(this.contextSource);
public void testSingleAttrQuery() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "awp9"); Map attribs = impl.getUserAttributes(queryMap); assertEquals("[email protected]", attribs.get("email")); }
impl.setLdapContext(ldapContext);
impl.setContextSource(this.contextSource);
public void testToString() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); StringBuffer expected = new StringBuffer(); expected.append(impl.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(impl.hashCode())); expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(ldapContext.hashCode())); expected.append(", timeLimit=0, baseDN=, query=(&(uid={0})(alias={1})), queryAttributes=[uid, alias], ldapAttributesToPortalAttributes={mail=[email]}]"); String result = impl.toString(); assertEquals(expected.toString(), result); }
expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName());
expected.append("[contextSource="); expected.append(contextSource.getClass().getName());
public void testToString() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); StringBuffer expected = new StringBuffer(); expected.append(impl.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(impl.hashCode())); expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(ldapContext.hashCode())); expected.append(", timeLimit=0, baseDN=, query=(&(uid={0})(alias={1})), queryAttributes=[uid, alias], ldapAttributesToPortalAttributes={mail=[email]}]"); String result = impl.toString(); assertEquals(expected.toString(), result); }
expected.append(Integer.toHexString(ldapContext.hashCode()));
expected.append(Integer.toHexString(contextSource.hashCode()));
public void testToString() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); StringBuffer expected = new StringBuffer(); expected.append(impl.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(impl.hashCode())); expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(ldapContext.hashCode())); expected.append(", timeLimit=0, baseDN=, query=(&(uid={0})(alias={1})), queryAttributes=[uid, alias], ldapAttributesToPortalAttributes={mail=[email]}]"); String result = impl.toString(); assertEquals(expected.toString(), result); }
if(parents.isEmpty()){ Iterator e = displays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).remove(); } }
public void removeParent(BasicSeismogramDisplay disowner){ parents.remove(disowner); if(parents.isEmpty()){ Iterator e = displays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).remove(); } } }
System.out.println(newInterval);
private void setInterval(TimeInterval newInterval){ double currentInterval = latestTime.getTime().getInterval().getValue(); System.out.println(newInterval); double scale = newInterval.getValue()/currentInterval; internalRegistrar.shaleTime(0, scale); }
this.setAttribute(ATTRIBUTE_IS_UNDERLINE, Boolean.toString(value));
this.setAttribute(ATTRIBUTE_IS_UNDERLINE, String.valueOf(value));
public void setIsUnderline(boolean value){ this.setAttribute(ATTRIBUTE_IS_UNDERLINE, Boolean.toString(value)); }
return BwEvent.maxDescriptionLength;
try { return fetchSvci().getSyspars().getMaxPublicDescriptionLength(); } catch (Throwable t) { err.emit(t); return 0; }
public int getMaxDescriptionLength() { return BwEvent.maxDescriptionLength; }
public JavaClosure(ATObject scope, JavaMethod meth) { super(meth, null); scope_ = scope;
public JavaClosure(ATObject scope) { this(scope, null);
public JavaClosure(ATObject scope, JavaMethod meth) { super(meth, null); scope_ = scope; }
public String getDefaultPersonalAccess() {
public static String getDefaultPersonalAccess() {
public String getDefaultPersonalAccess() { return defaultPersonalAccess; }
public String getDefaultPublicAccess() {
public static String getDefaultPublicAccess() {
public String getDefaultPublicAccess() { return defaultPublicAccess; }
debugMsg(debugsb.toString() + "...Check access denied (!allowed)");
debugsb.append("...Check access denied (!allowed) "); debugsb.append(ca.privileges); debugMsg(debugsb.toString());
public CurrentAccess evaluateAccess(AccessPrincipal who, String owner, Privilege[] how, char[] acl, PrivilegeSet filter) throws AccessException { boolean authenticated = !who.getUnauthenticated(); boolean isOwner = false; CurrentAccess ca = new CurrentAccess(); ca.desiredAccess = how; ca.acl = this; decode(acl); if (authenticated) { isOwner = who.getAccount().equals(owner); } StringBuffer debugsb = null; if (debug) { debugsb = new StringBuffer("Check access for '"); debugsb.append(new String(acl)); debugsb.append("' with authenticated = "); debugsb.append(authenticated); debugsb.append(" isOwner = "); debugsb.append(isOwner); } getPrivileges: { if (!authenticated) { ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeUnauthenticated); break getPrivileges; } if (isOwner) { ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOwner); if (ca.privileges == null) { ca.privileges = PrivilegeSet.makeDefaultOwnerPrivileges(); } break getPrivileges; } // Not owner - look for user ca.privileges = Ace.findMergedPrivilege(this, who.getAccount(), Ace.whoTypeUser); if (ca.privileges != null) { if (debug) { debugsb.append("... For user got: " + ca.privileges); } break getPrivileges; } // No specific user access - look for group access if (who.getGroupNames() != null) { Iterator it = who.getGroupNames().iterator(); while (it.hasNext()) { String group = (String)it.next(); if (debug) { debugsb.append("...Try access for group " + group); } PrivilegeSet privs = Ace.findMergedPrivilege(this, group, Ace.whoTypeGroup); if (privs != null) { ca.privileges = PrivilegeSet.mergePrivileges(ca.privileges, privs, false); } } } if (ca.privileges != null) { if (debug) { debugsb.append("...For groups got: " + ca.privileges); } break getPrivileges; } // "other" access set? ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOther); if (ca.privileges != null) { if (debug) { debugsb.append("...For other got: " + ca.privileges); } break getPrivileges; } } // getPrivileges if (ca.privileges == null) { if (debug) { debugMsg(debugsb.toString() + "...Check access denied (noprivs)"); } return ca; } ca.privileges.setUnspecified(isOwner); if (filter != null) { ca.privileges.filterPrivileges(filter); } if (how.length == 0) { // Means any access will do ca.accessAllowed = ca.privileges.getAnyAllowed(); return ca; } for (int i = 0; i < how.length; i++) { char priv = ca.privileges.getPrivilege(how[i].getIndex()); if ((priv != allowed) && (priv != allowedInherited)) { if (debug) { debugMsg(debugsb.toString() + "...Check access denied (!allowed)"); } return ca; } } if (debug) { debugMsg(debugsb.toString() + "...Check access allowed"); } ca.accessAllowed = true; return ca; }
/* Parse any content
public void doMethod(HttpServletRequest req, HttpServletResponse resp) throws WebdavException { if (debug) { trace("MkcolMethod: doMethod"); } /* Parse any content */ Document doc = parseContent(req, resp); /* Create the node */ String resourceUri = getResourceUri(req); WebdavNsNode node = getNsIntf().getNode(resourceUri); getNsIntf().makeCollection(req, node); if (doc != null) { int st = processDoc(req, doc); if (st != HttpServletResponse.SC_OK) { resp.setStatus(st); throw new WebdavException(st); } } resp.setStatus(HttpServletResponse.SC_CREATED); }
*/
public void doMethod(HttpServletRequest req, HttpServletResponse resp) throws WebdavException { if (debug) { trace("MkcolMethod: doMethod"); } /* Parse any content */ Document doc = parseContent(req, resp); /* Create the node */ String resourceUri = getResourceUri(req); WebdavNsNode node = getNsIntf().getNode(resourceUri); getNsIntf().makeCollection(req, node); if (doc != null) { int st = processDoc(req, doc); if (st != HttpServletResponse.SC_OK) { resp.setStatus(st); throw new WebdavException(st); } } resp.setStatus(HttpServletResponse.SC_CREATED); }
form.getMsg().emit("org.bedework.pubevents.message.authuser.updated");
form.getMsg().emit("org.bedework.client.message.authuser.updated");
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getUserAuth().isSuperUser()) { return "noAccess"; } CalSvcI svci = form.getCalSvcI(); /** We are just updating from the current form values. */ BwAuthUser au = validateAuthUser(form); if (au == null) { return "retry"; } if (debug) { debugMsg("Update authUser " + au); } svci.getUserAuth().updateUser(au); form.getMsg().emit("org.bedework.pubevents.message.authuser.updated"); return "continue"; }
logger.debug("calling getWindingRule");
public int getWindingRule(){ return WIND_NON_ZERO; }
if(currentIndex % 200 == 0){ logger.debug("calling isDone"); }
public boolean isDone(){ if(currentIndex == endIndex){ return true; } return false; }
if(currentIndex % 200 == 0){ logger.debug("calling next()"); }
public void next(){ currentIndex++; }
if (seed == null) { throw new IllegalArgumentException("seed may not be null"); }
public Map getUserAttributes(final Map seed) { return new HashMap(seed); }
if (isDefined) { log.debug(indent + " " + "<is-defined/>\n");
if (isNotDefined) { log.debug(indent + " " + "<is-not-defined/>\n");
public void dump(Logger log, String indent) { StringBuffer sb = new StringBuffer(indent); sb.append("<prop-filter name=\""); sb.append(name); sb.append("\">\n"); log.debug(sb.toString()); if (isDefined) { log.debug(indent + " " + "<is-defined/>\n"); } else if (timeRange != null) { timeRange.dump(log, indent + " "); } else { match.dump(log, indent + " "); } if (paramFilters != null) { Iterator it = paramFilters.iterator(); while (it.hasNext()) { ParamFilter pf = (ParamFilter)it.next(); pf.dump(log, indent + " "); } } log.debug(indent + "<prop-filter/>"); }
return false; } if (getIsDefined()) { return true;
return getIsNotDefined();
public boolean filter(Component c) throws WebdavException { try { PropertyList pl = c.getProperties(); if (pl == null) { return false; } Property prop = pl.getProperty(getName()); if (prop == null) { return false; } if (getIsDefined()) { return true; } TextMatch match = getMatch(); if (match != null) { return match.matches(prop.getValue()); } TimeRange tr = getTimeRange(); if (tr == null) { // invalid state? return true; } return tr.matches(prop); } catch (Throwable t) { throw new WebdavException(t); } }
if (isDefined) { log.debug(indent + " " + "<is-defined/>\n");
if (isNotDefined) { log.debug(indent + " " + "<is-not-defined/>\n");
public void dump(Logger log, String indent) { StringBuffer sb = new StringBuffer(indent); sb.append("<param-filter name=\""); sb.append(name); sb.append(">\n"); log.debug(sb.toString()); if (isDefined) { log.debug(indent + " " + "<is-defined/>\n"); } else { match.dump(log, indent + " "); } log.debug(indent + "<param-filter/>"); }
Field field = tableObj.getClass().getField(tableName+"Seq");
Field field = tableObj.getClass().getDeclaredField(tableName+"Seq");
public static void createSequence(String tableName, Connection conn, Object tableObj, SQLLoader statements) throws SQLException { try { Field field = tableObj.getClass().getField(tableName+"Seq"); String key = tableName + "Seq.create"; if(field != null ) { if (statements.has(key)) { String sql = statements.get(key); field.setAccessible(true); field.set(tableObj, new JDBCSequence(conn, tableName+"Seq", statements.get(tableName+"Seq.create"), statements.get(tableName+"Seq.nextVal"))); } else { throw new IllegalArgumentException(tableName+"Seq.create is not defined, unable to create sequence"); } } } catch(NoSuchFieldException e) { // no field following the naming convention, so skip } catch(IllegalArgumentException e) { GlobalExceptionHandler.handle("Thought this couldn't happen since I checked the object type.", e); } catch(IllegalAccessException e) { GlobalExceptionHandler.handle("Thought this couldn't happen since I called setAccessible. Looks like I was wrong", e); } }
logger.info("No Sequence field named: "+tableName+"Seq found."); Field[] fields = tableObj.getClass().getDeclaredFields(); for(int i = 0; i < fields.length; i++) { logger.info("Field in "+tableName+" "+fields[i].getName()); }
public static void createSequence(String tableName, Connection conn, Object tableObj, SQLLoader statements) throws SQLException { try { Field field = tableObj.getClass().getField(tableName+"Seq"); String key = tableName + "Seq.create"; if(field != null ) { if (statements.has(key)) { String sql = statements.get(key); field.setAccessible(true); field.set(tableObj, new JDBCSequence(conn, tableName+"Seq", statements.get(tableName+"Seq.create"), statements.get(tableName+"Seq.nextVal"))); } else { throw new IllegalArgumentException(tableName+"Seq.create is not defined, unable to create sequence"); } } } catch(NoSuchFieldException e) { // no field following the naming convention, so skip } catch(IllegalArgumentException e) { GlobalExceptionHandler.handle("Thought this couldn't happen since I checked the object type.", e); } catch(IllegalAccessException e) { GlobalExceptionHandler.handle("Thought this couldn't happen since I called setAccessible. Looks like I was wrong", e); } }
return getNameService().resolve(getNameService().to_name(dns));
NameComponent[] names = getNameService().to_name(dns); return getNameService().resolve(names);
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound,CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) dns = dns + "/" + interfacename + ".interface"; if(objectname != null && objectname.length() != 0) { objectname = objectname;// + getVersion(); dns = dns + "/" + objectname + ".object"+getVersion(); } logger.info("the final dns resolved is "+dns); try { return getNameService().resolve(getNameService().to_name(dns)); } catch(NotFound nfe) { logger.info("NOT FOUND Exception caught while resolving dns name context and the name not found is "+nfe.rest_of_name[0].id); throw nfe; } catch(InvalidName ine) { logger.info("INVALID NAME Exception caught while resolving dns name context"); throw ine; } catch(CannotProceed cpe) { logger.info("CANNOT PROCEED Exception caught while resolving dns name context"); throw cpe; } }
logger.info("NOT FOUND Exception caught while resolving dns name context and the name not found is "+nfe.rest_of_name[0].id);
logger.info("NOT FOUND Exception caught while resolving name context and the name not found is "+nfe.rest_of_name[0].id);
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound,CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) dns = dns + "/" + interfacename + ".interface"; if(objectname != null && objectname.length() != 0) { objectname = objectname;// + getVersion(); dns = dns + "/" + objectname + ".object"+getVersion(); } logger.info("the final dns resolved is "+dns); try { return getNameService().resolve(getNameService().to_name(dns)); } catch(NotFound nfe) { logger.info("NOT FOUND Exception caught while resolving dns name context and the name not found is "+nfe.rest_of_name[0].id); throw nfe; } catch(InvalidName ine) { logger.info("INVALID NAME Exception caught while resolving dns name context"); throw ine; } catch(CannotProceed cpe) { logger.info("CANNOT PROCEED Exception caught while resolving dns name context"); throw cpe; } }
logger.info("INVALID NAME Exception caught while resolving dns name context");
logger.info("INVALID NAME Exception caught while resolving name context", ine);
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound,CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) dns = dns + "/" + interfacename + ".interface"; if(objectname != null && objectname.length() != 0) { objectname = objectname;// + getVersion(); dns = dns + "/" + objectname + ".object"+getVersion(); } logger.info("the final dns resolved is "+dns); try { return getNameService().resolve(getNameService().to_name(dns)); } catch(NotFound nfe) { logger.info("NOT FOUND Exception caught while resolving dns name context and the name not found is "+nfe.rest_of_name[0].id); throw nfe; } catch(InvalidName ine) { logger.info("INVALID NAME Exception caught while resolving dns name context"); throw ine; } catch(CannotProceed cpe) { logger.info("CANNOT PROCEED Exception caught while resolving dns name context"); throw cpe; } }
public List getAllObjects(String interfaceName, FissBranch startingBranch) { List leaves = new ArrayList(); NamingContext namingContext = startingBranch.namingContext; BindingListHolder bindings = new BindingListHolder(); BindingIteratorHolder bindingIteratorHolder = new BindingIteratorHolder(); namingContext.list(0, bindings, bindingIteratorHolder); BindingIterator bindingIterator = bindingIteratorHolder.value; BindingHolder bindingHolder = new BindingHolder(); while(bindingIterator != null && bindingIterator.next_one(bindingHolder)) { Binding binding = bindingHolder.value; if(binding.binding_type == BindingType.ncontext) { if((binding.binding_name[0].kind.equals(INTERFACE) && binding.binding_name[0].id.equals(interfaceName)) || binding.binding_name[0].kind.equals(DNS)) { String newPath; if(binding.binding_name[0].kind.equals(DNS)) { newPath = startingBranch.path + binding.binding_name[0].id + "/"; } else { newPath = startingBranch.path; } NamingContext newNC = null; try { newNC = NamingContextHelper.narrow(namingContext.resolve(binding.binding_name)); } catch(UserException e) { throw new RuntimeException("This should not happen as the naming context should have come from the server. This probably indicates a programming error.", e); } leaves.addAll(getAllObjects(interfaceName, new FissBranch(newNC, newPath))); } } else if(binding.binding_name[0].kind.equals(OBJECT)) { Object o = null; if(interfaceName.equals(NETWORKDC)) { o = new NSNetworkDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(EVENTDC)) { o = new NSEventDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(SEISDC)) { o = new NSSeismogramDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(PLOTTABLEDC)) { o = new NSPlottableDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else { try { o = startingBranch.namingContext.resolve(binding.binding_name); } catch(UserException e) { throw new RuntimeException("This should not happen as the naming context should have come from the server. This probably indicates a programming error.", e); } } leaves.add(o); } } return leaves;
public List getAllObjects(String interfaceName) { return getAllObjects(interfaceName, new FissBranch(getNameService(), "/"));
public List getAllObjects(String interfaceName, FissBranch startingBranch) { List leaves = new ArrayList(); NamingContext namingContext = startingBranch.namingContext; BindingListHolder bindings = new BindingListHolder(); BindingIteratorHolder bindingIteratorHolder = new BindingIteratorHolder(); namingContext.list(0, bindings, bindingIteratorHolder); BindingIterator bindingIterator = bindingIteratorHolder.value; BindingHolder bindingHolder = new BindingHolder(); while(bindingIterator != null && bindingIterator.next_one(bindingHolder)) { Binding binding = bindingHolder.value; if(binding.binding_type == BindingType.ncontext) { if((binding.binding_name[0].kind.equals(INTERFACE) && binding.binding_name[0].id.equals(interfaceName)) || binding.binding_name[0].kind.equals(DNS)) { String newPath; if(binding.binding_name[0].kind.equals(DNS)) { newPath = startingBranch.path + binding.binding_name[0].id + "/"; } else { newPath = startingBranch.path; } NamingContext newNC = null; try { newNC = NamingContextHelper.narrow(namingContext.resolve(binding.binding_name)); } catch(UserException e) { throw new RuntimeException("This should not happen as the naming context should have come from the server. This probably indicates a programming error.", e); } leaves.addAll(getAllObjects(interfaceName, new FissBranch(newNC, newPath))); } } else if(binding.binding_name[0].kind.equals(OBJECT)) { Object o = null; if(interfaceName.equals(NETWORKDC)) { o = new NSNetworkDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(EVENTDC)) { o = new NSEventDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(SEISDC)) { o = new NSSeismogramDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(PLOTTABLEDC)) { o = new NSPlottableDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else { try { o = startingBranch.namingContext.resolve(binding.binding_name); } catch(UserException e) { throw new RuntimeException("This should not happen as the naming context should have come from the server. This probably indicates a programming error.", e); } } leaves.add(o); } } return leaves; }
TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException {
MicroSecondTimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException {
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time);
MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.getBeginTime());
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time);
MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.getEndTime());
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) {
if(packetType.equals("DT") && !fileTimeWindow.contains(time)) {
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
public RT130BadPacketException(String s) { super(s);
public RT130BadPacketException() { super();
public RT130BadPacketException(String s) { super(s); }
form.getMsg().emit("org.bedework.client.message.sponsor.referenced");
form.getErr().emit("org.bedework.client.error.sponsor.referenced");
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } BwSponsor sp = form.getSponsor(); int delResult = form.getCalSvcI().deleteSponsor(sp); if (delResult == 2) { form.getMsg().emit("org.bedework.client.message.sponsor.referenced"); return "inUse"; } if (delResult == 1) { form.getErr().emit("org.bedework.client.error.nosuchsponsor", sp); return "notFound"; } form.getMsg().emit("org.bedework.client.message.sponsor.deleted"); return "continue"; }
double scale = 2.2;
double scale = 1.8;
public OMEvent(EventAccessOperations eao) throws NoPreferredOrigin{ super(2); Origin prefOrigin = eao.get_preferred_origin(); float lat = prefOrigin.my_location.latitude; float lon = prefOrigin.my_location.longitude; float mag = prefOrigin.magnitudes[0].value; double scale = 2.2; int lilDiameter = (int)Math.pow(scale, 3.0); OMCircle lilCircle = new OMCircle(lat, lon, lilDiameter, lilDiameter); if (mag <= 3.0){ bigCircle = new OMCircle(lat, lon, lilDiameter, lilDiameter); } else{ mag = (float)(Math.pow(scale, (double)mag)); bigCircle = new OMCircle(lat, lon, (int)Math.floor(mag), (int)Math.floor(mag)); } event = new CacheEvent(eao); Color color = getDepthColor((QuantityImpl)prefOrigin.my_location.depth); lilCircle.setLinePaint(Color.BLACK); lilCircle.setFillPaint(color); bigCircle.setStroke(DisplayUtils.THREE_PIXEL_STROKE); bigCircle.setLinePaint(color); add(bigCircle); add(lilCircle); generate(getProjection()); }
if(size.height == 0) break;
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; numLeft = requests.size(); while(numLeft > 0){ synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); } HashMap plotters = currentRequirements.getPlotters(); Dimension size = currentRequirements.getSize(); Image currentImage = currentPatron.createImage(size.width, size.height); Graphics2D graphic = (Graphics2D)currentImage.getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(currentPatron){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue()){ requests.removeFirst(); currentPatron.setImage(currentImage); } } numLeft = requests.size(); } }
System.out.println("THe channel Str is "+ ChannelIdUtil.toString(channels[j].get_id()));
public Channel[] retrieve_grouping( Channel[] channels, Channel channel) { ChannelId channelId = channel.get_id(); String givenChannelStr = channelId.channel_code; String givenPrefixStr = givenChannelStr.substring(0, givenChannelStr.length() - 1); char givenOrientation = givenChannelStr.charAt(givenChannelStr.length() - 1); String searchString = ""; Channel[] rtnchannels = new Channel[3]; for(int j = 0; j < channels.length; j++) { //System.out.println("THe channel Str is "+ ChannelIdUtil.toString(channels[j].get_id())); } //System.out.println("The given Channel is "+givenChannelStr+" given Orientation is "+givenOrientation); for(int i = 0; i < patterns.length; i++) { if(patterns[i].indexOf(givenOrientation) != -1) { searchString = patterns[i]; //System.out.println("The search String is "+searchString); searchString = searchString.replace(givenOrientation, '_'); //System.out.println("The search string after is "+searchString); } else { return new Channel[0]; } int count = 0; rtnchannels = new Channel[3]; rtnchannels[count] = channel; count++; //System.out.println("The length of the channels is "+channels.length); for(int counter = 0; counter < channels.length; counter++) { String channelStr = channels[counter].get_id().channel_code; String prefixStr = channelStr.substring(0, channelStr.length() - 1); char orientation = channelStr.charAt(channelStr.length() - 1); //System.out.println("The channelstr is "+channelStr); if(prefixStr.equals(givenPrefixStr) && searchString.indexOf(orientation) != -1) { //System.out.println("The searchString is "+searchString); searchString = searchString.replace(orientation,'_'); rtnchannels[count] = channels[counter]; count++; //System.out.println("ORIENTATION "+orientation+"The matched channelStr is "+channelStr); } } if( searchString.equals("___") ) { //System.out.println("---------------___----------> RETURNING THE CHANNELS"); for(int counter = 0; counter < rtnchannels.length; counter++) { //if(rtnchannels[counter] == null) //System.out.println(" IS NULL "); // else //System.out.println(" IS NOT NULL "); } return rtnchannels; } } return new Channel[0]; }
if (getReqPar(request, "user") != null) {
if (getPublicAdmin(form) && (getReqPar(request, "user") != null)) {
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.fetchSvci(); BwPreferences prefs; /* Refetch the prefs */ if (getReqPar(request, "user") != null) { /* Fetch a given users preferences */ if (!form.getCurUserSuperUser()) { return "noAccess"; // First line of defence } BwUser user = findUser(request, form); if (user == null) { return "notFound"; } prefs = svc.getUserPrefs(user); } else { prefs = svc.getUserPrefs(); } String str = getReqPar(request, "preferredView"); if (str != null) { if (svc.findView(str) == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", str); return "notFound"; } prefs.setPreferredView(str); } str = getReqPar(request, "viewPeriod"); if (str != null) { prefs.setPreferredViewPeriod(form.validViewPeriod(str)); } str = getReqPar(request, "skin"); if (str != null) { prefs.setSkinName(str); } str = getReqPar(request, "skinStyle"); if (str != null) { prefs.setSkinStyle(str); } str = getReqPar(request, "email"); if (str != null) { prefs.setEmail(str); } str = getReqPar(request, "newCalPath"); if (str != null) { BwCalendar cal = svc.getCalendar(str); if (cal == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", str); return "notFound"; } prefs.setDefaultCalendar(cal); } int mode = getIntReqPar(request, "userMode", -1); if (mode != -1) { if ((mode < 0) || (mode > BwPreferences.maxMode)) { form.getErr().emit("org.bedework.client.error.badPref", "userMode"); return "badPref"; } prefs.setUserMode(mode); } str = getReqPar(request, "workDays"); if (str != null) { // XXX validate prefs.setWorkDays(str); } int minutes = getIntReqPar(request, "workDayStart", -1); if (minutes != -1) { if ((minutes < 0) || (minutes > 24 * 60 - 1)) { form.getErr().emit("org.bedework.client.error.badPref", "workDayStart"); return "badPref"; } prefs.setWorkdayStart(minutes); } minutes = getIntReqPar(request, "workDayEnd", -1); if (minutes != -1) { if ((minutes < 0) || (minutes > 24 * 60 - 1)) { form.getErr().emit("org.bedework.client.error.badPref", "workDayEnd"); return "badPref"; } prefs.setWorkdayEnd(minutes); } if (prefs.getWorkdayStart() > prefs.getWorkdayEnd()) { form.getErr().emit("org.bedework.client.error.badPref", "workDayStart > workDayEnd"); return "badPref"; } str = getReqPar(request, "preferredEndType"); if (str != null) { if ("duration".equals(str) || "date".equals(str)) { prefs.setPreferredEndType(str); } else { form.getErr().emit("org.bedework.client.error.badPref", "preferredEndType"); return "badPref"; } } svc.updateUserPrefs(prefs); form.setUserPreferences(prefs); form.getMsg().emit("org.bedework.client.message.prefs.updated"); return "success"; }
public void addParent(BasicSeismogramDisplay newParent){ parents.add(newParent); }
public void addParent(BasicSeismogramDisplay newParent){ if(!parents.contains(newParent)) parents.add(newParent); }
public void addParent(BasicSeismogramDisplay newParent){ parents.add(newParent); }
setEncoded(val);
EncodedAcl ea = new EncodedAcl(); ea.setEncoded(val);
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
if (empty()) {
if (ea.empty()) {
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
while (hasMore()) {
while (ea.hasMore()) {
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
ace.decode(this, true);
ace.decode(ea, true);
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
forward = checkLogOut(request, form);
if (!isPortlet) { forward = checkLogOut(request, form); } else { forward = null; }
public ActionForward execute(ActionMapping mapping, ActionForm frm, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ErrorEmitSvlt err = null; MessageEmitSvlt msg = null; String forward = "success"; UtilActionForm form = (UtilActionForm)frm; try { messages = getResources(request); /* Explicitly set logging on/off with an init parameter. Basing debugging off the state of log4j turns out to be too inflexible - for example, we have many applications with exactly the same code, basing logging on class names doesn't work. */ String debugVal = servlet.getServletConfig().getServletContext().getInitParameter("debug"); debug = !"0".equals(debugVal); checkDebug(request, form); isPortlet = isPortletRequest(request); noActionErrors = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.noactionerrors", "no").equals("yes"); err = getErrorObj(request, messages); msg = getMessageObj(request, messages); /** Log the request - virtual domains can make it difficult to * distinguish applications. */ logRequest(request); if (debug) { debugOut("entry"); debugOut("================================"); debugOut("isPortlet=" + isPortlet); Enumeration en = servlet.getInitParameterNames(); while (en.hasMoreElements()) { debugOut("attr name=" + en.nextElement()); } debugOut("================================"); dumpRequest(request); } if (!form.getInitialised()) { // Do one time settings form.setNocache( JspUtil.getProperty(messages, "edu.rpi.sss.util.action.nocache", "no").equals("yes")); form.setInitialised(true); } form.setLog(getLogger()); form.setDebug(debug); form.setMres(messages); form.setBrowserType(JspUtil.getBrowserType(request)); form.assignCurrentUser(request.getRemoteUser()); form.setUrl(JspUtil.getUrl(request)); form.setSchemeHostPort(JspUtil.getURLshp(request)); form.setContext(JspUtil.getContext(request)); form.setUrlPrefix(JspUtil.getURLPrefix(request)); form.setActionPath(mapping.getPath()); form.setErr(err); form.setMsg(msg); form.assignSessionId(getSessionId(request)); checkNocache(request, response, form); String defaultContentType = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.contenttype", "text/html"); /** Set up presentation values from request */ doPresentation(request, form); String contentName = getContentName(form); if (contentName != null) { /* Indicate we have a file attachment with the given name */ response.setHeader("Content-Disposition", "Attachment; Filename=\"" + contentName + "\""); } // Debugging action to test session serialization if (debug) { checkSerialize(request); } String appRoot = form.getPresentationState().getAppRoot(); if (appRoot != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("edu.rpi.sss.util.action.approot", appRoot); } /* ---------------------------------------------------------------- Everything is set up and ready to go. Execute something ---------------------------------------------------------------- */ forward = checkLogOut(request, form); if (forward != null) { // Disable xslt filters response.setContentType("text/html"); } else { response.setContentType(defaultContentType); forward = checkVarReq(request, form); if (forward == null) { forward = checkForwardto(request); } if (forward == null) { forward = performAction(request, response, form, messages); } } if (forward == null) { getLogger().warn("Forward = null"); err.emit("edu.rpi.sss.util.nullforward"); forward = "error"; } if (err == null) { getLogger().warn("No errors object"); } else if (err.messagesEmitted()) { if (noActionErrors) { } else { ActionErrors aes = ((ErrorEmitSvlt)err).getErrors(); saveErrors(request, aes); } if (debug) { getLogger().debug(((ErrorEmitSvlt)err).getMsgList().size() + " errors emitted"); } } else if (debug) { getLogger().debug("No errors emitted"); } if (msg == null) { getLogger().warn("No messages object"); } else if (msg.messagesEmitted()) { ActionMessages ams = ((MessageEmitSvlt)msg).getMessages(); saveMessages(request, ams); if (debug) { getLogger().debug(ams.size() + " messages emitted"); } } else if (debug) { getLogger().debug("No messages emitted"); } if (debug) { getLogger().debug("exit to " + forward); } } catch (Throwable t) { if (debug) { getLogger().debug("Action exception: ", t); } err.emit(t); forward = "error"; } return (mapping.findForward(forward)); }
response.setContentType(defaultContentType);
if (!isPortlet) { response.setContentType(defaultContentType); }
public ActionForward execute(ActionMapping mapping, ActionForm frm, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ErrorEmitSvlt err = null; MessageEmitSvlt msg = null; String forward = "success"; UtilActionForm form = (UtilActionForm)frm; try { messages = getResources(request); /* Explicitly set logging on/off with an init parameter. Basing debugging off the state of log4j turns out to be too inflexible - for example, we have many applications with exactly the same code, basing logging on class names doesn't work. */ String debugVal = servlet.getServletConfig().getServletContext().getInitParameter("debug"); debug = !"0".equals(debugVal); checkDebug(request, form); isPortlet = isPortletRequest(request); noActionErrors = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.noactionerrors", "no").equals("yes"); err = getErrorObj(request, messages); msg = getMessageObj(request, messages); /** Log the request - virtual domains can make it difficult to * distinguish applications. */ logRequest(request); if (debug) { debugOut("entry"); debugOut("================================"); debugOut("isPortlet=" + isPortlet); Enumeration en = servlet.getInitParameterNames(); while (en.hasMoreElements()) { debugOut("attr name=" + en.nextElement()); } debugOut("================================"); dumpRequest(request); } if (!form.getInitialised()) { // Do one time settings form.setNocache( JspUtil.getProperty(messages, "edu.rpi.sss.util.action.nocache", "no").equals("yes")); form.setInitialised(true); } form.setLog(getLogger()); form.setDebug(debug); form.setMres(messages); form.setBrowserType(JspUtil.getBrowserType(request)); form.assignCurrentUser(request.getRemoteUser()); form.setUrl(JspUtil.getUrl(request)); form.setSchemeHostPort(JspUtil.getURLshp(request)); form.setContext(JspUtil.getContext(request)); form.setUrlPrefix(JspUtil.getURLPrefix(request)); form.setActionPath(mapping.getPath()); form.setErr(err); form.setMsg(msg); form.assignSessionId(getSessionId(request)); checkNocache(request, response, form); String defaultContentType = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.contenttype", "text/html"); /** Set up presentation values from request */ doPresentation(request, form); String contentName = getContentName(form); if (contentName != null) { /* Indicate we have a file attachment with the given name */ response.setHeader("Content-Disposition", "Attachment; Filename=\"" + contentName + "\""); } // Debugging action to test session serialization if (debug) { checkSerialize(request); } String appRoot = form.getPresentationState().getAppRoot(); if (appRoot != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("edu.rpi.sss.util.action.approot", appRoot); } /* ---------------------------------------------------------------- Everything is set up and ready to go. Execute something ---------------------------------------------------------------- */ forward = checkLogOut(request, form); if (forward != null) { // Disable xslt filters response.setContentType("text/html"); } else { response.setContentType(defaultContentType); forward = checkVarReq(request, form); if (forward == null) { forward = checkForwardto(request); } if (forward == null) { forward = performAction(request, response, form, messages); } } if (forward == null) { getLogger().warn("Forward = null"); err.emit("edu.rpi.sss.util.nullforward"); forward = "error"; } if (err == null) { getLogger().warn("No errors object"); } else if (err.messagesEmitted()) { if (noActionErrors) { } else { ActionErrors aes = ((ErrorEmitSvlt)err).getErrors(); saveErrors(request, aes); } if (debug) { getLogger().debug(((ErrorEmitSvlt)err).getMsgList().size() + " errors emitted"); } } else if (debug) { getLogger().debug("No errors emitted"); } if (msg == null) { getLogger().warn("No messages object"); } else if (msg.messagesEmitted()) { ActionMessages ams = ((MessageEmitSvlt)msg).getMessages(); saveMessages(request, ams); if (debug) { getLogger().debug(ams.size() + " messages emitted"); } } else if (debug) { getLogger().debug("No messages emitted"); } if (debug) { getLogger().debug("exit to " + forward); } } catch (Throwable t) { if (debug) { getLogger().debug("Action exception: ", t); } err.emit(t); forward = "error"; } return (mapping.findForward(forward)); }
logger = (BwLog)CalEnv.getGlobalObject("loggerclass", BwLog.class);
logger = (BwLog)CalEnvFactory.getEnv(null, false).getGlobalObject("loggerclass", BwLog.class);
public static BwLog getLogger() { BwLog logger = null; try { logger = (BwLog)CalEnv.getGlobalObject("loggerclass", BwLog.class); } catch (Throwable t) { logger = new BwLogImpl(); } return logger; }
if(beginTime == null)
if(beginTime == null){
public void addSeismogram(LocalSeismogram seis){ if(beginTime == null) this.beginTime = ((LocalSeismogramImpl)seis).getBeginTime(); if(displayInterval == null) this.displayInterval = new TimeInterval(((LocalSeismogramImpl)seis).getBeginTime(), ((LocalSeismogramImpl)seis).getEndTime()); seismos.put(seis, ((LocalSeismogramImpl)seis).getBeginTime()); this.updateTimeSyncListeners(); }
seismos.put(seis, ((LocalSeismogramImpl)seis).getBeginTime());
public void addSeismogram(LocalSeismogram seis){ if(beginTime == null) this.beginTime = ((LocalSeismogramImpl)seis).getBeginTime(); if(displayInterval == null) this.displayInterval = new TimeInterval(((LocalSeismogramImpl)seis).getBeginTime(), ((LocalSeismogramImpl)seis).getEndTime()); seismos.put(seis, ((LocalSeismogramImpl)seis).getBeginTime()); this.updateTimeSyncListeners(); }
public abstract MicroSecondTimeRange getTimeRange();
public abstract MicroSecondTimeRange getTimeRange(DataSetSeismogram seis);
public abstract MicroSecondTimeRange getTimeRange();
if (current.getEvent().get_preferred_origin().equals(eqSelectionEvent.getEvents()[0].get_preferred_origin())){
if (DisplayUtils.originIsEqual(current.getEvent(), eqSelectionEvent.getEvents()[0])){
public void eqSelectionChanged(EQSelectionEvent eqSelectionEvent) { OMEvent selected = null; List deselected = new ArrayList(); synchronized(circles){ Iterator it = circles.iterator(); while (it.hasNext()){ OMEvent current = (OMEvent)it.next(); try{ if (current.getEvent().get_preferred_origin().equals(eqSelectionEvent.getEvents()[0].get_preferred_origin())){ selected = current; }else{ deselected.add(current); } } catch(NoPreferredOrigin e){} } } if(selected != null){ selected.select(); synchronized(circles){ circles.moveIndexedToTop(circles.indexOf(selected)); } } Iterator it = deselected.iterator(); while(it.hasNext()){ ((OMEvent)it.next()).deselect(); } }
catch(NoPreferredOrigin e){}
catch(NoPreferredOrigin e){ e.printStackTrace(); }
public void eqSelectionChanged(EQSelectionEvent eqSelectionEvent) { OMEvent selected = null; List deselected = new ArrayList(); synchronized(circles){ Iterator it = circles.iterator(); while (it.hasNext()){ OMEvent current = (OMEvent)it.next(); try{ if (current.getEvent().get_preferred_origin().equals(eqSelectionEvent.getEvents()[0].get_preferred_origin())){ selected = current; }else{ deselected.add(current); } } catch(NoPreferredOrigin e){} } } if(selected != null){ selected.select(); synchronized(circles){ circles.moveIndexedToTop(circles.indexOf(selected)); } } Iterator it = deselected.iterator(); while(it.hasNext()){ ((OMEvent)it.next()).deselect(); } }
StringBuffer buf = new StringBuffer(); ParseRegions regions = new ParseRegions(); String location = regions.getGeographicRegionName(event.get_attributes().region.number); MicroSecondDate msd = new MicroSecondDate(event.get_preferred_origin().origin_time); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); sdf.format(msd); float mag = event.get_preferred_origin().magnitudes[0].value; Quantity depth = event.get_preferred_origin().my_location.depth; buf.append("Event: "); buf.append(location + " | "); buf.append(sdf.format(msd) + " | "); buf.append("Mag " + mag + " | "); buf.append("Depth " + depth.value + " " + depth.the_units); fireRequestInfoLine(buf.toString());
fireRequestInfoLine(getEventInfo(event));
public boolean mouseMoved(MouseEvent e){ synchronized(circles){ Iterator it = circles.iterator(); while(it.hasNext()){ OMEvent current = (OMEvent)it.next(); try{ if(current.getBigCircle().contains(e.getX(), e.getY())){ EventAccessOperations event = current.getEvent(); StringBuffer buf = new StringBuffer(); //Get geographic name of origin ParseRegions regions = new ParseRegions(); String location = regions.getGeographicRegionName(event.get_attributes().region.number); //Get Date and format it accordingly MicroSecondDate msd = new MicroSecondDate(event.get_preferred_origin().origin_time); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); sdf.format(msd); //Get Magnitude float mag = event.get_preferred_origin().magnitudes[0].value; //get depth Quantity depth = event.get_preferred_origin().my_location.depth; buf.append("Event: "); buf.append(location + " | "); buf.append(sdf.format(msd) + " | "); buf.append("Mag " + mag + " | "); buf.append("Depth " + depth.value + " " + depth.the_units); fireRequestInfoLine(buf.toString()); return true; } } catch(Exception ex){} } } fireRequestInfoLine(" "); return false; }
CalSvcIPars pars = new CalSvcIPars(user, access, user,
CalSvcIPars pars = new CalSvcIPars(user, user,
public CalSvcTestWrapper(String user, int access, boolean publicEvents, boolean debug) throws Throwable { super(); //this.debug = debug; isPublic = publicEvents; this.user = user; String envPrefix; if (publicEvents) { envPrefix = webAdminAppPrefix; } else if (user == null) { envPrefix = webPublicAppPrefix; } else { envPrefix = webPersonalAppPrefix; } CalSvcIPars pars = new CalSvcIPars(user, access, user, envPrefix, publicEvents, false, // caldav null, // synch debug); init(pars); }
form.getErr().emit("org.bedework.error.location.referenced");
form.getErr().emit("org.bedework.client.error.location.referenced");
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getLocationId(); if (id < 0) { // Do nothing return "doNothing"; } CalSvcI svci = form.getCalSvcI(); BwLocation loc = svci.getLocation(id); int delResult = svci.deleteLocation(loc); if (delResult == 2) { form.getErr().emit("org.bedework.error.location.referenced"); return "referenced"; } if (delResult == 1) { form.getErr().emit("org.bedework.error.nosuchlocation", id); return "doNothing"; } form.getMsg().emit("org.bedework.message.deleted.locations", 1); return "success"; }
form.getErr().emit("org.bedework.error.nosuchlocation", id);
form.getErr().emit("org.bedework.client.error.nosuchlocation", id);
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getLocationId(); if (id < 0) { // Do nothing return "doNothing"; } CalSvcI svci = form.getCalSvcI(); BwLocation loc = svci.getLocation(id); int delResult = svci.deleteLocation(loc); if (delResult == 2) { form.getErr().emit("org.bedework.error.location.referenced"); return "referenced"; } if (delResult == 1) { form.getErr().emit("org.bedework.error.nosuchlocation", id); return "doNothing"; } form.getMsg().emit("org.bedework.message.deleted.locations", 1); return "success"; }
form.getMsg().emit("org.bedework.message.deleted.locations", 1);
form.getMsg().emit("org.bedework.client.message.deleted.locations", 1);
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getLocationId(); if (id < 0) { // Do nothing return "doNothing"; } CalSvcI svci = form.getCalSvcI(); BwLocation loc = svci.getLocation(id); int delResult = svci.deleteLocation(loc); if (delResult == 2) { form.getErr().emit("org.bedework.error.location.referenced"); return "referenced"; } if (delResult == 1) { form.getErr().emit("org.bedework.error.nosuchlocation", id); return "doNothing"; } form.getMsg().emit("org.bedework.message.deleted.locations", 1); return "success"; }
request.setQueryString("param1=test1");
public void testGetCurrentUrlMalformedQueryString() throws Exception { request.setScheme("http"); request.setServerName("www.example.com"); request.setServerPort(80); request.setContextPath(""); request.setServletPath("/index.jsp"); request.setQueryString("param1=test1"); URL result = RequestHelper.getCurrentUrl(request); String ext = result.toExternalForm(); assertEquals("http://www.example.com/index.jsp?param1=test1", ext); }
request.setQueryString("param1=test1");
public void testGetCurrentUrlMalformedQueryString() throws Exception { request.setScheme("http"); request.setServerName("www.example.com"); request.setServerPort(80); request.setContextPath(""); request.setServletPath("/index.jsp"); request.setQueryString("param1=test1"); URL result = RequestHelper.getCurrentUrl(request); String ext = result.toExternalForm(); assertEquals("http://www.example.com/index.jsp?param1=test1", ext); }
Privilege p = findPriv(privs[privAll], acl);
Privilege p = Privilege.findPriv(privs[privAll], privs[privNone], acl);
public static PrivilegeSet fromEncoding(EncodedAcl acl) throws AccessException { char[] privStates = { unspecified, // privAll unspecified, // privRead unspecified, // privReadAcl unspecified, // privReadCurrentUserPrivilegeSet unspecified, // privReadFreeBusy unspecified, // privWrite unspecified, // privWriteAcl unspecified, // privWriteProperties unspecified, // privWriteContent unspecified, // privBind unspecified, // privUnbind unspecified, // privUnlock unspecified, // privNone }; while (acl.hasMore()) { char c = acl.getChar(); if ((c == ' ') || (c == inheritedFlag)) { break; } acl.back(); Privilege p = findPriv(privs[privAll], acl); if (p == null) { throw AccessException.badACL("unknown priv"); } // Set the states based on the priv we just found. setState(privStates, p, p.getDenial()); } return new PrivilegeSet(privStates); }
throw AccessException.badACL("unknown priv");
throw AccessException.badACL("unknown priv " + acl.getErrorInfo());
public static PrivilegeSet fromEncoding(EncodedAcl acl) throws AccessException { char[] privStates = { unspecified, // privAll unspecified, // privRead unspecified, // privReadAcl unspecified, // privReadCurrentUserPrivilegeSet unspecified, // privReadFreeBusy unspecified, // privWrite unspecified, // privWriteAcl unspecified, // privWriteProperties unspecified, // privWriteContent unspecified, // privBind unspecified, // privUnbind unspecified, // privUnlock unspecified, // privNone }; while (acl.hasMore()) { char c = acl.getChar(); if ((c == ' ') || (c == inheritedFlag)) { break; } acl.back(); Privilege p = findPriv(privs[privAll], acl); if (p == null) { throw AccessException.badACL("unknown priv"); } // Set the states based on the priv we just found. setState(privStates, p, p.getDenial()); } return new PrivilegeSet(privStates); }
if (debug) { debugMsg("set pos to " + pos); }
public void setPos(int val) { pos = val; }
Privilege p = findPriv(privs[privAll], acl);
Privilege p = Privilege.findPriv(privs[privAll], privs[privNone], acl);
public static Collection getPrivs(EncodedAcl acl) throws AccessException { ArrayList al = new ArrayList(); while (acl.hasMore()) { char c = acl.getChar(); if ((c == ' ') || (c == inheritedFlag)) { break; } acl.back(); Privilege p = findPriv(privs[privAll], acl); if (p == null) { throw AccessException.badACL("unknown priv"); } al.add(p); } return al; }
int getMaxMonth() { return 12;
int getMaxMonth(int year) { return getMaxMonth();
int getMaxMonth() { return 12; }
MicroSecondDate halfPastFirstDay = START.add((TimeInterval)ONE_DAY.divideBy(2)); MicroSecondTimeRange halfFirstToHalfSecond = new MicroSecondTimeRange(halfPastFirstDay, ONE_DAY); PlottableChunk[] out = plottDb.get(halfFirstToHalfSecond,
TimeInterval halfDay = (TimeInterval)ONE_DAY.divideBy(2); MicroSecondDate halfPastFirstDay = START.add(halfDay); MicroSecondTimeRange halfFirstToStartSecond = new MicroSecondTimeRange(halfPastFirstDay, halfDay); PlottableChunk[] out = plottDb.get(halfFirstToStartSecond,
public void testPutTwoDaysGetOne() throws SQLException, IOException { PlottableChunk secondDay = new PlottableChunk(data.getData(), 0, 2, 2000, PIXELS, CHAN_ID); plottDb.put(new PlottableChunk[] {data, secondDay}); MicroSecondDate halfPastFirstDay = START.add((TimeInterval)ONE_DAY.divideBy(2)); MicroSecondTimeRange halfFirstToHalfSecond = new MicroSecondTimeRange(halfPastFirstDay, ONE_DAY); PlottableChunk[] out = plottDb.get(halfFirstToHalfSecond, data.getChannel(), data.getPixelsPerDay()); int halfLength = data.getData().x_coor.length / 2; int[] x = new int[halfLength]; int[] y = new int[halfLength]; for(int i = 0; i < halfLength; i++) { x[i] = (i + halfLength) / 2; } System.arraycopy(data.getData().y_coor, halfLength, y, 0, halfLength); PlottableChunk secondHalfFirstDay = new PlottableChunk(new Plottable(x, y), halfLength, 1, 2000, PIXELS, CHAN_ID); assertEquals(secondHalfFirstDay, out[0]); }
x[i] = (i + halfLength) / 2;
x[i] = i / 2;
public void testPutTwoDaysGetOne() throws SQLException, IOException { PlottableChunk secondDay = new PlottableChunk(data.getData(), 0, 2, 2000, PIXELS, CHAN_ID); plottDb.put(new PlottableChunk[] {data, secondDay}); MicroSecondDate halfPastFirstDay = START.add((TimeInterval)ONE_DAY.divideBy(2)); MicroSecondTimeRange halfFirstToHalfSecond = new MicroSecondTimeRange(halfPastFirstDay, ONE_DAY); PlottableChunk[] out = plottDb.get(halfFirstToHalfSecond, data.getChannel(), data.getPixelsPerDay()); int halfLength = data.getData().x_coor.length / 2; int[] x = new int[halfLength]; int[] y = new int[halfLength]; for(int i = 0; i < halfLength; i++) { x[i] = (i + halfLength) / 2; } System.arraycopy(data.getData().y_coor, halfLength, y, 0, halfLength); PlottableChunk secondHalfFirstDay = new PlottableChunk(new Plottable(x, y), halfLength, 1, 2000, PIXELS, CHAN_ID); assertEquals(secondHalfFirstDay, out[0]); }
PlottableChunk secondHalfFirstDay = new PlottableChunk(new Plottable(x, y), halfLength,
Plottable plott = new Plottable(x, y); PlottableChunk secondHalfFirstDay = new PlottableChunk(plott, PIXELS / 2,
public void testPutTwoDaysGetOne() throws SQLException, IOException { PlottableChunk secondDay = new PlottableChunk(data.getData(), 0, 2, 2000, PIXELS, CHAN_ID); plottDb.put(new PlottableChunk[] {data, secondDay}); MicroSecondDate halfPastFirstDay = START.add((TimeInterval)ONE_DAY.divideBy(2)); MicroSecondTimeRange halfFirstToHalfSecond = new MicroSecondTimeRange(halfPastFirstDay, ONE_DAY); PlottableChunk[] out = plottDb.get(halfFirstToHalfSecond, data.getChannel(), data.getPixelsPerDay()); int halfLength = data.getData().x_coor.length / 2; int[] x = new int[halfLength]; int[] y = new int[halfLength]; for(int i = 0; i < halfLength; i++) { x[i] = (i + halfLength) / 2; } System.arraycopy(data.getData().y_coor, halfLength, y, 0, halfLength); PlottableChunk secondHalfFirstDay = new PlottableChunk(new Plottable(x, y), halfLength, 1, 2000, PIXELS, CHAN_ID); assertEquals(secondHalfFirstDay, out[0]); }
org.eclipse.gmf.internal.codegen.draw2d.GridLayout layoutThis = new org.eclipse.gmf.internal.codegen.draw2d.GridLayout();
GridLayout layoutThis = new GridLayout();
public ClassFigure() { org.eclipse.gmf.internal.codegen.draw2d.GridLayout layoutThis = new org.eclipse.gmf.internal.codegen.draw2d.GridLayout(); layoutThis.numColumns = 1; layoutThis.makeColumnsEqualWidth = true; layoutThis.horizontalSpacing = 0; layoutThis.verticalSpacing = 0; layoutThis.marginWidth = 0; layoutThis.marginHeight = 0; this.setLayoutManager(layoutThis); this.setFill(false); this.setFillXOR(false); this.setOutline(false); this.setOutlineXOR(false); this.setLineWidth(1); this.setLineStyle(org.eclipse.draw2d.Graphics.LINE_SOLID); createContents(); }