You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(7) |
Aug
|
Sep
(46) |
Oct
(102) |
Nov
(10) |
Dec
(21) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
(3) |
Mar
(14) |
Apr
(9) |
May
(12) |
Jun
(4) |
Jul
(40) |
Aug
(60) |
Sep
(38) |
Oct
(2) |
Nov
(1) |
Dec
(42) |
2008 |
Jan
(23) |
Feb
(29) |
Mar
(107) |
Apr
(27) |
May
(3) |
Jun
(1) |
Jul
(15) |
Aug
(7) |
Sep
(19) |
Oct
|
Nov
(2) |
Dec
|
2009 |
Jan
(36) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(15) |
Jul
(30) |
Aug
(32) |
Sep
(11) |
Oct
(21) |
Nov
(12) |
Dec
(15) |
2010 |
Jan
(29) |
Feb
(9) |
Mar
(25) |
Apr
|
May
(7) |
Jun
(5) |
Jul
(21) |
Aug
(32) |
Sep
(10) |
Oct
(8) |
Nov
(29) |
Dec
(8) |
2011 |
Jan
(9) |
Feb
(35) |
Mar
(11) |
Apr
(4) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(30) |
2012 |
Jan
(5) |
Feb
(7) |
Mar
(10) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jrb...@us...> - 2009-07-27 16:07:41
|
Revision: 902 http://cishell.svn.sourceforge.net/cishell/?rev=902&view=rev Author: jrbibers Date: 2009-07-27 16:07:28 +0000 (Mon, 27 Jul 2009) Log Message: ----------- Minor stylistic refactoring while reading CIShell code in preparation for updates to conversion exception handling. Modified Paths: -------------- trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableAlgorithmFactory.java Modified: trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java 2009-07-27 16:07:28 UTC (rev 902) @@ -58,7 +58,7 @@ /** * Uses this Converter to convert the given Data object to a new format. * This is a convenience method that uses this Converter to convert a Data - * object of the corrent format to a Data object of the defined output format. + * object of the current format to a Data object of the defined output format. * * @param data The Data object with compatible format * @return A Data object of correct output format Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2009-07-27 16:07:28 UTC (rev 902) @@ -52,16 +52,11 @@ props.put(OUT_DATA, refs[refs.length-1].getProperty(OUT_DATA)); props.put(LABEL, props.get(IN_DATA) + " -> " + props.get(OUT_DATA)); - String lossiness = LOSSLESS; - for (int i=0; i < refs.length; i++) { - if (LOSSY.equals(refs[i].getProperty(CONVERSION))) { - lossiness = LOSSY; - } - } - //TODO: Do the same thing for complexity + // TODO: Do the same thing for complexity + String lossiness = calculateLossiness(refs); props.put(CONVERSION, lossiness); } - + /** * @see org.cishell.service.conversion.Converter#convert(org.cishell.framework.data.Data) */ @@ -73,10 +68,14 @@ try { dm = alg.execute(); - } catch (AlgorithmExecutionException e1) { - throw new ConversionException("Exception occurred while converting data \r\n" + e1.getMessage(),e1); - } catch (Exception e2) { - throw new ConversionException("Exception occurred while converting data \r\n" + e2.getMessage(), e2); + } catch (AlgorithmExecutionException aee) { + throw new ConversionException( + "Problem converting data: " + aee.getMessage(), + aee); + } catch (Exception e) { + throw new ConversionException( + "Problem converting data: " + e.getMessage(), + e); } Object outData = null; @@ -88,12 +87,14 @@ Dictionary props = inDM.getMetadata(); Dictionary newProps = new Hashtable(); - for (Enumeration e=props.keys(); e.hasMoreElements();) { + for (Enumeration e = props.keys(); e.hasMoreElements();) { Object key = e.nextElement(); newProps.put(key, props.get(key)); } - String outFormat = (String)getProperties().get(AlgorithmProperty.OUT_DATA); + String outFormat = + (String) getProperties().get(AlgorithmProperty.OUT_DATA); + return new BasicData(newProps, outData, outFormat); } else { return null; @@ -122,7 +123,9 @@ return props; } - public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) { + public Algorithm createAlgorithm(Data[] dm, + Dictionary parameters, + CIShellContext context) { return new ConverterAlgorithm(dm, parameters, context); } @@ -137,37 +140,59 @@ public String toString() { String str =""; for (int j = 0; j < refs.length; ++j) { - str += refs[j].getProperty(Constants.SERVICE_ID) + " " + refs[j].getProperty(Constants.SERVICE_PID) + "-> "; + str += refs[j].getProperty(Constants.SERVICE_ID); + str += " "; + str += refs[j].getProperty(Constants.SERVICE_PID); + str += "-> "; } + return str; } public boolean equals(Object o) { - boolean equals = false; + boolean equal = false; if (o instanceof Converter) { - ServiceReference[] otherServiceReference = ((Converter)o).getConverterChain(); + ServiceReference[] otherServiceReference = + ((Converter) o).getConverterChain(); if (refs.length == otherServiceReference.length) { for (int i = 0; i < otherServiceReference.length; i++) { if (refs[i].getProperty(Constants.SERVICE_ID).equals( - otherServiceReference[i].getProperty(Constants.SERVICE_ID))) { - equals = true; + otherServiceReference[i].getProperty( + Constants.SERVICE_ID))) { + equal = true; } else { - equals = false; + equal = false; break; } } } } - return equals; + return equal; } - private class ConverterAlgorithm implements Algorithm { + /* The conversion chain (refs) is lossless + * if and only if no conversion (ref) is lossy. + */ + private String calculateLossiness(ServiceReference[] refs) { + String lossiness = LOSSLESS; + for (int i=0; i < refs.length; i++) { + if (LOSSY.equals(refs[i].getProperty(CONVERSION))) { + lossiness = LOSSY; + } + } + + return lossiness; + } + + private class ConverterAlgorithm implements Algorithm { Data[] inDM; CIShellContext context; Dictionary parameters; - public ConverterAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) { + public ConverterAlgorithm(Data[] dm, + Dictionary parameters, + CIShellContext context) { this.inDM = dm; this.parameters = parameters; this.context = context; @@ -175,15 +200,18 @@ public Data[] execute() throws AlgorithmExecutionException { Data[] dm = inDM; - for (int i=0; i < refs.length; i++) { - AlgorithmFactory factory = (AlgorithmFactory)bContext.getService(refs[i]); + for (int i = 0; i < refs.length; i++) { + AlgorithmFactory factory = + (AlgorithmFactory) bContext.getService(refs[i]); if (factory != null) { - Algorithm alg = factory.createAlgorithm(dm, parameters, context); + Algorithm alg = + factory.createAlgorithm(dm, parameters, context); dm = alg.execute(); } else { - throw new AlgorithmExecutionException("Missing subconverter: " + throw new AlgorithmExecutionException( + "Missing subconverter: " + refs[i].getProperty(Constants.SERVICE_PID)); } } Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java 2009-07-27 16:07:28 UTC (rev 902) @@ -94,8 +94,7 @@ } /** - * Assemble the directed graph of converters. Currently unweighted - * + * Assemble the directed graph of converters. Currently unweighted. */ private void assembleGraph() { try { @@ -132,8 +131,8 @@ */ public Converter[] findConverters(String inFormat, String outFormat) { // saveGraph(); - if (inFormat != null && inFormat.length() > 0 && - outFormat != null && outFormat.length() > 0) { + if (inFormat != null && inFormat.length() > 0 + && outFormat != null && outFormat.length() > 0) { Converter[] converters = null; @@ -146,28 +145,25 @@ return converters; } - return new Converter[0]; + return new Converter[0]; } /** - * If the final format is of type file-ext, then append the final converter to the - * converter list + * If the final format is of type file-ext, then append the final converter + * to the converter list * * @param converters Current converter chain * @param outFormat Final data type * @return The edited converter chain */ - private Converter[] addFinalStepConversions(Converter[] converters, String outFormat) { + private Converter[] addFinalStepConversions(Converter[] converters, + String outFormat) { Collection newConverters = new HashSet(); Set formats = new HashSet(); for (int i=0; i < converters.length; i++) { String format = (String) converters[i].getProperties().get(OUT_DATA); - //tmp - //String inFormat = (String) converters[i].getProperties().get(IN_DATA); - //System.out.println("Converter:"+converters.length+":"+ inFormat + "->" + format + "->" + outFormat); - if (!formats.contains(format)) { String filter = "(&("+ALGORITHM_TYPE+"="+TYPE_VALIDATOR+")" + "(!("+REMOTE+"=*))" + @@ -175,8 +171,10 @@ "("+OUT_DATA+"="+outFormat+"))"; try { - ServiceReference[] refs = bContext.getServiceReferences( - AlgorithmFactory.class.getName(), filter); + ServiceReference[] refs = + bContext.getServiceReferences( + AlgorithmFactory.class.getName(), + filter); if (refs != null && refs.length > 0) { for (int j=0; j < refs.length; j++) { @@ -184,10 +182,12 @@ converters[i].getConverterChain())); chain.add(refs[j]); - ServiceReference[] newChain = (ServiceReference[]) - chain.toArray(new ServiceReference[0]); + ServiceReference[] newChain = (ServiceReference[]) + chain.toArray(new ServiceReference[0]); - newConverters.add(new ConverterImpl(bContext, ciContext, newChain)); + newConverters.add(new ConverterImpl(bContext, + ciContext, + newChain)); } formats.add(format); @@ -209,13 +209,8 @@ * @see org.cishell.service.conversion.DataConversionService#findConverters(java.lang.String, java.lang.String) */ private Converter[] getConverters(String inFormat, String outFormat) { - String inFilter = "(&(" + ALGORITHM_TYPE + "=" + TYPE_CONVERTER + ")" - + "("+IN_DATA+"="+inFormat+") " + "("+OUT_DATA+"=*)" + - "(!("+IN_DATA+"=file-ext:*))" + "(!(" + REMOTE + "=*)))"; - - String outFilter = "(&(" + ALGORITHM_TYPE + "=" + TYPE_CONVERTER + ")" - + "("+IN_DATA+"=*) " + "("+OUT_DATA+"="+outFormat+")" - + "(!(" + REMOTE + "=*)))"; + String inFilter = createConverterFilterForInFormat(inFormat); + String outFilter = createConverterFilterForOutFormat(outFormat); Collection converterList = new HashSet(); @@ -238,23 +233,24 @@ if (inRefs != null && outRefs != null) { Set inFileTypeSet = new HashSet(); for (int i = 0; i < inRefs.length; ++i) { - inFileTypeSet.add(inRefs[i] - .getProperty(AlgorithmProperty.IN_DATA)); + inFileTypeSet.add( + inRefs[i].getProperty(AlgorithmProperty.IN_DATA)); } Set outFileTypeSet = new HashSet(); for (int i = 0; i < outRefs.length; ++i) { - outFileTypeSet.add(outRefs[i] - .getProperty(AlgorithmProperty.OUT_DATA)); + outFileTypeSet.add( + outRefs[i].getProperty(AlgorithmProperty.OUT_DATA)); } for (Iterator i = inFileTypeSet.iterator(); i.hasNext();) { String srcDataType = (String) i.next(); for (Iterator j = outFileTypeSet.iterator(); j.hasNext();) { - Converter converter = getConverter( srcDataType, - (String) j.next()); - if (converter != null) + Converter converter = + getConverter(srcDataType, (String) j.next()); + if (converter != null) { converterList.add(converter); + } } } } @@ -263,6 +259,20 @@ } return (Converter[]) converterList.toArray(new Converter[0]); } + + private String createConverterFilterForOutFormat(String outFormat) { + String outFilter = "(&(" + ALGORITHM_TYPE + "=" + TYPE_CONVERTER + ")" + + "("+IN_DATA+"=*) " + "("+OUT_DATA+"="+outFormat+")" + + "(!(" + REMOTE + "=*)))"; + return outFilter; + } + + private String createConverterFilterForInFormat(String inFormat) { + String inFilter = "(&(" + ALGORITHM_TYPE + "=" + TYPE_CONVERTER + ")" + + "("+IN_DATA+"="+inFormat+") " + "("+OUT_DATA+"=*)" + + "(!("+IN_DATA+"=file-ext:*))" + "(!(" + REMOTE + "=*)))"; + return inFilter; + } /** * Get the shortest converter path. This returns a single converter path @@ -271,26 +281,31 @@ * @return Single converter path */ private Converter getConverter(String inType, String outType) { - Vertex srcVertex = (Vertex)dataTypeToVertex.get(inType); - Vertex tgtVertex = (Vertex)dataTypeToVertex.get(outType); + Vertex sourceVertex = (Vertex) dataTypeToVertex.get(inType); + Vertex targetVertex = (Vertex) dataTypeToVertex.get(outType); - if (srcVertex != null && tgtVertex != null) { - DijkstraShortestPath shortestPathAlg = new DijkstraShortestPath(graph); - List edgeList = shortestPathAlg.getPath(srcVertex, tgtVertex); + if (sourceVertex != null && targetVertex != null) { + DijkstraShortestPath shortestPathAlg = + new DijkstraShortestPath(graph); + List edgeList = shortestPathAlg.getPath(sourceVertex, targetVertex); if (edgeList.size() > 0) { - ServiceReference[] serviceReferenceArray = new ServiceReference[edgeList - .size()]; + ServiceReference[] serviceReferenceArray = + new ServiceReference[edgeList.size()]; for (int i = 0; i < serviceReferenceArray.length; ++i) { Edge edge = (Edge) edgeList.get(i); - AbstractList converterList = (AbstractList) edge - .getUserDatum(SERVICE_LIST); - serviceReferenceArray[i] = (ServiceReference) converterList - .get(0); + AbstractList converterList = + (AbstractList) edge.getUserDatum(SERVICE_LIST); + serviceReferenceArray[i] = + (ServiceReference) converterList.get(0); } - return new ConverterImpl(bContext, ciContext, serviceReferenceArray); + + return new ConverterImpl(bContext, + ciContext, + serviceReferenceArray); } } + return null; } @@ -318,10 +333,11 @@ converters = findConverters(format, outFormat); set.addAll(new HashSet(Arrays.asList(converters))); } - if (!(data.getData() instanceof File) && data.getData() != null) { - Iterator iter = getClassesFor(data.getData().getClass()).iterator(); - while (iter.hasNext()) { - Class c = (Class) iter.next(); + if (!(data.getData() instanceof File) && data.getData() != null) { + Class dataClass = data.getData().getClass(); + for (Iterator it = getClassesFor(dataClass).iterator(); + it.hasNext();) { + Class c = (Class) it.next(); converters = findConverters(c.getName(), outFormat); set.addAll(new HashSet(Arrays.asList(converters))); } @@ -386,8 +402,10 @@ public void serviceChanged(ServiceEvent event) { ServiceReference inServiceRef = event.getServiceReference(); - String inDataType = (String)inServiceRef.getProperty(AlgorithmProperty.IN_DATA); - String outDataType = (String)inServiceRef.getProperty(AlgorithmProperty.OUT_DATA); + String inDataType = + (String) inServiceRef.getProperty(AlgorithmProperty.IN_DATA); + String outDataType = + (String) inServiceRef.getProperty(AlgorithmProperty.OUT_DATA); if (event.getType() == ServiceEvent.MODIFIED) { removeServiceReference(inDataType, outDataType, inServiceRef); @@ -403,31 +421,33 @@ /** * Remove a service reference in the graph - * @param srcDataType The source data type of the serviceReference to remove - * @param tgtDataType The target data type of the serviceReference to remove + * @param sourceDataType The source data type of the serviceReference to remove + * @param targetDataType The target data type of the serviceReference to remove * @param serviceReference The serviceReference to remove */ - private void removeServiceReference(String srcDataType, String tgtDataType, ServiceReference serviceReference) { - if (srcDataType != null && tgtDataType != null) { - Vertex srcVertex = (Vertex) dataTypeToVertex.get(srcDataType); - Vertex tgtVertex = (Vertex) dataTypeToVertex.get(tgtDataType); - String pid = (String) serviceReference - .getProperty(Constants.SERVICE_PID); + private void removeServiceReference(String sourceDataType, + String targetDataType, + ServiceReference serviceReference) { + if (sourceDataType != null && targetDataType != null) { + Vertex sourceVertex = (Vertex) dataTypeToVertex.get(sourceDataType); + Vertex targetVertex = (Vertex) dataTypeToVertex.get(targetDataType); + String pid = + (String) serviceReference.getProperty(Constants.SERVICE_PID); - if (srcVertex != null && tgtVertex != null) { - Edge edge = srcVertex.findEdge(tgtVertex); + if (sourceVertex != null && targetVertex != null) { + Edge edge = sourceVertex.findEdge(targetVertex); if (edge != null) { - AbstractList serviceList = (AbstractList) edge - .getUserDatum(SERVICE_LIST); - for (Iterator iterator = serviceList.iterator(); iterator - .hasNext();) { - ServiceReference currentServiceReference = (ServiceReference) iterator - .next(); - String currentPid = (String) currentServiceReference + AbstractList serviceList = + (AbstractList) edge.getUserDatum(SERVICE_LIST); + for (Iterator refs = serviceList.iterator(); refs.hasNext();) { + ServiceReference currentServiceReference = + (ServiceReference) refs.next(); + String currentPid = + (String) currentServiceReference .getProperty(Constants.SERVICE_PID); if (pid.equals(currentPid)) { - iterator.remove(); + refs.remove(); } } if (serviceList.isEmpty()) { @@ -440,25 +460,30 @@ /** * Add service reference to the graph - * @param srcDataType The source data type - * @param tgtDataType The target data type + * @param sourceDataType The source data type + * @param targetDataType The target data type * @param serviceReference The service reference to add */ - private void addServiceReference(String srcDataType, String tgtDataType, ServiceReference serviceReference) { - if (srcDataType != null && srcDataType.length() > 0 - && tgtDataType != null && tgtDataType.length() > 0) { - Vertex srcVertex = getVertex(srcDataType); - Vertex tgtVertex = getVertex(tgtDataType); + private void addServiceReference(String sourceDataType, + String targetDataType, + ServiceReference serviceReference) { + if (sourceDataType != null && sourceDataType.length() > 0 + && targetDataType != null && targetDataType.length() > 0) { + Vertex sourceVertex = getVertex(sourceDataType); + Vertex targetVertex = getVertex(targetDataType); - removeServiceReference(srcDataType, tgtDataType, serviceReference); + removeServiceReference( + sourceDataType, targetDataType, serviceReference); - Edge directedEdge = srcVertex.findEdge(tgtVertex); + Edge directedEdge = sourceVertex.findEdge(targetVertex); if (directedEdge == null) { - directedEdge = new DirectedSparseEdge(srcVertex, tgtVertex); + directedEdge = + new DirectedSparseEdge(sourceVertex, targetVertex); graph.addEdge(directedEdge); } - AbstractList serviceList = (AbstractList) directedEdge.getUserDatum(SERVICE_LIST); + AbstractList serviceList = + (AbstractList) directedEdge.getUserDatum(SERVICE_LIST); if (serviceList == null) { serviceList = new ArrayList(); serviceList.add(serviceReference); @@ -475,10 +500,11 @@ * @return The vertex */ private Vertex getVertex(String dataType) { - Vertex vertex = (SparseVertex)dataTypeToVertex.get(dataType); + Vertex vertex = (SparseVertex) dataTypeToVertex.get(dataType); if (vertex== null) { vertex = new SparseVertex(); - vertex.addUserDatum("label", dataType, + vertex.addUserDatum("label", + dataType, new UserDataContainer.CopyAction.Shared()); graph.addVertex(vertex); dataTypeToVertex.put(dataType, vertex); @@ -488,16 +514,18 @@ /** * Save the current converter graph to the user's home directory - * + */ private void saveGraph() { GraphMLFile writer = new GraphMLFile(); - Graph g = (Graph)graph.copy(); - for (Iterator i = g.getEdges().iterator(); i.hasNext();) { - Edge e = (Edge)i.next(); + Graph g = (Graph) graph.copy(); + for (Iterator edges = g.getEdges().iterator(); edges.hasNext();) { + Edge e = (Edge) edges.next(); e.removeUserDatum(SERVICE_LIST); } - writer.save(g, System.getProperty("user.home") + File.separator + "convertGraph.xml"); - + + writer.save(g, System.getProperty("user.home") + + File.separator + + "convertGraph.xml"); } } Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java 2009-07-27 16:07:28 UTC (rev 902) @@ -40,10 +40,8 @@ props.put(OUT_DATA, inData); props.put(LABEL, props.get(IN_DATA) + " -> " + props.get(OUT_DATA)); - String lossiness = LOSSLESS; - //TODO: Do the same thing for complexity - props.put(CONVERSION, lossiness); + props.put(CONVERSION, LOSSLESS); } /** Modified: trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableAlgorithmFactory.java =================================================================== --- trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableAlgorithmFactory.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableAlgorithmFactory.java 2009-07-27 16:07:28 UTC (rev 902) @@ -56,10 +56,8 @@ return provider; } - //pretty sure this isn't used by anything, but I fear deleting it. public StaticExecutableAlgorithmFactory(String algName, BundleContext bContext) { this.algName = algName; this.bContext = bContext; } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tan...@us...> - 2009-07-24 20:46:49
|
Revision: 901 http://cishell.svn.sourceforge.net/cishell/?rev=901&view=rev Author: tankchintan Date: 2009-07-24 20:46:36 +0000 (Fri, 24 Jul 2009) Log Message: ----------- Enforced the code style per new CheckStyle plugin & SUNS's specification. Modified Paths: -------------- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithm.java trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithmFactory.java trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphComputation.java Modified: trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithm.java =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithm.java 2009-07-24 18:09:35 UTC (rev 900) +++ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithm.java 2009-07-24 20:46:36 UTC (rev 901) @@ -30,22 +30,15 @@ * @author Chintan Tank */ -public class ConverterGraphAlgorithm implements Algorithm{ +public class ConverterGraphAlgorithm implements Algorithm { - private static final int NODE_STRENGTH_INDEX = 1; - private static final int NODEID_INDEX = 0; - private static final int CONVERTER_SERVICE_PID_INDEX = 3; - private static final int CONVERTER_NAME_INDEX = 2; - private static final int EDGE_TARGETID_INDEX = 1; - private static final int EDGE_SOURCEID_INDEX = 0; - private LogService logger; private BundleContext bundleContext; private int nodeCount, edgeCount; /** - * Construct with the appropriate parameters + * Construct with the appropriate parameters. * @param ciShellContext * @param bundleContext * @throws AlgorithmExecutionException @@ -56,7 +49,7 @@ this.logger = (LogService) ciShellContext.getService(LogService.class.getName()); } - public Data[] execute() throws AlgorithmExecutionException{ + public Data[] execute() throws AlgorithmExecutionException { try { @@ -76,7 +69,7 @@ * */ File outputNWBFile = createOutputGraphFile(converterGraphComputation); - return prepareOutputMetadata(new BasicData(outputNWBFile,"file:text/nwb")); + return prepareOutputMetadata(new BasicData(outputNWBFile, "file:text/nwb")); } catch (IOException e) { throw new AlgorithmExecutionException(e); @@ -134,8 +127,8 @@ ConverterGraphComputation converterGraphComputation, ConverterGraphOutputGenerator outputGenerator) { - for(Iterator edgeIterator = converterGraphComputation.edges.iterator(); - edgeIterator.hasNext(); ) { + for (Iterator edgeIterator = converterGraphComputation.edges.iterator(); + edgeIterator.hasNext();) { Edge edge = (Edge) edgeIterator.next(); int sourceNode = edge.source; @@ -143,7 +136,7 @@ final String converterName = edge.serviceShortPID; final String servicePID = edge.serviceCompletePID; - outputGenerator.addDirectedEdge(sourceNode, targetNode, new HashMap(){{ + outputGenerator.addDirectedEdge(sourceNode, targetNode, new HashMap() {{ put("converter_name", converterName); put("service_pid", servicePID); }}); @@ -158,16 +151,16 @@ ConverterGraphComputation converterGraphComputation, ConverterGraphOutputGenerator outputGenerator) { - for(Iterator nodeIterator = converterGraphComputation.nodes.entrySet().iterator(); - nodeIterator.hasNext(); ) { + for (Iterator nodeIterator = converterGraphComputation.nodes.entrySet().iterator(); + nodeIterator.hasNext();) { Map.Entry node = (Entry) nodeIterator.next(); - int nodeID = ((Node)node.getValue()).id; - final int strength = ((Node)node.getValue()).strength; + int nodeID = ((Node) node.getValue()).id; + final int strength = ((Node) node.getValue()).strength; String label = node.getKey().toString(); - outputGenerator.addNode(nodeID, label, new HashMap(){{ + outputGenerator.addNode(nodeID, label, new HashMap() {{ put("strength", strength); }}); } Modified: trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithmFactory.java =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithmFactory.java 2009-07-24 18:09:35 UTC (rev 900) +++ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithmFactory.java 2009-07-24 20:46:36 UTC (rev 901) @@ -14,7 +14,7 @@ * */ -public class ConverterGraphAlgorithmFactory implements AlgorithmFactory{ +public class ConverterGraphAlgorithmFactory implements AlgorithmFactory { private BundleContext bundleContext; Modified: trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphComputation.java =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphComputation.java 2009-07-24 18:09:35 UTC (rev 900) +++ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphComputation.java 2009-07-24 20:46:36 UTC (rev 901) @@ -99,26 +99,29 @@ * */ private void processServiceReferences() { - for(int converterCount = 0; converterCount < allConverterServices.length; converterCount++) { + for (int converterCount = 0; + converterCount < allConverterServices.length; + converterCount++) { int sourceNodeID, targetNodeID; - ServiceReference currentConverterServiceReference = allConverterServices[converterCount]; + ServiceReference currentConverterServiceReference = + allConverterServices[converterCount]; - String sourceNodeKey = (String)currentConverterServiceReference.getProperty("in_data"); - String targetNodeKey = (String)currentConverterServiceReference.getProperty("out_data"); + String sourceNodeKey = + (String) currentConverterServiceReference.getProperty("in_data"); + String targetNodeKey = + (String) currentConverterServiceReference.getProperty("out_data"); - if(nodes.containsKey(sourceNodeKey)) { - sourceNodeID = updateNode(sourceNodeKey); - } - else { + if (nodes.containsKey(sourceNodeKey)) { + sourceNodeID = updateNode(sourceNodeKey); + } else { sourceNodeID = createNode(sourceNodeKey); } - if(nodes.containsKey(targetNodeKey)) { + if (nodes.containsKey(targetNodeKey)) { targetNodeID = updateNode(targetNodeKey); - } - else { + } else { targetNodeID = createNode(targetNodeKey); } @@ -152,7 +155,8 @@ */ private void createEdge(int sourceNodeID, int targetNodeID, ServiceReference currentConverterServiceReference) { - String serviceCompletePID = (String)currentConverterServiceReference.getProperty("service.pid"); + String serviceCompletePID = + (String) currentConverterServiceReference.getProperty("service.pid"); /* * Converter name is placed in the last block of service.pid. This is used This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tan...@us...> - 2009-07-24 18:09:46
|
Revision: 900 http://cishell.svn.sourceforge.net/cishell/?rev=900&view=rev Author: tankchintan Date: 2009-07-24 18:09:35 +0000 (Fri, 24 Jul 2009) Log Message: ----------- Initial Import. Converter Graph plugin. For outputting a graph of all the converters in the tool. Code reviewed by Micah. Added Paths: ----------- trunk/core/org.cishell.algorithm.convertergraph/.classpath trunk/core/org.cishell.algorithm.convertergraph/.project trunk/core/org.cishell.algorithm.convertergraph/.settings/ trunk/core/org.cishell.algorithm.convertergraph/.settings/org.eclipse.pde.core.prefs trunk/core/org.cishell.algorithm.convertergraph/META-INF/ trunk/core/org.cishell.algorithm.convertergraph/META-INF/MANIFEST.MF trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/ trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/algorithm.properties trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/component.xml trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/l10n/ trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/l10n/bundle_en.properties trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/metatype/ trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/metatype/METADATA.XML trunk/core/org.cishell.algorithm.convertergraph/build/ trunk/core/org.cishell.algorithm.convertergraph/build.properties trunk/core/org.cishell.algorithm.convertergraph/src/ trunk/core/org.cishell.algorithm.convertergraph/src/org/ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithm.java trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithmFactory.java trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphComputation.java trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphOutputGenerator.java trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/Edge.java trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/Node.java Added: trunk/core/org.cishell.algorithm.convertergraph/.classpath =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/.classpath (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/.classpath 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="build"/> +</classpath> Added: trunk/core/org.cishell.algorithm.convertergraph/.project =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/.project (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/.project 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.algorithm.convertergraph</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/core/org.cishell.algorithm.convertergraph/.settings/org.eclipse.pde.core.prefs =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/.settings/org.eclipse.pde.core.prefs (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/.settings/org.eclipse.pde.core.prefs 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,4 @@ +#Thu Nov 30 13:33:03 EST 2006 +eclipse.preferences.version=1 +pluginProject.equinox=false +pluginProject.extensions=false Added: trunk/core/org.cishell.algorithm.convertergraph/META-INF/MANIFEST.MF =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/META-INF/MANIFEST.MF (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/META-INF/MANIFEST.MF 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Converter Graph +Bundle-SymbolicName: org.cishell.algorithm.convertergraph +Bundle-Version: 1.0.0 +Bundle-ClassPath: . +Bundle-Localization: plugin +Import-Package: edu.iu.nwb.converter.nwb.common, + edu.iu.nwb.util.nwbfile, + org.cishell.framework, + org.cishell.framework.algorithm, + org.cishell.framework.data, + org.cishell.reference.service.metatype, + org.osgi.framework;version="1.3.0", + org.osgi.service.component;version="1.0.0", + org.osgi.service.log;version="1.3.0", + org.osgi.service.metatype, + org.osgi.service.prefs;version="1.1.0" +X-AutoStart: true +Service-Component: OSGI-INF/component.xml Added: trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/algorithm.properties =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/algorithm.properties (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/algorithm.properties 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,12 @@ +menu_path=File/additions +label=Converter Graph +description=Provides graph of all the converters in the tool. +in_data=null +out_data=file:text/nwb +service.pid=org.cishell.algorithm.convertergraph.ConverterGraphAlgorithm +remoteable=true +written_in=Java +author=Chintan Tank +implementers=Chintan Tank +integrators=Chintan Tank +documentation_url=https://nwb.slis.indiana.edu/community/?n=File.ConverterGraph \ No newline at end of file Added: trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/component.xml =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/component.xml (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/component.xml 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.algorithm.convertergraph.ConverterGraphAlgorithm.component" immediate="false"> + <implementation class="org.cishell.algorithm.convertergraph.ConverterGraphAlgorithmFactory"/> + <properties entry="OSGI-INF/algorithm.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Added: trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/l10n/bundle_en.properties =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/l10n/bundle_en.properties (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/l10n/bundle_en.properties 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,7 @@ +#Localization variables for OSGI-INF/metatatype/METADATA.XML +# +#Samples: +#input=Input +#desc=Enter an integer (that will be converted to a string) +#name=Input->String +#name_desc=Converts inputted integer to string Added: trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/metatype/METADATA.XML =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/metatype/METADATA.XML (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/metatype/METADATA.XML 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> + <OCD name="Converter Graph" id="org.cishell.algorithm.convertergraph.ConverterGraphAlgorithm.OCD" + description="Provides Graph of all the converters in the tool."> + </OCD> + <Designate pid="org.cishell.algorithm.convertergraph.ConverterGraphAlgorithm"> + <Object ocdref="org.cishell.algorithm.convertergraph.ConverterGraphAlgorithm.OCD" /> + </Designate> +</metatype:MetaData> Added: trunk/core/org.cishell.algorithm.convertergraph/build.properties =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/build.properties (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/build.properties 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,5 @@ +source.. = src/ +output.. = build/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ Added: trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithm.java =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithm.java (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithm.java 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,214 @@ +package org.cishell.algorithm.convertergraph; + +import java.io.File; +import java.io.IOException; +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.data.BasicData; +import org.cishell.framework.data.Data; +import org.cishell.framework.data.DataProperty; +import org.osgi.framework.BundleContext; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.log.LogService; + +/** + * This plugin collects information about all the active converters in the tool and + * outputs a NWB file having this Directed network. Also nodes corresponding to each + * MIME/TYPE are weighted depending upon how many times they participate in a converter + * relationship. + * + * @author Chintan Tank + */ + +public class ConverterGraphAlgorithm implements Algorithm{ + + private static final int NODE_STRENGTH_INDEX = 1; + private static final int NODEID_INDEX = 0; + private static final int CONVERTER_SERVICE_PID_INDEX = 3; + private static final int CONVERTER_NAME_INDEX = 2; + private static final int EDGE_TARGETID_INDEX = 1; + private static final int EDGE_SOURCEID_INDEX = 0; + + private LogService logger; + private BundleContext bundleContext; + + private int nodeCount, edgeCount; + + /** + * Construct with the appropriate parameters + * @param ciShellContext + * @param bundleContext + * @throws AlgorithmExecutionException + */ + public ConverterGraphAlgorithm(Data[] data, Dictionary parameters, + CIShellContext ciShellContext, BundleContext bundleContext) { + this.bundleContext = bundleContext; + this.logger = (LogService) ciShellContext.getService(LogService.class.getName()); + } + + public Data[] execute() throws AlgorithmExecutionException{ + + try { + + /* + * Get all the converter service references currently in service. + * */ + ServiceReference[] allConverterServices = getAllConverters(); + + /* + * Process the references to create a network of weighted nodes & directed edges. + * */ + ConverterGraphComputation converterGraphComputation = + new ConverterGraphComputation(allConverterServices, logger); + + /* + * Used to generate the output file containing the network. + * */ + File outputNWBFile = createOutputGraphFile(converterGraphComputation); + + return prepareOutputMetadata(new BasicData(outputNWBFile,"file:text/nwb")); + + } catch (IOException e) { + throw new AlgorithmExecutionException(e); + } + } + + /** + * Call all the NWB File Handler processes in order to create a NWB file. + * @param converterGraphComputation + * @return + * @throws IOException + */ + private File createOutputGraphFile( + ConverterGraphComputation converterGraphComputation) + throws IOException { + + File outputNWBFile = File.createTempFile("nwb-", ".nwb"); + + ConverterGraphOutputGenerator outputGenerator = new ConverterGraphOutputGenerator( + converterGraphComputation, outputNWBFile); + + outputGenerator.addComment("Graph of all Converters in the Tool."); + + nodeCount = converterGraphComputation.nodes.size(); + outputGenerator.setNodeCount(nodeCount); + + outputGenerator.setNodeSchema(converterGraphComputation.nodeSchema); + + /* + * Print all the node rows to the output file. + * */ + setNodeTuples(converterGraphComputation, outputGenerator); + + edgeCount = converterGraphComputation.edges.size(); + outputGenerator.setDirectedEdgeCount(edgeCount); + + outputGenerator.setDirectedEdgeSchema(converterGraphComputation.edgeSchema); + + /* + * Print all the edge rows to the output file. + * */ + setDirectedEdgeTuples(converterGraphComputation, outputGenerator); + + outputGenerator.finishedParsing(); + outputGenerator.haltParsingNow(); + return outputNWBFile; + } + + /** + * Iterate through the nodes and print it into the output file. + * @param converterGraphComputation + * @param outputGenerator + */ + private void setDirectedEdgeTuples( + ConverterGraphComputation converterGraphComputation, + ConverterGraphOutputGenerator outputGenerator) { + + for(Iterator edgeIterator = converterGraphComputation.edges.iterator(); + edgeIterator.hasNext(); ) { + + Edge edge = (Edge) edgeIterator.next(); + int sourceNode = edge.source; + int targetNode = edge.target; + final String converterName = edge.serviceShortPID; + final String servicePID = edge.serviceCompletePID; + + outputGenerator.addDirectedEdge(sourceNode, targetNode, new HashMap(){{ + put("converter_name", converterName); + put("service_pid", servicePID); + }}); + } + } + + /** + * @param converterGraphComputation + * @param outputGenerator + */ + private void setNodeTuples( + ConverterGraphComputation converterGraphComputation, + ConverterGraphOutputGenerator outputGenerator) { + + for(Iterator nodeIterator = converterGraphComputation.nodes.entrySet().iterator(); + nodeIterator.hasNext(); ) { + + Map.Entry node = (Entry) nodeIterator.next(); + + int nodeID = ((Node)node.getValue()).id; + final int strength = ((Node)node.getValue()).strength; + String label = node.getKey().toString(); + + outputGenerator.addNode(nodeID, label, new HashMap(){{ + put("strength", strength); + }}); + } + } + + + /** + * Gets all the converter service references based on the LDAP query. + * @return + */ + private ServiceReference[] getAllConverters() { + try { + ServiceReference[] allConverters = + bundleContext.getAllServiceReferences( + AlgorithmFactory.class.getName(), + "(&(type=converter))"); + + if (allConverters == null) { + /* + * better to return a list of length zero than null + * */ + + allConverters = new ServiceReference[]{}; + } + + return allConverters; + + } catch (InvalidSyntaxException e) { + e.printStackTrace(); + return new ServiceReference[]{}; + } + } + + /** + * Prepares output metadata to be displayed to the user. + * @param outNWBData + */ + private Data[] prepareOutputMetadata(Data outNWBData) { + outNWBData.getMetadata().put(DataProperty.LABEL, "Converter Graph having " + + nodeCount + " nodes & " + edgeCount + " edges."); + outNWBData.getMetadata().put(DataProperty.TYPE, DataProperty.NETWORK_TYPE); + return new Data[]{outNWBData}; + } +} Added: trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithmFactory.java =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithmFactory.java (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphAlgorithmFactory.java 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,28 @@ +package org.cishell.algorithm.convertergraph; + +import java.util.Dictionary; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.data.Data; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +/** + * @author cdtank + * + */ + +public class ConverterGraphAlgorithmFactory implements AlgorithmFactory{ + + private BundleContext bundleContext; + + protected void activate(ComponentContext ctxt) { + bundleContext = ctxt.getBundleContext(); + } + + public Algorithm createAlgorithm(Data[] data, Dictionary parameters, CIShellContext context) { + return new ConverterGraphAlgorithm(data, parameters, context, bundleContext); + } +} \ No newline at end of file Added: trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphComputation.java =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphComputation.java (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphComputation.java 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,176 @@ +/** + * + */ +package org.cishell.algorithm.convertergraph; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.osgi.framework.ServiceReference; +import org.osgi.service.log.LogService; + +import edu.iu.nwb.util.nwbfile.NWBFileProperty; + +/** + * The algorithm is used for getting information about current converters is, + * 1. Get all the service references for converters in the system. + * 2. Create Node Schema to be used when constructing the NWB file. In this case + * it will be, + * id*int, label*string, strength*int + * 3. Create Edge Schema to be used when constructing the NWB file. In this case + * it will be, + * source*int, target*int, converter_name*string, service_pid*string + * 4. Iterate over all the converter service reference one at a time. + * 5. For collecting information for Nodes do, + * (a). Get node label using service properties in_data & out_data. + * (b). Check to see if this node is already present in the nodes map. + * (c). If it is present then just update the strength of node by incrementing + * that node's strength by 1. + * (d). Else create a new node. Provide it a default strength of 1 and update + * the node count. + * 6. For collecting information about Edges do, + * (a). Get the respective source & target node ids from the recently updates + * respective nodes. + * (b). Get the service_pid by using service property service.pid. + * (c). Get the converter_name by extracting the last block from service_pid. + * 7. These information is then passed on to {@link ConverterGraphOutputGenerator} + * for printing it into a NWB file. + * + * @author cdtank + * + */ +public class ConverterGraphComputation { + + private LogService logger; + private ServiceReference[] allConverterServices; + + public Map nodes = new HashMap(); + public LinkedHashMap nodeSchema = new LinkedHashMap(); + + public List edges = new ArrayList(); + public LinkedHashMap edgeSchema = new LinkedHashMap(); + + private int nodeCount; + + public ConverterGraphComputation(ServiceReference[] allConverterServices, + LogService logger) { + + this.nodeCount = 0; + this.logger = logger; + this.allConverterServices = allConverterServices; + + /* + * Side affects nodeSchema + * */ + createNodeSchema(); + + /* + * Side affects edgeSchema + * */ + createEdgeSchema(); + + /* + * Side affects nodes & edges + * */ + processServiceReferences(); + } + + private void createNodeSchema() { + nodeSchema.put("id", NWBFileProperty.TYPE_INT); + nodeSchema.put("label", NWBFileProperty.TYPE_STRING); + nodeSchema.put("strength", NWBFileProperty.TYPE_INT); + } + + private void createEdgeSchema() { + edgeSchema.put("source", NWBFileProperty.TYPE_INT); + edgeSchema.put("target", NWBFileProperty.TYPE_INT); + edgeSchema.put("converter_name", NWBFileProperty.TYPE_STRING); + edgeSchema.put("service_pid", NWBFileProperty.TYPE_STRING); + } + + + + /* + * Iterate over all the converter service references and process the + * information to get nodes & edges. + * */ + private void processServiceReferences() { + + for(int converterCount = 0; converterCount < allConverterServices.length; converterCount++) { + + int sourceNodeID, targetNodeID; + + ServiceReference currentConverterServiceReference = allConverterServices[converterCount]; + + String sourceNodeKey = (String)currentConverterServiceReference.getProperty("in_data"); + String targetNodeKey = (String)currentConverterServiceReference.getProperty("out_data"); + + if(nodes.containsKey(sourceNodeKey)) { + sourceNodeID = updateNode(sourceNodeKey); + } + else { + sourceNodeID = createNode(sourceNodeKey); + } + + if(nodes.containsKey(targetNodeKey)) { + targetNodeID = updateNode(targetNodeKey); + } + else { + targetNodeID = createNode(targetNodeKey); + } + + createEdge(sourceNodeID, targetNodeID, currentConverterServiceReference); + } + } + + private int updateNode(String currentNodeKey) { + int sourceNodeID; + Node sourceNodeValue = (Node) nodes.get(currentNodeKey); + sourceNodeID = sourceNodeValue.id; + sourceNodeValue.strength += 1; + return sourceNodeID; + } + + private int createNode(String nodeKey) { + nodeCount++; + Node nodeValue = new Node(); + nodeValue.id = nodeCount; + nodeValue.strength = 1; + + nodes.put(nodeKey, nodeValue); + return nodeCount; + } + + /** + * Create an edge based on source id, target id & other information. + * @param sourceNodeID + * @param targetNodeID + * @param currentConverterServiceReference + */ + private void createEdge(int sourceNodeID, int targetNodeID, + ServiceReference currentConverterServiceReference) { + String serviceCompletePID = (String)currentConverterServiceReference.getProperty("service.pid"); + + /* + * Converter name is placed in the last block of service.pid. This is used + * to extract it. + * */ + int startIndexForConverterName = serviceCompletePID.lastIndexOf(".") + 1; + String serviceShortPID = serviceCompletePID.substring(startIndexForConverterName); + + /* + * Build the actual edge tuple. + * */ + Edge edge = new Edge(); + edge.source = sourceNodeID; + edge.target = targetNodeID; + edge.serviceShortPID = serviceShortPID; + edge.serviceCompletePID = serviceCompletePID; + + edges.add(edge); + } + +} Added: trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphOutputGenerator.java =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphOutputGenerator.java (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/ConverterGraphOutputGenerator.java 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,62 @@ +package org.cishell.algorithm.convertergraph; + +import java.io.File; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +import edu.iu.nwb.util.nwbfile.NWBFileParserHandler; +import edu.iu.nwb.util.nwbfile.NWBFileWriter; + +public class ConverterGraphOutputGenerator implements NWBFileParserHandler { + + private NWBFileWriter output; + + public ConverterGraphOutputGenerator(ConverterGraphComputation converterGraphComputation, + File outputNWBFile) throws IOException { + output = new NWBFileWriter(outputNWBFile); + } + + public void setNodeCount(int numberOfNodes) { + output.setNodeCount(numberOfNodes); + } + + public void setNodeSchema(LinkedHashMap schema) { + output.setNodeSchema(schema); + } + + public void addNode(int id, String label, Map attributes) { + output.addNode(id, label, attributes); + } + + public void addDirectedEdge(int sourceNode, int targetNode, Map attributes) { + output.addDirectedEdge(sourceNode, targetNode, attributes); + } + public void addUndirectedEdge(int node1, int node2, Map attributes) { + output.addUndirectedEdge(node1, node2, attributes); + } + public void setDirectedEdgeCount(int numberOfEdges) { + output.setDirectedEdgeCount(numberOfEdges); + } + public void setDirectedEdgeSchema(LinkedHashMap schema) { + output.setDirectedEdgeSchema(schema); + } + public void setUndirectedEdgeCount(int numberOfEdges) { + output.setUndirectedEdgeCount(numberOfEdges); + } + public void setUndirectedEdgeSchema(LinkedHashMap schema) { + output.setUndirectedEdgeSchema(schema); + } + + public void addComment(String comment) { + output.addComment(comment); + } + + public void finishedParsing() { + output.finishedParsing(); + } + + public boolean haltParsingNow() { + return false; + } +} Added: trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/Edge.java =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/Edge.java (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/Edge.java 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,8 @@ +package org.cishell.algorithm.convertergraph; + +public class Edge { + public int source; + public int target; + public String serviceShortPID; + public String serviceCompletePID; +} \ No newline at end of file Added: trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/Node.java =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/Node.java (rev 0) +++ trunk/core/org.cishell.algorithm.convertergraph/src/org/cishell/algorithm/convertergraph/Node.java 2009-07-24 18:09:35 UTC (rev 900) @@ -0,0 +1,13 @@ +/** + * + */ +package org.cishell.algorithm.convertergraph; + +/** + * @author cdtank + * + */ +public class Node { + public int id; + public int strength; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tan...@us...> - 2009-07-24 18:08:43
|
Revision: 899 http://cishell.svn.sourceforge.net/cishell/?rev=899&view=rev Author: tankchintan Date: 2009-07-24 18:08:36 +0000 (Fri, 24 Jul 2009) Log Message: ----------- Initial import. Added Paths: ----------- trunk/core/org.cishell.algorithm.convertergraph/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fu...@us...> - 2009-07-24 18:01:41
|
Revision: 898 http://cishell.svn.sourceforge.net/cishell/?rev=898&view=rev Author: fugu13 Date: 2009-07-24 18:01:29 +0000 (Fri, 24 Jul 2009) Log Message: ----------- in_data now ignores spaces at the beginning and end of data types. Rigorously reviewed by Micah. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2009-07-24 17:46:29 UTC (rev 897) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2009-07-24 18:01:29 UTC (rev 898) @@ -117,9 +117,17 @@ logger.log(LogService.LOG_INFO, acknowledgement.toString()); } + private String[] separateInData(String inDataString) { + String[] inData = ("" + inDataString).split(","); + for(int ii = 0; ii < inData.length; ii++) { + inData[ii] = inData[ii].trim(); + } + return inData; + } + public void dataSelected(Data[] selectedData) { String inDataString = (String)ref.getProperty(IN_DATA); - String[] inData = ("" + inDataString).split(","); + String[] inData = separateInData(inDataString); if ((inData.length == 1 && inData[0].equalsIgnoreCase(NULL_DATA))) { data = new Data[0]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jrb...@us...> - 2009-07-24 17:46:39
|
Revision: 897 http://cishell.svn.sourceforge.net/cishell/?rev=897&view=rev Author: jrbibers Date: 2009-07-24 17:46:29 +0000 (Fri, 24 Jul 2009) Log Message: ----------- Added method to automate the common algorithm factory task of mutating a parameter in an object class definition to provide a dropdown list of options. Modified Paths: -------------- trunk/core/org.cishell.utilities/META-INF/MANIFEST.MF trunk/core/org.cishell.utilities/src/org/cishell/utilities/MutateParameterUtilities.java Modified: trunk/core/org.cishell.utilities/META-INF/MANIFEST.MF =================================================================== --- trunk/core/org.cishell.utilities/META-INF/MANIFEST.MF 2009-07-24 17:44:30 UTC (rev 896) +++ trunk/core/org.cishell.utilities/META-INF/MANIFEST.MF 2009-07-24 17:46:29 UTC (rev 897) @@ -15,4 +15,5 @@ prefuse.data.util, prefuse.util, prefuse.util.collections -Export-Package: org.cishell.utilities +Export-Package: org.cishell.utilities, + org.cishell.utilities.mutateParameter Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/MutateParameterUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/MutateParameterUtilities.java 2009-07-24 17:44:30 UTC (rev 896) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/MutateParameterUtilities.java 2009-07-24 17:46:29 UTC (rev 897) @@ -3,107 +3,148 @@ import java.io.IOException; import java.util.LinkedHashMap; -import org.cishell.reference.service.metatype.BasicAttributeDefinition; import org.cishell.reference.service.metatype.BasicObjectClassDefinition; +import org.cishell.utilities.mutateParameter.AttributeDefinitionTransformer; +import org.cishell.utilities.mutateParameter.NullDropdownTransformer; +import org.cishell.utilities.mutateParameter.ObjectClassDefinitionTransformer; import org.osgi.service.metatype.AttributeDefinition; import org.osgi.service.metatype.ObjectClassDefinition; import prefuse.data.Table; public class MutateParameterUtilities { - public static AttributeDefinition formLabelAttributeDefinition - (AttributeDefinition oldAttributeDefinition, Table table) - throws ColumnNotFoundException - { + /* TODO The mutateParameter subpackage is meant to eliminate all of the loops + * that invoke the formFooAttributeDefinition methods. + */ + + public static AttributeDefinition formLabelAttributeDefinition( + AttributeDefinition oldAttributeDefinition, Table table) + throws ColumnNotFoundException { String[] validStringColumnsInTable = TableUtilities.getValidStringColumnNamesInTable(table); AttributeDefinition labelAttributeDefinition = - new BasicAttributeDefinition(oldAttributeDefinition.getID(), - oldAttributeDefinition.getName(), - oldAttributeDefinition.getDescription(), - AttributeDefinition.STRING, - validStringColumnsInTable, - validStringColumnsInTable); + cloneToDropdownAttributeDefinition(oldAttributeDefinition, + validStringColumnsInTable, + validStringColumnsInTable); return labelAttributeDefinition; } - public static AttributeDefinition formDateAttributeDefinition - (AttributeDefinition oldAttributeDefinition, Table table) - throws ColumnNotFoundException - { + public static AttributeDefinition formDateAttributeDefinition( + AttributeDefinition oldAttributeDefinition, Table table) + throws ColumnNotFoundException { String[] validDateColumnsInTable = TableUtilities.getValidDateColumnNamesInTable(table); AttributeDefinition dateAttributeDefinition = - new BasicAttributeDefinition(oldAttributeDefinition.getID(), - oldAttributeDefinition.getName(), - oldAttributeDefinition.getDescription(), - AttributeDefinition.STRING, - validDateColumnsInTable, - validDateColumnsInTable); + cloneToDropdownAttributeDefinition(oldAttributeDefinition, + validDateColumnsInTable, + validDateColumnsInTable); return dateAttributeDefinition; } - public static AttributeDefinition formIntegerAttributeDefinition - (AttributeDefinition oldAttributeDefinition, Table table) - throws ColumnNotFoundException - { + public static AttributeDefinition formIntegerAttributeDefinition( + AttributeDefinition oldAttributeDefinition, Table table) + throws ColumnNotFoundException { String[] validIntegerColumnsInTable = TableUtilities.getValidIntegerColumnNamesInTable(table); AttributeDefinition integerAttributeDefinition = - new BasicAttributeDefinition(oldAttributeDefinition.getID(), - oldAttributeDefinition.getName(), - oldAttributeDefinition.getDescription(), - AttributeDefinition.STRING, - validIntegerColumnsInTable, - validIntegerColumnsInTable); + cloneToDropdownAttributeDefinition(oldAttributeDefinition, + validIntegerColumnsInTable, + validIntegerColumnsInTable); return integerAttributeDefinition; } - public static AttributeDefinition formNumberAttributeDefinition - (AttributeDefinition oldAttributeDefinition, Table table) - throws ColumnNotFoundException { + public static AttributeDefinition formNumberAttributeDefinition( + AttributeDefinition oldAttributeDefinition, Table table) + throws ColumnNotFoundException { String[] validNumberColumnsInTable = TableUtilities.getValidNumberColumnNamesInTable(table); AttributeDefinition numberAttributeDefinition = - new BasicAttributeDefinition(oldAttributeDefinition.getID(), - oldAttributeDefinition.getName(), - oldAttributeDefinition.getDescription(), - AttributeDefinition.STRING, - validNumberColumnsInTable, - validNumberColumnsInTable); + cloneToDropdownAttributeDefinition(oldAttributeDefinition, + validNumberColumnsInTable, + validNumberColumnsInTable); return numberAttributeDefinition; } - public static AttributeDefinition formAttributeDefinitionFromMap - (AttributeDefinition oldAttributeDefinition, - LinkedHashMap map, - String[] types, - String[] keysToSkip, - String[] keysToAdd) { + // TODO: Change LinkedHashMap to Map? + public static AttributeDefinition formAttributeDefinitionFromMap( + AttributeDefinition oldAttributeDefinition, + LinkedHashMap map, + String[] types, + String[] keysToSkip, + String[] keysToAdd) { String[] validNumberKeysInMap = MapUtilities.getValidKeysOfTypesInMap( map, types, keysToSkip, keysToAdd); AttributeDefinition numberAttributeDefinition = - new BasicAttributeDefinition( - oldAttributeDefinition.getID(), - oldAttributeDefinition.getName(), - oldAttributeDefinition.getDescription(), - AttributeDefinition.STRING, - validNumberKeysInMap, - validNumberKeysInMap); + cloneToDropdownAttributeDefinition(oldAttributeDefinition, + validNumberKeysInMap, + validNumberKeysInMap); return numberAttributeDefinition; } + public static AttributeDefinition cloneToDropdownAttributeDefinition( + AttributeDefinition oldAD, + final String[] optionLabels, + final String[] optionValues) { + AttributeDefinitionTransformer transformer = + new NullDropdownTransformer() { + public boolean shouldTransform(AttributeDefinition ad) { + return true; + } + + public String[] transformOptionLabels( + String[] oldOptionLabels) { + return optionLabels; + } + + public String[] transformOptionValues( + String[] oldOptionValues) { + return optionValues; + } + }; + + return transformer.transform(oldAD); + } + + /* Convenience method for a common mutation: + * Replacing a parameter (identified by its ID) with a dropdown list of + * options. + */ + public static BasicObjectClassDefinition mutateToDropdown( + ObjectClassDefinition oldOCD, + final String parameterID, + final String[] optionLabels, + final String[] optionValues) { + AttributeDefinitionTransformer dropdownTransformer = + new NullDropdownTransformer() { + public boolean shouldTransform(AttributeDefinition ad) { + return parameterID.equals(ad.getID()); + } + + public String[] transformOptionLabels( + String[] oldOptionLabels) { + return optionLabels; + } + public String[] transformOptionValues( + String[] oldOptionValues) { + return optionValues; + } + }; + + return ObjectClassDefinitionTransformer.apply(dropdownTransformer, + oldOCD); + } + public static BasicObjectClassDefinition createNewParameters( ObjectClassDefinition oldParameters) { try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jrb...@us...> - 2009-07-24 17:44:44
|
Revision: 896 http://cishell.svn.sourceforge.net/cishell/?rev=896&view=rev Author: jrbibers Date: 2009-07-24 17:44:30 +0000 (Fri, 24 Jul 2009) Log Message: ----------- Added ParameterMutator utilities for transforming ObjectClassDefinitions and AttributeDefinitions. See MutateParameterUtilities.mutateToDropdown() for an example usage. Added Paths: ----------- trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/ trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/AttributeDefinitionTransformer.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/DropdownTransformer.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/NullDropdownTransformer.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/ObjectClassDefinitionTransformer.java Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/AttributeDefinitionTransformer.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/AttributeDefinitionTransformer.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/AttributeDefinitionTransformer.java 2009-07-24 17:44:30 UTC (rev 896) @@ -0,0 +1,19 @@ +package org.cishell.utilities.mutateParameter; + +import org.osgi.service.metatype.AttributeDefinition; + +/* There would be one implementation of this interface for each useful + * constructor of BasicAttributeDefinition, where the transform is defined as in + * DropdownTransformer. + */ +public interface AttributeDefinitionTransformer { + public boolean shouldTransform(AttributeDefinition ad); + public AttributeDefinition transform(AttributeDefinition oldAD); + public String transformID(String oldID); + public String transformName(String oldName); + public String transformDescription(String oldDescription); + public int transformType(int oldType); +} + + + Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/DropdownTransformer.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/DropdownTransformer.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/DropdownTransformer.java 2009-07-24 17:44:30 UTC (rev 896) @@ -0,0 +1,27 @@ +package org.cishell.utilities.mutateParameter; + +import org.cishell.reference.service.metatype.BasicAttributeDefinition; +import org.osgi.service.metatype.AttributeDefinition; + +public abstract class DropdownTransformer + implements AttributeDefinitionTransformer { + public AttributeDefinition transform(AttributeDefinition oldAD) { + if (shouldTransform(oldAD)) { + return + new BasicAttributeDefinition( + transformID(oldAD.getID()), + transformName(oldAD.getName()), + transformDescription(oldAD.getDescription()), + transformType(oldAD.getType()), + transformOptionLabels(oldAD.getOptionLabels()), + transformOptionValues(oldAD.getOptionValues())); + } + else { + return oldAD; + } + } + + public abstract String[] transformOptionLabels(String[] oldOptionLabels); + public abstract String[] transformOptionValues(String[] oldOptionValues); +} + Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/NullDropdownTransformer.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/NullDropdownTransformer.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/NullDropdownTransformer.java 2009-07-24 17:44:30 UTC (rev 896) @@ -0,0 +1,40 @@ +package org.cishell.utilities.mutateParameter; + +import org.osgi.service.metatype.AttributeDefinition; + +/* A dropdown-forming AttributeDefinition transformer which by default + * performs no transformation. + * This is a convenient access to DropdownTransformer where you may override + * methods to transform only the arguments that you wish to modify. + * The typical case would be extending shouldTransform (think of as a filter), + * transformOptionLabels, and transformOptionValues. + */ +public abstract class NullDropdownTransformer extends DropdownTransformer { + public boolean shouldTransform(AttributeDefinition ad) { + return false; + } + + public String transformID(String oldID) { + return oldID; + } + + public String transformName(String oldName) { + return oldName; + } + + public String transformDescription(String oldDescription) { + return oldDescription; + } + + public int transformType(int oldType) { + return oldType; + } + + public String[] transformOptionLabels(String[] oldOptionLabels) { + return oldOptionLabels; + } + + public String[] transformOptionValues(String[] oldOptionValues) { + return oldOptionValues; + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/ObjectClassDefinitionTransformer.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/ObjectClassDefinitionTransformer.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/mutateParameter/ObjectClassDefinitionTransformer.java 2009-07-24 17:44:30 UTC (rev 896) @@ -0,0 +1,51 @@ +package org.cishell.utilities.mutateParameter; + +import java.util.Iterator; +import java.util.List; + +import org.cishell.reference.service.metatype.BasicObjectClassDefinition; +import org.cishell.utilities.MutateParameterUtilities; +import org.osgi.service.metatype.AttributeDefinition; +import org.osgi.service.metatype.ObjectClassDefinition; + +public class ObjectClassDefinitionTransformer { + private static final int OUTGOING_ATTRIBUTES_FILTER = + ObjectClassDefinition.REQUIRED; + private static final int INCOMING_ATTRIBUTES_FILTER = + ObjectClassDefinition.ALL; + + /* Create newOCD from oldOCD by applying transformer + * to each AttributeDefinition. + */ + public static BasicObjectClassDefinition apply( + AttributeDefinitionTransformer transformer, + ObjectClassDefinition oldOCD) { + BasicObjectClassDefinition newOCD = + MutateParameterUtilities.createNewParameters(oldOCD); + + AttributeDefinition[] oldADs = + oldOCD.getAttributeDefinitions(INCOMING_ATTRIBUTES_FILTER); + for(int ii = 0; ii < oldADs.length; ii++) { + newOCD.addAttributeDefinition(OUTGOING_ATTRIBUTES_FILTER, + transformer.transform(oldADs[ii])); + } + + return newOCD; + } + + /* Convenience method for batching transformations. + * TODO Untested + */ + public static BasicObjectClassDefinition transform( + BasicObjectClassDefinition oldOCD, List transformers) { + BasicObjectClassDefinition newOCD = oldOCD; + + for ( Iterator it = transformers.iterator(); it.hasNext(); ) { + AttributeDefinitionTransformer transformer = + (AttributeDefinitionTransformer) it.next(); + newOCD = apply(transformer, newOCD); + } + + return newOCD; + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-07-23 20:19:07
|
Revision: 895 http://cishell.svn.sourceforge.net/cishell/?rev=895&view=rev Author: mwlinnem Date: 2009-07-23 20:19:00 +0000 (Thu, 23 Jul 2009) Log Message: ----------- Added Paths: ----------- trunk/testing/CNS_Sun_Checks_for_Eclipse.xml Added: trunk/testing/CNS_Sun_Checks_for_Eclipse.xml =================================================================== --- trunk/testing/CNS_Sun_Checks_for_Eclipse.xml (rev 0) +++ trunk/testing/CNS_Sun_Checks_for_Eclipse.xml 2009-07-23 20:19:00 UTC (rev 895) @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> + +<!-- + This configuration file was written by the eclipse-cs plugin configuration editor +--> +<!-- + Checkstyle-Configuration: 3 Modified Sun Checks (Eclipse) + Description: +Slightly modified version of Sun Checks that better matches the default code formatter setting of Eclipse. +--> +<module name="Checker"> + <property name="severity" value="warning"/> + <module name="TreeWalker"> + <property name="tabWidth" value="4"/> + <module name="JavadocMethod"> + <property name="severity" value="ignore"/> + <property name="logLoadErrors" value="true"/> + <property name="suppressLoadErrors" value="true"/> + </module> + <module name="JavadocType"> + <property name="severity" value="ignore"/> + </module> + <module name="JavadocVariable"> + <property name="severity" value="ignore"/> + </module> + <module name="JavadocStyle"/> + <module name="ConstantName"/> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MemberName"/> + <module name="MethodName"/> + <module name="PackageName"/> + <module name="ParameterName"/> + <module name="StaticVariableName"/> + <module name="TypeName"/> + <module name="AvoidStarImport"/> + <module name="IllegalImport"/> + <module name="RedundantImport"/> + <module name="UnusedImports"/> + <module name="LineLength"> + <property name="max" value="100"/> + </module> + <module name="MethodLength"/> + <module name="ParameterNumber"/> + <module name="EmptyForIteratorPad"/> + <module name="MethodParamPad"/> + <module name="NoWhitespaceAfter"> + <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/> + </module> + <module name="NoWhitespaceBefore"/> + <module name="OperatorWrap"/> + <module name="ParenPad"/> + <module name="TypecastParenPad"/> + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"/> + <module name="ModifierOrder"/> + <module name="RedundantModifier"/> + <module name="AvoidNestedBlocks"/> + <module name="EmptyBlock"/> + <module name="LeftCurly"/> + <module name="NeedBraces"/> + <module name="RightCurly"/> + <module name="AvoidInlineConditionals"/> + <module name="DoubleCheckedLocking"/> + <module name="EmptyStatement"/> + <module name="EqualsHashCode"/> + <module name="HiddenField"> + <property name="severity" value="ignore"/> + </module> + <module name="IllegalInstantiation"/> + <module name="InnerAssignment"/> + <module name="MagicNumber"/> + <module name="MissingSwitchDefault"/> + <module name="RedundantThrows"> + <property name="logLoadErrors" value="true"/> + <property name="suppressLoadErrors" value="true"/> + </module> + <module name="SimplifyBooleanExpression"/> + <module name="SimplifyBooleanReturn"/> + <module name="DesignForExtension"> + <property name="severity" value="ignore"/> + </module> + <module name="FinalClass"/> + <module name="HideUtilityClassConstructor"/> + <module name="InterfaceIsType"/> + <module name="VisibilityModifier"/> + <module name="ArrayTypeStyle"/> + <module name="FinalParameters"> + <property name="severity" value="ignore"/> + </module> + <module name="TodoComment"> + <property name="severity" value="ignore"/> + </module> + <module name="UpperEll"/> + </module> + <module name="JavadocPackage"> + <property name="severity" value="ignore"/> + </module> + <module name="NewlineAtEndOfFile"> + <property name="severity" value="ignore"/> + </module> + <module name="Translation"/> + <module name="FileLength"/> + <module name="FileTabCharacter"> + <property name="severity" value="ignore"/> + </module> + <module name="RegexpSingleline"> + <property name="severity" value="ignore"/> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> +</module> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jrb...@us...> - 2009-07-22 20:20:01
|
Revision: 894 http://cishell.svn.sourceforge.net/cishell/?rev=894&view=rev Author: jrbibers Date: 2009-07-22 20:19:56 +0000 (Wed, 22 Jul 2009) Log Message: ----------- Added method to test whether a File is empty to FileUtilities. Modified Paths: -------------- trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java 2009-07-21 13:07:46 UTC (rev 893) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java 2009-07-22 20:19:56 UTC (rev 894) @@ -1,7 +1,10 @@ package org.cishell.utilities; import java.awt.image.BufferedImage; +import java.io.BufferedReader; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; @@ -131,6 +134,15 @@ return temporaryTextFile; } + public static boolean isFileEmpty(File file) + throws FileNotFoundException, IOException { + final BufferedReader reader = new BufferedReader(new FileReader(file)); + String firstLine = reader.readLine(); + reader.close(); + boolean fileIsEmpty = ( firstLine == null ); + return fileIsEmpty; + } + private static File ensureDirectoryExists(String directoryPath) { File directory = new File(directoryPath); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2009-07-21 13:07:49
|
Revision: 893 http://cishell.svn.sourceforge.net/cishell/?rev=893&view=rev Author: pataphil Date: 2009-07-21 13:07:46 +0000 (Tue, 21 Jul 2009) Log Message: ----------- Fixed 1.4 compatibility issues? Modified Paths: -------------- trunk/core/org.cishell.utilities/src/org/cishell/utilities/ArrayListUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/DateUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/NumberUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/ArrayListUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/ArrayListUtilities.java 2009-07-20 22:31:21 UTC (rev 892) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/ArrayListUtilities.java 2009-07-21 13:07:46 UTC (rev 893) @@ -27,7 +27,8 @@ } } - for (String keyToAdd : keysToAdd) { + for (int ii = 0; ii < keysToAdd.length; ii++) { + String keyToAdd = keysToAdd[ii]; if (!union.contains(keyToAdd)) { union.add(keyToAdd); } Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/DateUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/DateUtilities.java 2009-07-20 22:31:21 UTC (rev 892) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/DateUtilities.java 2009-07-21 13:07:46 UTC (rev 893) @@ -196,8 +196,9 @@ public static Date parseDate(String dateString) throws ParseException { - for (DateFormat format : ACCEPTED_DATE_FORMATS) { + for (int ii = 0; ii < ACCEPTED_DATE_FORMATS.length; ii++) { try { + DateFormat format = ACCEPTED_DATE_FORMATS[ii]; format.setLenient(false); Date date = format.parse(dateString); Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java 2009-07-20 22:31:21 UTC (rev 892) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java 2009-07-21 13:07:46 UTC (rev 893) @@ -5,15 +5,14 @@ import java.util.Set; public class MapUtilities { - public static String[] getValidKeysOfTypesInMap(Map map, - String[] types, - String[] keysToSkip, - String[] keysToAdd) + public static String[] getValidKeysOfTypesInMap( + Map map, String[] types, String[] keysToSkip, String[] keysToAdd) throws ColumnNotFoundException { ArrayList workingKeys = new ArrayList(); Set entrySet = map.entrySet(); - for (String type : types) { + for (int ii = 0; ii < types.length; ii++) { + String type = types[ii]; ArrayList keysForType = SetUtilities.getKeysOfMapEntrySetWithValue(entrySet, type); workingKeys = ArrayListUtilities.unionArrayLists( Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/NumberUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/NumberUtilities.java 2009-07-20 22:31:21 UTC (rev 892) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/NumberUtilities.java 2009-07-21 13:07:46 UTC (rev 893) @@ -30,7 +30,7 @@ throw new NumberFormatException(EMPTY_CELL_MESSAGE); } else { - return objectAsShortArray[0].doubleValue(); + return new Double(objectAsShortArray[0].doubleValue()); } } else if (object instanceof int[]) { @@ -50,7 +50,7 @@ throw new NumberFormatException(EMPTY_CELL_MESSAGE); } else { - return objectAsIntegerArray[0].doubleValue(); + return new Double(objectAsIntegerArray[0].doubleValue()); } } else if (object instanceof long[]) { @@ -70,7 +70,7 @@ throw new NumberFormatException(EMPTY_CELL_MESSAGE); } else { - return objectAsLongArray[0].doubleValue(); + return new Double(objectAsLongArray[0].doubleValue()); } } else if (object instanceof float[]) { @@ -90,7 +90,7 @@ throw new NumberFormatException(EMPTY_CELL_MESSAGE); } else { - return objectAsFloatArray[0].doubleValue(); + return new Double(objectAsFloatArray[0].doubleValue()); } } else if (object instanceof double[]) { Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java 2009-07-20 22:31:21 UTC (rev 892) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java 2009-07-21 13:07:46 UTC (rev 893) @@ -125,7 +125,9 @@ ArrayList workingColumnNames = new ArrayList(); for (int ii = 0; ii < schema.getColumnCount(); ii++) { - for (Class objectClass : objectClasses) { + for (int jj = 0; jj < objectClasses.length; jj++) { + Class objectClass = objectClasses[jj]; + if (objectClass.isAssignableFrom(schema.getColumnType(ii))) { workingColumnNames.add(schema.getColumnName(ii)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2009-07-20 22:31:31
|
Revision: 892 http://cishell.svn.sourceforge.net/cishell/?rev=892&view=rev Author: pataphil Date: 2009-07-20 22:31:21 +0000 (Mon, 20 Jul 2009) Log Message: ----------- Welcome text now always gets displayed. Probably. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java Modified: trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2009-07-20 18:44:49 UTC (rev 891) +++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2009-07-20 22:31:21 UTC (rev 892) @@ -15,6 +15,9 @@ package org.cishell.reference.gui.log; //standard java +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.util.Enumeration; import java.util.HashMap; import java.util.Map; @@ -166,7 +169,14 @@ ServiceReference ref = context.getServiceReference(LogReaderService.class.getName()); LogReaderService reader = (LogReaderService) context.getService(ref); if (reader != null) { - reader.addLogListener(this); + reader.addLogListener(this); + + Enumeration backLogEntries = reader.getLog(); + + while (backLogEntries.hasMoreElements()) { + LogEntry logEntry = (LogEntry)backLogEntries.nextElement(); + this.logged(logEntry); + } } else System.out.println("reader is null"); @@ -180,7 +190,6 @@ } public void logged(final LogEntry entry) { - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { public void run() { String message = entry.getMessage(); @@ -198,7 +207,6 @@ } } }); - } private boolean goodMessage(String msg) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2009-07-20 18:44:53
|
Revision: 891 http://cishell.svn.sourceforge.net/cishell/?rev=891&view=rev Author: pataphil Date: 2009-07-20 18:44:49 +0000 (Mon, 20 Jul 2009) Log Message: ----------- * "Merged" TableUtilities with changes made to edu.iu.scipolicy.utilities before Utilities were moved to CIShell. Modified Paths: -------------- trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java 2009-07-17 22:02:42 UTC (rev 890) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java 2009-07-20 18:44:49 UTC (rev 891) @@ -66,6 +66,59 @@ } } + public static String formNonConflictingNewColumnName( + Schema schema, String[] suggestedColumnNames) + throws ColumnNotFoundException { + List workingColumnNames = getAllColumnNames(schema); + + boolean suggestedNameFound = false; + for(int suggestedNameIndex = 0; suggestedNameIndex < suggestedColumnNames.length; suggestedNameIndex++) { + for(int i = 0; i < workingColumnNames.size(); i++) { + if(workingColumnNames.get(i).toString().equalsIgnoreCase(suggestedColumnNames[suggestedNameIndex])) { + suggestedNameFound = true; + break; + } + } + /* + * To ensure that whenever a suggested name is found in the original column schema, create a name. + * */ + if(suggestedNameFound) { + break; + } + } + + /* + * If none of the suggested names are conflicting then return the first suggested name. + * */ + if(!suggestedNameFound) { + return suggestedColumnNames[0]; + } + + /* + * This part of code will be executed only if the suggested names are already present in the + * column schema. + * */ + boolean newColumnNameFound = false; + int columnNameSuffix = 2; + while(true) { + /* + * The pattern for new names will be taken from the first suggested column name. + * */ + String newColumnName = + suggestedColumnNames[0].concat("_" + columnNameSuffix); + for(int i = 0; i < workingColumnNames.size(); i++) { + if(workingColumnNames.get(i).toString().equalsIgnoreCase(newColumnName)) { + newColumnNameFound = true; + break; + } + } + if(!newColumnNameFound) { + return newColumnName; + } + columnNameSuffix++; + } + } + public static String[] filterSchemaColumnNamesByClasses (Schema schema, Class[] objectClasses) throws ColumnNotFoundException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-07-17 22:02:44
|
Revision: 890 http://cishell.svn.sourceforge.net/cishell/?rev=890&view=rev Author: mwlinnem Date: 2009-07-17 22:02:42 +0000 (Fri, 17 Jul 2009) Log Message: ----------- StringBuilder isn't in Java 1.4 . Using StringBuffer instead. Modified Paths: -------------- trunk/core/org.cishell.utilities/src/org/cishell/utilities/StringUtilities.java Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/StringUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/StringUtilities.java 2009-07-17 21:59:15 UTC (rev 889) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/StringUtilities.java 2009-07-17 22:02:42 UTC (rev 890) @@ -3,7 +3,7 @@ public class StringUtilities { public static String implodeStringArray(String[] stringArray, String separator) { final int stringArrayLength = stringArray.length; - StringBuilder workingResultString = new StringBuilder(); + StringBuffer workingResultString = new StringBuffer(); for (int ii = 0; ii < stringArrayLength; ii++) { workingResultString.append(stringArray[ii]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-07-17 21:59:18
|
Revision: 889 http://cishell.svn.sourceforge.net/cishell/?rev=889&view=rev Author: mwlinnem Date: 2009-07-17 21:59:15 +0000 (Fri, 17 Jul 2009) Log Message: ----------- Cosmetic change. Modified Paths: -------------- trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml Modified: trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml =================================================================== --- trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2009-07-17 21:56:16 UTC (rev 888) +++ trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2009-07-17 21:59:15 UTC (rev 889) @@ -167,6 +167,6 @@ <param name="element.id" value="org.cishell.utilities"/> <param name="project.name" value="/core/org.cishell.utilities"/> <param name="url" value="https://cishell.svn.sourceforge.net/svnroot/cishell/trunk"/> - </antcall> + </antcall> </target> </project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-07-17 21:56:21
|
Revision: 888 http://cishell.svn.sourceforge.net/cishell/?rev=888&view=rev Author: mwlinnem Date: 2009-07-17 21:56:16 +0000 (Fri, 17 Jul 2009) Log Message: ----------- Adding org.cishell.utilities to build system. This should right the wrong of having a NWB-repository dependency in CIShell. Modified Paths: -------------- trunk/deployment/org.cishell.reference.feature/feature.xml trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml Modified: trunk/deployment/org.cishell.reference.feature/feature.xml =================================================================== --- trunk/deployment/org.cishell.reference.feature/feature.xml 2009-07-17 21:25:53 UTC (rev 887) +++ trunk/deployment/org.cishell.reference.feature/feature.xml 2009-07-17 21:56:16 UTC (rev 888) @@ -107,4 +107,11 @@ version="0.0.0" unpack="false"/> + <plugin + id="org.cishell.utilities" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> Modified: trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml =================================================================== --- trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2009-07-17 21:25:53 UTC (rev 887) +++ trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2009-07-17 21:56:16 UTC (rev 888) @@ -162,5 +162,11 @@ <param name="project.name" value="/libs/jythonlib"/> <param name="url" value="https://cishell.svn.sourceforge.net/svnroot/cishell/trunk"/> </antcall> + <antcall target="svn.co"> + <param name="target" value="plugins"/> + <param name="element.id" value="org.cishell.utilities"/> + <param name="project.name" value="/core/org.cishell.utilities"/> + <param name="url" value="https://cishell.svn.sourceforge.net/svnroot/cishell/trunk"/> + </antcall> </target> </project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2009-07-17 21:26:08
|
Revision: 887 http://cishell.svn.sourceforge.net/cishell/?rev=887&view=rev Author: pataphil Date: 2009-07-17 21:25:53 +0000 (Fri, 17 Jul 2009) Log Message: ----------- Made 1.4-compliant. (Was 1.5.) Modified Paths: -------------- trunk/core/org.cishell.utilities/.classpath Removed Paths: ------------- trunk/core/org.cishell.utilities/tests/ Modified: trunk/core/org.cishell.utilities/.classpath =================================================================== --- trunk/core/org.cishell.utilities/.classpath 2009-07-17 21:13:00 UTC (rev 886) +++ trunk/core/org.cishell.utilities/.classpath 2009-07-17 21:25:53 UTC (rev 887) @@ -1,9 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="tests"/> - <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="output" path="bin"/> </classpath> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2009-07-17 21:13:13
|
Revision: 886 http://cishell.svn.sourceforge.net/cishell/?rev=886&view=rev Author: pataphil Date: 2009-07-17 21:13:00 +0000 (Fri, 17 Jul 2009) Log Message: ----------- Initial commit. Used to be edu.iu.scipolicy.utilities, but they are general-purpose for all CIShell projects. Added Paths: ----------- trunk/core/org.cishell.utilities/.classpath trunk/core/org.cishell.utilities/.project trunk/core/org.cishell.utilities/.settings/ trunk/core/org.cishell.utilities/.settings/org.eclipse.jdt.core.prefs trunk/core/org.cishell.utilities/.settings/org.eclipse.pde.core.prefs trunk/core/org.cishell.utilities/META-INF/ trunk/core/org.cishell.utilities/META-INF/MANIFEST.MF trunk/core/org.cishell.utilities/build.properties trunk/core/org.cishell.utilities/src/ trunk/core/org.cishell.utilities/src/org/ trunk/core/org.cishell.utilities/src/org/cishell/ trunk/core/org.cishell.utilities/src/org/cishell/utilities/ trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmNotFoundException.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/ArrayListUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/ColumnNotFoundException.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/DateUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/DefaultDictionary.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/FAQCalendar.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/ImageUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/MutateParameterUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/NumberUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/SetUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/StringUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java trunk/core/org.cishell.utilities/tests/ trunk/core/org.cishell.utilities/tests/edu/ trunk/core/org.cishell.utilities/tests/edu/iu/ trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/ trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/ trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/DateUtilitiesTest.java trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/DefaultDictionaryTest.java trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/FAQCalendarTest.java trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/FileUtilitiesTest.java trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/ImageUtilitiesTest.java trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/MutateParameterUtilitiesTest.java trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/StringUtilitiesTest.java trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/TableUtilitiesTest.java Added: trunk/core/org.cishell.utilities/.classpath =================================================================== --- trunk/core/org.cishell.utilities/.classpath (rev 0) +++ trunk/core/org.cishell.utilities/.classpath 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="tests"/> + <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/core/org.cishell.utilities/.project =================================================================== --- trunk/core/org.cishell.utilities/.project (rev 0) +++ trunk/core/org.cishell.utilities/.project 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.utilities</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/core/org.cishell.utilities/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/core/org.cishell.utilities/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/core/org.cishell.utilities/.settings/org.eclipse.jdt.core.prefs 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,7 @@ +#Fri Jan 16 16:03:38 EST 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 Added: trunk/core/org.cishell.utilities/.settings/org.eclipse.pde.core.prefs =================================================================== --- trunk/core/org.cishell.utilities/.settings/org.eclipse.pde.core.prefs (rev 0) +++ trunk/core/org.cishell.utilities/.settings/org.eclipse.pde.core.prefs 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,4 @@ +#Fri Jan 16 16:03:38 EST 2009 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false Added: trunk/core/org.cishell.utilities/META-INF/MANIFEST.MF =================================================================== --- trunk/core/org.cishell.utilities/META-INF/MANIFEST.MF (rev 0) +++ trunk/core/org.cishell.utilities/META-INF/MANIFEST.MF 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Utilities Plug-in +Bundle-SymbolicName: org.cishell.utilities +Bundle-Version: 1.0.0 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.cishell.framework.algorithm;version="1.0.0", + org.cishell.reference.service.metatype, + org.osgi.framework;version="1.4.0", + org.osgi.service.metatype;version="1.1.0", + prefuse, + prefuse.data, + prefuse.data.column, + prefuse.data.tuple, + prefuse.data.util, + prefuse.util, + prefuse.util.collections +Export-Package: org.cishell.utilities Added: trunk/core/org.cishell.utilities/build.properties =================================================================== --- trunk/core/org.cishell.utilities/build.properties (rev 0) +++ trunk/core/org.cishell.utilities/build.properties 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmNotFoundException.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmNotFoundException.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmNotFoundException.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,21 @@ +package org.cishell.utilities; + +public class AlgorithmNotFoundException extends RuntimeException { + private static final long serialVersionUID = 1L; + + public AlgorithmNotFoundException() { + super(); + } + + public AlgorithmNotFoundException(String arg0) { + super(arg0); + } + + public AlgorithmNotFoundException(Throwable arg0) { + super(arg0); + } + + public AlgorithmNotFoundException(String arg0, Throwable arg1) { + super(arg0, arg1); + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,48 @@ +package org.cishell.utilities; + +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.osgi.framework.BundleContext; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; + + +public class AlgorithmUtilities { + // TODO: ISILoadAndCleanAlgorithmFactory should use this? + // It's copied directly from it (and cleaned up a little bit)... + public static AlgorithmFactory getAlgorithmFactoryByFilter( + String filter, BundleContext bundleContext) + throws AlgorithmNotFoundException { + ServiceReference[] algorithmFactoryReferences; + + try { + algorithmFactoryReferences = bundleContext.getServiceReferences( + AlgorithmFactory.class.getName(), filter); + } catch (InvalidSyntaxException invalidSyntaxException) { + throw new AlgorithmNotFoundException(invalidSyntaxException); + } + + if (algorithmFactoryReferences != null && + algorithmFactoryReferences.length != 0) { + ServiceReference algorithmFactoryReference = + algorithmFactoryReferences[0]; + + AlgorithmFactory algorithmFactory = + (AlgorithmFactory)bundleContext.getService( + algorithmFactoryReference); + + return algorithmFactory; + } + else { + throw new AlgorithmNotFoundException("Unable to find an " + + "algorithm that satisfied the following filter:\n" + filter); + } + } + + public static AlgorithmFactory getAlgorithmFactoryByPID( + String pid, BundleContext bundleContext) + throws AlgorithmNotFoundException { + String filter = "(service.pid=" + pid + ")"; + + return getAlgorithmFactoryByFilter(filter, bundleContext); + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/ArrayListUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/ArrayListUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/ArrayListUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,38 @@ +package org.cishell.utilities; + +import java.util.ArrayList; +import java.util.Arrays; + +public class ArrayListUtilities { + public static ArrayList unionArrayLists(ArrayList arrayList1, + ArrayList arrayList2, + String[] keysToSkip, + String[] keysToAdd) { + ArrayList union = new ArrayList(); + + for (int ii = 0; ii < arrayList1.size(); ii++) { + Object element = arrayList1.get(ii); + + if (!union.contains(element) && + Arrays.binarySearch(keysToSkip, element) < 0) { + union.add(element); + } + } + + for (int ii = 0; ii < arrayList2.size(); ii++) { + Object element = arrayList2.get(ii); + + if (!union.contains(element)) { + union.add(element); + } + } + + for (String keyToAdd : keysToAdd) { + if (!union.contains(keyToAdd)) { + union.add(keyToAdd); + } + } + + return union; + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/ColumnNotFoundException.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/ColumnNotFoundException.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/ColumnNotFoundException.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,21 @@ +package org.cishell.utilities; + +public class ColumnNotFoundException extends RuntimeException { + private static final long serialVersionUID = 1L; + + public ColumnNotFoundException() { + super(); + } + + public ColumnNotFoundException(String arg0) { + super(arg0); + } + + public ColumnNotFoundException(Throwable arg0) { + super(arg0); + } + + public ColumnNotFoundException(String arg0, Throwable arg1) { + super(arg0, arg1); + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/DateUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/DateUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/DateUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,335 @@ +package org.cishell.utilities; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +// TODO: Fix this class. +public class DateUtilities { + public final static double AVERAGE_MILLIS_PER_MONTH = + (365.24 * 24 * 60 * 60 * 1000 / 12); + + // TODO: Is this actually necessary? + public static Date[] generateDaysBetweenDates(Date startDate, Date endDate) { + GregorianCalendar startDateCalendar = + new GregorianCalendar(startDate.getYear() + 1900, + startDate.getMonth(), + startDate.getDate()); + + GregorianCalendar endDateCalendar = + new GregorianCalendar(endDate.getYear() + 1900, + endDate.getMonth(), + endDate.getDate()); + + // Return an empty set of days (Dates) if the start date is actually AFTER + // the end date. + if (startDateCalendar.getTimeInMillis() > endDateCalendar.getTimeInMillis()) + return new Date [0]; + + // There is at least one day between the provided start and end dates (dates + // themselves included). + + ArrayList workingDaysBetweenDates = new ArrayList(); + GregorianCalendar currentCalendarForDateThatWeAreCalculating = + (GregorianCalendar)startDateCalendar.clone(); + final Date actualEndDateAccordingToCalendar = endDateCalendar.getTime(); + boolean shouldKeepGeneratingDaysBetweenDates = true; + + // This is the meat of the Date generation. + while (shouldKeepGeneratingDaysBetweenDates) { + // Get the current calculated date. + Date currentCalculatedDate = + currentCalendarForDateThatWeAreCalculating.getTime(); + + // Add the current date that we are calculating. + workingDaysBetweenDates.add(currentCalculatedDate); + + // Move the current calendar for the date that we are calculating + // forward in time a day. + currentCalendarForDateThatWeAreCalculating.add(Calendar.DATE, 1); + + // Should we stop now? + if ((currentCalculatedDate.getYear() == + actualEndDateAccordingToCalendar.getYear()) && + (currentCalculatedDate.getMonth() == + actualEndDateAccordingToCalendar.getMonth()) && + (currentCalculatedDate.getDate() == + actualEndDateAccordingToCalendar.getDate())) + { + shouldKeepGeneratingDaysBetweenDates = false; + } + } + + Date[] finalDaysBetweenDates = new Date [workingDaysBetweenDates.size()]; + + return (Date[])workingDaysBetweenDates.toArray(finalDaysBetweenDates); + } + + public static int calculateDaysBetween(Date[] dateSet) { + return dateSet.length; + } + + public static int calculateDaysBetween(Date startDate, Date endDate) { + FAQCalendar startDateCalendar = new FAQCalendar(startDate.getYear(), + startDate.getMonth(), + startDate.getDate()); + + FAQCalendar endDateCalendar = new FAQCalendar(endDate.getYear(), + endDate.getMonth(), + endDate.getDate()); + + return (int)startDateCalendar.diffDayPeriods(endDateCalendar); + } + + public static int calculateMonthsBetween(Date startDate, Date endDate) { + int roundedMonthsBetween = (int)Math.round + ((endDate.getTime() - startDate.getTime()) / AVERAGE_MILLIS_PER_MONTH); + + if (roundedMonthsBetween > 0) { + return roundedMonthsBetween; + } + else { + // HACK(?): There must be at least one month between + // (even if they're both the same month). + return 1; + } + } + + // Assumes dateSet is sorted from earliest to latest. + public static Date[] getNewYearsDatesFromDateSet(Date[] dateSet) { + ArrayList workingNewYearsDates = new ArrayList(); + + // Return an empty set if there are no dates. + if (dateSet.length == 0) + return new Date [0]; + + // If the first date is not a new year's date, add a new year's date for + // that date's year. + if ((dateSet[0].getMonth() != 0) || (dateSet[0].getDate() != 1)) + workingNewYearsDates.add(new Date(dateSet[0].getYear(), 0, 1)); + + // Find each date that has the month and day of 1-1 (well, 0-1 because Date + // is stupid). + for (int ii = 0; ii < dateSet.length; ii++) { + if ((dateSet[ii].getMonth() == 0) && (dateSet[ii].getDate() == 1)) + workingNewYearsDates.add(dateSet[ii]); + } + + Date[] finalNewYearsDates = new Date [workingNewYearsDates.size()]; + + return (Date[])workingNewYearsDates.toArray(finalNewYearsDates); + } + + public static Date[] generateNewYearsDatesBetweenDates(Date startDate, + Date endDate) + { + final int startDateYear = startDate.getYear(); + final int endDateYear = endDate.getYear(); + // The number of years between the two years (inclusive). + final int numYearsBetween = ((endDateYear - startDateYear) + 1); + + // Return an empty array if the start date is after the end date. + if (numYearsBetween == 0) + return new Date[] { }; + + Date[] newYearsDatesBetween = new Date [numYearsBetween]; + + for (int ii = 0; ii < numYearsBetween; ii++) + newYearsDatesBetween[ii] = new Date((startDateYear + ii), 0, 1); + + return newYearsDatesBetween; + } + + // TODO: This could also REALLY be improved. + public static Date[] generateFirstOfTheMonthDatesBetweenDates(Date[] dateSet) { + ArrayList workingFirstOfTheMonthDates = new ArrayList(); + + // Find each date that has the day of 1. + for (int ii = 0; ii < dateSet.length; ii++) { + if (dateSet[ii].getDate() == 1) + workingFirstOfTheMonthDates.add(dateSet[ii]); + } + + Date[] finalFirstOfTheMonthDates = + new Date [workingFirstOfTheMonthDates.size()]; + + return (Date[])workingFirstOfTheMonthDates.toArray + (finalFirstOfTheMonthDates); + } + + public static Date[] generateFirstOfTheMonthDatesBetweenDates(Date startDate, + Date endDate) + { + Date[] allDaysBetweenDates = generateDaysBetweenDates(startDate, endDate); + + return generateFirstOfTheMonthDatesBetweenDates(allDaysBetweenDates); + } + + //TODO: These should be sorted so the first format checked is the most likely format, etc... + private static final DateFormat[] ACCEPTED_DATE_FORMATS = { + DateFormat.getDateInstance(DateFormat.FULL), + new SimpleDateFormat("d-MM-yy"), + new SimpleDateFormat("d-MM-yyyy"), + new SimpleDateFormat("dd-MM-yy"), + new SimpleDateFormat("dd-MM-yyyy"), + new SimpleDateFormat("d/MM/yy"), + new SimpleDateFormat("dd/MM/yy"), + new SimpleDateFormat("d/MM/yyyy"), + new SimpleDateFormat("dd/MMM/yyyy"), + new SimpleDateFormat("d-MMM-yy"), + new SimpleDateFormat("d-MMM-yyyy"), + new SimpleDateFormat("dd-MMM-yy"), + new SimpleDateFormat("dd-MMM-yyyy"), + new SimpleDateFormat("d/MMM/yy"), + new SimpleDateFormat("dd/MMM/yy"), + new SimpleDateFormat("d/MMM/yyyy"), + new SimpleDateFormat("dd/MMM/yyyy"), + new SimpleDateFormat("yyyy"), + DateFormat.getDateInstance(DateFormat.SHORT), + DateFormat.getDateInstance(DateFormat.MEDIUM), + DateFormat.getDateInstance(DateFormat.LONG), + }; + + public static Date parseDate(String dateString) + throws ParseException { + for (DateFormat format : ACCEPTED_DATE_FORMATS) { + try { + format.setLenient(false); + Date date = format.parse(dateString); + + if (date.getYear() < 1900) { + date.setYear(date.getYear() + 1900); + } + + return date; + } + catch (ParseException dateParseException) { + continue; + } + } + + String exceptionMessage = "Could not parse the field " + + "'" + dateString + "'" + + " as a date."; + + throw new ParseException(exceptionMessage, 0); + } + + public static Date interpretObjectAsDate(Object object) + throws ParseException{ + final String EMPTY_DATE_MESSAGE = "An empty date was found."; + + String objectAsString = object.toString(); + + // TODO: These if's are a result of a "bug" in Prefuse's. + // CSV Table Reader, which interprets a column as being an array type + // if it has empty cells. + if (object instanceof Date) { + return (Date)object; + } + else if (object instanceof short[]) { + short[] year = (short[])object; + + if (year.length == 0) { + throw new ParseException(EMPTY_DATE_MESSAGE, 0); + } + else { + objectAsString = "" + year[0]; + } + } + else if (object instanceof Short[]) { + Short[] year = (Short[])object; + + if (year.length == 0) { + throw new ParseException(EMPTY_DATE_MESSAGE, 0); + } + else { + objectAsString = "" + year[0]; + } + } + else if (object instanceof int[]) { + int[] year = (int[])object; + + if (year.length == 0) { + throw new ParseException(EMPTY_DATE_MESSAGE, 0); + } + else { + objectAsString = "" + year[0]; + } + } + else if (object instanceof Integer[]) { + Integer[] year = (Integer[])object; + + if (year.length == 0) { + throw new ParseException(EMPTY_DATE_MESSAGE, 0); + } + else { + objectAsString = year.toString(); + } + } + else if (object instanceof long[]) { + long[] year = (long[])object; + + if (year.length == 0) { + throw new ParseException(EMPTY_DATE_MESSAGE, 0); + } + else { + objectAsString = "" + year[0]; + } + } + else if (object instanceof Long[]) { + Long[] year = (Long[])object; + + if (year.length == 0) { + throw new ParseException(EMPTY_DATE_MESSAGE, 0); + } + else { + objectAsString = "" + year[0]; + } + } + else if (object instanceof String[]) { + String[] year = (String[])object; + + if (year.length == 0) { + throw new ParseException(EMPTY_DATE_MESSAGE, 0); + } + else { + objectAsString = year[0]; + } + } + + return parseDate(objectAsString); + } + +// private java.util.Date parseDate(String dateString) +// throws AlgorithmExecutionException { +// for (DateFormat format : ACCEPTED_DATE_FORMATS) { +// try { +// format.setLenient(false); +// java.util.Date date = format.parse(dateString); +// //WE PARSED THE DATE SUCCESSFULLY (if we get to this point)! +// //Finish up our processing and return the date. +// +// //TODO: Methinks this is a hack we should eliminate +// if (date.getYear() < 1900) +// date.setYear(date.getYear() + 1900); +// java.sql.Date dateForSQL = new java.sql.Date(date.getTime()); +// return dateForSQL; +// } catch (ParseException e) { +// continue; +// } +// } +// +// //we could not parse the date with any of the accepted formats. +// +// String exceptionMessage = +// "Could not parse the field " + +// "'" + dateString + "'" + +// " as a date. Aborting the algorithm."; +// throw new AlgorithmExecutionException(exceptionMessage); +// } +} Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/DefaultDictionary.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/DefaultDictionary.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/DefaultDictionary.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,58 @@ +package org.cishell.utilities; + +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.Hashtable; + +public class DefaultDictionary extends Dictionary { + Object defaultValue; + Dictionary wrappedDictionary; + + public DefaultDictionary + (Object defaultValue, Dictionary wrappedDictionary) + { + this.defaultValue = defaultValue; + this.wrappedDictionary = wrappedDictionary; + } + + public DefaultDictionary(Object defaultValue) { + this(defaultValue, new Hashtable()); + } + + public Object getDefaultValue() { + return this.defaultValue; + } + + public Enumeration elements() { + return this.wrappedDictionary.elements(); + } + + public Object get(Object key) { + Object wrappedDictionaryGetResult = this.wrappedDictionary.get(key); + + if (wrappedDictionaryGetResult == null) + return this.defaultValue; + + return wrappedDictionaryGetResult; + } + + public boolean isEmpty() { + return this.wrappedDictionary.isEmpty(); + } + + public Enumeration keys() { + return this.wrappedDictionary.keys(); + } + + public Object put(Object key, Object value) { + return this.wrappedDictionary.put(key, value); + } + + public Object remove(Object key) { + return this.wrappedDictionary.remove(key); + } + + public int size() { + return this.wrappedDictionary.size(); + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/FAQCalendar.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/FAQCalendar.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/FAQCalendar.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,100 @@ +package org.cishell.utilities; + +import java.util.Calendar; +import java.util.GregorianCalendar; + +// Patrick: I found this on Google. Thanks to Paul Hill! +// Found at: http://www.xmission.com/~goodhill/dates/deltaDates.html + +/** + * Demonstration of delta day calculations. + * @author Paul Hill + * @copyright 2004 Paul Hill + */ +public class FAQCalendar extends GregorianCalendar { + /** + * All minutes have this many milliseconds except the last minute of the day on a day defined with + * a leap second. + */ + public static final long MILLISECS_PER_MINUTE = 60*1000; + + /** + * Number of milliseconds per hour, except when a leap second is inserted. + */ + public static final long MILLISECS_PER_HOUR = 60*MILLISECS_PER_MINUTE; + + /** + * Number of leap seconds per day expect on + * <BR/>1. days when a leap second has been inserted, e.g. 1999 JAN 1. + * <BR/>2. Daylight-savings "spring forward" or "fall back" days. + */ + protected static final long MILLISECS_PER_DAY = 24*MILLISECS_PER_HOUR; + + /**** + * Value to add to the day number returned by this calendar to find the Julian Day number. + * This is the Julian Day number for 1/1/1970. + * Note: Since the unix Day number is the same from local midnight to local midnight adding + * JULIAN_DAY_OFFSET to that value results in the chronologist, historians, or calenderists + * Julian Day number. + * @see http://www.hermetic.ch/cal_stud/jdn.htm + */ + public static final long EPOCH_UNIX_ERA_DAY = 2440588L; + + /** + * @see java.util.GregorianCalendar#GregorianCalendar() + */ + public FAQCalendar() { + super(); + } + /** + * @param millisecondTime - time as a binary Unix/Java time value. + * @see java.util.GregorianCalendar + */ + public FAQCalendar( long millisecondTime ) { + super(); + this.setTimeInMillis( millisecondTime); + } + + /** + * @see java.util.GregorianCalendar#GregorianCalendar(int, int, int) + */ + public FAQCalendar( int y, int m, int d ) { + super( y, m, d ); + } + + /** + * @see java.util.GregorianCalendar#GregorianCalendar(int, int, int, int, int, int) + */ + public FAQCalendar( int y, int m, int d, int h, int min, int s ) { + super( y, m, d, h, min, s ); + } + + /** + * @return Day number where day 0 is 1/1/1970, as per the Unix/Java date/time epoch. + */ + public long getUnixDay() { + long offset = get(Calendar.ZONE_OFFSET) + get(Calendar.DST_OFFSET); + long day = (long)Math.floor( (double)(getTime().getTime() + offset ) / ((double)MILLISECS_PER_DAY) ); + return day; + } + + /** + * @return LOCAL Chronologists Julian day number each day starting from midnight LOCAL TIME. + * @see http://tycho.usno.navy.mil/mjd.html for more information about local C-JDN + */ + public long getJulianDay() { + return getUnixDay() + EPOCH_UNIX_ERA_DAY; + } + /** + * find the number of days from this date to the given end date. + * later end dates result in positive values. + * Note this is not the same as subtracting day numbers. Just after midnight subtracted from just before + * midnight is 0 days for this method while subtracting day numbers would yields 1 day. + * @param end - any Calendar representing the moment of time at the end of the interval for calculation. + */ + public long diffDayPeriods(Calendar end) { + long endL = end.getTimeInMillis() + end.getTimeZone().getOffset( end.getTimeInMillis() ); + long startL = this.getTimeInMillis() + this.getTimeZone().getOffset( this.getTimeInMillis() ); + return (endL - startL) / MILLISECS_PER_DAY; + } +} Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,144 @@ +package org.cishell.utilities; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +import javax.imageio.ImageIO; + +public class FileUtilities { + // Return a File pointing to the directory specified in temporaryDirectoryPath, + // creating the directory if it doesn't already exist. + private static File createTemporaryDirectory(String temporaryDirectoryPath) { + return ensureDirectoryExists(temporaryDirectoryPath + File.separator + "temp"); + } + + // Attempt to create a temporary file on disk whose name is passed in. + public static File createTemporaryFile(File temporaryDirectory, + String temporaryDirectoryPath, + String temporaryFileName, + String temporaryFileExtension) + { + ensureDirectoryExists(temporaryDirectoryPath); + + File temporaryFile; + + try { + temporaryFile = File.createTempFile("NWB-Session-" + temporaryFileName, + "." + temporaryFileExtension, + temporaryDirectory); + } + catch (IOException e) { + // We couldn't make the temporary file in the temporary directory + // using the standard Java File temporary file scheme (?), so we're + // coming up with our own temporary file (that we hope doesn't already + // exist). + temporaryFile = new File(temporaryDirectoryPath + File.separator + + temporaryFileName + "temp." + + temporaryFileExtension); + + if (!temporaryFile.exists()) { + try { + temporaryFile.createNewFile(); + } + catch (IOException e2) { + throw new RuntimeException(e2); + } + + temporaryFile.deleteOnExit(); + } + } + + return temporaryFile; + } + + // Attempt to create a temporary file on disk in a temporary directory (that may + // also be created, if necessary). + public static File createTemporaryFileInTemporaryDirectory + (String temporaryDirectoryPath, + String temporaryFileName, + String temporaryFileExtension) throws IOException + { + // Get/create the temporary directory. + File temporaryDirectory = createTemporaryDirectory(temporaryDirectoryPath); + + // Attempt to create the temporary file in our temporary directory now. + File temporaryFile = createTemporaryFile(temporaryDirectory, + temporaryDirectoryPath, + temporaryFileName, + temporaryFileExtension); + + // If the creation of the temporary file failed, throw an exception. + if (temporaryFile == null) { + throw new IOException + ("Failed to generate a file in the temporary directory."); + } + + return temporaryFile; + } + + public static String getDefaultTemporaryDirectory() { + return System.getProperty("java.io.tmpdir"); + } + + public static File createTemporaryFileInDefaultTemporaryDirectory + (String temporaryFileName, + String temporaryFileExtension) throws IOException + { + return createTemporaryFileInTemporaryDirectory + (getDefaultTemporaryDirectory(), + temporaryFileName, + temporaryFileExtension); + } + + public static File writeBufferedImageIntoTemporaryDirectory + (BufferedImage bufferedImage, + String imageType) throws IOException, Exception + { + // Get the system-wide temporary directory path. + String temporaryDirectoryPath = getDefaultTemporaryDirectory(); + File temporaryImageFile = + createTemporaryFileInTemporaryDirectory(temporaryDirectoryPath, + "nwb-temp", + imageType); + + // Attempt to write the image to the temporary file on disk. + if (!ImageIO.write(bufferedImage, imageType, temporaryImageFile)) { + throw new Exception + ("No valid image writer was found for the image type " + imageType); + } + + return temporaryImageFile; + } + + public static File writeTextIntoTemporaryDirectory(String text, + String fileExtension) + throws IOException, Exception + { + // Get the system-wide temporary directory path. + String temporaryDirectoryPath = getDefaultTemporaryDirectory(); + File temporaryTextFile = + createTemporaryFileInTemporaryDirectory(temporaryDirectoryPath, + "nwb-temp", + fileExtension); + + FileWriter textFileWriter = new FileWriter(temporaryTextFile); + + textFileWriter.write(text); + textFileWriter.flush(); + + return temporaryTextFile; + } + + private static File ensureDirectoryExists(String directoryPath) { + File directory = new File(directoryPath); + + if (!directory.exists()) { + directory.mkdir(); + directory.deleteOnExit(); + } + + return directory; + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/ImageUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/ImageUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/ImageUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,27 @@ +package org.cishell.utilities; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; + +public class ImageUtilities { + // Constants. + private static final int TEMPORARY_IMAGE_WIDTH = 640; + private static final int TEMPORARY_IMAGE_HEIGHT = 480; + + public static BufferedImage createBufferedImageFilledWithColor + (Color fillColor) { + // Create the image (that we will fill and output). + BufferedImage bufferedImage = new BufferedImage(TEMPORARY_IMAGE_WIDTH, + TEMPORARY_IMAGE_HEIGHT, + BufferedImage.TYPE_INT_RGB); + + // Get the image's graphics context so we can paint to/fill the image. + Graphics2D bufferedImageGraphics2D = bufferedImage.createGraphics(); + + // Fill the image with the color passed in. + bufferedImageGraphics2D.setBackground(fillColor); + + return bufferedImage; + } +}; \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,25 @@ +package org.cishell.utilities; + +import java.util.ArrayList; +import java.util.Map; +import java.util.Set; + +public class MapUtilities { + public static String[] getValidKeysOfTypesInMap(Map map, + String[] types, + String[] keysToSkip, + String[] keysToAdd) + throws ColumnNotFoundException { + ArrayList workingKeys = new ArrayList(); + Set entrySet = map.entrySet(); + + for (String type : types) { + ArrayList keysForType = + SetUtilities.getKeysOfMapEntrySetWithValue(entrySet, type); + workingKeys = ArrayListUtilities.unionArrayLists( + workingKeys, keysForType, keysToSkip, keysToAdd); + } + + return (String[])workingKeys.toArray(new String[0]); + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/MutateParameterUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/MutateParameterUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/MutateParameterUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,123 @@ +package org.cishell.utilities; + +import java.io.IOException; +import java.util.LinkedHashMap; + +import org.cishell.reference.service.metatype.BasicAttributeDefinition; +import org.cishell.reference.service.metatype.BasicObjectClassDefinition; +import org.osgi.service.metatype.AttributeDefinition; +import org.osgi.service.metatype.ObjectClassDefinition; + +import prefuse.data.Table; + +public class MutateParameterUtilities { + public static AttributeDefinition formLabelAttributeDefinition + (AttributeDefinition oldAttributeDefinition, Table table) + throws ColumnNotFoundException + { + String[] validStringColumnsInTable = + TableUtilities.getValidStringColumnNamesInTable(table); + + AttributeDefinition labelAttributeDefinition = + new BasicAttributeDefinition(oldAttributeDefinition.getID(), + oldAttributeDefinition.getName(), + oldAttributeDefinition.getDescription(), + AttributeDefinition.STRING, + validStringColumnsInTable, + validStringColumnsInTable); + + return labelAttributeDefinition; + } + + public static AttributeDefinition formDateAttributeDefinition + (AttributeDefinition oldAttributeDefinition, Table table) + throws ColumnNotFoundException + { + String[] validDateColumnsInTable = + TableUtilities.getValidDateColumnNamesInTable(table); + + AttributeDefinition dateAttributeDefinition = + new BasicAttributeDefinition(oldAttributeDefinition.getID(), + oldAttributeDefinition.getName(), + oldAttributeDefinition.getDescription(), + AttributeDefinition.STRING, + validDateColumnsInTable, + validDateColumnsInTable); + + return dateAttributeDefinition; + } + + public static AttributeDefinition formIntegerAttributeDefinition + (AttributeDefinition oldAttributeDefinition, Table table) + throws ColumnNotFoundException + { + String[] validIntegerColumnsInTable = + TableUtilities.getValidIntegerColumnNamesInTable(table); + + AttributeDefinition integerAttributeDefinition = + new BasicAttributeDefinition(oldAttributeDefinition.getID(), + oldAttributeDefinition.getName(), + oldAttributeDefinition.getDescription(), + AttributeDefinition.STRING, + validIntegerColumnsInTable, + validIntegerColumnsInTable); + + return integerAttributeDefinition; + } + + public static AttributeDefinition formNumberAttributeDefinition + (AttributeDefinition oldAttributeDefinition, Table table) + throws ColumnNotFoundException { + String[] validNumberColumnsInTable = + TableUtilities.getValidNumberColumnNamesInTable(table); + + AttributeDefinition numberAttributeDefinition = + new BasicAttributeDefinition(oldAttributeDefinition.getID(), + oldAttributeDefinition.getName(), + oldAttributeDefinition.getDescription(), + AttributeDefinition.STRING, + validNumberColumnsInTable, + validNumberColumnsInTable); + + return numberAttributeDefinition; + } + + public static AttributeDefinition formAttributeDefinitionFromMap + (AttributeDefinition oldAttributeDefinition, + LinkedHashMap map, + String[] types, + String[] keysToSkip, + String[] keysToAdd) { + String[] validNumberKeysInMap = + MapUtilities.getValidKeysOfTypesInMap( + map, types, keysToSkip, keysToAdd); + + AttributeDefinition numberAttributeDefinition = + new BasicAttributeDefinition( + oldAttributeDefinition.getID(), + oldAttributeDefinition.getName(), + oldAttributeDefinition.getDescription(), + AttributeDefinition.STRING, + validNumberKeysInMap, + validNumberKeysInMap); + + return numberAttributeDefinition; + } + + public static BasicObjectClassDefinition createNewParameters( + ObjectClassDefinition oldParameters) { + try { + return + new BasicObjectClassDefinition(oldParameters.getID(), + oldParameters.getName(), + oldParameters.getDescription(), + oldParameters.getIcon(16)); + } + catch (IOException e) { + return new BasicObjectClassDefinition + (oldParameters.getID(), + oldParameters.getName(), + oldParameters.getDescription(), null); + } + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/NumberUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/NumberUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/NumberUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,121 @@ +package org.cishell.utilities; + +public class NumberUtilities { + public static Double interpretObjectAsDouble(Object object) + throws NumberFormatException { + final String EMPTY_CELL_MESSAGE = "An empty number cell was found."; + + // TODO: These if's are a result of a "bug" in Prefuse's. + // CSV Table Reader, which interprets a column as being an array type + // if it has empty cells. + if (object instanceof Number) { + Number number = (Number)object; + + return new Double(number.doubleValue()); + } + else if (object instanceof short[]) { + short[] objectAsShortArray = (short[])object; + + if (objectAsShortArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return new Double((double)objectAsShortArray[0]); + } + } + else if (object instanceof Short[]) { + Short[] objectAsShortArray = (Short[])object; + + if (objectAsShortArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return objectAsShortArray[0].doubleValue(); + } + } + else if (object instanceof int[]) { + int[] objectAsIntArray = (int[])object; + + if (objectAsIntArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return new Double((double)objectAsIntArray[0]); + } + } + else if (object instanceof Integer[]) { + Integer[] objectAsIntegerArray = (Integer[])object; + + if (objectAsIntegerArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return objectAsIntegerArray[0].doubleValue(); + } + } + else if (object instanceof long[]) { + long[] objectAsLongArray = (long[])object; + + if (objectAsLongArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return new Double((double)objectAsLongArray[0]); + } + } + else if (object instanceof Long[]) { + Long[] objectAsLongArray = (Long[])object; + + if (objectAsLongArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return objectAsLongArray[0].doubleValue(); + } + } + else if (object instanceof float[]) { + float[] objectAsFloatArray = (float[])object; + + if (objectAsFloatArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return new Double((double)objectAsFloatArray[0]); + } + } + else if (object instanceof Float[]) { + Float[] objectAsFloatArray = (Float[])object; + + if (objectAsFloatArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return objectAsFloatArray[0].doubleValue(); + } + } + else if (object instanceof double[]) { + double[] objectAsDoubleArray = (double[])object; + + if (objectAsDoubleArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return new Double(objectAsDoubleArray[0]); + } + } + else if (object instanceof Double[]) { + Double[] objectAsDoubleArray = (Double[])object; + + if (objectAsDoubleArray.length == 0) { + throw new NumberFormatException(EMPTY_CELL_MESSAGE); + } + else { + return objectAsDoubleArray[0]; + } + } + + String objectAsString = object.toString(); + + return new Double(objectAsString); + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/SetUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/SetUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/SetUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,24 @@ +package org.cishell.utilities; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +public class SetUtilities { + public static ArrayList getKeysOfMapEntrySetWithValue(Set mapEntrySet, + Object value) { + ArrayList keysOfMapEntrySetWithValue = new ArrayList(); + Iterator mapEntrySetIterator = mapEntrySet.iterator(); + + while (mapEntrySetIterator.hasNext()) { + Map.Entry entry = (Map.Entry)mapEntrySetIterator.next(); + + if (entry.getValue().equals(value)) { + keysOfMapEntrySetWithValue.add(entry.getKey()); + } + } + + return keysOfMapEntrySetWithValue; + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/StringUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/StringUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/StringUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,17 @@ +package org.cishell.utilities; + +public class StringUtilities { + public static String implodeStringArray(String[] stringArray, String separator) { + final int stringArrayLength = stringArray.length; + StringBuilder workingResultString = new StringBuilder(); + + for (int ii = 0; ii < stringArrayLength; ii++) { + workingResultString.append(stringArray[ii]); + if (ii != stringArrayLength - 1) { + workingResultString.append(separator); + } + } + + return workingResultString.toString(); + } +} Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/TableUtilities.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,241 @@ +package org.cishell.utilities; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import prefuse.data.Schema; +import prefuse.data.Table; +import prefuse.util.collections.IntIterator; + +public class TableUtilities { + public static String[] filterSchemaColumnNamesByClass + (Schema schema, Class objectClass) throws ColumnNotFoundException + { + ArrayList workingColumnNames = new ArrayList(); + + for (int ii = 0; ii < schema.getColumnCount(); ii++) { + if (objectClass.isAssignableFrom(schema.getColumnType(ii))) + workingColumnNames.add(schema.getColumnName(ii)); + } + + if (workingColumnNames.size() == 0) { + throw new ColumnNotFoundException + ("No column of type " + objectClass.getName() + " was found."); + } + + String[] finalColumnNames = new String [workingColumnNames.size()]; + + return (String[])workingColumnNames.toArray(finalColumnNames); + } + + public static List getAllColumnNames(Schema schema) + throws ColumnNotFoundException { + List workingColumnNames = new ArrayList(); + + for (int ii = 0; ii < schema.getColumnCount(); ii++) { + workingColumnNames.add(schema.getColumnName(ii)); + } + + if (workingColumnNames.size() == 0) { + throw new ColumnNotFoundException + ("No columns found in the schema."); + } + + return workingColumnNames; + } + + public static String formNonConflictingNewColumnName( + Schema schema, String suggestedColumnName) + throws ColumnNotFoundException { + List workingColumnNames = getAllColumnNames(schema); + + if(!workingColumnNames.contains(suggestedColumnName)) { + return suggestedColumnName; + } + else { + int columnNameSuffix = 1; + while(true) { + String newColumnName = + suggestedColumnName.concat("_" + columnNameSuffix); + if(!workingColumnNames.contains(newColumnName)) { + return newColumnName; + } + columnNameSuffix++; + } + } + } + + public static String[] filterSchemaColumnNamesByClasses + (Schema schema, Class[] objectClasses) throws ColumnNotFoundException + { + ArrayList workingColumnNames = new ArrayList(); + + for (int ii = 0; ii < schema.getColumnCount(); ii++) { + for (Class objectClass : objectClasses) { + if (objectClass.isAssignableFrom(schema.getColumnType(ii))) { + workingColumnNames.add(schema.getColumnName(ii)); + + break; + } + } + } + + if (workingColumnNames.size() > 0) { + String[] finalColumnNames = new String [workingColumnNames.size()]; + + return (String[])workingColumnNames.toArray(finalColumnNames); + } + // An exception is thrown if there is not at least 1 column name. + else { + StringBuffer objectClassesString = new StringBuffer(); + objectClassesString.append("["); + + for (int ii = 0; ii < objectClasses.length; ii++) { + objectClassesString.append(objectClasses[ii].getName()); + + if ((ii + 1) < objectClasses.length) { + objectClassesString.append(", "); + } + } + + objectClassesString.append("]"); + + throw new ColumnNotFoundException + ("No column of types " + objectClassesString + " was found."); + } + } + + public static String[] getValidStringColumnNamesInTable(Table table) + throws ColumnNotFoundException + { + return filterSchemaColumnNamesByClass(table.getSchema(), String.class); + } + + public static String[] getValidDateColumnNamesInTable(Table table) + throws ColumnNotFoundException + { + Class[] possibleDateClasses = { + Date.class, + int.class, + Integer.class, + String.class, + int[].class, + Integer[].class, + String[].class, + }; + + return filterSchemaColumnNamesByClasses(table.getSchema(), + possibleDateClasses); + } + + public static String[] getValidIntegerColumnNamesInTable(Table table) + throws ColumnNotFoundException + { + Class[] possibleIntegerClasses = { + int.class, + Integer.class, + int[].class, + Integer[].class + }; + + return filterSchemaColumnNamesByClasses(table.getSchema(), + possibleIntegerClasses); + } + + public static String[] getValidNumberColumnNamesInTable(Table table) + throws ColumnNotFoundException { + Class[] possibleNumberClasses = { + byte.class, + byte[].class, + Byte.class, + Byte[].class, + short.class, + short[].class, + Short.class, + Short[].class, + int.class, + int[].class, + Integer.class, + Integer[].class, + long.class, + long[].class, + Long.class, + Long[].class, + float.class, + float[].class, + Float.class, + Float[].class, + double.class, + double[].class, + Double.class, + Double[].class + }; + + return filterSchemaColumnNamesByClasses(table.getSchema(), + possibleNumberClasses); + } + + public static Table createTableUsingSchema(Schema tableSchema) { + final int numTableColumns = tableSchema.getColumnCount(); + Table table = new Table(); + + for (int ii = 0; ii < numTableColumns; ii++) { + table.addColumn(tableSchema.getColumnName(ii), + tableSchema.getColumnType(ii)); + } + + return table; + } + + public static void copyTableRow(int newTableRow, + int originalTableRow, + Table newTable, + Table originalTable) + { + final int numTableColumns = originalTable.getColumnCount(); + + for (int ii = 0; ii < numTableColumns; ii++) + newTable.set(newTableRow, ii, originalTable.get(originalTableRow, ii)); + } + + public static Table + copyNRowsFromTableUsingIntIterator(Table originalTable, + IntIterator iterator, + int topN, + boolean isDescending) + { + // TODO: Add a couple comments in this method + + Schema tableSchema = originalTable.getSchema(); + final int numTableRows = originalTable.getRowCount(); + Table newTable = createTableUsingSchema(tableSchema); + final int numRowsToCopy = Math.min(numTableRows, topN); + int[] originalTableRowsToCopy = new int [numTableRows]; + + newTable.addRows(numRowsToCopy); + + for (int ii = 0; ii < numTableRows; ii++) + originalTableRowsToCopy[ii] = iterator.nextInt(); + + // TODO: Comment the side-effects here + + if (!isDescending) { + for (int ii = 0; ii < numRowsToCopy; ii++) { + copyTableRow + (ii, originalTableRowsToCopy[ii], newTable, originalTable); + } + } + else { + for (int ii = 0; ii < numRowsToCopy; ii++) + { + copyTableRow(ii, + originalTableRowsToCopy[numTableRows - ii - 1], + newTable, + originalTable); + } + } + + return newTable; + } +} \ No newline at end of file Added: trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/DateUtilitiesTest.java =================================================================== --- trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/DateUtilitiesTest.java (rev 0) +++ trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/DateUtilitiesTest.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,178 @@ +package edu.iu.scipolicy.utilities; + +import static org.junit.Assert.fail; + +import java.util.Date; + +import org.cishell.utilities.DateUtilities; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class DateUtilitiesTest { + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testGenerateDaysBetweenSameDates() { + Date startDate = new Date(1984, 0, 1); + Date endDate = startDate; + + Date[] datesBetween = + DateUtilities.generateDaysBetweenDates(startDate, endDate); + + if ((datesBetween.length != 1) || (!datesBetween[0].equals(startDate))) + fail(); + } + + @Test + public void testGenerateDaysBetweenReversedDates() { + Date startDate = new Date(1984, 0, 2); + Date endDate = new Date(1984, 0, 1); + + Date[] datesBetween = + DateUtilities.generateDaysBetweenDates(startDate, endDate); + + if ((datesBetween == null) || (datesBetween.length != 0)) + fail(); + } + + @Test + public void testGenerateDaysBetweenDates() { + Date startDate = new Date(1984, 0, 1); + Date endDate = new Date(1984, 0, 25); + + Date[] datesBetween = + DateUtilities.generateDaysBetweenDates(startDate, endDate); + + if ((datesBetween == null) || (datesBetween.length == 0)) + fail(); + + for (int ii = 0; ii < datesBetween.length; ii++) { + int expectedDay = (ii + 1); + + if ((datesBetween[ii].getYear() != startDate.getYear()) || + (datesBetween[ii].getMonth() != startDate.getMonth()) || + (datesBetween[ii].getDate() != expectedDay)) + { + fail(); + } + } + } + + @Test + public void testCalculateDaysBetweenDateArray() { + Date startDate = new Date(1984, 0, 1); + Date endDate = new Date(1984, 0, 2); + Date[] dateArray = new Date[] { startDate, endDate }; + + if (DateUtilities.calculateDaysBetween(dateArray) != 2) + fail(); + } + + @Test + public void testCalculateDaysBetweenDateDate() { + Date startDate = new Date(1984, 0, 1); + Date endDate = new Date(1984, 0, 25); + + if (DateUtilities.calculateDaysBetween(startDate, endDate) != 24) + fail(); + } + + @Test + public void testCalculateMonthsBetween() { + Date startDate = new Date(1984, 0, 1); + Date endDate = new Date(1984, 1, 1); + + if (DateUtilities.calculateMonthsBetween(startDate, endDate) != 1) + fail(); + } + + @Test + public void testGetNewYearsDatesFromDateSet() { + Date startDate = new Date(1984, 0, 1); + Date endDate = new Date (2000, 2, 15); + + Date[] datesBetween = + DateUtilities.generateDaysBetweenDates(startDate, endDate); + + Date[] newYearsDates = + DateUtilities.getNewYearsDatesFromDateSet(datesBetween); + + for (int ii = 0; ii < newYearsDates.length; ii++) { + if ((newYearsDates[ii].getYear() != (1984 + ii)) || + (newYearsDates[ii].getMonth() != 0) || + (newYearsDates[ii].getDate() != 1)) + { + fail(); + } + } + } + + @Test + public void testGenerateNewYearsDatesBetweenDates() { + Date startDate = new Date(1984, 0, 1); + Date endDate = new Date(2000, 2, 15); + + Date[] newYearsDates = + DateUtilities.generateNewYearsDatesBetweenDates(startDate, endDate); + + for (int ii = 0; ii < newYearsDates.length; ii++) { + if ((newYearsDates[ii].getYear() != (1984 + ii)) || + (newYearsDates[ii].getMonth() != 0) || + (newYearsDates[ii].getDate() != 1)) + { + fail(); + } + } + } + + @Test + public void testGenerateFirstOfTheMonthDatesBetweenDatesDateDate() { + Date startDate = new Date(1984, 0, 1); + Date endDate = new Date(1984, 11, 31); + + Date[] datesBetween = + DateUtilities.generateDaysBetweenDates(startDate, endDate); + + Date[] firstOfTheMonthDates = + DateUtilities.generateFirstOfTheMonthDatesBetweenDates + (startDate, endDate); + + for (int ii = 0; ii < firstOfTheMonthDates.length; ii++) { + if ((firstOfTheMonthDates[ii].getYear() != startDate.getYear()) || + (firstOfTheMonthDates[ii].getMonth() != ii) || + (firstOfTheMonthDates[ii].getDate() != 1)) + { + fail(); + } + } + } + + @Test + public void testGenerateFirstOfTheMonthDatesBetweenDatesDateArray() { + Date startDate = new Date(1984, 0, 1); + Date endDate = new Date(1984, 11, 31); + + Date[] datesBetween = + DateUtilities.generateDaysBetweenDates(startDate, endDate); + + Date[] firstOfTheMonthDates = + DateUtilities.generateFirstOfTheMonthDatesBetweenDates + (datesBetween); + + for (int ii = 0; ii < firstOfTheMonthDates.length; ii++) { + if ((firstOfTheMonthDates[ii].getYear() != startDate.getYear()) || + (firstOfTheMonthDates[ii].getMonth() != ii) || + (firstOfTheMonthDates[ii].getDate() != 1)) + { + fail(); + } + } + } +} Added: trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/DefaultDictionaryTest.java =================================================================== --- trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/DefaultDictionaryTest.java (rev 0) +++ trunk/core/org.cishell.utilities/tests/edu/iu/scipolicy/utilities/DefaultDictionaryTest.java 2009-07-17 21:13:00 UTC (rev 886) @@ -0,0 +1,111 @@ +package edu.iu.s... [truncated message content] |
From: <pat...@us...> - 2009-07-17 21:12:17
|
Revision: 885 http://cishell.svn.sourceforge.net/cishell/?rev=885&view=rev Author: pataphil Date: 2009-07-17 21:12:10 +0000 (Fri, 17 Jul 2009) Log Message: ----------- Initial import. Added Paths: ----------- trunk/core/org.cishell.utilities/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-07-14 17:58:56
|
Revision: 884 http://cishell.svn.sourceforge.net/cishell/?rev=884&view=rev Author: mwlinnem Date: 2009-07-14 17:58:51 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Turning parameter preferences off by default. These don't yet work nicely with mutateParameters, and are causing bugs. We can re-enable it by default if/when it works for mutateParameters and is shown to be more stable. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java trunk/core/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2009-07-14 15:51:03 UTC (rev 883) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2009-07-14 17:58:51 UTC (rev 884) @@ -349,7 +349,7 @@ protected boolean hasParamDefaultPreferences(ServiceReference algRef) { String prefsToPublish = (String) algRef.getProperty(UserPrefsProperty.PREFS_PUBLISHED_KEY); if (prefsToPublish == null) { - return true; + return false; } return prefsToPublish.contains(UserPrefsProperty.PUBLISH_PARAM_DEFAULT_PREFS_VALUE); Modified: trunk/core/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java =================================================================== --- trunk/core/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java 2009-07-14 15:51:03 UTC (rev 883) +++ trunk/core/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java 2009-07-14 17:58:51 UTC (rev 884) @@ -193,11 +193,7 @@ } else { String unparsedPublishedPrefsValues = (String) prefReference.getProperty(UserPrefsProperty.PREFS_PUBLISHED_KEY); if (unparsedPublishedPrefsValues == null) { - if (processingKey ==UserPrefsProperty.PUBLISH_PARAM_DEFAULT_PREFS_VALUE) { - return true; - } else { - return false; - } + return false; } String[] publishedPrefsValues = unparsedPublishedPrefsValues.split(","); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tan...@us...> - 2009-07-14 15:51:04
|
Revision: 883 http://cishell.svn.sourceforge.net/cishell/?rev=883&view=rev Author: tankchintan Date: 2009-07-14 15:51:03 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Preference services decoupled with file load. Micah. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java 2009-07-14 15:33:20 UTC (rev 882) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java 2009-07-14 15:51:03 UTC (rev 883) @@ -29,7 +29,9 @@ } public void updated(Dictionary properties) throws ConfigurationException { - this.properties = properties; + if (properties != null) { + this.properties = properties; + } //printPreferences(properties); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-07-14 15:33:24
|
Revision: 882 http://cishell.svn.sourceforge.net/cishell/?rev=882&view=rev Author: mwlinnem Date: 2009-07-14 15:33:20 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Fixed FileLoad to work decently if preference service is not present. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java 2009-06-25 20:35:42 UTC (rev 881) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java 2009-07-14 15:33:20 UTC (rev 882) @@ -37,7 +37,17 @@ // unpack preference properties if (defaultLoadDirectory == null) { - defaultLoadDirectory = (String) prefProperties.get("loadDir"); + + /* + * get the default load directory from preferences, + * if it has been set. + */ + Object result = prefProperties.get("loadDir"); + if (result != null) { + defaultLoadDirectory = (String) result; + } else { + defaultLoadDirectory = ""; + } } } Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java 2009-06-25 20:35:42 UTC (rev 881) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java 2009-07-14 15:33:20 UTC (rev 882) @@ -30,22 +30,22 @@ public void updated(Dictionary properties) throws ConfigurationException { this.properties = properties; - printPreferences(properties); + //printPreferences(properties); } - private void printPreferences(Dictionary properties) { - System.out.println(" Preferences are as follows for File Load:"); - if (properties == null) { - System.out.println(" Dictionary is null!"); - } else { - Enumeration propertiesKeys = properties.keys(); - - while (propertiesKeys.hasMoreElements()) { - String propertiesKey = (String) propertiesKeys.nextElement(); - - Object propertiesValue = properties.get(propertiesKey); - System.out.println(" " + propertiesKey + ":" + propertiesValue); - } - } - } +// private void printPreferences(Dictionary properties) { +// System.out.println(" Preferences are as follows for File Load:"); +// if (properties == null) { +// System.out.println(" Dictionary is null!"); +// } else { +// Enumeration propertiesKeys = properties.keys(); +// +// while (propertiesKeys.hasMoreElements()) { +// String propertiesKey = (String) propertiesKeys.nextElement(); +// +// Object propertiesValue = properties.get(propertiesKey); +// System.out.println(" " + propertiesKey + ":" + propertiesValue); +// } +// } +// } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-06-25 20:36:17
|
Revision: 881 http://cishell.svn.sourceforge.net/cishell/?rev=881&view=rev Author: mwlinnem Date: 2009-06-25 20:35:42 +0000 (Thu, 25 Jun 2009) Log Message: ----------- Moved from NWB repository. Added Paths: ----------- trunk/libs/hsqldb/.classpath trunk/libs/hsqldb/.project trunk/libs/hsqldb/.settings/ trunk/libs/hsqldb/META-INF/ trunk/libs/hsqldb/META-INF/MANIFEST.MF trunk/libs/hsqldb/build.properties trunk/libs/hsqldb/hsqldb.jar Added: trunk/libs/hsqldb/.classpath =================================================================== --- trunk/libs/hsqldb/.classpath (rev 0) +++ trunk/libs/hsqldb/.classpath 2009-06-25 20:35:42 UTC (rev 881) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry exported="true" kind="lib" path="hsqldb.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/libs/hsqldb/.project =================================================================== --- trunk/libs/hsqldb/.project (rev 0) +++ trunk/libs/hsqldb/.project 2009-06-25 20:35:42 UTC (rev 881) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>hsqldb</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/libs/hsqldb/META-INF/MANIFEST.MF =================================================================== --- trunk/libs/hsqldb/META-INF/MANIFEST.MF (rev 0) +++ trunk/libs/hsqldb/META-INF/MANIFEST.MF 2009-06-25 20:35:42 UTC (rev 881) @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: HSQLDB Plug-in +Bundle-SymbolicName: hsqldb +Bundle-Version: 1.0.0 +Bundle-ClassPath: hsqldb.jar +Bundle-Localization: plugin +Export-Package: .,org.hsqldb,org.hsqldb.index,org.hsqldb.jdbc,org.hsqldb.lib,org.hsqldb.lib.java,org.hsqldb.persist,org.hsqldb.resources,org.hsqldb.rowio,org.hsqldb.scriptio,org.hsqldb.store,org.hsqldb.types,org.hsqldb.util Added: trunk/libs/hsqldb/build.properties =================================================================== --- trunk/libs/hsqldb/build.properties (rev 0) +++ trunk/libs/hsqldb/build.properties 2009-06-25 20:35:42 UTC (rev 881) @@ -0,0 +1,2 @@ +bin.includes = META-INF/,\ + hsqldb.jar Added: trunk/libs/hsqldb/hsqldb.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/hsqldb/hsqldb.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-06-25 20:35:13
|
Revision: 880 http://cishell.svn.sourceforge.net/cishell/?rev=880&view=rev Author: mwlinnem Date: 2009-06-25 20:35:12 +0000 (Thu, 25 Jun 2009) Log Message: ----------- Initial import. Moving from NWB repository. Added Paths: ----------- trunk/libs/hsqldb/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-06-25 18:22:49
|
Revision: 879 http://cishell.svn.sourceforge.net/cishell/?rev=879&view=rev Author: mwlinnem Date: 2009-06-25 18:22:37 +0000 (Thu, 25 Jun 2009) Log Message: ----------- Added Paths: ----------- trunk/libs/derbylib/ Removed Paths: ------------- trunk/libs/Apache_Derby/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2009-06-25 18:21:14
|
Revision: 878 http://cishell.svn.sourceforge.net/cishell/?rev=878&view=rev Author: mwlinnem Date: 2009-06-25 18:20:55 +0000 (Thu, 25 Jun 2009) Log Message: ----------- Added Paths: ----------- trunk/libs/Apache_Derby/.classpath trunk/libs/Apache_Derby/.project trunk/libs/Apache_Derby/.settings/ trunk/libs/Apache_Derby/META-INF/ trunk/libs/Apache_Derby/META-INF/MANIFEST.MF trunk/libs/Apache_Derby/build.properties trunk/libs/Apache_Derby/derby.jar trunk/libs/Apache_Derby/derbyLocale_cs.jar trunk/libs/Apache_Derby/derbyLocale_de_DE.jar trunk/libs/Apache_Derby/derbyLocale_es.jar trunk/libs/Apache_Derby/derbyLocale_fr.jar trunk/libs/Apache_Derby/derbyLocale_hu.jar trunk/libs/Apache_Derby/derbyLocale_it.jar trunk/libs/Apache_Derby/derbyLocale_ja_JP.jar trunk/libs/Apache_Derby/derbyLocale_ko_KR.jar trunk/libs/Apache_Derby/derbyLocale_pl.jar trunk/libs/Apache_Derby/derbyLocale_pt_BR.jar trunk/libs/Apache_Derby/derbyLocale_ru.jar trunk/libs/Apache_Derby/derbyLocale_zh_CN.jar trunk/libs/Apache_Derby/derbyLocale_zh_TW.jar trunk/libs/Apache_Derby/derbyclient.jar trunk/libs/Apache_Derby/derbynet.jar trunk/libs/Apache_Derby/derbyrun.jar trunk/libs/Apache_Derby/derbytools.jar Added: trunk/libs/Apache_Derby/.classpath =================================================================== --- trunk/libs/Apache_Derby/.classpath (rev 0) +++ trunk/libs/Apache_Derby/.classpath 2009-06-25 18:20:55 UTC (rev 878) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry exported="true" kind="lib" path="derbyLocale_fr.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_zh_CN.jar"/> + <classpathentry exported="true" kind="lib" path="derby.jar"/> + <classpathentry exported="true" kind="lib" path="derbytools.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_it.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_ko_KR.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_es.jar"/> + <classpathentry exported="true" kind="lib" path="derbyrun.jar"/> + <classpathentry exported="true" kind="lib" path="derbynet.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_ru.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_pt_BR.jar"/> + <classpathentry exported="true" kind="lib" path="derbyclient.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_pl.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_ja_JP.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_zh_TW.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_de_DE.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_cs.jar"/> + <classpathentry exported="true" kind="lib" path="derbyLocale_hu.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/libs/Apache_Derby/.project =================================================================== --- trunk/libs/Apache_Derby/.project (rev 0) +++ trunk/libs/Apache_Derby/.project 2009-06-25 18:20:55 UTC (rev 878) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Apache Derby</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/libs/Apache_Derby/META-INF/MANIFEST.MF =================================================================== --- trunk/libs/Apache_Derby/META-INF/MANIFEST.MF (rev 0) +++ trunk/libs/Apache_Derby/META-INF/MANIFEST.MF 2009-06-25 18:20:55 UTC (rev 878) @@ -0,0 +1,101 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Apache Derby Plug-in +Bundle-SymbolicName: Apache_Derby +Bundle-Version: 1.0.0 +Bundle-ClassPath: derbyLocale_fr.jar,derbyLocale_zh_CN.jar,derby.jar,derbytools.jar,derbyLocale_it.jar,derbyLocale_ko_KR.jar,derbyLocale_es.jar,derbyrun.jar,derbynet.jar,derbyLocale_ru.jar,derbyLocale_pt_BR.jar,derbyclient.jar,derbyLocale_pl.jar,derbyLocale_ja_JP.jar,derbyLocale_zh_TW.jar,derbyLocale_de_DE.jar,derbyLocale_cs.jar,derbyLocale_hu.jar +Export-Package: org.apache.derby, + org.apache.derby.authentication, + org.apache.derby.catalog, + org.apache.derby.catalog.types, + org.apache.derby.client, + org.apache.derby.client.am, + org.apache.derby.client.net, + org.apache.derby.database, + org.apache.derby.diag, + org.apache.derby.drda, + org.apache.derby.iapi.db, + org.apache.derby.iapi.error, + org.apache.derby.iapi.jdbc, + org.apache.derby.iapi.reference, + org.apache.derby.iapi.services.cache, + org.apache.derby.iapi.services.classfile, + org.apache.derby.iapi.services.compiler, + org.apache.derby.iapi.services.context, + org.apache.derby.iapi.services.crypto, + org.apache.derby.iapi.services.daemon, + org.apache.derby.iapi.services.diag, + org.apache.derby.iapi.services.i18n, + org.apache.derby.iapi.services.info, + org.apache.derby.iapi.services.io, + org.apache.derby.iapi.services.loader, + org.apache.derby.iapi.services.locks, + org.apache.derby.iapi.services.memory, + org.apache.derby.iapi.services.monitor, + org.apache.derby.iapi.services.property, + org.apache.derby.iapi.services.stream, + org.apache.derby.iapi.services.timer, + org.apache.derby.iapi.services.uuid, + org.apache.derby.iapi.sql, + org.apache.derby.iapi.sql.compile, + org.apache.derby.iapi.sql.conn, + org.apache.derby.iapi.sql.depend, + org.apache.derby.iapi.sql.dictionary, + org.apache.derby.iapi.sql.execute, + org.apache.derby.iapi.store.access, + org.apache.derby.iapi.store.access.conglomerate, + org.apache.derby.iapi.store.access.xa, + org.apache.derby.iapi.store.raw, + org.apache.derby.iapi.store.raw.data, + org.apache.derby.iapi.store.raw.log, + org.apache.derby.iapi.store.raw.xact, + org.apache.derby.iapi.tools, + org.apache.derby.iapi.tools.i18n, + org.apache.derby.iapi.types, + org.apache.derby.iapi.util, + org.apache.derby.impl.db, + org.apache.derby.impl.drda, + org.apache.derby.impl.io, + org.apache.derby.impl.jdbc, + org.apache.derby.impl.jdbc.authentication, + org.apache.derby.impl.load, + org.apache.derby.impl.services.bytecode, + org.apache.derby.impl.services.cache, + org.apache.derby.impl.services.daemon, + org.apache.derby.impl.services.jce, + org.apache.derby.impl.services.locks, + org.apache.derby.impl.services.monitor, + org.apache.derby.impl.services.reflect, + org.apache.derby.impl.services.stream, + org.apache.derby.impl.services.timer, + org.apache.derby.impl.services.uuid, + org.apache.derby.impl.sql, + org.apache.derby.impl.sql.catalog, + org.apache.derby.impl.sql.compile, + org.apache.derby.impl.sql.conn, + org.apache.derby.impl.sql.depend, + org.apache.derby.impl.sql.execute, + org.apache.derby.impl.sql.execute.rts, + org.apache.derby.impl.store.access, + org.apache.derby.impl.store.access.btree, + org.apache.derby.impl.store.access.btree.index, + org.apache.derby.impl.store.access.conglomerate, + org.apache.derby.impl.store.access.heap, + org.apache.derby.impl.store.access.sort, + org.apache.derby.impl.store.raw, + org.apache.derby.impl.store.raw.data, + org.apache.derby.impl.store.raw.log, + org.apache.derby.impl.store.raw.xact, + org.apache.derby.impl.tools.dblook, + org.apache.derby.impl.tools.ij, + org.apache.derby.impl.tools.sysinfo, + org.apache.derby.info, + org.apache.derby.io, + org.apache.derby.jdbc, + org.apache.derby.loc, + org.apache.derby.loc.drda, + org.apache.derby.osgi, + org.apache.derby.shared.common.error, + org.apache.derby.shared.common.i18n, + org.apache.derby.tools, + org.apache.derby.vti Added: trunk/libs/Apache_Derby/build.properties =================================================================== --- trunk/libs/Apache_Derby/build.properties (rev 0) +++ trunk/libs/Apache_Derby/build.properties 2009-06-25 18:20:55 UTC (rev 878) @@ -0,0 +1,19 @@ +bin.includes = META-INF/,\ + derbyLocale_fr.jar,\ + derbyLocale_zh_CN.jar,\ + derby.jar,\ + derbytools.jar,\ + derbyLocale_it.jar,\ + derbyLocale_ko_KR.jar,\ + derbyLocale_es.jar,\ + derbyrun.jar,\ + derbynet.jar,\ + derbyLocale_ru.jar,\ + derbyLocale_pt_BR.jar,\ + derbyclient.jar,\ + derbyLocale_pl.jar,\ + derbyLocale_ja_JP.jar,\ + derbyLocale_zh_TW.jar,\ + derbyLocale_de_DE.jar,\ + derbyLocale_cs.jar,\ + derbyLocale_hu.jar Added: trunk/libs/Apache_Derby/derby.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derby.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_cs.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_cs.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_de_DE.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_de_DE.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_es.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_es.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_fr.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_fr.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_hu.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_hu.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_it.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_it.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_ja_JP.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_ja_JP.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_ko_KR.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_ko_KR.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_pl.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_pl.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_pt_BR.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_pt_BR.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_ru.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_ru.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_zh_CN.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_zh_CN.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyLocale_zh_TW.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyLocale_zh_TW.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyclient.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyclient.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbynet.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbynet.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbyrun.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbyrun.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/Apache_Derby/derbytools.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/Apache_Derby/derbytools.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |