id
int32 0
3k
| input
stringlengths 43
33.8k
| gt
stringclasses 1
value |
---|---|---|
400 | <s> package net . sf . sveditor . core ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IProjectNature ; import org . eclipse . core . runtime . CoreException ; public class SVProjectNature implements IProjectNature { private IProject fProject ; public void configure | |
401 | <s> package org . rubypeople . rdt . refactoring . tests . core ; import junit . framework . TestCase ; import org . rubypeople . rdt . refactoring . core . IRefactoringConditionChecker ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . core . RefactoringConditionChecker ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; import org . rubypeople . rdt . refactoring . documentprovider . StringDocumentProvider ; public class TC_RefactoringConditionChecker extends TestCase { private final class TestConditionChecker extends RefactoringConditionChecker { private TestConditionChecker ( final IDocumentProvider provider ) { super ( getDefaultConfig ( provider ) ) ; } @ Override public void init ( IRefactoringConfig configObj ) { } @ Override protected void checkInitialConditions ( ) { } } public void testSyntaxErrors ( ) { RefactoringConditionChecker checker = new TestConditionChecker ( new StringDocumentProvider ( "" , "" ) ) ; assertEquals ( 1 , checker . getInitialMessages ( ) . get ( IRefactoringConditionChecker . ERRORS ) . size ( ) ) ; assertEquals ( 0 , checker . getInitialMessages ( ) . get ( IRefactoringConditionChecker . WARNING ) . size ( ) ) ; } public void testSyntaxErrorsInIncludes ( ) { StringDocumentProvider stringDocumentProvider = new StringDocumentProvider ( "" , "" ) ; stringDocumentProvider . addFile ( "other" , "" ) ; RefactoringConditionChecker checker = new TestConditionChecker ( stringDocumentProvider ) ; assertEquals ( 0 , checker . getInitialMessages ( ) . | |
402 | <s> package org . oddjob . sql ; import java . io . InputStream ; import java . sql . Blob ; import java . sql . Connection ; import java . sql . PreparedStatement ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . util . ArrayList ; import java . util . List ; import org . apache . log4j . Logger ; import org . oddjob . arooa . registry . Path ; import org . oddjob . persist . SerializeWithBinaryStream ; import org . oddjob . persist . SerializeWithBytes ; public class HSQLSerializationFactory implements SQLSerializationFactory { private String table ; @ Override public SQLSerialization createSerialization ( Connection connection ) throws SQLException { return new HSQLSerialization ( connection , table ) ; } public void setTable ( String tableName ) { this . table = tableName ; } public String getTable ( ) { return table ; } } class HSQLSerialization implements SQLSerialization { private static final Logger logger = Logger . getLogger ( HSQLSerialization . class ) ; private final Connection connection ; private final PreparedStatement updateStmt ; private final PreparedStatement insertStmt ; private final PreparedStatement selectStmt ; private final PreparedStatement deleteStmt ; private final PreparedStatement clearStmt ; private final PreparedStatement listStmt ; HSQLSerialization ( Connection connection , String tableName ) throws SQLException { this . connection = connection ; String table = tableName ; if ( table == null ) { table = "ODDJOB" ; } try { String insertSQL = "insert into " + table + "" ; logger . debug ( "Preparing: " + insertSQL ) ; this . insertStmt = connection . prepareStatement ( insertSQL ) ; String updateSQL = "update " + table + "" ; logger . debug ( "Preparing: " + updateSQL ) ; this . updateStmt = connection . prepareStatement ( updateSQL ) ; String selectSQL = "" + table + "" ; logger . debug ( "Preparing: " + selectSQL ) ; this . selectStmt = connection . prepareStatement ( selectSQL ) ; String deleteSQL = "delete from " + table + "" ; logger . debug ( "Preparing: " + deleteSQL ) ; this . deleteStmt = connection . prepareStatement ( deleteSQL ) ; String clearSQL = "delete from " + table + "" ; logger . debug ( "Preparing: " + clearSQL ) ; this . clearStmt = connection . prepareStatement ( clearSQL ) ; String listSQL = "" + table + "" ; logger . debug ( "Preparing: " + listSQL ) ; this . listStmt = connection . prepareStatement | |
403 | <s> package com . asakusafw . vocabulary . batch ; import java . util . regex . | |
404 | <s> package org . rubypeople . rdt . internal . ui . browsing ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . ViewerFilter ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Widget ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . viewsupport . ProblemTreeViewer ; public class PackagesViewTreeViewer extends ProblemTreeViewer implements IPackagesViewViewer { public PackagesViewTreeViewer ( Composite parent , int style ) { super ( parent , style ) ; } @ Override public void unmapElement ( Object element ) { super . unmapElement ( element ) ; } @ Override public void unmapElement ( Object element , Widget item ) { super . unmapElement ( element , item ) ; } @ Override public void mapElement ( Object element , Widget item ) { super . mapElement ( element , item ) ; } protected Object [ ] getFilteredChildren ( Object parent ) { List list = new ArrayList ( ) ; Object [ ] result = getRawChildren ( parent ) ; if ( result != null ) { Object [ ] toBeFiltered = new Object [ 1 ] ; for ( int i = 0 ; i < result . length ; i ++ ) { Object object = result [ i ] ; toBeFiltered [ 0 ] = object ; if ( isEssential ( object ) || filter ( toBeFiltered ) . length == 1 ) list . add ( object ) ; } } return list . toArray ( ) ; } protected Object [ ] filter ( Object [ ] elements ) { ViewerFilter [ ] filters = getFilters ( ) ; if ( filters == null || filters . length == 0 ) return elements ; ArrayList filtered = new ArrayList ( elements . length ) ; Object root = getRoot ( ) ; for ( int i = 0 ; i < elements . length ; i ++ ) { boolean add = true ; if ( ! isEssential ( elements [ i ] ) ) { for ( int j = 0 ; j < filters . length ; j ++ ) { add = filters [ j ] . select ( this , root , elements [ i ] | |
405 | <s> package com . asakusafw . bulkloader . common ; import java . io . File ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . fs . FileSystem ; import org . apache . hadoop . fs . Path ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . runtime . util . VariableTable ; public final class FileNameUtil { private static final Class < ? > CLASS = FileNameUtil . class ; private FileNameUtil ( ) { return ; } public static File createImportFilePath ( String targetName , String jobflowId , String executionId , String tableName ) throws BulkLoaderSystemException { File fileDirectry = new File ( ConfigurationLoader . getProperty ( Constants . PROP_KEY_IMP_FILE_DIR ) ) ; if ( ! fileDirectry . exists ( ) ) { throw new BulkLoaderSystemException ( CLASS , "" , fileDirectry . getAbsolutePath ( ) ) ; } StringBuilder strFileName = new StringBuilder ( Constants . IMPORT_FILE_PREFIX ) ; strFileName . append ( Constants . IMPORT_FILE_DELIMITER ) ; strFileName . append ( targetName ) ; strFileName . append ( Constants . IMPORT_FILE_DELIMITER ) ; strFileName . append ( jobflowId ) ; strFileName . append ( Constants . IMPORT_FILE_DELIMITER ) ; strFileName . append ( executionId ) ; strFileName . append ( Constants . IMPORT_FILE_DELIMITER ) ; strFileName . append ( tableName ) ; strFileName . append ( Constants . IMPORT_FILE_EXTENSION ) ; return new File ( fileDirectry , strFileName . toString ( ) ) ; } public static String createSendImportFileName ( String tableName ) { StringBuilder strFileNmae = new StringBuilder ( Constants . IMPORT_FILE_PREFIX ) ; strFileNmae . append ( Constants . IMPORT_FILE_DELIMITER ) ; strFileNmae . append ( tableName ) ; strFileNmae . append ( Constants . EXPORT_FILE_EXTENSION ) ; return strFileNmae . toString ( ) ; } public static String getImportTableName ( String fileName ) { String normalized = new File ( fileName ) . getName ( ) . replace ( File . separatorChar , '/' ) ; int start = Constants . IMPORT_FILE_PREFIX . length ( ) + Constants . IMPORT_FILE_DELIMITER . length ( ) ; int end = normalized . length ( ) - Constants . IMPORT_FILE_EXTENSION . length ( ) ; return normalized . substring ( start , end ) ; } public static Path createPath ( Configuration conf , String rawPath , String executionId , String user ) throws BulkLoaderSystemException { return createPaths ( conf , Collections . singletonList ( rawPath ) , executionId , user ) . get ( 0 ) ; } public static List < Path > createPaths ( Configuration conf , List < String > rawPaths , String executionId , String user ) throws BulkLoaderSystemException { String basePathString = ConfigurationLoader . getProperty ( Constants . PROP_KEY_BASE_PATH ) ; Path basePath ; if ( basePathString == null || basePathString . isEmpty ( ) ) { basePath = null ; } else { basePath = new Path ( basePathString ) ; } VariableTable variables = Constants . createVariableTable ( ) ; variables . defineVariable ( Constants . HDFS_PATH_VARIABLE_USER , user ) ; variables . defineVariable ( Constants . HDFS_PATH_VARIABLE_EXECUTION_ID , executionId ) ; FileSystem fs ; try { if ( basePath == null ) { fs = FileSystem . get ( conf ) ; } else { fs = FileSystem . get ( basePath . toUri ( ) , conf ) ; basePath = fs . makeQualified ( basePath ) ; } } catch ( IOException e ) { throw new BulkLoaderSystemException ( e , CLASS , "" , rawPaths ) ; } List < Path > results = new ArrayList < Path > ( ) ; for ( String rawPath : rawPaths ) { String resolved = variables . parse ( rawPath , false ) ; Path fullPath ; if ( basePath == null ) { fullPath = fs . makeQualified ( new Path ( resolved ) ) ; } else { fullPath = new Path ( basePath , resolved ) ; } results . add ( fullPath ) ; } return results ; } public static String createSendExportFileName ( | |
406 | <s> package net . sf . sveditor . ui . wizards ; import net . sf . sveditor . core . srcgen . NewClassGenerator ; import net . sf . sveditor . ui . SVUiPlugin ; import org . eclipse . core . | |
407 | <s> package com . asakusafw . dmdl . directio . csv . driver ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . math . BigDecimal ; import java . text . MessageFormat ; import java . util . Arrays ; import java . util . List ; import java . util . Random ; import org . apache . hadoop . io . Text ; import org . junit . Before ; import org . junit . Test ; import com . asakusafw . dmdl . directio . common . driver . GeneratorTesterRoot ; import com . asakusafw . dmdl . java . emitter . driver . ObjectDriver ; import com . asakusafw . runtime . directio . BinaryStreamFormat ; import com . asakusafw . runtime . directio . util . DelimiterRangeInputStream ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . csv . CsvConfiguration ; import com . asakusafw . runtime . io . csv . CsvFormatException ; import com . asakusafw . runtime . io . csv . CsvParser ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . utils . collections . Lists ; public class CsvFormatEmitterTest extends GeneratorTesterRoot { @ Before public void setUp ( ) throws Exception { emitDrivers . add ( new CsvFormatEmitter ( ) ) ; emitDrivers . add ( new ObjectDriver ( ) ) ; } @ Test public void simple ( ) throws Exception { ModelLoader loaded = generateJava ( "simple" ) ; ModelWrapper model = loaded . newModel ( "Simple" ) ; BinaryStreamFormat < ? > support = ( BinaryStreamFormat < ? > ) loaded . newObject ( "csv" , "" ) ; assertThat ( support . getSupportedType ( ) , is ( ( Object ) model . unwrap ( ) . getClass ( ) ) ) ; BinaryStreamFormat < Object > unsafe = unsafe ( support ) ; model . set ( "value" , new Text ( "" ) ) ; ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; ModelOutput < Object > writer = unsafe . createOutput ( model . unwrap ( ) . getClass ( ) , "hello" , output ) ; writer . write ( model . unwrap ( ) ) ; writer . close ( ) ; Object buffer = loaded . newModel ( "Simple" ) . unwrap ( ) ; ModelInput < Object > reader = unsafe . createInput ( model . unwrap ( ) . getClass ( ) , "hello" , in ( output ) , 0 , size ( output ) ) ; assertThat ( reader . readTo ( buffer ) , is ( true ) ) ; assertThat ( buffer , is ( buffer ) ) ; assertThat ( reader . readTo ( buffer ) , is ( false ) ) ; } @ Test public void types ( ) throws Exception { ModelLoader loaded = generateJava ( "types" ) ; ModelWrapper model = loaded . newModel ( "Types" ) ; BinaryStreamFormat < ? > support = ( BinaryStreamFormat < ? > ) loaded . newObject ( "csv" , "" ) ; assertThat ( support . getSupportedType ( ) , is ( ( Object ) model . unwrap ( ) . getClass ( ) ) ) ; ModelWrapper empty = loaded . newModel ( "Types" ) ; ModelWrapper all = loaded . newModel ( "Types" ) ; all . set ( "c_int" , 100 ) ; all . set ( "c_text" , new Text ( "" ) ) ; all . set ( "c_boolean" , true ) ; all . set ( "c_byte" , ( byte ) 64 ) ; all . set ( "c_short" , ( short ) 1023 ) ; all . set ( "c_long" , 100000L ) ; all . set ( "c_float" , 1.5f ) ; all . set ( "c_double" , 2.5f ) ; all . set ( "c_decimal" , new BigDecimal ( "3.1415" ) ) ; all . set ( "c_date" , new Date ( 2011 , 9 , 1 ) ) ; all . set ( "c_datetime" , new DateTime ( 2011 , 12 , 31 , 23 , 59 , 59 ) ) ; BinaryStreamFormat < Object > unsafe = unsafe ( support ) ; ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; ModelOutput < Object > writer = unsafe . createOutput ( model . unwrap ( ) . getClass ( ) , "hello" , output ) ; writer . write ( empty . unwrap ( ) ) ; writer . write ( all . unwrap ( ) ) ; writer . close ( ) ; Object buffer = loaded . newModel ( "Types" ) . unwrap ( ) ; ModelInput < Object > reader = unsafe . createInput ( model . unwrap ( ) . getClass ( ) , "hello" , in ( output ) , 0 , size ( output ) ) ; assertThat ( reader . readTo ( buffer ) , is ( true ) ) ; assertThat ( buffer , is ( empty . unwrap ( ) ) ) ; assertThat ( reader . readTo ( buffer ) , is ( true ) ) ; assertThat ( buffer , is ( all . unwrap ( ) ) ) ; assertThat ( reader . readTo ( buffer ) , is ( false ) ) ; } @ Test public void attributes ( ) throws Exception { ModelLoader loaded = generateJava ( "attributes" ) ; ModelWrapper model = loaded . newModel ( "Model" ) ; model . set ( "text_value" , new Text ( "-UNK-" ) ) ; model . set ( "true_value" , true ) ; model . set ( "false_value" , false ) ; model . set ( "date_value" , new Date ( 2011 , 10 , 11 ) ) ; model . set ( "" , new DateTime ( 2011 , 1 , 2 , 13 , 14 , 15 ) ) ; BinaryStreamFormat < Object > support = unsafe ( loaded . newObject ( "csv" , "" ) ) ; ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; ModelOutput < Object > writer = support . createOutput ( model . unwrap ( ) . getClass ( ) , "hello" , output ) ; writer . write ( model . unwrap ( ) ) ; writer . close ( ) ; String [ ] [ ] results = parse ( 5 , new String ( output . toByteArray ( ) , "ISO-2022-jp" ) ) ; assertThat ( results , is ( new String [ ] [ ] { { "text_value" , "true_value" , "false_value" , "date_value" , "" } , { "-UNK-" , "T" , "F" , "2011/10/11" , "" } , } ) ) ; } @ Test public void header ( ) throws Exception { ModelLoader loaded = generateJava ( | |
408 | <s> package org . rubypeople . rdt . internal . corext . util ; import org . rubypeople . rdt . core . IRubyElement ; import | |
409 | <s> package net . ggtools . grand . ui . graph ; import java . io . File ; import java . util . Map ; import java . util . Properties ; import net . ggtools . grand . ant . AntProject ; import net . ggtools . grand . exceptions . GrandException ; import net . ggtools . grand . graph . Graph ; import net . ggtools . grand . graph . GraphProducer ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; public class GraphModel implements GraphProducer { private static final Log log = LogFactory . getLog ( GraphModel . class ) ; private File lastLoadedFile ; private AntProject producer = null ; private Properties lastLoadedFileProperties ; public final Graph getGraph ( ) throws GrandException { Graph graph = null ; if ( producer != null ) { graph = producer . getGraph ( ) ; } return graph ; } public void openFile ( final File file , final Properties properties ) throws GrandException { lastLoadedFileProperties = properties ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Loading " + file ) ; } lastLoadedFile = file ; producer = new AntProject ( file , properties ) ; } public void reload ( final Properties properties ) throws GrandException { if ( lastLoadedFile != null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( | |
410 | <s> package org . rubypeople . rdt . internal . testunit . ui ; import org . eclipse . jface . action . Action ; public class ScrollLockAction extends Action { private TestUnitView fRunnerViewPart ; public ScrollLockAction ( TestUnitView viewer ) { super ( TestUnitMessages . ScrollLockAction_action_label ) ; fRunnerViewPart = viewer ; setToolTipText ( TestUnitMessages . ScrollLockAction_action_tooltip ) ; setDisabledImageDescriptor ( | |
411 | <s> package com . asakusafw . dmdl . windgate . csv . driver ; import java . text . SimpleDateFormat ; import java . util . Map ; import com . asakusafw . dmdl . Diagnostic ; import com . asakusafw . dmdl . Diagnostic . Level ; import com . asakusafw . dmdl . model . AstAttribute ; import com . asakusafw . dmdl . model . AstAttributeElement ; import com . asakusafw . dmdl . model . AstLiteral ; import com . asakusafw . dmdl . model . LiteralKind ; import com . asakusafw . dmdl . semantics . DmdlSemantics ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; import com . asakusafw . dmdl . spi . ModelAttributeDriver ; import com . asakusafw . dmdl . util . AttributeUtil ; import com . asakusafw . dmdl . windgate . csv . driver . CsvSupportTrait . Configuration ; import com . asakusafw . runtime . io . csv . CsvConfiguration ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateTime ; public class CsvSupportDriver extends ModelAttributeDriver { public static final String TARGET_NAME = "windgate.csv" ; public static final String ELEMENT_CHARSET_NAME = "charset" ; public static final String ELEMENT_HAS_HEADER_NAME = "has_header" ; public static final String ELEMENT_TRUE_NAME = "true" ; public static final String ELEMENT_FALSE_NAME = "false" ; public static final String ELEMENT_DATE_NAME = "date" ; public static final String ELEMENT_DATE_TIME_NAME = "datetime" ; @ Override public String getTargetName ( ) { return TARGET_NAME ; } @ Override public void process ( DmdlSemantics environment , ModelDeclaration declaration , AstAttribute attribute ) { Map < String , AstAttributeElement > elements = AttributeUtil . getElementMap ( attribute ) ; Configuration conf = analyzeConfig ( environment , attribute , elements ) ; if ( conf != null ) { declaration . putTrait ( CsvSupportTrait . class , new CsvSupportTrait ( attribute , conf ) ) ; } } private Configuration analyzeConfig ( DmdlSemantics environment , AstAttribute attribute , Map < String , AstAttributeElement > elements ) { AstLiteral charset = take ( environment , elements , ELEMENT_CHARSET_NAME , LiteralKind . STRING ) ; AstLiteral header = take ( environment , elements , ELEMENT_HAS_HEADER_NAME , LiteralKind . BOOLEAN ) ; AstLiteral trueRep = take ( environment , elements , ELEMENT_TRUE_NAME , LiteralKind . STRING ) ; AstLiteral falseRep = take ( environment , elements , ELEMENT_FALSE_NAME , LiteralKind . STRING ) ; AstLiteral dateFormat = take ( environment , elements , ELEMENT_DATE_NAME , LiteralKind . STRING ) ; AstLiteral dateTimeFormat = take ( environment , elements , ELEMENT_DATE_TIME_NAME , LiteralKind . STRING ) ; environment . reportAll ( AttributeUtil . reportInvalidElements ( attribute , elements . values ( ) ) ) ; Configuration result = new Configuration ( ) ; if ( charset != null && checkNotEmpty ( environment , ELEMENT_CHARSET_NAME , charset ) ) { result . setCharsetName ( charset . toStringValue ( ) ) ; } if ( header != null ) { result . setEnableHeader ( header . toBooleanValue ( ) ) ; } if ( trueRep != null && checkNotEmpty ( environment , ELEMENT_TRUE_NAME , trueRep ) ) { result . setTrueFormat ( trueRep . toStringValue ( ) ) ; } if ( falseRep != null && checkNotEmpty ( environment , ELEMENT_FALSE_NAME , falseRep ) | |
412 | <s> package com . asakusafw . compiler . tool . analysis ; import java . io . IOException ; import java . io . OutputStream ; import java . nio . charset . Charset ; import java . text . MessageFormat ; import java . util . Collection ; import java . util . List ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . batch . AbstractWorkflowProcessor ; import com . asakusafw . compiler . batch . WorkDescriptionProcessor ; import com . asakusafw . compiler . batch . Workflow ; import com . asakusafw . compiler . batch . processor . JobFlowWorkDescriptionProcessor ; import com . asakusafw . compiler . flow . jobflow . JobflowModel ; import com . asakusafw . compiler . flow . plan . StageBlock ; import com . asakusafw . compiler . flow . plan . StageGraph ; import com . asakusafw . compiler . flow . visualizer . VisualAnalyzer ; import com . asakusafw . compiler . flow . visualizer . VisualGraph ; import com . asakusafw . compiler . flow . visualizer . VisualGraphEmitter ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . vocabulary . batch . JobFlowWorkDescription ; import com . asakusafw . vocabulary . batch . WorkDescription ; import com . asakusafw . vocabulary . flow . graph . FlowGraph ; public class VisualizeJobflowStructureProcessor extends AbstractWorkflowProcessor { static final Logger LOG = LoggerFactory . getLogger ( VisualizeJobflowStructureProcessor . class ) ; static final Charset ENCODING = Charset . forName ( "UTF-8" ) ; private static final String PATH_FLOW_GRAPH = Constants . PATH_JOBFLOW + "" ; private static final String PATH_STAGE_GRAPH = Constants . PATH_JOBFLOW + "" ; private static final String PATH_STAGE_BLOCK = Constants . PATH_JOBFLOW + "" ; @ Override public Collection < Class < ? extends WorkDescriptionProcessor < ? > > > getDescriptionProcessors ( ) { List < Class < ? extends WorkDescriptionProcessor < ? > > > results = Lists . create ( ) ; results . add ( JobFlowWorkDescriptionProcessor . class ) ; return results ; } @ Override public void process ( Workflow workflow ) throws IOException { for ( Workflow . Unit unit : workflow . getGraph ( ) . getNodeSet ( ) ) { processUnit ( unit ) ; } } private void processUnit ( Workflow . Unit unit ) throws IOException { assert unit != null ; WorkDescription desc = unit . getDescription ( ) ; if ( desc instanceof JobFlowWorkDescription ) { processDescription ( ( JobFlowWorkDescription ) desc , ( JobflowModel ) unit . getProcessed ( ) ) ; } else { throw new AssertionError ( desc ) ; } } private void processDescription ( JobFlowWorkDescription desc , JobflowModel model ) throws IOException { assert desc != null ; assert model != null ; StageGraph stageGraph = model . getStageGraph ( ) ; processFlowGraph ( model . getFlowId ( ) , stageGraph . getInput ( ) . getSource ( ) . getOrigin ( ) ) ; processStageGraph ( model . getFlowId ( ) , stageGraph ) ; for ( StageBlock stage : stageGraph . getStages ( ) ) | |
413 | <s> package net . sf . sveditor . core . db . index . plugin_lib ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . ISVDBIndexFactory ; import net . sf . sveditor . core . db . index . SVDBIndexConfig ; import net . sf . sveditor . core . db . index . cache . ISVDBIndexCache ; public class SVDBPluginLibIndexFactory implements ISVDBIndexFactory { public static final | |
414 | <s> package com . asakusafw . dmdl . thundergate . view ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . Arrays ; import org . junit . Test ; import com . asakusafw . dmdl . thundergate . model . Aggregator ; import com . asakusafw . dmdl . thundergate . view . model . CreateView ; import com . asakusafw . dmdl . thundergate . view . model . From ; import com . asakusafw . dmdl . thundergate . view . model . Join ; import com . asakusafw . dmdl . thundergate . view . model . Name ; import com . asakusafw . dmdl . thundergate . view . model . On ; import com . asakusafw . dmdl . thundergate . view . model . Select ; public class ViewParserTest { @ Test public void parseJoin ( ) throws Exception { ViewDefinition def = def ( "select" + "" + "" + "" + "" + "" + "where" + "" ) ; CreateView model = ViewParser . parse ( def ) ; assertThat ( model , is ( new CreateView ( n ( "test" ) , Arrays . asList ( new Select [ ] { new Select ( n ( "t1.pk" ) , Aggregator . IDENT , n ( "pk" ) ) , new Select ( n ( "t1.val1" ) , Aggregator . IDENT , n ( "val1" ) ) , new Select ( n ( "t2.val2" ) , Aggregator . IDENT | |
415 | <s> package org . oddjob . scheduling ; import java . io . Serializable ; import java . util . LinkedHashMap ; import java . util . Map ; public class ScheduleSummary implements Serializable { private static final long serialVersionUID = 20051117 ; private String id ; private Map < String | |
416 | <s> package com . asakusafw . testdriver . bulkloader ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . util . Arrays ; import java . util . List ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . model . SimpleDataModelDefinition ; import com . asakusafw . vocabulary . bulkloader . DbImporterDescription ; public class BulkLoadImporterPreparatorTest { static final DataModelDefinition < Simple > SIMPLE = new SimpleDataModelDefinition < Simple > ( Simple . class ) ; static final DbImporterDescription NORMAL = new DbImporterDescription ( ) { @ Override public Class < ? > getModelType ( ) { return Simple . class ; } @ Override public String getTargetName ( ) { return "importer" ; } @ Override public LockType getLockType ( ) { return LockType . UNUSED ; } } ; static final DbImporterDescription CACHED = new DbImporterDescription ( ) { @ Override public Class < ? > getModelType ( ) { return Simple . class ; } @ Override public String getTargetName ( ) { return "importer" ; } @ Override public LockType getLockType ( ) { return LockType . UNUSED ; } @ Override public boolean isCacheEnabled ( ) { return | |
417 | <s> package com . asakusafw . testdriver ; import java . io . File ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . Collections ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . flow . FlowDescriptionDriver ; import com . asakusafw . compiler . testing . DirectExporterDescription ; import com . asakusafw . testdriver . core . DataModelSinkFactory ; import com . asakusafw . testdriver . core . DifferenceSinkFactory ; import com . asakusafw . testdriver . core . ModelTester ; import com . asakusafw . testdriver . core . ModelVerifier ; import com . asakusafw . testdriver . core . VerifierFactory ; import com . asakusafw . vocabulary . flow . Out ; import com . asakusafw . vocabulary . flow . Source ; public class FlowPartDriverOutput < T > extends DriverOutputBase < T > implements Out < T > { private static final Logger LOG = LoggerFactory . getLogger ( FlowPartDriverOutput . class ) ; protected FlowDescriptionDriver descDriver ; private final Out < T > out ; public FlowPartDriverOutput ( TestDriverContext driverContext , FlowDescriptionDriver descDriver , String name , Class < T > modelType ) { this . driverContext = driverContext ; this . descDriver = descDriver ; this . name = name ; this . modelType = modelType ; String exportPath = FlowPartDriverUtils . createOutputLocation ( driverContext , name ) . toPath ( '/' ) ; LOG . info ( "Export Path=" + exportPath ) ; exporterDescription = new DirectExporterDescription ( modelType , exportPath ) ; out = descDriver . createOut ( name , exporterDescription ) ; } public FlowPartDriverOutput < T > prepare ( String sourcePath ) { LOG . info ( "" + getModelType ( ) ) ; setSourceUri ( sourcePath ) ; return this ; } public FlowPartDriverOutput < T > verify ( String expectedPath , String verifyRulePath ) { LOG . info ( "" + modelType ) ; try { setVerifier ( expectedPath , verifyRulePath , Collections . < ModelTester < T > > emptyList ( ) ) ; } catch ( IOException e ) { throw new IllegalStateException ( MessageFormat . format ( "" , name , expectedPath , verifyRulePath ) , e ) ; } return this ; } public FlowPartDriverOutput < T > verify ( String expectedPath , String verifyRulePath , ModelTester < ? super T > tester ) { LOG . info ( "" + modelType ) ; try { setVerifier ( expectedPath , verifyRulePath , Collections . singletonList ( tester ) ) ; } catch ( IOException e | |
418 | <s> package com . pogofish . jadt . parser . javacc ; import java . io . Reader ; import com . pogofish . jadt . parser . ParserImplFactory ; public class JavaCCParserImplFactory implements | |
419 | <s> package com . asakusafw . thundergate . runtime . cache . mapreduce ; import java . io . IOException ; import org . apache . hadoop . io . NullWritable ; import org . apache . hadoop . mapreduce . Mapper ; import com . asakusafw . thundergate . runtime . cache . ThunderGateCacheSupport ; public class DeleteMapper extends Mapper < NullWritable , ThunderGateCacheSupport | |
420 | <s> package org . oddjob . framework ; import org . apache . commons . beanutils . ConversionException ; import org . apache . commons . beanutils . DynaBean ; import org . apache . commons . beanutils . DynaProperty ; import org . apache . commons . beanutils . PropertyUtils ; import org . oddjob . arooa . reflect . ArooaClass ; import org . oddjob . arooa . reflect . ArooaClassFactory ; import org . oddjob . arooa . reflect . ArooaClasses ; public class WrapDynaBean implements DynaBean { static { ArooaClasses . register ( WrapDynaBean . class , new ArooaClassFactory < WrapDynaBean > ( ) { @ Override public ArooaClass classFor ( WrapDynaBean instance ) { return new WrapDynaArooaClass ( instance . getDynaClass ( ) , instance . getClass ( ) ) ; } } ) ; } public WrapDynaBean ( Object instance ) { super ( ) ; this . instance = instance ; this . dynaClass = WrapDynaClass . createDynaClass ( instance . getClass ( ) ) ; } protected WrapDynaClass dynaClass = null ; protected Object instance = null ; public boolean contains ( String name , String key ) { throw new UnsupportedOperationException ( "" ) ; } public Object get ( String name ) { if ( ! dynaClass . isReadable ( name ) ) { return null ; } Object value = null ; try { value = PropertyUtils . getSimpleProperty ( instance , name ) ; } catch ( Throwable t ) { throw new RuntimeException ( "" + name , t ) ; } return ( value ) ; } public Object get ( String name , int index ) { if ( ! dynaClass . isReadable ( name ) ) { return null ; } Object value = null ; try { value = PropertyUtils . getIndexedProperty ( instance , name , index ) ; } catch ( IndexOutOfBoundsException e ) { throw e ; } catch ( | |
421 | <s> package org . rubypeople . rdt . refactoring . core . renamefield ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashSet ; import java . util . LinkedHashMap ; import org . jruby . ast . ArrayNode ; import org . jruby . ast . ClassVarAsgnNode ; import org . jruby . ast . ClassVarNode ; import org . jruby . ast . FCallNode ; import org . jruby . ast . InstAsgnNode ; import org . jruby . ast . InstVarNode ; import org . jruby . ast . Node ; import org . jruby . ast . SymbolNode ; import org . rubypeople . rdt . refactoring . core . SelectionNodeProvider ; import org . rubypeople . rdt . refactoring . core . renamefield . fielditems . AttrFieldItem ; import org . rubypeople . rdt . refactoring . core . renamefield . fielditems . ClassVarAsgnFieldItem ; import org . rubypeople . rdt . refactoring . core . renamefield . fielditems . ClassVarFieldItem ; import org . rubypeople . rdt . refactoring . core . renamefield . fielditems . FieldItem ; import org . rubypeople . rdt . refactoring . core . renamefield . fielditems . InstAsgnFieldItem ; import org . rubypeople . rdt . refactoring . core . renamefield . fielditems . InstVarFieldItem ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . AttrAccessorNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; public class FieldProvider { private ClassNodeWrapper classNode ; private Collection < ClassNodeWrapper > relatedClasses ; private LinkedHashMap < String , ArrayList < FieldItem > > fields ; private IDocumentProvider docProvider ; public FieldProvider ( ClassNodeWrapper classNode , IDocumentProvider docProvider ) { this . classNode = classNode ; this . fields = new LinkedHashMap < String , ArrayList < FieldItem > > ( ) ; this . docProvider = docProvider ; initRelatedClasses ( ) ; for ( ClassNodeWrapper currentClass : relatedClasses ) { initAttrs ( currentClass ) ; initAccessors ( currentClass ) ; initClassFields ( currentClass ) ; } } private void initRelatedClasses ( ) { relatedClasses = new ArrayList < ClassNodeWrapper > ( ) ; Collection < ClassNodeWrapper > itselfAndSuperclasses = docProvider . getProjectClassNodeProvider ( ) . getClassAndAllSuperClasses ( classNode ) ; relatedClasses . addAll ( itselfAndSuperclasses ) ; Collection < ClassNodeWrapper > subclasses = docProvider . getProjectClassNodeProvider ( ) . getSubClassesOf ( classNode . getName ( ) ) ; relatedClasses . addAll ( subclasses ) ; } private void initClassFields ( ClassNodeWrapper classWrapper ) { Collection < Node > allOccurences = classWrapper . getClassFieldOccurences ( ) ; for ( Node currentAttr : allOccurences ) { if ( currentAttr instanceof ClassVarNode ) { ClassVarNode classVar = ( ClassVarNode ) currentAttr ; if ( ! isVarSubNodeOfAsgn ( classVar , allOccurences , ClassVarAsgnNode . class ) ) { addClassVar ( classVar ) ; } } else if ( currentAttr instanceof ClassVarAsgnNode ) { addClassVarAsgn ( ( ClassVarAsgnNode ) currentAttr ) ; } else { System . out . println ( Messages . FieldProvider_UnexpectedNodeOfType + currentAttr . getClass ( ) + Messages . FieldProvider_RetrievedAsField + currentAttr . toString ( ) ) ; } } } private void addClassVarAsgn ( ClassVarAsgnNode classVarAsgnNode ) { String name = FieldItem . fieldName ( classVarAsgnNode . getName ( ) ) ; initNameList ( name ) ; ArrayList < FieldItem > fieldList = fields . get ( name ) ; fieldList . add ( new ClassVarAsgnFieldItem ( classVarAsgnNode ) ) ; } private void addClassVar ( ClassVarNode classVarNode ) { String name = FieldItem . fieldName ( classVarNode . getName ( ) ) ; initNameList ( name ) ; ArrayList < FieldItem > fieldList = fields . get ( name ) ; fieldList . add ( new ClassVarFieldItem ( classVarNode ) ) ; } private void initAccessors ( ClassNodeWrapper classWrapper ) { for ( AttrAccessorNodeWrapper currentAccessor : classWrapper . getAccessorNodes ( ) ) { String name = FieldItem . fieldName ( currentAccessor . getAttrName ( ) ) ; initNameList ( name ) ; ArrayList < FieldItem > itemList = fields . get ( name ) ; for ( FCallNode accessorPart : currentAccessor . getAccessorNodes ( ) ) { ArrayNode arrayNode = ( ArrayNode ) accessorPart . getArgsNode ( ) ; for ( Object actObj : arrayNode . childNodes ( ) ) { SymbolNode aktSymbol = ( SymbolNode ) actObj ; if ( name . equals ( aktSymbol . getName ( ) ) ) { itemList . add ( new AttrFieldItem ( aktSymbol ) ) ; } } } } } private void initAttrs ( ClassNodeWrapper classWrapper ) { Collection < Node > allOccurences = classWrapper . getInstFieldOccurences ( ) ; for ( Node currentAttr : allOccurences ) { if ( currentAttr instanceof SymbolNode ) { addAttr ( ( SymbolNode ) currentAttr ) ; } else if ( currentAttr instanceof InstVarNode ) { InstVarNode instVar = ( InstVarNode ) currentAttr ; if ( ! isVarSubNodeOfAsgn ( instVar , allOccurences , InstAsgnNode . class ) ) { addInstVar ( instVar ) ; } } else if ( currentAttr instanceof InstAsgnNode ) { addInstAsgn ( ( InstAsgnNode ) currentAttr ) ; } else { System . out . println ( Messages . FieldProvider_UnexpectedNodeOfType + currentAttr . getClass ( ) + Messages . FieldProvider_RetrievedAsAttribute + currentAttr . toString ( ) ) ; } } } private boolean isVarSubNodeOfAsgn ( Node instVar , Collection < Node > allNodes , Class kind ) { for ( Node currentNode : allNodes ) { if ( currentNode . getClass ( ) . isAssignableFrom ( kind ) ) { if ( currentNode . getPosition ( ) . getFile ( ) . equals ( instVar . getPosition ( ) . getFile ( ) ) ) { if ( SelectionNodeProvider . nodeContainsPosition ( currentNode , instVar . getPosition ( ) . getStartOffset ( ) ) ) { return true ; } } } } return false ; } private void addInstAsgn ( InstAsgnNode currentAttr ) { String name = FieldItem . fieldName ( currentAttr . getName ( ) ) ; initNameList ( name ) ; ArrayList < FieldItem > fieldList = fields . get ( name ) ; fieldList . add ( new InstAsgnFieldItem ( currentAttr ) ) ; } private void addInstVar ( InstVarNode instVar ) { String name = FieldItem . fieldName ( instVar . getName ( ) ) ; initNameList ( name ) ; ArrayList < FieldItem | |
422 | <s> package net . ggtools . grand . ui . graph ; import net . ggtools . grand . ant . AntTargetNode . SourceElement ; import net . ggtools . grand . | |
423 | <s> package org . rubypeople . rdt . internal . ui . workingsets ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . IdentityHashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . core . runtime . ListenerList ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . jface . viewers . IElementComparer ; import org . eclipse . ui . ILocalWorkingSetManager ; import org . eclipse . ui . IMemento ; import org . eclipse . ui . IWorkingSet ; import org . eclipse . ui . IWorkingSetManager ; import org . eclipse . ui . IWorkingSetUpdater ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . core . IRubyProject ; public class WorkingSetModel { public static final String CHANGE_WORKING_SET_MODEL_CONTENT = "" ; public static final IElementComparer COMPARER = new WorkingSetComparar ( ) ; private static final String TAG_LOCAL_WORKING_SET_MANAGER = "" ; private static final String TAG_ACTIVE_WORKING_SET = "" ; private static final String TAG_WORKING_SET_NAME = "" ; private static final String TAG_CONFIGURED = "configured" ; private ILocalWorkingSetManager fLocalWorkingSetManager ; private List < IWorkingSet > fActiveWorkingSets ; private ListenerList fListeners ; private IPropertyChangeListener fWorkingSetManagerListener ; private OthersWorkingSetUpdater fOthersWorkingSetUpdater ; private ElementMapper fElementMapper = new ElementMapper ( ) ; private boolean fConfigured ; private static class WorkingSetComparar implements IElementComparer { public boolean equals ( Object o1 , Object o2 ) { IWorkingSet w1 = o1 instanceof IWorkingSet ? ( IWorkingSet ) o1 : null ; IWorkingSet w2 = o2 instanceof IWorkingSet ? ( IWorkingSet ) o2 : null ; if ( w1 == null || w2 == null ) return o1 . equals ( o2 ) ; return w1 == w2 ; } public int hashCode ( Object element ) { if ( element instanceof IWorkingSet ) return System . identityHashCode ( element ) ; return element . hashCode ( ) ; } } private static class ElementMapper { private Map fElementToWorkingSet = new HashMap ( ) ; private Map < IWorkingSet , IAdaptable [ ] > fWorkingSetToElement = new IdentityHashMap < IWorkingSet , IAdaptable [ ] > ( ) ; private Map fResourceToWorkingSet = new HashMap ( ) ; private List fNonProjectTopLevelElements = new ArrayList ( ) ; public void clear ( ) { fElementToWorkingSet . clear ( ) ; fWorkingSetToElement . clear ( ) ; fResourceToWorkingSet . clear ( ) ; fNonProjectTopLevelElements . clear ( ) ; } public void rebuild ( IWorkingSet [ ] workingSets ) { clear ( ) ; for ( int i = 0 ; i < workingSets . length ; i ++ ) { put ( workingSets [ i ] ) ; } } public IAdaptable [ ] remove ( IWorkingSet ws ) { IAdaptable [ ] elements = fWorkingSetToElement . remove ( ws ) ; if ( elements != null ) { for ( int i = 0 ; i < elements . length ; i ++ ) { removeElement ( elements [ i ] , ws ) ; } } return elements ; } public IAdaptable [ ] refresh ( IWorkingSet ws ) { IAdaptable [ ] oldElements = fWorkingSetToElement . get ( ws ) ; if ( oldElements == null ) return null ; IAdaptable [ ] newElements = ws . getElements ( ) ; List < IAdaptable > toRemove = new ArrayList < IAdaptable > ( Arrays . asList ( oldElements ) ) ; List < IAdaptable > toAdd = new ArrayList < IAdaptable > ( Arrays . asList ( newElements ) ) ; computeDelta ( toRemove , toAdd , oldElements , newElements ) ; for ( Iterator < IAdaptable > iter = toAdd . iterator ( ) ; iter . hasNext ( ) ; ) { addElement ( iter . next ( ) , ws ) ; } for ( Iterator < IAdaptable > iter = toRemove . iterator ( ) ; iter . hasNext ( ) ; ) { removeElement ( iter . next ( ) , ws ) ; } if ( toRemove . size ( ) > 0 || toAdd . size ( ) > 0 ) fWorkingSetToElement . put ( ws , newElements ) ; return oldElements ; } private void computeDelta ( List toRemove , List toAdd , IAdaptable [ ] oldElements , IAdaptable [ ] newElements ) { for ( int i = 0 ; i < oldElements . length ; i ++ ) { toAdd . remove ( oldElements [ i ] ) ; } for ( int i = 0 ; i < newElements . length ; i ++ ) { toRemove . remove ( newElements [ i ] ) ; } } public IWorkingSet getFirstWorkingSet ( Object element ) { return ( IWorkingSet ) getFirstElement ( fElementToWorkingSet , element ) ; } public List getAllWorkingSets ( Object element ) { return getAllElements ( fElementToWorkingSet , element ) ; } public IWorkingSet getFirstWorkingSetForResource ( IResource resource ) { return ( IWorkingSet ) getFirstElement ( fResourceToWorkingSet , resource ) ; } public List getAllWorkingSetsForResource ( IResource resource ) { return getAllElements ( fResourceToWorkingSet , resource ) ; } public List getNonProjectTopLevelElements ( ) { return fNonProjectTopLevelElements ; } private void put ( IWorkingSet ws ) { if ( fWorkingSetToElement . containsKey ( ws ) ) return ; IAdaptable [ ] elements = ws . getElements ( ) ; fWorkingSetToElement . put ( ws , elements ) ; for ( int i = 0 ; i < elements . length ; i ++ ) { IAdaptable element = elements [ i ] ; addElement ( element , ws ) ; if ( ! ( element instanceof IProject ) && ! ( element instanceof IRubyProject ) ) { fNonProjectTopLevelElements . add ( element ) ; } } } private void addElement ( IAdaptable element , IWorkingSet ws ) { addToMap ( fElementToWorkingSet , element , ws ) ; IResource resource = ( IResource ) element . getAdapter ( IResource . class ) ; if ( resource != null ) { addToMap ( fResourceToWorkingSet , resource , ws ) ; } } private void removeElement ( IAdaptable element , IWorkingSet ws ) { removeFromMap ( fElementToWorkingSet , element , ws ) ; IResource resource = ( IResource ) element . getAdapter ( IResource . class ) ; if ( resource != null ) { removeFromMap ( fResourceToWorkingSet , resource , ws ) ; } } private void addToMap ( Map map , IAdaptable key , IWorkingSet value ) { Object obj = map . get ( key ) ; if ( obj == null ) { map . put ( key , value ) ; } else if ( obj instanceof IWorkingSet ) { List l = new ArrayList ( 2 ) ; l . add ( obj ) ; l . add ( value ) ; map . put ( key , l ) ; } else if ( obj instanceof List ) { ( ( List ) obj ) . add ( value ) ; } } private void removeFromMap ( Map map , IAdaptable key , IWorkingSet value ) { Object current = map . get ( key ) ; if ( current == null ) { return ; } else if ( current instanceof List ) { List list = ( List ) current ; list . remove ( value ) ; switch ( list . size ( ) ) { case 0 : map . remove ( key ) ; break ; case 1 : map . put ( key , list . get ( 0 ) ) ; break ; } } else if ( current == value ) { map . remove ( key ) ; } } private Object getFirstElement ( Map map , Object key ) { Object obj = map . get ( key ) ; if ( obj instanceof List ) return ( ( List ) obj ) . get ( 0 ) ; return obj ; } private List getAllElements ( Map map , Object key ) { Object obj = map . get ( key ) ; if ( obj instanceof List ) return ( List ) obj ; if ( obj == null ) return Collections . EMPTY_LIST ; List result = new ArrayList ( 1 ) ; result . add ( obj ) ; return result ; } } public WorkingSetModel ( ) { fLocalWorkingSetManager = PlatformUI . getWorkbench ( ) . createLocalWorkingSetManager ( ) ; addListenersToWorkingSetManagers ( ) ; fActiveWorkingSets = new ArrayList < IWorkingSet > ( 2 ) ; IWorkingSet others = fLocalWorkingSetManager . createWorkingSet ( WorkingSetMessages . WorkingSetModel_others_name , new IAdaptable [ 0 ] ) ; others . setId ( OthersWorkingSetUpdater . ID ) ; fLocalWorkingSetManager . addWorkingSet ( others ) ; Assert . isNotNull ( fOthersWorkingSetUpdater ) ; fActiveWorkingSets . add ( others ) ; fElementMapper . rebuild ( getActiveWorkingSets ( ) ) ; fOthersWorkingSetUpdater . updateElements ( ) ; } public WorkingSetModel ( IMemento memento ) { fLocalWorkingSetManager = PlatformUI . getWorkbench ( ) . createLocalWorkingSetManager ( ) ; addListenersToWorkingSetManagers ( ) ; fActiveWorkingSets = new ArrayList < IWorkingSet > ( 2 ) ; restoreState ( memento ) ; Assert . isNotNull ( fOthersWorkingSetUpdater ) ; fElementMapper . rebuild ( getActiveWorkingSets ( ) ) ; fOthersWorkingSetUpdater . updateElements ( ) ; } private void addListenersToWorkingSetManagers ( ) { fListeners = new ListenerList ( ListenerList . IDENTITY ) ; fWorkingSetManagerListener = new IPropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent event ) { workingSetManagerChanged ( event ) ; } } ; PlatformUI . getWorkbench ( ) . getWorkingSetManager ( ) . addPropertyChangeListener ( fWorkingSetManagerListener ) ; fLocalWorkingSetManager . addPropertyChangeListener ( fWorkingSetManagerListener ) ; } public void dispose ( ) { if ( fWorkingSetManagerListener != null ) { PlatformUI . getWorkbench ( ) . getWorkingSetManager ( ) . removePropertyChangeListener ( fWorkingSetManagerListener ) ; fLocalWorkingSetManager . removePropertyChangeListener ( fWorkingSetManagerListener ) ; fLocalWorkingSetManager . dispose ( ) ; fWorkingSetManagerListener = null ; } } public IAdaptable [ ] getChildren ( IWorkingSet workingSet ) { return workingSet . getElements ( ) ; } public Object getParent ( Object element ) { if ( element instanceof IWorkingSet && fActiveWorkingSets . contains ( element ) ) return this ; return fElementMapper . getFirstWorkingSet ( element ) ; } public Object [ ] getAllParents ( Object element ) { if ( element instanceof IWorkingSet && fActiveWorkingSets . contains ( element ) ) return new Object [ ] { this } ; | |
424 | <s> package org . rubypeople . rdt . refactoring . core . splitlocal ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . core . RefactoringConditionChecker ; public class SplitLocalConditionChecker extends RefactoringConditionChecker { private SplitLocalConfig config ; public SplitLocalConditionChecker ( SplitLocalConfig config ) { super ( config ) ; } public void init ( IRefactoringConfig configObj ) { this . config = ( SplitLocalConfig ) configObj ; | |
425 | <s> package com . asakusafw . compiler . flow . processor ; import java . util . List ; import java . util . Set ; import com . asakusafw . compiler . common . TargetOperator ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . DataClass . Property ; import com . asakusafw . compiler . flow . RendezvousProcessor ; import com . asakusafw . runtime . util . TypeUtil ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import | |
426 | <s> package com . asakusafw . dmdl . thundergate . model ; import java . text . MessageFormat ; import java . util . List ; public class TableModelDescription extends ModelDescription { public TableModelDescription ( ModelReference reference , List < ModelProperty > properties ) { super ( reference , properties ) ; for ( ModelProperty property : properties ) { if ( property . getJoined ( ) != null ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , reference , property . getName ( ) ) ) ; } Source source = property . getFrom ( ) ; if ( | |
427 | <s> package org . rubypeople . rdt . internal . ui . util ; import junit . framework . Test ; import junit . framework . TestSuite ; public class InternalUIUtilTests { public static Test suite ( ) { TestSuite suite = new TestSuite ( "" ) ; suite . addTestSuite ( TwoArrayQuickSorterTest | |
428 | <s> package org . oddjob . io ; import java . io . IOException ; import java . io . OutputStream ; import java . util . ArrayList ; import java . util . List ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . types . ValueFactory ; public class TeeType implements ValueFactory < OutputStream > { private final List < OutputStream > outputs = new ArrayList < OutputStream > ( ) ; public void setOutputs ( int index , OutputStream output ) { if ( output == null ) { outputs . remove ( index ) ; } else { outputs . add ( index , output ) ; } } @ Override public OutputStream toValue ( ) throws ArooaConversionException { return new OutputStream ( ) { @ Override public void write ( int b ) throws IOException { for ( OutputStream output : outputs ) { output . write ( b ) ; } } @ Override public void write ( byte [ ] b ) throws IOException { for ( OutputStream output : outputs ) { output . write ( b ) ; } } @ Override public void write ( byte [ ] b , int off , int len ) throws IOException { for ( | |
429 | <s> package org . rubypeople . rdt . internal . ui . actions ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . viewers . TableViewer ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; public class SelectAllAction extends Action { private TableViewer fViewer ; public SelectAllAction ( TableViewer viewer ) | |
430 | <s> package d2rq ; import java . io . File ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . PrintStream ; import jena . cmdline . ArgDecl ; import jena . cmdline . CommandLine ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import com . hp . hpl . jena . rdf . model . Model ; import de . fuberlin . wiwiss . d2rq . CommandLineTool ; import de . fuberlin . wiwiss . d2rq . SystemLoader ; import de . fuberlin . wiwiss . d2rq . mapgen . MappingGenerator ; public class generate_mapping extends CommandLineTool { private final static Log log = LogFactory . getLog ( generate_mapping . class ) ; public static void main ( String [ ] args ) { new generate_mapping ( ) . process ( args ) ; } public void usage ( ) { System . err . println ( "" ) ; System . err . println ( ) ; printStandardArguments ( false ) ; System . err . println ( " Options:" ) ; printConnectionOptions ( ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( ) ; System . exit ( 1 ) ; } private ArgDecl outfileArg = new ArgDecl ( true , "o" , "out" , "outfile" ) ; private ArgDecl vocabAsOutput = new ArgDecl ( false , "v" , "vocab" ) ; public void initArgs ( CommandLine cmd ) { cmd . add ( outfileArg ) ; cmd . add ( vocabAsOutput ) ; } public void | |
431 | <s> package org . oddjob . jmx . server ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import javax . management . MalformedObjectNameException ; import javax . management . Notification ; import javax . management . ObjectName ; import junit . framework . TestCase ; import org . oddjob . Helper ; import org . oddjob . Structural ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . MockClassResolver ; import org . oddjob . arooa . registry . BeanDirectory ; import org . oddjob . arooa . registry . MockBeanRegistry ; import org . oddjob . arooa . registry . ServerId ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . jmx . MockRemoteOddjobBean ; import org . oddjob . jmx . RemoteDirectoryOwner ; import org . oddjob . jmx . RemoteOddjobBean ; import org . oddjob . jmx . client . ClientHandlerResolver ; public class ServerMainBeanTest extends TestCase { private class OurModel extends MockServerModel { ServerInterfaceManagerFactory simf ; @ Override public ServerInterfaceManagerFactory getInterfaceManagerFactory ( ) { return simf ; } @ Override public String getLogFormat ( ) { return null ; } @ Override public ServerId getServerId ( ) { return new ServerId ( "http://test" ) ; } } ObjectName childName ; { try { childName = new ObjectName ( "oddjob" , "name" , "whatever" ) ; } catch ( MalformedObjectNameException e ) { throw new RuntimeException ( e ) ; } } private class OurServerToolkit extends MockServerSideToolkit { ArooaSession session = new StandardArooaSession ( ) ; Object child ; List < Notification > sent = new ArrayList < Notification > ( ) ; ServerContext context ; @ Override public ServerContext getContext ( ) { return context ; } @ Override public RemoteOddjobBean getRemoteBean ( ) { return new MockRemoteOddjobBean ( ) ; } @ Override public void runSynchronized ( Runnable runnable ) { runnable . run ( ) ; } @ Override public Notification createNotification ( String type ) { return new Notification ( "X" , this , 0 ) ; } @ Override public void sendNotification ( Notification notification ) { sent . add ( notification ) ; } @ Override public ServerSession getServerSession ( ) { return new MockServerSession ( ) { @ Override public ObjectName createMBeanFor ( Object theChild , ServerContext childContext ) { child = theChild ; return childName ; } @ Override public void destroy ( ObjectName childName ) { assertEquals ( ServerMainBeanTest . this . childName , childName ) ; child = null ; } @ Override public ArooaSession getArooaSession ( ) { return session ; } } ; } } private class OurClassResolver extends MockClassResolver { @ Override public Class < ? > findClass ( String className ) { try { return Class . forName ( className ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } } } public void testInterfaces ( ) { BeanDirectory beanDirectory = new MockBeanRegistry ( ) { @ Override public String getIdFor ( Object component ) { return null ; } } ; Object child = new Object ( ) ; ServerMainBean test = new ServerMainBean ( child , beanDirectory ) ; ServerInterfaceManagerFactoryImpl simf = new ServerInterfaceManagerFactoryImpl ( ) ; simf . addServerHandlerFactories ( new ResourceFactoryProvider ( new StandardArooaSession ( ) ) . getHandlerFactories ( ) ) ; OurModel model = new OurModel ( ) ; model . simf = simf ; ServerContextImpl context = new ServerContextImpl ( test , model , beanDirectory ) ; OurServerToolkit toolkit = new OurServerToolkit ( ) ; toolkit . context = context ; ServerInterfaceManager serverInterfaceManager = simf . create ( test , toolkit ) ; | |
432 | <s> package com . asakusafw . windgate . file . resource ; import static org . hamcrest . CoreMatchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . ObjectOutputStream ; import java . util . Arrays ; import java . util . Collections ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; import com . asakusafw . windgate . core . DriverScript ; import com . asakusafw . windgate . core . GateScript ; import com . asakusafw . windgate . core . ProcessScript ; import com . asakusafw . windgate . core . resource . DrainDriver ; import com . asakusafw . windgate . core . resource . SourceDriver ; import com . asakusafw . windgate . core . vocabulary . FileProcess ; public class FileResourceMirrorTest { @ Rule public TemporaryFolder folder = new TemporaryFolder ( ) ; @ Test public void getName ( ) throws Exception { FileResourceMirror resource = new FileResourceMirror ( "testing" ) ; try { assertThat ( resource . getName ( ) , is ( "testing" ) ) ; } finally { resource . close ( ) ; } } @ Test public void prepare ( ) throws Exception { File source = folder . newFile ( "source" ) ; File drain = folder . newFile ( "drain" ) ; FileResourceMirror resource = new FileResourceMirror ( "testing" ) ; try { ProcessScript < String > script = script ( source , drain ) ; resource . prepare ( gate ( script ) ) ; } finally { resource . close ( ) ; } } @ Test public void createSource ( ) throws | |
433 | <s> package org . oddjob . jmx . server ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . oddjob . jmx . JMXServerJob ; import org . oddjob . jmx . SharedConstants ; public class ServerInterfaceManagerFactoryImpl implements ServerInterfaceManagerFactory { private Set < ServerInterfaceHandlerFactory < ? , ? > > serverHandlerFactories = new HashSet < ServerInterfaceHandlerFactory < ? , ? > > ( ) ; private OddjobJMXAccessController accessController ; public ServerInterfaceManagerFactoryImpl ( ) { this . serverHandlerFactories . addAll ( Arrays . asList ( SharedConstants . DEFAULT_SERVER_HANDLER_FACTORIES ) ) ; } public ServerInterfaceManagerFactoryImpl ( ServerInterfaceHandlerFactory < | |
434 | <s> package com . pogofish . jadt . samples . visitor ; import java . io . PrintWriter ; public class ColorExamples { public void printString ( Color color | |
435 | <s> package org . oddjob . jmx ; import java . util . HashMap ; import java . util . Map ; import javax . management . MBeanServerConnection ; import javax . management . remote . JMXConnector ; import javax . management . remote . JMXConnectorFactory ; import javax . management . remote . JMXServiceURL ; import junit . framework . TestCase ; import org . apache . commons . beanutils . DynaBean ; import org . apache . log4j . Logger ; import org . oddjob . Helper ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Structural ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . registry . BeanRegistry ; import org . oddjob . arooa . registry . MockBeanRegistry ; import org . oddjob . arooa . registry . SimpleBeanRegistry ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . jobs . WaitJob ; import org . oddjob . state . IsNotExecuting ; import org . oddjob . state . ParentState ; import org . oddjob . state . State ; import org . oddjob . structural . ChildHelper ; import org . oddjob . structural . StructuralListener ; public class JMXServerJobTest extends TestCase { private static final Logger logger = Logger . getLogger ( JMXServerJobTest . class ) ; protected void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; } int unique ; Map < Object , String > ids = new HashMap < Object , String > ( ) ; private class OurEmptyRegistrySession extends StandardArooaSession { @ Override public BeanRegistry getBeanRegistry ( ) { return new MockBeanRegistry ( ) { @ Override public String getIdFor ( Object component ) { assertNotNull ( component ) ; String id = ids . get ( component ) ; if ( id == null ) { id = "x" + unique ++ ; ids . put ( component , id ) ; } return id ; } } ; } } public void testServerMBeans ( ) throws Exception { Object root = new Object ( ) { public String toString ( ) { return "test" ; } } ; JMXServerJob server = new JMXServerJob ( ) ; server . setRoot ( root ) ; server . setArooaSession ( new StandardArooaSession ( ) ) ; server . setUrl ( "" ) ; server . start ( ) ; JMXServiceURL address = new JMXServiceURL ( server . getAddress ( ) ) ; JMXConnector cntor = JMXConnectorFactory . connect ( address ) ; MBeanServerConnection mBeanServer = cntor . getMBeanServerConnection ( ) ; assertEquals ( new Integer ( 3 ) , mBeanServer . getMBeanCount ( ) ) ; cntor . close ( ) ; server . stop ( ) ; } public void testRun ( ) throws Exception { Object root = new Object ( ) { public String toString ( ) { return "test" ; } } ; JMXServerJob server = new JMXServerJob ( ) ; server . setRoot ( root ) ; server . setArooaSession ( new StandardArooaSession ( ) ) ; server . setUrl ( "" ) ; server . start ( ) ; JMXClientJob client = new JMXClientJob ( ) ; client . setConnection ( server . getAddress ( ) ) ; client . setArooaSession ( new StandardArooaSession ( ) ) ; client . run ( ) ; Object [ ] children = Helper . getChildren ( client ) ; assertEquals ( 1 , children . length ) ; assertEquals ( "test" , children [ 0 ] . toString ( ) ) ; client . stop ( ) ; server . stop ( ) ; } public static class Component { public String getFruit ( ) { return "apples" ; } } private class OurSession extends StandardArooaSession { SimpleBeanRegistry registry = new SimpleBeanRegistry ( ) ; @ Override public BeanRegistry getBeanRegistry ( ) { return registry ; } } public void testLinkedServers ( ) throws Exception { ArooaSession server2Session = new OurSession ( ) ; Component comp1 = new Component ( ) ; server2Session . getBeanRegistry ( ) . register ( "fred" , comp1 ) ; JMXServerJob server2 = new JMXServerJob ( ) ; server2 . setRoot ( comp1 ) ; server2 . setArooaSession ( server2Session ) ; server2 . setUrl ( "" ) ; server2 . start ( ) ; OurSession server1Session = new OurSession ( ) ; JMXClientJob client = new JMXClientJob ( ) ; server1Session . registry . register ( "client" , client ) ; client . setArooaSession ( server1Session ) ; client . setConnection ( server2 . getAddress ( ) ) ; client . run ( ) ; JMXServerJob server1 = new JMXServerJob ( ) ; server1 . setRoot ( client ) ; server1 . setUrl ( "" ) ; server1 . setArooaSession ( new OurEmptyRegistrySession ( ) ) ; server1 . start ( ) ; Object o = server1Session . registry . lookup ( "client/fred" ) ; assertNotNull ( o ) ; DynaBean db = ( DynaBean ) o ; assertEquals ( "apples" , db . get ( "fruit" ) ) ; client . stop ( ) ; server1 . stop ( ) ; server2 . stop ( ) ; } public void testNestedOddjob ( ) throws Exception { String EOL = System . getProperty ( "" ) ; final String xml = "" + EOL + " <job>" + EOL + "" + EOL + " <jobs>" + EOL + "" + EOL + "" + EOL + "" + EOL + "" + EOL + "" + EOL + "" + EOL + "" + EOL + "" + EOL + "" + EOL + "" + EOL + "" + EOL + "" + EOL + " </jobs>" + EOL + "" + EOL + " </job>" + EOL + "</oddjob>" + EOL ; final Oddjob oj = new Oddjob ( ) ; oj . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oj . run ( ) ; assertNotNull ( new OddjobLookup ( oj ) . lookup ( "oj/echo" ) ) ; JMXClientJob client = new JMXClientJob ( ) ; client . setArooaSession ( new StandardArooaSession ( ) ) ; client . setConnection ( ( String ) new OddjobLookup ( oj ) . lookup ( "" ) ) ; client . run ( ) ; oj . setConfiguration ( new XMLConfiguration ( "TEST" , xml ) ) ; oj . run ( ) ; Object o = new OddjobLookup ( client ) . lookup ( "oj" ) ; assertNotNull ( | |
436 | <s> package com . aptana . rdt . core . gems ; import java . util . List ; import java . util . Set ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . debug . core . ILaunchConfiguration ; public interface IGemManager { public static final String DEFAULT_GEM_HOST = "" ; public ILaunchConfiguration run ( String args ) throws CoreException ; public Set < Gem > getGems ( ) ; public Set < Gem > getRemoteGems ( ) ; public IStatus installGem ( Gem gem , IProgressMonitor monitor ) ; public IStatus installGem ( Gem gem , boolean includeDependencies , IProgressMonitor monitor ) ; public IStatus installGem ( Gem gem , String sourceURL , IProgressMonitor monitor ) ; public IStatus removeGem ( Gem gem , IProgressMonitor monitor ) ; public IStatus update ( Gem gem , IProgressMonitor monitor ) ; public IStatus updateAll ( IProgressMonitor monitor ) ; public boolean gemInstalled ( String gemName ) ; public IStatus refresh ( IProgressMonitor monitor ) ; | |
437 | <s> package net . sf . sveditor . core . scanner ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . eclipse . core . runtime . NullProgressMonitor ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . ISVDBNamedItem ; import net . sf . sveditor . core . db . ISVDBScopeItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBMacroDef ; import net . sf . sveditor . core . db . index . SVDBFileTree ; import net . sf . sveditor . core . db . index . cache . ISVDBIndexCache ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; public class FileContextSearchMacroProvider implements IPreProcMacroProvider { private Map < String , SVDBMacroDef > fMacroCache ; private ISVDBIndexCache fIndexCache ; private Map < String , SVDBFileTree > fWorkingSet ; private SVDBFileTree fContext ; private boolean fDebugEnS = false ; private int fIndent = 0 ; private LogHandle fLog ; public FileContextSearchMacroProvider ( ISVDBIndexCache cache , Map < String , SVDBFileTree > working_set ) { fIndexCache = cache ; fWorkingSet = working_set ; fMacroCache = new HashMap < String , SVDBMacroDef > ( ) ; fLog = LogFactory . getLogHandle ( "" ) ; } public void setFileContext ( SVDBFileTree context ) { fContext = context ; } public void addMacro ( SVDBMacroDef macro ) { if ( fMacroCache . containsKey ( macro . getName ( ) ) ) { fMacroCache . remove ( macro . getName ( ) ) ; } fMacroCache . put ( macro . getName ( ) , macro ) ; } public SVDBMacroDef findMacro ( String name , int lineno ) { if ( fMacroCache . containsKey ( name ) ) { return fMacroCache . get ( name ) ; } else { return searchContext ( fContext , name ) ; } } public void setMacro ( String key , String value ) { if ( fMacroCache . containsKey ( key ) ) { fMacroCache . get ( key ) . setDef ( value ) ; } else { SVDBMacroDef def = new SVDBMacroDef ( key , value ) ; fMacroCache . put ( key , def ) ; } } protected SVDBMacroDef searchContext ( SVDBFileTree context , String key ) { SVDBMacroDef ret ; debug_s ( indent ( fIndent ++ ) + "" + context . getFilePath ( ) + ", \"" + key + "\")" ) ; if ( ( ret = fMacroCache . get ( key ) ) == null ) { if ( ( ret = searchDown ( context , context , key ) ) == null ) { for ( String ib_s : context . getIncludedByFiles ( ) ) { SVDBFileTree ib ; if ( fWorkingSet . containsKey ( ib_s ) ) { ib = fWorkingSet . get ( ib_s ) ; } else { ib = fIndexCache . getFileTree ( new NullProgressMonitor ( ) , ib_s ) ; } if ( ib == null ) { fLog . error ( "" + ib_s + "" ) ; fLog . error ( "" + fContext . getFilePath ( ) ) ; continue ; } ret = searchUp ( context , ib , context , key ) ; } } if ( ret != null ) { if ( fMacroCache . containsKey ( key ) ) { fMacroCache . remove ( key ) ; } fMacroCache . put ( key , ret ) ; } } debug_s ( indent ( -- fIndent ) + "" + context . getFilePath ( ) + ", \"" + key + "\"" ) ; return ret ; } private SVDBMacroDef searchLocal ( SVDBFileTree file , ISVDBScopeItem context , String key ) { SVDBMacroDef m = null ; debug_s ( indent ( fIndent ++ ) + "" + file . getFilePath ( ) + ", \"" + key + "\"" ) ; for ( ISVDBItemBase it : context . getItems ( ) ) { debug_s ( " it=" + ( ( ISVDBNamedItem ) it ) . getName ( ) ) ; if ( it . getType ( ) == SVDBItemType . MacroDef && ( ( ISVDBNamedItem ) it ) . getName ( ) . equals ( key ) ) { m = ( SVDBMacroDef ) it ; } else if ( it instanceof ISVDBScopeItem ) { m = searchLocal ( file , ( ISVDBScopeItem ) it , key ) ; } if ( m != null ) { break ; } } debug_s ( indent ( -- fIndent ) + "" + file . getFilePath ( ) + ", \"" + key + "\"" ) ; return m ; } private SVDBMacroDef searchDown ( SVDBFileTree boundary , SVDBFileTree context , String key ) { SVDBMacroDef m = null ; debug_s ( indent ( fIndent ++ ) + "" + context . getFilePath ( ) + ", \"" + key + | |
438 | <s> package org . rubypeople . rdt . internal . testunit . util ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . IStatus ; import org . rubypeople . rdt . internal . testunit . ui . TestunitPlugin ; public class TestUnitStatus implements IStatus { private String fStatusMessage ; private int fSeverity ; public TestUnitStatus ( ) { this ( OK , null ) ; } public TestUnitStatus ( int severity , String message ) { fStatusMessage = message ; fSeverity = severity ; } public static IStatus createError ( String message ) { return new TestUnitStatus ( IStatus . ERROR , message ) ; } public static IStatus createWarning ( String message ) { return new TestUnitStatus ( IStatus . WARNING , message ) ; } public static IStatus createInfo ( String message ) { return new TestUnitStatus ( IStatus . INFO , message ) ; } public boolean isOK ( ) { return fSeverity == IStatus . OK ; } public boolean isWarning ( ) { return | |
439 | <s> package com . asakusafw . compiler . flow . processor . operator ; import java . util . List ; import com . asakusafw . compiler . flow . processor . MasterJoinFlowProcessor ; import com . asakusafw . compiler . flow . testing . model . | |
440 | <s> package org . rubypeople . rdt . refactoring . action ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . action . MenuManager ; import org . eclipse . ui . actions . ActionGroup ; import org . rubypeople . rdt . refactoring . core . IRefactoringContext ; import org . rubypeople . rdt . refactoring . core . RefactoringContext ; import org . rubypeople . rdt . refactoring . core . convertlocaltofield . ConvertLocalToFieldRefactoring ; import org . rubypeople . rdt . refactoring . core . encapsulatefield . EncapsulateFieldRefactoring ; import org . rubypeople . rdt . refactoring . core . extractconstant . ExtractConstantRefactoring ; import org . rubypeople . rdt . refactoring . core . extractmethod . ExtractMethodRefactoring ; import org . rubypeople . rdt . refactoring . core . generateaccessors . GenerateAccessorsRefactoring ; import org . rubypeople . rdt . refactoring . core . generateconstructor . GenerateConstructorRefactoring ; import org . rubypeople . rdt . refactoring . core . inlineclass . InlineClassRefactoring ; import org . rubypeople . rdt . refactoring . core . inlinelocal . InlineLocalRefactoring ; import org . rubypeople . rdt . refactoring . core . inlinemethod . InlineMethodRefactoring ; import org . rubypeople . rdt . refactoring . core . mergeclasspartsinfile . MergeClassPartsInFileRefactoring ; import org . rubypeople . rdt . refactoring . core . mergewithexternalclassparts . MergeWithExternalClassPartsRefactoring ; import org . rubypeople . rdt . refactoring . core . movefield . MoveFieldRefactoring ; import org . rubypeople . rdt . refactoring . core . movemethod . MoveMethodRefactoring ; import org . rubypeople . rdt . refactoring . core . overridemethod . OverrideMethodRefactoring ; import org . rubypeople . rdt . refactoring . core . pullup . PullUpRefactoring ; import org . rubypeople . rdt . refactoring . core . pushdown . PushDownRefactoring ; import org . rubypeople . rdt . refactoring . core . rename . RenameRefactoring ; import org . rubypeople . rdt . refactoring . core . splitlocal . SplitTempRefactoring ; import org . rubypeople . rdt . ui . actions . RubyActionGroup ; public class RefactoringActionGroup extends ActionGroup { public void fillContextMenu ( IMenuManager menu ) { IRefactoringContext selectionProvider = new RefactoringContext ( null ) ; IMenuManager source = menu . findMenuUsingPath ( RubyActionGroup . MENU_ID ) ; addSourceMenuItems ( source , selectionProvider ) ; menu . insertAfter ( RubyActionGroup . MENU_ID , getRefactorMenu ( selectionProvider ) ) ; } private IMenuManager getRefactorMenu ( IRefactoringContext selectionProvider ) { IMenuManager submenu = new MenuManager ( Messages . RefactoringActionGroup ) ; | |
441 | <s> package com . asakusafw . yaess . core ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Properties ; import java . util . Set ; import java . util . TreeSet ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; public class FlowScriptTest { @ Rule public final TemporaryFolder folder = new TemporaryFolder ( ) ; @ Test public void simple ( ) throws Exception { Map < ExecutionPhase , List < ? extends ExecutionScript > > exec = new HashMap < ExecutionPhase , List < ? extends ExecutionScript > > ( ) ; exec . put ( ExecutionPhase . MAIN , Arrays . asList ( hadoop ( 1 ) ) ) ; FlowScript script = new FlowScript ( "testing" , set ( "b1" , "b2" ) , exec ) ; assertThat ( script . getId ( ) , is ( "testing" ) ) ; assertThat ( script . getBlockerIds ( ) , is ( set ( "b1" , "b2" ) ) ) ; assertThat ( script . getScripts ( ) . size ( ) , is ( ExecutionPhase . values ( ) . length ) ) ; assertThat ( script . getScripts ( ) . get ( ExecutionPhase . MAIN ) , hasItem ( hadoop ( 1 ) ) ) ; } @ Test public void loadFlow ( ) throws Exception { Map < ExecutionPhase , List < ? extends ExecutionScript > > exec = new HashMap < ExecutionPhase , List < ? extends ExecutionScript > > ( ) ; exec . put ( ExecutionPhase . IMPORT , Arrays . asList ( command ( 0 ) ) ) ; exec . put ( ExecutionPhase . MAIN , Arrays . asList ( hadoop ( 1 ) , command ( 2 , 1 ) ) ) ; exec . put ( ExecutionPhase . EXPORT , Arrays . asList ( command ( 100 ) ) ) ; FlowScript script = new FlowScript ( "testing" , set ( "b1" , "b2" ) , exec ) ; exec . put ( ExecutionPhase . INITIALIZE , Arrays . asList ( command ( 100 ) ) ) ; FlowScript dummy = new FlowScript ( "dummy" , set ( ) , exec ) ; Properties p = new Properties ( ) ; script . storeTo ( p ) ; dummy . storeTo ( p ) ; FlowScript loaded = FlowScript . load ( p , "testing" ) ; assertThat ( loaded , is ( script ) ) ; } @ Test ( expected = IllegalArgumentException . class ) public void loadFlow_missing ( ) throws Exception { Properties p = new Properties ( ) ; FlowScript . load ( p , "testing" ) ; } @ Test public void loadPhase ( ) throws Exception { Map < ExecutionPhase , List < ? extends ExecutionScript > > exec = new HashMap < ExecutionPhase , List < ? extends ExecutionScript > > ( ) ; exec . put ( ExecutionPhase . IMPORT , Arrays . asList ( command ( 0 ) ) ) ; exec . put ( ExecutionPhase . MAIN , Arrays . asList ( hadoop ( 1 ) , command ( 2 , 1 ) ) ) ; exec . put ( ExecutionPhase . EXPORT , Arrays . asList ( command ( 100 ) ) ) ; FlowScript script = new FlowScript ( "testing" , set ( "b1" , "b2" ) , exec ) ; exec . put ( ExecutionPhase . INITIALIZE , Arrays . asList ( command ( 100 ) ) ) ; FlowScript dummy = new FlowScript ( "dummy" , set ( ) , exec ) ; Properties p = new Properties ( ) ; script . storeTo ( p ) ; dummy . storeTo ( p ) ; Set < ExecutionScript > loaded = FlowScript . load ( p , "testing" , ExecutionPhase . MAIN ) ; assertThat ( loaded . size ( ) , is ( 2 ) ) ; assertThat ( loaded , hasItem ( hadoop ( 1 ) ) ) ; assertThat ( loaded , hasItem ( command ( 2 , 1 ) ) ) ; } @ Test public void loadPhase_empty ( ) throws Exception { Map < ExecutionPhase , List < ? extends ExecutionScript > > exec = new HashMap < ExecutionPhase , List < ? extends ExecutionScript > > ( ) ; FlowScript script = new FlowScript ( "testing" , set ( "b1" , "b2" ) , exec ) ; exec . put ( ExecutionPhase . INITIALIZE , Arrays . asList ( command ( 100 ) ) ) ; FlowScript dummy = new FlowScript ( "dummy" , set ( ) , exec ) ; Properties p = new Properties ( ) ; script . storeTo ( p ) ; dummy . | |
442 | <s> package net . sf . sveditor . core . docs . html ; public interface IHTMLIcons { String OBJ_ICONS = "" ; String MODULE_OBJ = OBJ_ICONS + "" ; String INT_OBJ = OBJ_ICONS + "int_obj.gif" ; String CLASS_OBJ = OBJ_ICONS | |
443 | <s> package org . rubypeople . rdt . internal . ui . dialogs ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . CLabel ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . widgets . Composite ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; public class MessageLine extends CLabel { private Color fNormalMsgAreaBackground ; private Color fErrorMsgAreaBackground ; public MessageLine ( Composite parent ) { this ( parent , SWT . LEFT ) ; } public void setErrorBackground ( Color color ) { fErrorMsgAreaBackground = color ; } public MessageLine ( Composite parent , int style ) { super ( parent , style ) ; fNormalMsgAreaBackground = getBackground ( ) ; fErrorMsgAreaBackground = null ; } private Image findImage ( IStatus status ) { if ( status . isOK ( ) ) { return null ; } else if ( status . matches ( IStatus . ERROR ) ) { return RubyPluginImages . get ( RubyPluginImages . IMG_OBJS_ERROR ) ; } else if ( status . matches | |
444 | <s> package com . asakusafw . dmdl . windgate . common . driver ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . List ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . jsr199 . testing . VolatileJavaFile ; import com . asakusafw . utils . java . model . syntax . PackageDeclaration ; import com . asakusafw . utils . java . model . util . Emitter ; public class VolatileEmitter extends | |
445 | <s> package org . oddjob . launch ; import java . io . File ; import java . io . IOException ; import java . util . Arrays ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; public class FileSpecTest extends TestCase { private static final Logger logger = Logger . getLogger ( FileSpecTest . class ) ; public void testMatch ( ) { assertEquals ( true , FileSpec . match ( "apple" , "apple" , false ) ) ; assertEquals ( true , FileSpec . match ( "*apple*" , "apple" , false ) ) ; assertEquals ( true , FileSpec . match ( "ap?le" , "apple" , false | |
446 | <s> package org . rubypeople . rdt . internal . ui . refactoring ; import org . eclipse . core . runtime . IAdapterFactory ; import org . eclipse . ltk . core . refactoring . TextEditBasedChange ; import org . eclipse . ltk | |
447 | <s> import java . awt . HeadlessException ; import java . awt . Image ; import java . awt . Toolkit ; import java . awt . TrayIcon ; import java . awt . datatransfer . Clipboard ; import java . awt . datatransfer . DataFlavor ; import java . awt . datatransfer . StringSelection ; import java . awt . datatransfer . Transferable ; import java . awt . datatransfer . UnsupportedFlavorException ; import java . awt . image . BufferedImage ; import java . awt . image . RenderedImage ; import java . io . BufferedReader ; import java . io . ByteArrayOutputStream ; import java . io . File ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . net . URL ; import java . net . URLConnection ; import java . net . URLEncoder ; import javax . imageio . ImageIO ; import org . apache . commons . codec . binary . Base64 ; public class Upload extends Thread { String IMGUR_POST_URI = "" ; String PASTEBIN_URI = "" ; String PASTEBIN_LOGIN_URI = "" ; String PASTEBIN_API_KEY = "" ; String PASTEBIN_USER_KEY ; String IMGUR_API_KEY = "" ; String pastebinError = "Uknown Error" ; String [ ] imgUrl = null ; Transferable t = Toolkit . getDefaultToolkit ( ) . getSystemClipboard ( ) . getContents ( null ) ; Thread uploadThread ; BufferedImage image ; Tray tray ; boolean imageUpload = true ; String uploadText ; ByteArrayOutputStream baos ; public Upload ( BufferedImage image , Tray ol , boolean imageUpload ) { this . imageUpload = imageUpload ; this . image = image ; this . tray = ol ; uploadThread = new Thread ( this ) ; uploadThread . start ( ) ; } public Upload ( boolean imageUpload , Tray ol ) { this . tray = ol ; this . imageUpload = imageUpload ; uploadText = getClipboard ( ) ; uploadThread = new Thread ( this ) ; uploadThread . start ( ) ; } public Upload ( ) { } @ Override public void run ( ) { tray . trayIcon . displayMessage ( "Uploading..." , "" , TrayIcon . MessageType . INFO ) ; if ( imageUpload ) { boolean uploaded = uploadImage ( image ) ; if ( uploaded ) { tray . trayIcon . displayMessage ( "" , "" , TrayIcon . MessageType . INFO ) ; } else tray . trayIcon . displayMessage ( "" , "" , TrayIcon . MessageType . WARNING ) ; } else { boolean uploaded = uploadText ( uploadText ) ; if ( uploaded ) { tray . trayIcon . displayMessage ( "" , "" , TrayIcon . MessageType . INFO ) ; } else tray . trayIcon . displayMessage ( "" , pastebinError , TrayIcon . MessageType . WARNING ) ; } } private Boolean uploadImage ( BufferedImage img ) { try { baos = new ByteArrayOutputStream ( ) ; ImageIO . write ( img , "png" , baos ) ; URL url = new URL ( IMGUR_POST_URI ) ; String data = URLEncoder . encode ( "image" , "UTF-8" ) + "=" + URLEncoder . encode ( Base64 . encodeBase64String ( baos . toByteArray ( ) ) . toString ( ) , "UTF-8" ) ; data += "&" + URLEncoder . encode ( "key" , "UTF-8" ) + "=" + URLEncoder . encode ( IMGUR_API_KEY , "UTF-8" ) ; URLConnection conn = url . openConnection ( ) ; conn . setDoOutput ( true ) ; OutputStreamWriter wr = new OutputStreamWriter ( conn . getOutputStream ( ) ) ; wr | |
448 | <s> package de . fuberlin . wiwiss . d2rq . helpers ; import java . util . Arrays ; import java . util . Collection ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Set ; import junit . framework . TestCase ; import org . apache . log4j . Level ; import org . apache . log4j . Logger ; import com . hp . hpl . jena . query . Query ; import com . hp . hpl . jena . query . QueryExecution ; import com . hp . hpl . jena . query . QueryExecutionFactory ; import com . hp . hpl . jena . query . QueryFactory ; import com . hp . hpl . jena . query . QuerySolution ; import com . hp . hpl . jena . query . ResultSet ; import com . hp . hpl . jena . rdf . model . RDFNode ; import com . hp . hpl . jena . sparql . vocabulary . FOAF ; import com . hp . hpl . jena . vocabulary . DC ; import de . fuberlin . wiwiss . d2rq . jena . ModelD2RQ ; import de . fuberlin . wiwiss . d2rq . sql . BeanCounter ; import de . fuberlin . wiwiss . d2rq . vocab . ISWC ; import de . fuberlin . wiwiss . d2rq . vocab . SKOS ; public abstract class QueryLanguageTestFramework extends TestCase { protected ModelD2RQ model ; protected Set < Map < String , RDFNode > > results ; protected String queryString ; protected Map < String , RDFNode > currentSolution = new HashMap < String , RDFNode > ( ) ; int nTimes = 1 ; BeanCounter startInst ; boolean compareQueryHandlers = false ; int configs ; BeanCounter diffInfo [ ] ; Set < Map < String , RDFNode > > resultMaps [ ] ; String printed [ ] ; String handlerDescription [ ] ; boolean usingD2RQ [ ] ; boolean verbatim [ ] ; @ SuppressWarnings ( "unchecked" ) protected void setUpHandlers ( ) { configs = 2 ; diffInfo = new BeanCounter [ configs ] ; resultMaps = new HashSet [ configs ] ; printed = new String [ configs ] ; handlerDescription = new String [ ] { "" , "" } ; usingD2RQ = new boolean [ ] { false , true } ; verbatim = new boolean [ ] { false , true } ; } private final static String pckg = "" ; protected static Logger bigStringInResultLogger = Logger . getLogger ( pckg + "" ) ; protected Logger dumpLogger = Logger . getLogger ( pckg + "Dump" ) ; protected Logger usingLogger = Logger . getLogger ( pckg + "Using" ) ; protected Logger testCaseSeparatorLogger = Logger . getLogger ( pckg + "" ) ; protected Logger performanceLogger = Logger . getLogger ( pckg + "Performance" ) ; protected Logger queryLogger = Logger . getLogger ( pckg + "Query" ) ; protected Logger differentLogger = Logger . getLogger ( pckg + "Different" ) ; protected Logger differenceLogger = Logger . getLogger ( pckg + "Difference" ) ; protected Logger sqlResultSetLogger = Logger . getLogger ( pckg + "SQLResultSet" ) ; protected Logger oldSQLResultSetLogger ; protected Logger oldSQLResultSetSeparatorLogger ; public QueryLanguageTestFramework ( ) { super ( ) ; setUpHandlers ( ) ; } protected void setUpShowPerformance ( ) { nTimes = 10 ; compareQueryHandlers = true ; queryLogger . setLevel ( Level . DEBUG ) ; queryLogger . setLevel ( Level . DEBUG ) ; performanceLogger . setLevel ( Level . DEBUG ) ; } protected void setUpMixOutputs ( boolean v ) { compareQueryHandlers = v ; usingLogger . setLevel ( v ? Level . DEBUG : Level . INFO ) ; testCaseSeparatorLogger . setLevel ( v ? Level . DEBUG : Level . INFO ) ; } protected void setUpShowStatements ( ) { queryLogger . setLevel ( Level . DEBUG ) ; sqlResultSetLogger . setLevel ( Level . DEBUG ) ; } protected void setUpShowErrors ( ) { differentLogger . setLevel ( Level . DEBUG ) ; differenceLogger . setLevel ( Level . DEBUG ) ; } protected void setUpShowWarnings ( ) { bigStringInResultLogger . setLevel ( Level . DEBUG ) ; } protected void setUpShowAll ( ) { setUpMixOutputs ( true ) ; verbatim [ 0 ] = true ; setUpShowPerformance ( ) ; setUpShowStatements ( ) ; setUpShowErrors ( ) ; setUpShowWarnings ( ) ; } protected abstract String mapURL ( ) ; protected void setUp ( ) throws Exception { this . model = new ModelD2RQ ( mapURL ( ) , "TURTLE" , "http://test/" ) ; setUpShowErrors ( ) ; } protected void tearDown ( ) throws Exception { this . model . close ( ) ; this . results = null ; super . tearDown ( ) ; } public void runTest ( ) throws Throwable { testCaseSeparatorLogger . debug ( "" ) ; if ( ! compareQueryHandlers ) { super . runTest ( ) ; return ; } Level oldQueryLoggerState = queryLogger . getLevel ( ) ; Level oldSqlResultSetLoggerState = sqlResultSetLogger . getLevel ( ) ; try { for ( int i = 0 ; i < configs ; i ++ ) { queryLogger . setLevel ( verbatim [ i ] ? oldQueryLoggerState : Level . INFO ) ; sqlResultSetLogger . setLevel ( verbatim [ i ] ? oldSqlResultSetLoggerState : Level . INFO ) ; usingLogger . debug ( "using " + handlerDescription [ i ] + " ..." ) ; startInst = BeanCounter . instance ( ) ; for ( int j = 0 ; j < nTimes ; j ++ ) { if ( j > 0 ) { queryLogger . setLevel ( Level . INFO ) ; sqlResultSetLogger . setLevel ( Level . INFO ) ; } super . runTest ( ) ; } diffInfo [ i ] = BeanCounter . instanceMinus ( startInst ) ; diffInfo [ i ] . div ( nTimes ) ; resultMaps [ i ] = results ; } performanceLogger . debug ( handlerDescription [ 0 ] + " vs. " + handlerDescription [ 1 ] + " = " + diffInfo [ 0 ] . sqlPerformanceString ( ) + " : " + diffInfo [ 1 ] . sqlPerformanceString ( ) + "" ) ; if ( ! resultMaps [ 0 ] . equals ( resultMaps [ 1 ] ) ) { differentLogger . debug ( handlerDescription [ 0 ] + " vs. " + handlerDescription [ 1 ] + "" + resultMaps [ | |
449 | <s> package net . sf . sveditor . core . tests . index . cache ; import junit . framework . Test ; import junit . framework . TestSuite ; public class IndexCacheTests extends TestSuite { public static Test suite ( ) { TestSuite suite = new TestSuite ( "IndexTests" ) ; suite . addTest | |
450 | <s> package com . asakusafw . yaess . bootstrap ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import java . util . WeakHashMap ; public class SerialExecutionTracker implements ExecutionTracker { private static final Map < Id , List < Record > > map = new WeakHashMap < ExecutionTracker . Id , List < Record > > ( ) ; @ Override public synchronized void add ( Id id , Record record ) throws IOException , InterruptedException { List < Record > history = map . get ( id ) ; if ( history == null ) { history = new ArrayList < Record | |
451 | <s> package org . rubypeople . rdt . refactoring . nodewrapper ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . ArgsNode ; import org . jruby . ast . ArgumentNode ; import org . jruby . ast . BlockArgNode ; import org . jruby . ast . ListNode ; import org . jruby . ast . RestArgNode ; import org . rubypeople . rdt . refactoring . core . NodeFactory ; public class ArgsNodeWrapper implements INodeWrapper { private ArgsNode argsNode ; private Collection < String > argumentNames ; public ArgsNodeWrapper ( ArgsNode argsNode ) { this . argsNode = argsNode ; argumentNames = new ArrayList < String > ( ) ; if ( hasArgs ( ) ) { ListNode list = argsNode . getArgs ( ) ; for ( Object obj : list . childNodes ( ) ) { if ( obj instanceof ArgumentNode ) { argumentNames . add ( ( ( ArgumentNode ) obj ) . getName ( ) ) ; } } } } public String getArgsListAsString ( ) { if ( ! hasArgs ( ) ) return "" ; StringBuilder argList = new StringBuilder ( ) ; for ( String argName : argumentNames ) { argList . append ( argName + ", " ) ; } return ' ' + argList . substring ( 0 , argList . length ( ) - 2 ) ; } public Collection < String > getArgsList ( ) { return argumentNames ; } public boolean hasArgs ( ) { return argsNode . getRequiredArgsCount ( ) != | |
452 | <s> package org . oddjob . util ; import java . io . File ; import java . io . IOException ; import java . lang . reflect . InvocationTargetException ; import java . lang . reflect . Method ; import java . net . URISyntaxException ; import java . net . URL ; import java . net . URLClassLoader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . OurDirs ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . io . FilesType ; import org . oddjob . logging . LogEvent ; import org . oddjob . logging . LogLevel ; import org . oddjob . logging . LogListener ; import org . oddjob . tools . CompileJob ; public class URLClassLoaderTypeTest extends TestCase { private static final Logger logger = Logger . getLogger ( URLClassLoaderTypeTest . class ) ; @ Override protected void setUp ( ) throws Exception { super . setUp ( ) ; logger . debug ( "" + getName ( ) + "" ) ; logger . debug ( "" + ClassLoader . getSystemClassLoader ( ) + ", Context=" + Thread . currentThread ( ) . getContextClassLoader ( ) ) ; ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( cl instanceof URLClassLoader ) { URL [ ] urls = ( ( URLClassLoader ) cl ) . getURLs ( ) ; logger . debug ( "URLS: " + Arrays . toString ( urls ) ) ; } } public void testLoadMixedJob ( ) throws Exception { ClassLoader existingContextClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; OurDirs dirs = new OurDirs ( ) ; File check = dirs . relative ( "" ) ; if ( ! check . exists ( ) ) { compileSample ( dirs ) ; } URLClassLoaderType test = new URLClassLoaderType ( ) ; test . setFiles ( new File [ ] { dirs . relative ( "" ) } ) ; test . setParent ( getClass ( ) . getClassLoader ( ) ) ; assertEquals ( "" + dirs . relative ( "" ) . toString ( ) + "]" , test . toString ( ) ) ; ClassLoader classLoader = test . toValue ( ) ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setClassLoader ( classLoader ) ; String xml = "<oddjob>" + "<job>" + "" + "</job>" + "</oddjob>" ; oddjob . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oddjob . run ( ) ; OddjobLookup lookup = new OddjobLookup ( oddjob ) ; ClassLoader classLoaderWhenRunning = lookup . lookup ( "" , ClassLoader . class ) ; ClassLoader jobClassLoader = lookup . lookup ( "" , ClassLoader . class ) ; assertEquals ( classLoader , jobClassLoader ) ; assertEquals ( classLoader , classLoaderWhenRunning ) ; assertEquals ( existingContextClassLoader , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; } static public void compileSample ( final OurDirs dirs ) { File dir = dirs . relative ( "" ) ; if ( new File ( dir , "AJob.class" ) . exists ( ) ) { return ; } FilesType sources = new FilesType ( ) ; sources . setFiles ( dirs . relative ( "" ) . getPath ( ) + File . separator + "*.java" ) ; CompileJob compile = new CompileJob ( ) ; compile . setFiles ( sources . toFiles ( ) ) ; compile . run ( ) ; if ( compile . getResult ( ) != 0 ) { throw new RuntimeException ( "" ) ; } } public void testInOddjob ( ) throws URISyntaxException { OurDirs dirs = new OurDirs ( ) ; compileSample ( dirs ) ; URL url = getClass ( ) . getClassLoader ( ) . getResource ( "" ) ; File file = new File ( url . toURI ( ) ) ; Oddjob oddjob = new Oddjob | |
453 | <s> package com . asakusafw . bulkloader . common ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . sql . Connection ; import java . sql . DriverManager ; import java . sql . PreparedStatement ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . sql . Statement ; import java . text . MessageFormat ; import java . util . Properties ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . log . Log ; public final class DBConnection { static final Log LOG = new Log ( DBConnection . class ) ; private static final Class < ? > CLASS = DBConnection . class ; private static volatile boolean initialized = false ; private DBConnection ( ) { return ; } public static void init ( String jdbcDriverName ) throws BulkLoaderSystemException { try { Class . forName ( jdbcDriverName ) . newInstance ( ) ; initialized = true ; } catch ( NullPointerException e ) { throw new BulkLoaderSystemException ( e , CLASS , "" , jdbcDriverName ) ; } catch ( InstantiationException e ) { throw new BulkLoaderSystemException ( e , CLASS , "" , jdbcDriverName ) ; } catch ( IllegalAccessException e ) { throw new BulkLoaderSystemException ( e , CLASS , "" , jdbcDriverName ) ; } catch ( ClassNotFoundException e ) { throw new BulkLoaderSystemException ( e , CLASS , "" , jdbcDriverName ) ; } } public static Connection getConnection ( ) throws BulkLoaderSystemException { Connection conn = null ; FileInputStream fis = null ; if ( ! initialized ) { throw new BulkLoaderSystemException ( CLASS , "" , "-UNK-" ) ; } String url = ConfigurationLoader . getProperty ( Constants . PROP_KEY_DB_URL ) ; String user = ConfigurationLoader . getProperty ( Constants . PROP_KEY_DB_USER ) ; String password = ConfigurationLoader . getProperty ( Constants . PROP_KEY_DB_PASSWORD ) ; String param = ConfigurationLoader . getProperty ( Constants . PROP_KEY_NAME_DB_PRAM ) ; try { if ( param != null && ! param | |
454 | <s> package com . melloware . jintellitype ; public interface JIntellitypeConstants { public static final String ERROR_MESSAGE = "" ; public static final int MOD_ALT = 1 ; public static final int MOD_CONTROL = 2 ; public static final int MOD_SHIFT = 4 ; public static final int MOD_WIN = 8 ; public static final int APPCOMMAND_BROWSER_BACKWARD = 1 ; public static final int APPCOMMAND_BROWSER_FORWARD = 2 ; public static final int APPCOMMAND_BROWSER_REFRESH = 3 ; public static final int APPCOMMAND_BROWSER_STOP = 4 ; public static final int APPCOMMAND_BROWSER_SEARCH = 5 ; public static final int APPCOMMAND_BROWSER_FAVOURITES = 6 ; public static final int APPCOMMAND_BROWSER_HOME = 7 ; public static final int APPCOMMAND_VOLUME_MUTE = 8 ; public static final int APPCOMMAND_VOLUME_DOWN = 9 ; public static final int APPCOMMAND_VOLUME_UP = 10 ; public static final int APPCOMMAND_MEDIA_NEXTTRACK = 11 ; public static final int APPCOMMAND_MEDIA_PREVIOUSTRACK = 12 ; public static final int APPCOMMAND_MEDIA_STOP = 13 ; public | |
455 | <s> package net . bioclipse . opentox . ds . wizards ; import java . util . List ; import java . util . Map ; import net . bioclipse . opentox . ds . OpenToxModel ; import org . eclipse . jface . wizard . IWizardPage ; import | |
456 | <s> package com . asakusafw . yaess . jobqueue ; import static com . asakusafw . yaess . jobqueue . client . JobStatus . Kind . * ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . concurrent . ConcurrentHashMap ; import org . junit . Test ; import com . asakusafw . runtime . core . context . RuntimeContext ; import com . asakusafw . runtime . core . context . RuntimeContext . ExecutionMode ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . ExecutionMonitor ; import com . asakusafw . yaess . core . ExecutionPhase ; import com . asakusafw . yaess . core . HadoopScript ; import com . asakusafw . yaess . core . ProfileContext ; import com . asakusafw . yaess . core . ServiceProfile ; import com . asakusafw . yaess . core . VariableResolver ; import com . asakusafw . yaess . jobqueue . client . JobClient ; import com . asakusafw . yaess . jobqueue . client . JobId ; import com . asakusafw . yaess . jobqueue . client . JobScript ; import com . asakusafw . yaess . jobqueue . client . JobStatus ; public class QueueHadoopScriptHandlerTest { @ Test public void execute ( ) throws Exception { MockJobClient c1 = new MockJobClient ( "testing" , COMPLETED ) ; JobClientProfile profile = new JobClientProfile ( "testing" , list ( c1 ) , 1000 , 10 ) ; QueueHadoopScriptHandler handler = create ( ) ; handler . doConfigure ( profile ) ; ExecutionContext context = context ( ) ; HadoopScript script = script ( ) ; handler . execute ( ExecutionMonitor . NULL , context , script ) ; JobScript js = c1 . registered . get ( "testing" ) ; assertThat ( js , is ( notNullValue ( ) ) ) ; assertThat ( js . getBatchId ( ) , is ( context . getBatchId ( ) ) ) ; assertThat ( js . getFlowId ( ) , is ( context . getFlowId ( ) ) ) ; assertThat ( js . getExecutionId ( ) , is ( context . getExecutionId ( ) ) ) ; assertThat ( js . getPhase ( ) , is ( context . getPhase ( ) ) ) ; assertThat ( js . getStageId ( ) , is ( script . getId ( ) ) ) ; assertThat ( js . getMainClassName ( ) , is ( script . getClassName ( ) ) ) ; assertThat ( js . getArguments ( ) , is ( context . getArguments ( ) ) ) ; Map < String , String > properties = new HashMap < String , String > ( ) ; properties . putAll ( map ( "s" , "service" ) ) ; properties . putAll ( script . getHadoopProperties ( ) ) ; assertThat ( js . getProperties ( ) , is ( properties ) ) ; assertThat ( js . getEnvironmentVariables ( ) , is ( script . getEnvironmentVariables ( ) ) ) ; } @ Test public void execute_step ( ) throws Exception { MockJobClient c1 = new MockJobClient ( "testing" , WAITING , RUNNING , COMPLETED ) ; JobClientProfile profile = new JobClientProfile ( "testing" , list ( c1 ) , 100 , 10 ) ; QueueHadoopScriptHandler handler = create ( ) ; handler . doConfigure ( profile ) ; ExecutionContext context = context ( ) ; HadoopScript script = script ( ) ; handler . execute ( ExecutionMonitor . NULL , context , script ) ; } @ Test ( expected = IOException . class ) public void execute_fail ( ) throws Exception { MockJobClient c1 = new MockJobClient ( "testing" ) ; JobStatus fail = new JobStatus ( ) ; fail . setKind ( COMPLETED ) ; fail . setExitCode ( 1 ) ; c1 . add ( fail ) ; JobClientProfile profile = new JobClientProfile ( "testing" , list ( c1 ) , 1000 , 10 ) ; QueueHadoopScriptHandler handler = create ( ) ; handler . doConfigure ( profile ) ; ExecutionContext context = context ( ) ; HadoopScript script = script ( ) ; handler . execute ( ExecutionMonitor . NULL , context , script ) ; } @ Test ( expected = IOException . class ) public void execute_error ( ) throws Exception { MockJobClient c1 = new MockJobClient ( "testing" , ERROR ) ; JobClientProfile profile = new JobClientProfile ( "testing" , list ( c1 ) , 1000 , 10 ) ; QueueHadoopScriptHandler handler = create ( ) ; handler . doConfigure ( profile ) ; ExecutionContext context = context ( ) ; HadoopScript script = script ( ) ; handler . execute ( ExecutionMonitor . NULL , context , script ) ; } @ Test ( expected = IOException . class ) public void execute_aborted ( ) throws Exception { MockJobClient c1 = new MockJobClient ( "testing" ) ; JobClientProfile profile = new JobClientProfile ( "testing" , list ( c1 ) , 1000 , 10 ) ; QueueHadoopScriptHandler handler = create ( ) ; handler . doConfigure ( profile ) ; ExecutionContext context = context ( ) ; HadoopScript script = script ( ) ; handler . execute ( ExecutionMonitor . NULL , context , script ) ; } @ Test ( expected = IOException . class ) public void execute_register_failed ( ) throws Exception { MockJobClient c1 = new MockJobClient ( null , COMPLETED ) ; JobClientProfile profile = new JobClientProfile ( "testing" , list ( c1 ) , 1000 , 10 ) ; QueueHadoopScriptHandler handler = create ( ) ; handler . doConfigure ( profile ) ; ExecutionContext context = context ( ) ; HadoopScript script = script ( ) ; handler . execute ( ExecutionMonitor . NULL , context , script ) ; } @ Test ( expected = IOException . class ) public void execute_register_failover ( ) throws Exception { MockJobClient c1 = new MockJobClient ( null , ERROR ) ; MockJobClient c2 = new MockJobClient ( "testing" , COMPLETED ) ; JobClientProfile profile = new JobClientProfile ( "testing" , list ( c1 ) , 1000 , 10 ) ; QueueHadoopScriptHandler handler = create ( ) ; handler . doConfigure ( profile ) ; ExecutionContext context = context ( ) ; HadoopScript script = script ( ) ; handler . execute ( ExecutionMonitor . NULL , context , script ) ; assertThat ( c2 . count , is ( greaterThan ( 0 ) ) ) ; } @ Test ( expected = IOException . class ) public void execute_register_timeout ( ) throws Exception { MockJobClient c1 = new MockJobClient ( "testing" , ERROR ) { @ Override public JobId register ( JobScript script ) throws IOException , InterruptedException { Thread . sleep ( 10000 ) ; return super . register ( script ) ; } } ; MockJobClient c2 = new MockJobClient ( "testing" , COMPLETED ) ; JobClientProfile profile = new JobClientProfile ( "testing" , list ( c1 ) | |
457 | <s> package org . rubypeople . rdt . astviewer . views ; import java . util . ArrayList ; import java . util . Iterator ; import org . jruby . ast . NewlineNode ; import org . jruby . ast . Node ; import org . jruby . ast . RootNode ; public class AstUtility { public static ArrayList < Node > findAllNodes ( Node rootNode ) { ArrayList < Node > nodes = new ArrayList < Node > ( ) ; if ( rootNode == null ) return nodes ; nodes . add ( rootNode ) ; for ( Object o : rootNode . childNodes ( ) ) { nodes . addAll ( findAllNodes ( ( Node ) o ) ) ; } return nodes ; } public static String nodeList ( ArrayList < Node > nodes ) { StringBuilder str = new StringBuilder ( ) ; for ( Node node : nodes ) { String name = node . getClass ( ) . getName ( ) ; str . append ( name . substring ( name . lastIndexOf ( "." ) + 1 , name . length ( ) ) ) ; str . append ( ", " ) ; } str . deleteCharAt ( str . length ( ) - 1 ) ; str . deleteCharAt ( str . length ( ) - 1 ) ; return str . toString ( ) ; } public static String formatedPosition ( Node n ) { if ( n == null || n . getPosition ( ) == null ) return "" ; StringBuilder posString = new StringBuilder ( ) ; posString . append ( "Lines [" ) ; posString . append ( n . getPosition ( ) . getStartLine ( ) ) ; posString . append ( ":" ) ; posString . append ( n . getPosition ( ) . getEndLine ( ) ) ; posString . append ( "], Offset [" ) ; posString . append ( n . getPosition ( ) . getStartOffset ( ) ) ; posString . append ( ":" ) ; posString . append ( n . getPosition ( ) . getEndOffset ( ) ) ; posString . append ( "]" ) ; return posString . toString ( ) ; } public static String | |
458 | <s> package com . asakusafw . testdriver . directio ; import java . io . IOException ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . testdriver . core . BaseImporterPreparator ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . ImporterPreparator ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . vocabulary . directio . DirectFileInputDescription ; public class DirectFileInputPreparator extends BaseImporterPreparator < DirectFileInputDescription > { static final Logger LOG = LoggerFactory . getLogger ( DirectFileInputPreparator . class ) ; @ Override public void truncate ( DirectFileInputDescription description , TestContext context | |
459 | <s> package org . rubypeople . rdt . ui . wizards ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . text . ITextSelection ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Text ; import org . rubypeople . rdt . core . IBuffer ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . ISourceRange ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . RubyConventions ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . formatter . CodeFormatter ; import org . rubypeople . rdt . core . search . IRubySearchConstants ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchEngine ; import org . rubypeople . rdt . core . util . Util ; import org . rubypeople . rdt . internal . corext . codemanipulation . StubUtility ; import org . rubypeople . rdt . internal . corext . util . CodeFormatterUtil ; import org . rubypeople . rdt . internal . corext . util . RubyModelUtil ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . dialogs . TextFieldNavigationHandler ; import org . rubypeople . rdt . internal . ui . dialogs . TypeSelectionDialog2 ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . SuperModuleSelectionDialog ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . DialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IDialogFieldListener ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IListAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IStringButtonAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . LayoutUtil ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . ListDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . Separator ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . StringButtonDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . StringDialogField ; public abstract class NewTypeWizardPage extends NewContainerWizardPage { private static class InterfaceWrapper { public String interfaceName ; public InterfaceWrapper ( String interfaceName ) { this . interfaceName = interfaceName ; } public int hashCode ( ) { return interfaceName . hashCode ( ) ; } public boolean equals ( Object obj ) { return obj != null && getClass ( ) . equals ( obj . getClass ( ) ) && ( ( InterfaceWrapper ) obj ) . interfaceName . equals ( interfaceName ) ; } } private static class InterfacesListLabelProvider extends LabelProvider { private Image fInterfaceImage ; public InterfacesListLabelProvider ( ) { fInterfaceImage = RubyPluginImages . get ( RubyPluginImages . IMG_OBJS_MODULE ) ; } public String getText ( Object element ) { return ( ( InterfaceWrapper ) element ) . interfaceName ; } public Image getImage ( Object element ) { return fInterfaceImage ; } } private final static String PAGE_NAME = "" ; protected final static String PACKAGE = PAGE_NAME + ".package" ; protected final static String ENCLOSING = PAGE_NAME + ".enclosing" ; protected final static String ENCLOSINGSELECTION = ENCLOSING + ".selection" ; protected final static String TYPENAME = PAGE_NAME + ".typename" ; protected final static String SUPER = PAGE_NAME + ".superclass" ; protected final static String INTERFACES = PAGE_NAME + ".interfaces" ; protected final static String METHODS = PAGE_NAME + ".methods" ; private IType fCurrType ; private StringDialogField fTypeNameDialogField ; private StringButtonDialogField fSuperClassDialogField ; private ListDialogField fSuperModulesDialogField ; private IType fCreatedType ; protected IStatus fTypeNameStatus ; protected IStatus fSuperClassStatus ; protected IStatus fSuperModulesStatus ; private int fTypeKind ; public static final int CLASS_TYPE = 1 ; public static final int INTERFACE_TYPE = 2 ; public NewTypeWizardPage ( boolean isClass , String pageName ) { this ( isClass ? CLASS_TYPE : INTERFACE_TYPE , pageName ) ; } public NewTypeWizardPage ( int typeKind , String pageName ) { super ( pageName ) ; fTypeKind = typeKind ; fCreatedType = null ; TypeFieldsAdapter adapter = new TypeFieldsAdapter ( ) ; fTypeNameDialogField = new StringDialogField ( ) ; fTypeNameDialogField . setDialogFieldListener ( adapter ) ; fTypeNameDialogField . setLabelText ( getTypeNameLabel ( ) ) ; fSuperClassDialogField = new StringButtonDialogField ( adapter ) ; | |
460 | <s> package com . asakusafw . compiler . flow . jobflow ; import java . io . IOException ; import java . util . Collection ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . ExternalIoCommandProvider ; import com . asakusafw . compiler . flow . ExternalIoDescriptionProcessor ; import com . asakusafw . compiler . flow . ExternalIoDescriptionProcessor . Input ; import com . asakusafw . compiler . flow . ExternalIoDescriptionProcessor . IoContext ; import com . asakusafw . compiler . flow . ExternalIoDescriptionProcessor . Output ; import com . asakusafw . compiler . flow . ExternalIoDescriptionProcessor . SourceInfo ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Delivery ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Export ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Import ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Process ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Processible ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Reduce ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . SideData ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Source ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Stage ; import com . asakusafw . compiler . flow . plan . StageGraph ; import com . asakusafw . compiler . flow . stage . StageModel ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Maps ; import com . asakusafw . utils . graph . Graph ; import com . asakusafw . utils . graph . Graphs ; public class JobflowCompiler { static final Logger LOG = LoggerFactory . getLogger ( JobflowCompiler . class ) ; @ SuppressWarnings ( "unused" ) private final FlowCompilingEnvironment environment ; private final JobflowAnalyzer analyzer ; private final StageClientEmitter stageClientEmitter ; private final CleanupStageClientEmitter cleanupStageClientEmitter ; public JobflowCompiler ( FlowCompilingEnvironment environment ) { Precondition . checkMustNotBeNull ( environment , "environment" ) ; this . environment = environment ; this . analyzer = new JobflowAnalyzer ( environment ) ; this . stageClientEmitter = new StageClientEmitter ( environment ) ; this . cleanupStageClientEmitter = new CleanupStageClientEmitter ( environment ) ; } public JobflowModel compile ( StageGraph graph , Collection < StageModel > stageModels ) throws IOException { Precondition . checkMustNotBeNull ( graph , "graph" ) ; Precondition . checkMustNotBeNull ( stageModels , "stageModels" ) ; LOG . debug ( "" , graph . getInput ( ) . getSource ( ) . getDescription ( ) . getName ( ) ) ; JobflowModel jobflow = analyze ( graph , stageModels ) ; compileClients ( jobflow ) ; CompiledJobflow compiled = emit ( jobflow ) ; jobflow . setCompiled ( compiled ) ; reportSummary ( jobflow ) ; return jobflow ; } private JobflowModel analyze ( StageGraph graph , Collection < | |
461 | <s> package org . oddjob . designer . elements ; import org . oddjob . arooa . design . DesignFactory ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignProperty ; import org . oddjob . arooa . design . DesignValueBase ; import org . oddjob . arooa . design . IndexedDesignProperty ; import org . oddjob . arooa . design . SimpleTextAttribute ; import org . oddjob . arooa . design . screem . BorderedGroup ; import org . oddjob . arooa . design . | |
462 | <s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import java . util . ResourceBundle ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . text . ITextOperationTarget ; import org . eclipse . jface . text . Position ; import org . eclipse . jface . text . source . Annotation ; import org . eclipse . jface . text . source . IAnnotationModel ; import org . eclipse . jface . text . source . ISourceViewer ; import org . eclipse . jface . text . source . VerticalRulerEvent ; import org . eclipse . ui . ISelectionListener ; | |
463 | <s> package com . asakusafw . utils . java . model . util ; import java . io . File ; import java . io . IOException ; import java . io . PrintWriter ; import java . nio . charset . Charset ; import java . text . MessageFormat ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . syntax . PackageDeclaration ; import com . asakusafw . utils . java . model . syntax . SimpleName ; public class Filer extends Emitter { private final File outputPath ; private final Charset encoding ; public Filer ( File outputPath , Charset encoding ) { if ( outputPath == null ) { throw new IllegalArgumentException ( "" ) ; } if ( encoding == null ) { throw new IllegalArgumentException ( "" ) ; } this . outputPath = outputPath ; this . encoding = | |
464 | <s> package com . asakusafw . compiler . flow . plan ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . Arrays ; import java . util . Collections ; import java . util . Iterator ; import java . util . List ; import java . util . Set ; import org . junit . Test ; import org . junit . runner . RunWith ; import org . junit . runners . Parameterized ; import org . junit . runners . Parameterized . Parameters ; import com . asakusafw . compiler . flow . FlowCompilerOptions ; import com . asakusafw . compiler . flow . FlowCompilerOptions . GenericOptionValue ; import com . asakusafw . compiler . flow . FlowGraphGenerator ; import com . asakusafw . compiler . flow . FlowGraphRewriter ; import com . asakusafw . vocabulary . flow . graph . Connectivity ; import com . asakusafw . vocabulary . flow . graph . FlowBoundary ; import com . asakusafw . vocabulary . flow . graph . FlowElement ; import com . asakusafw . vocabulary . flow . graph . FlowElementKind ; import com . asakusafw . vocabulary . flow . graph . FlowGraph ; @ RunWith ( Parameterized . class ) public class StagePlannerTest { private final FlowGraphGenerator gen = new FlowGraphGenerator ( ) ; private final GenericOptionValue opt ; @ Parameters public static List < Object [ ] > parameters ( ) { return Arrays . asList ( new Object [ ] [ ] { { GenericOptionValue . DISABLED } , { GenericOptionValue . ENABLED } , } ) ; } public StagePlannerTest ( GenericOptionValue opt ) { this . opt = opt ; } private StagePlanner getPlanner ( ) { FlowCompilerOptions options = new FlowCompilerOptions ( ) ; options . setCompressConcurrentStage ( false ) ; options . setCompressFlowPart ( false ) ; options . setEnableCombiner ( false ) ; options . setEnableDebugLogging ( true ) ; options . setHashJoinForSmall ( false ) ; options . setHashJoinForTiny ( false ) ; options . putExtraAttribute ( StagePlanner . KEY_COMPRESS_FLOW_BLOCK_GROUP , opt . getSymbol ( ) ) ; return new StagePlanner ( Collections . < FlowGraphRewriter > emptyList ( ) , options ) ; } @ Test public void validate_ok ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op" , "in" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op.in" ) . connect ( "op.out" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; assertThat ( getPlanner ( ) . validate ( graph ) , is ( true ) ) ; } @ Test public void validate_notInConnected ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op" , "in opened" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op.in" ) . connect ( "op.out" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; assertThat ( getPlanner ( ) . validate ( graph ) , is ( false ) ) ; } @ Test public void validate_notOutConnected ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op" , "in" , "out opened" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op.in" ) . connect ( "op.out" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; assertThat ( getPlanner ( ) . validate ( graph ) , is ( false ) ) ; } @ Test public void validate_notOutConnected_butOptional ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op" , "in" , "out opened" , Connectivity . OPTIONAL ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op.in" ) . connect ( "op.out" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; assertThat ( getPlanner ( ) . validate ( graph ) , is ( true ) ) ; } @ Test public void validate_looped ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op" , "in" , "out" ) ; gen . defineOperator ( "back" , "in" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op.in" ) . connect ( "op.out" , "out" ) ; gen . connect ( "op" , "back" ) . connect ( "back" , "op" ) ; FlowGraph graph = gen . toGraph ( ) ; assertThat ( getPlanner ( ) . validate ( graph ) , is ( false ) ) ; } @ Test public void validate_componentError ( ) { FlowGraphGenerator comp = new FlowGraphGenerator ( ) ; comp . defineInput ( "in" ) ; comp . defineOperator ( "op" , "in" , "out opened" ) ; comp . defineOutput ( "out" ) ; comp . connect ( "in" , "op.in" ) . connect ( "op.out" , "out" ) ; gen . defineInput ( "in" ) ; gen . defineFlowPart ( "c" , comp . toGraph ( ) ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "c.in" ) . connect ( "c.out" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; assertThat ( getPlanner ( ) . validate ( graph ) , is ( false ) ) ; } @ Test public void insertCheckpoints_insert ( ) { gen . defineInput ( "in1" ) ; gen . defineOperator ( "op1" , "in" , "a b" , FlowBoundary . SHUFFLE ) ; gen . defineOperator ( "op2" , "in" , "out" , FlowBoundary . SHUFFLE ) ; gen . defineOutput ( "out1" ) ; gen . defineOutput ( "out2" ) ; gen . connect ( "in1" , "op1" ) . connect ( "op1.a" , "op2" ) . connect ( "op2" , "out1" ) ; gen . connect ( "op1.b" , "out2" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . insertCheckpoints ( graph ) ; assertThat ( FlowGraphUtil . collectBoundaries ( graph ) , not ( gen . getAsSet ( "in1" , "op1" , "op2" , "out1" , "out2" ) ) ) ; Set < FlowElement > a = FlowGraphUtil . getSucceedingBoundaries ( gen . output ( "op1.a" ) ) ; Set < FlowElement > b = FlowGraphUtil . getSucceedingBoundaries ( gen . output ( "op1.b" ) ) ; assertThat ( a . isEmpty ( ) , is ( false ) ) ; assertThat ( b . isEmpty ( ) , is ( false ) ) ; for ( FlowElement elem : a ) { assertThat ( FlowGraphUtil . isStageBoundary ( elem ) , is ( true ) ) ; } for ( FlowElement elem : b ) { assertThat ( FlowGraphUtil . isStageBoundary ( elem ) , is ( true ) ) ; } } @ Test public void insertCheckpoints_nothing ( ) { gen . defineInput ( "in1" ) ; gen . defineOperator ( "op1" , "in" , "a b" , FlowBoundary . SHUFFLE ) ; gen . defineOperator ( "op2" , "in" , "out" ) ; gen . defineOutput ( "out1" ) ; gen . defineOutput ( "out2" ) ; gen . connect ( "in1" , "op1" ) . connect ( "op1.a" , "op2" ) . connect ( "op2" , "out1" ) ; gen . connect ( "op1.b" , "out2" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . insertCheckpoints ( graph ) ; assertThat ( FlowGraphUtil . collectBoundaries ( graph ) , is ( gen . getAsSet ( "in1" , "op1" , "out1" , "out2" ) ) ) ; } @ Test public void insertIdentities_nothing ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op" , "in" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op.in" ) . connect ( "op.out" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . insertIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in" , "op" , "out" ) ) ) ; } @ Test public void insertIdentities_stage_shuffle ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op1" , "in" , "out" , FlowBoundary . SHUFFLE ) ; gen . defineOperator ( "op2" , "in" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op1" ) . connect ( "op1" , "op2" ) . connect ( "op2" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . insertIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , not ( gen . getAsSet ( "in" , "op1" , "op2" , "out" ) ) ) ; FlowElement id = succ ( gen . get ( "in" ) ) ; assertThat ( FlowGraphUtil . isIdentity ( id ) , is ( true ) ) ; FlowElement op1 = succ ( id ) ; assertThat ( op1 , is ( gen . get ( "op1" ) ) ) ; FlowElement op2 = succ ( op1 ) ; assertThat ( op2 , is ( gen . get ( "op2" ) ) ) ; FlowElement out = succ ( op2 ) ; assertThat ( out , is ( gen . get ( "out" ) ) ) ; } @ Test public void insertIdentities_stage_stage ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op1" , "in" , "out" , FlowBoundary . STAGE ) ; gen . defineOperator ( "op2" , "in" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op1" ) . connect ( "op1" , "op2" ) . connect ( "op2" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . insertIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , not ( gen . getAsSet ( "in" , "op1" , "op2" , "out" ) ) ) ; FlowElement id = succ ( gen . get ( "in" ) ) ; assertThat ( FlowGraphUtil . isIdentity ( id ) , is ( true ) ) ; FlowElement op1 = succ ( id ) ; assertThat ( op1 , is ( gen . get ( "op1" ) ) ) ; FlowElement op2 = succ ( op1 ) ; assertThat ( op2 , is ( gen . get ( "op2" ) ) ) ; FlowElement out = succ ( op2 ) ; assertThat ( out , is ( gen . get ( "out" ) ) ) ; } @ Test public void insertIdentities_shuffle_stage ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op1" , "in" , "out" ) ; gen . defineOperator ( "op2" , "in" , "out" , FlowBoundary . SHUFFLE ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op1" ) . connect ( "op1" , "op2" ) . connect ( "op2" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . insertIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in" , "op1" , "op2" , "out" ) ) ) ; } @ Test public void splitIdentities_nothing ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op" , "in" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op.in" ) . connect ( "op.out" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . splitIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in" , "op" , "out" ) ) ) ; } @ Test public void splitIdentities_split ( ) { gen . defineInput ( "in1" ) ; gen . defineInput ( "in2" ) ; gen . definePseud ( "id" ) ; gen . defineOutput ( "out1" ) ; gen . defineOutput ( "out2" ) ; gen . connect ( "in1" , "id" ) . connect ( "id" , "out1" ) ; gen . connect ( "in2" , "id" ) . connect ( "id" , "out2" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . splitIdentities ( graph ) ; Set < FlowElement > succ1 = FlowGraphUtil . getSuccessors ( gen . get ( "in1" ) ) ; Set < FlowElement > succ2 = FlowGraphUtil . getSuccessors ( gen . get ( "in2" ) ) ; assertThat ( succ1 . size ( ) , is ( 2 ) ) ; assertThat ( succ2 . size ( ) , is ( 2 ) ) ; Iterator < FlowElement > iter1 = succ1 . iterator ( ) ; FlowElement elem1 = iter1 . next ( ) ; FlowElement elem2 = iter1 . next ( ) ; Iterator < FlowElement > iter2 = succ2 . iterator ( ) ; FlowElement elem3 = iter2 . next ( ) ; FlowElement elem4 = iter2 . next ( ) ; assertThat ( FlowGraphUtil . getSuccessors ( elem1 ) . size ( ) , is ( 1 ) ) ; assertThat ( FlowGraphUtil . getSuccessors ( elem2 ) . size ( ) , is ( 1 ) ) ; assertThat ( FlowGraphUtil . getSuccessors ( elem3 ) . size ( ) , is ( 1 ) ) ; assertThat ( FlowGraphUtil . getSuccessors ( elem4 ) . size ( ) , is ( 1 ) ) ; assertThat ( FlowGraphUtil . getPredecessors ( elem1 ) . size ( ) , is ( 1 ) ) ; assertThat ( FlowGraphUtil . getPredecessors ( elem2 ) . size ( ) , is ( 1 ) ) ; assertThat ( FlowGraphUtil . getPredecessors ( elem3 ) . size ( ) , is ( 1 ) ) ; assertThat ( FlowGraphUtil . getPredecessors ( elem4 ) . size ( ) , is ( 1 ) ) ; assertThat ( elem1 , not ( sameInstance ( elem3 ) ) ) ; assertThat ( elem1 , not ( sameInstance ( elem4 ) ) ) ; assertThat ( elem2 , not ( sameInstance ( elem3 ) ) ) ; assertThat ( elem2 , not ( sameInstance ( elem4 ) ) ) ; } @ Test public void splitIdentities_yetSplitted ( ) { gen . defineInput ( "in1" ) ; gen . definePseud ( "id1" ) ; gen . definePseud ( "id2" ) ; gen . defineOutput ( "out1" ) ; gen . defineOutput ( "out2" ) ; gen . connect ( "in1" , "id1" ) . connect ( "id1" , "out1" ) ; gen . connect ( "in1" , "id2" ) . connect ( "id2" , "out2" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . splitIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in1" , "id1" , "id2" , "out1" , "out2" ) ) ) ; } @ Test public void reduceIdentities_op_op ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op1" , "in" , "out" ) ; gen . defineOperator ( "op2" , "in" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op1" ) . connect ( "op1" , "op2" ) . connect ( "op2" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . reduceIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in" , "op1" , "op2" , "out" ) ) ) ; assertThat ( succ ( gen . get ( "in" ) ) , is ( gen . get ( "op1" ) ) ) ; assertThat ( succ ( gen . get ( "op1" ) ) , is ( gen . get ( "op2" ) ) ) ; assertThat ( succ ( gen . get ( "op2" ) ) , is ( gen . get ( "out" ) ) ) ; } @ Test public void reduceIdentities_op_id ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op1" , "in" , "out" ) ; gen . definePseud ( "id" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op1" ) . connect ( "op1" , "id" ) . connect ( "id" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . reduceIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in" , "op1" , "out" ) ) ) ; assertThat ( succ ( gen . get ( "in" ) ) , is ( gen . get ( "op1" ) ) ) ; assertThat ( succ ( gen . get ( "op1" ) ) , is ( gen . get ( "out" ) ) ) ; } @ Test public void reduceIdentities_id_op ( ) { gen . defineInput ( "in" ) ; gen . definePseud ( "id" ) ; gen . defineOperator ( "op1" , "in" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "id" ) . connect ( "id" , "op1" ) . connect ( "op1" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . reduceIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in" , "op1" , "out" ) ) ) ; assertThat ( succ ( gen . get ( "in" ) ) , is ( gen . get ( "op1" ) ) ) ; assertThat ( succ ( gen . get ( "op1" ) ) , is ( gen . get ( "out" ) ) ) ; } @ Test public void reduceIdentities_mapBody ( ) { gen . defineInput ( "in" ) ; gen . definePseud ( "id" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "id" ) . connect ( "id" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . reduceIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in" , "id" , "out" ) ) ) ; assertThat ( succ ( gen . get ( "in" ) ) , is ( gen . get ( "id" ) ) ) ; assertThat ( succ ( gen . get ( "id" ) ) , is ( gen . get ( "out" ) ) ) ; } @ Test public void reduceIdentities_reduceBody ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op1" , "in" , "out" , FlowBoundary . SHUFFLE ) ; gen . definePseud ( "id" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op1" ) . connect ( "op1" , "id" ) . connect ( "id" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . reduceIdentities ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in" , "op1" , "out" ) ) ) ; assertThat ( succ ( gen . get ( "in" ) ) , is ( gen . get ( "op1" ) ) ) ; assertThat ( succ ( gen . get ( "op1" ) ) , is ( gen . get ( "out" ) ) ) ; } @ Test public void normalizeFlowGraph ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op1" , "in" , "out" ) ; gen . definePseud ( "id" ) ; gen . defineOutput ( "out1" ) ; gen . defineOutput ( "out2" ) ; gen . connect ( "in" , "op1" ) . connect ( "op1" , "id" ) . connect ( "id" , "out1" ) ; gen . connect ( "id" , "out2" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . normalizeFlowGraph ( graph ) ; assertThat ( FlowGraphUtil . collectElements ( graph ) , is ( gen . getAsSet ( "in" , "op1" , "out1" , "out2" ) ) ) ; assertThat ( succ ( gen . get ( "in" ) ) , is ( gen . get ( "op1" ) ) ) ; assertThat ( FlowGraphUtil . getSuccessors ( gen . get ( "op1" ) ) , is ( gen . getAsSet ( "out1" , "out2" ) ) ) ; assertThat ( pred ( gen . get ( "out1" ) ) , is ( gen . get ( "op1" ) ) ) ; assertThat ( pred ( gen . get ( "out2" ) ) , is ( gen . get ( "op1" ) ) ) ; assertThat ( pred ( gen . get ( "op1" ) ) , is ( gen . get ( "in" ) ) ) ; } @ Test public void normalizeFlowGraph_component ( ) { FlowGraphGenerator comp = new FlowGraphGenerator ( ) ; comp . defineInput ( "in" ) ; comp . defineOperator ( "op1" , "in" , "out" ) ; comp . definePseud ( "id" ) ; comp . defineOutput ( "out1" ) ; comp . defineOutput ( "out2" ) ; comp . connect ( "in" , "op1" ) . connect ( "op1" , "id" ) . connect ( "id" , "out1" ) ; comp . connect ( "id" , "out2" ) ; gen . defineInput ( "in" ) ; gen . defineFlowPart ( "c" , comp . toGraph ( ) ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "c" ) . connect ( "c.out1" , "out" ) . connect ( "c.out2" , "out" ) ; FlowGraph graph = gen . toGraph ( ) ; getPlanner ( ) . normalizeFlowGraph ( graph ) ; deletePseuds ( graph ) ; assertThat ( succ ( gen . get ( "in" ) ) , is ( comp . get ( "op1" ) ) ) ; assertThat ( succ ( comp . get ( "op1" ) ) , is ( gen . get ( "out" ) ) ) ; assertThat ( pred ( gen . get ( "out" ) ) , is ( comp . get ( "op1" ) ) ) ; assertThat ( pred ( comp . get ( "op1" ) ) , is ( gen . get ( "in" ) ) ) ; } @ Test public void plan_through ( ) { gen . defineInput ( "in" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "out" ) ; StageGraph stages = getPlanner ( ) . plan ( gen . toGraph ( ) ) ; assertThat ( stages . getInput ( ) . getBlockOutputs ( ) . size ( ) , is ( 1 ) ) ; assertThat ( stages . getOutput ( ) . getBlockInputs ( ) . size ( ) , is ( 1 ) ) ; assertThat ( stages . getStages ( ) . size ( ) , is ( 0 ) ) ; assertThat ( FlowBlock . isConnected ( stages . getInput ( ) . getBlockOutputs ( ) . get ( 0 ) , stages . getOutput ( ) . getBlockInputs ( ) . get ( 0 ) ) , is ( true ) ) ; } @ Test public void plan_singleMapper ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op" , "in" , "out" ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op" ) . connect ( "op" , "out" ) ; StageGraph stages = getPlanner ( ) . plan ( gen . toGraph ( ) ) ; assertThat ( stages . getInput ( ) . getBlockOutputs ( ) . size ( ) , is ( 1 ) ) ; assertThat ( stages . getOutput ( ) . getBlockInputs ( ) . size ( ) , is ( 1 ) ) ; assertThat ( stages . getStages ( ) . size ( ) , is ( 1 ) ) ; StageBlock mr = stages . getStages ( ) . get ( 0 ) ; assertThat ( mr . getMapBlocks ( ) . size ( ) , is ( 1 ) ) ; assertThat ( mr . hasReduceBlocks ( ) , is ( false ) ) ; FlowBlock mapper = single ( mr . getMapBlocks ( ) ) ; assertThat ( FlowBlock . isConnected ( stages . getInput ( ) . getBlockOutputs ( ) . get ( 0 ) , mapper . getBlockInputs ( ) . get ( 0 ) ) , is ( true ) ) ; assertThat ( FlowBlock . isConnected ( mapper . getBlockOutputs ( ) . get ( 0 ) , stages . getOutput ( ) . getBlockInputs ( ) . get ( 0 ) ) , is ( true ) ) ; assertThat ( mapper . getElements ( ) . size ( ) , is ( 1 ) ) ; FlowElement mapperOp = single ( mapper . getElements ( ) ) ; assertThat ( mapperOp . getDescription ( ) , is ( gen . desc ( "op" ) ) ) ; } @ Test public void plan_singleReducer ( ) { gen . defineInput ( "in" ) ; gen . defineOperator ( "op" , "in" , "out" , FlowBoundary . SHUFFLE ) ; gen . defineOutput ( "out" ) ; gen . connect ( "in" , "op" ) . connect ( "op" , "out" ) ; StageGraph stages = getPlanner ( ) . plan ( gen . toGraph ( ) ) ; assertThat ( stages . getInput ( ) . getBlockOutputs ( ) . size ( ) , is ( 1 ) ) ; assertThat ( stages . getOutput ( ) . getBlockInputs ( ) . size | |
465 | <s> package org . oddjob . jmx . general ; import javax . management . MBeanServerConnection ; import org . oddjob . arooa | |
466 | <s> package com . asakusafw . dmdl . model ; import java . util . List ; import com . asakusafw . dmdl . Region ; import com . asakusafw . utils . collections . Lists ; public class AstModelMapping extends AbstractAstNode { private final Region region ; public final List < AstPropertyMapping > properties ; public AstModelMapping ( Region region , List < AstPropertyMapping > properties ) { | |
467 | <s> package org . oddjob . framework ; import junit . framework . TestCase ; import org . oddjob . FailedToStopException ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . standard . StandardArooaSession ; public class ServiceStrategiesTest extends TestCase { ArooaSession session = new StandardArooaSession ( ) ; public static class MyService1 implements Service { boolean started ; @ Override public void start ( ) throws Exception { started = true ; } @ Override public void stop ( ) throws FailedToStopException { started = false ; } } public void testIsServiceAlreadyStrategy ( ) throws Exception { ServiceStrategy test = new ServiceStrategies ( ) . isServiceAlreadyStrategy ( ) ; MyService1 service = new MyService1 ( ) ; ServiceAdaptor adaptor = test . serviceFor ( service , session ) ; assertNotNull ( adaptor ) ; assertEquals ( service , adaptor . getComponent ( ) ) ; adaptor . start ( ) ; assertEquals ( true , service . started ) ; adaptor . stop ( ) ; assertEquals ( false , service . started ) ; assertNull ( test . serviceFor ( new Object ( ) , session ) ) ; } public static class MyService2 { boolean started ; @ Start public void begin ( ) { started = true ; } @ Stop public void end ( ) { started = false ; } } public void testHasServiceAnotationsStrategy ( ) throws Exception { ServiceStrategy test = new ServiceStrategies ( | |
468 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . jface . dialogs . StatusDialog ; import org . eclipse . jface . resource . ImageDescriptor ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . jface . viewers . ViewerSorter ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Shell ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . DialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IDialogFieldListener ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IListAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . LayoutUtil ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . ListDialogField ; import org . rubypeople . rdt . ui . viewsupport . ImageDescriptorRegistry ; public class ExclusionInclusionDialog extends StatusDialog { private static class ExclusionInclusionLabelProvider extends LabelProvider { private Image fElementImage ; public ExclusionInclusionLabelProvider ( ImageDescriptor descriptor ) { ImageDescriptorRegistry registry = RubyPlugin . getImageDescriptorRegistry ( ) ; fElementImage = registry . get ( descriptor ) ; } public Image getImage ( Object element ) { return fElementImage ; } public String getText ( Object element ) { return ( String ) element ; } } private ListDialogField fInclusionPatternList ; private ListDialogField fExclusionPatternList ; private CPListElement fCurrElement ; private IProject fCurrProject ; private IContainer fCurrSourceFolder ; private static final int IDX_ADD = 0 ; private static final int IDX_ADD_MULTIPLE = 1 ; private static final int IDX_EDIT = 2 ; private static final int IDX_REMOVE = 4 ; public ExclusionInclusionDialog ( Shell parent , CPListElement entryToEdit , boolean focusOnExcluded ) { super ( parent ) ; setShellStyle ( getShellStyle ( ) | SWT . RESIZE ) ; fCurrElement = entryToEdit ; setTitle ( NewWizardMessages . ExclusionInclusionDialog_title ) ; fCurrProject = entryToEdit . getRubyProject ( ) . getProject ( ) ; IWorkspaceRoot root = fCurrProject . getWorkspace ( ) . getRoot ( ) ; IResource res = root . findMember ( entryToEdit . getPath ( ) ) ; if ( res instanceof IContainer ) { fCurrSourceFolder = ( IContainer ) res ; } String excLabel = NewWizardMessages . ExclusionInclusionDialog_exclusion_pattern_label ; ImageDescriptor excDescriptor = RubyPluginImages . DESC_OBJS_EXCLUSION_FILTER_ATTRIB ; String [ ] excButtonLabels = new String [ ] { NewWizardMessages . ExclusionInclusionDialog_exclusion_pattern_add , NewWizardMessages . ExclusionInclusionDialog_exclusion_pattern_add_multiple , NewWizardMessages . ExclusionInclusionDialog_exclusion_pattern_edit , null , NewWizardMessages . ExclusionInclusionDialog_exclusion_pattern_remove } ; String incLabel = NewWizardMessages . ExclusionInclusionDialog_inclusion_pattern_label ; ImageDescriptor incDescriptor = RubyPluginImages . DESC_OBJS_INCLUSION_FILTER_ATTRIB ; String [ ] incButtonLabels = new String [ ] { NewWizardMessages . ExclusionInclusionDialog_inclusion_pattern_add , NewWizardMessages . ExclusionInclusionDialog_inclusion_pattern_add_multiple , NewWizardMessages . ExclusionInclusionDialog_inclusion_pattern_edit , null , NewWizardMessages . ExclusionInclusionDialog_inclusion_pattern_remove } ; fExclusionPatternList = createListContents ( entryToEdit , CPListElement . EXCLUSION , excLabel , excDescriptor , excButtonLabels ) ; fInclusionPatternList = createListContents ( entryToEdit , CPListElement . INCLUSION , incLabel , incDescriptor , incButtonLabels ) ; if ( focusOnExcluded ) { fExclusionPatternList . postSetFocusOnDialogField ( parent . getDisplay ( ) ) ; } else { fInclusionPatternList . postSetFocusOnDialogField ( parent . getDisplay ( ) ) ; } } private ListDialogField createListContents ( CPListElement entryToEdit , String key , String label , ImageDescriptor descriptor , String [ ] buttonLabels ) { ExclusionPatternAdapter adapter = new ExclusionPatternAdapter ( ) ; ListDialogField patternList = new ListDialogField ( adapter , buttonLabels , new ExclusionInclusionLabelProvider ( descriptor ) ) ; patternList . setDialogFieldListener ( adapter ) ; patternList . setLabelText ( label ) ; patternList . setRemoveButtonIndex ( IDX_REMOVE ) ; patternList . enableButton ( IDX_EDIT , false ) ; IPath [ ] pattern = ( IPath [ ] ) entryToEdit . getAttribute ( key ) ; ArrayList elements = new ArrayList ( | |
469 | <s> package com . postmark . java ; public class PostmarkException extends Exception { private static final long serialVersionUID = 8742554283535762204L ; private PostmarkResponse response ; public PostmarkException ( Throwable cause ) { super | |
470 | <s> package org . springframework . samples . petclinic . web ; import org . springframework . beans . factory . annotation . Autowired ; import org . springframework . samples . petclinic . Clinic ; import org . springframework . samples . petclinic . Owner ; import org . springframework . samples . petclinic . validation . OwnerValidator ; import org . springframework . stereotype . Controller ; import org . springframework . ui . Model ; import org . springframework . validation . BindingResult ; import org . springframework . web . bind . WebDataBinder ; import org . springframework . web . bind . annotation . InitBinder ; import org . springframework . web . bind . annotation . ModelAttribute ; import org . springframework . web . bind . annotation . RequestMapping ; import org . springframework . web . bind . annotation . RequestMethod ; | |
471 | <s> package com . asakusafw . compiler . flow . model ; import java . lang . reflect . Method ; import java . text . MessageFormat ; import java . util . Collection ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import com . asakusafw . compiler . common . JavaName ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . compiler . repository . ValueOptionProperty ; import com . asakusafw . runtime . model . DataModel ; import com . asakusafw . runtime . value . ValueOption ; import com . asakusafw . utils . collections . Maps ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . util . ExpressionBuilder ; import com . asakusafw . utils . java . model . util . TypeBuilder ; public class DataModelClass implements DataClass { private final ModelFactory factory ; private final Class < ? > type ; private final Map < String , DataClass . Property > properties ; public static DataModelClass create ( FlowCompilingEnvironment environment , Class < ? > type ) { Precondition . checkMustNotBeNull ( environment , "environment" ) ; Precondition . checkMustNotBeNull ( type , "type" ) ; Map < String , Property > properties = collectProperties ( environment , type ) ; return new DataModelClass ( environment . getModelFactory ( ) , type , properties ) ; } private static Map < String , DataClass . Property > collectProperties ( FlowCompilingEnvironment environment , Class < ? > aClass ) { assert environment != null ; assert aClass != null ; Map < String , Property > results = Maps . create ( ) ; for ( Method method : aClass . getMethods ( ) ) { String propertyName = toPropertyName ( method ) ; Class < ? > propertyType = method . getReturnType ( ) ; if ( propertyType == ValueOption . class || ValueOption . class . isAssignableFrom ( propertyType ) == false ) { continue ; } @ SuppressWarnings ( "unchecked" ) Class < ? extends ValueOption < ? > > valueOptionType = ( Class < ? extends ValueOption < ? > > ) propertyType ; results . put ( propertyName , new ValueOptionProperty ( environment . getModelFactory ( ) , propertyName , valueOptionType ) ) ; } return results ; } private static String toPropertyName ( Method method ) { assert method != null ; JavaName name = JavaName . of ( method . getName ( ) ) ; List < String > segments = name . getSegments ( ) ; if ( segments . size ( ) <= 2 ) { return null ; } if ( segments . get ( 0 ) . equals ( "get" ) == false || segments . get ( segments . size ( ) - 1 ) . equals ( "option" ) == false ) { return null ; } name . removeLast ( ) ; name . removeFirst ( ) ; return name . toMemberName ( ) ; } protected DataModelClass ( ModelFactory factory , Class < ? > type , Map < String , Property > properties ) { Precondition . checkMustNotBeNull ( factory , "factory" ) ; Precondition . checkMustNotBeNull ( type , "type" ) ; Precondition . checkMustNotBeNull ( properties , "properties" ) ; this . factory = factory ; this . type = type ; this . properties = properties ; } @ Override public java . lang . reflect . Type getType ( ) { return type ; } @ Override public Statement reset ( Expression object ) { Precondition . checkMustNotBeNull ( object , "object" ) ; return new ExpressionBuilder ( factory , object ) . method ( "reset" ) . toStatement ( ) ; } @ Override public Expression createNewInstance ( Type target ) { Precondition . checkMustNotBeNull ( target , "target" ) ; return new TypeBuilder ( factory , target ) . newObject ( ) . toExpression ( ) ; } @ Override public Statement assign ( Expression target , Expression source ) { Precondition . checkMustNotBeNull ( target , "target" ) ; Precondition . checkMustNotBeNull ( source , "source" ) ; return new ExpressionBuilder ( factory , target ) . method ( "copyFrom" , source ) . toStatement ( ) ; } @ Override public Statement createWriter ( Expression object , Expression dataOutput ) { Precondition . checkMustNotBeNull ( object , "object" ) ; Precondition . checkMustNotBeNull ( dataOutput , "dataOutput" ) ; return new ExpressionBuilder ( factory , object ) . method ( "write" , dataOutput ) . toStatement ( ) ; } @ Override public Statement createReader ( Expression object , Expression dataInput ) { Precondition . checkMustNotBeNull ( object , "object" ) ; Precondition . checkMustNotBeNull ( dataInput , "dataInput" ) ; return new ExpressionBuilder ( factory , object ) . method | |
472 | <s> package org . rubypeople . rdt . refactoring . core . extractconstant ; import org . jruby . ast . ArrayNode ; import org . jruby . ast . BignumNode ; import org . jruby . ast . FalseNode ; import org . jruby . ast . FixnumNode ; import org . jruby . ast . HashNode ; import org . jruby . ast . NilNode ; import org . jruby . ast . StrNode ; import org . jruby . ast . TrueNode ; import org . jruby . ast . ZArrayNode ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . core . RefactoringConditionChecker ; public class ExtractConstantConditionChecker extends RefactoringConditionChecker { private ExtractConstantConfig config ; public ExtractConstantConditionChecker ( IRefactoringConfig config2 ) { super ( config2 ) ; } protected void checkInitialConditions ( ) { if ( ! existSelectedNodes ( ) ) { addError ( "" ) ; } else if ( ! isPrimitive ( ) ) { addError ( "" ) ; } } private boolean isPrimitive ( ) { return ( config . getSelectedNodes ( ) instanceof ZArrayNode ) || ( config . getSelectedNodes ( ) instanceof ArrayNode ) || ( config . getSelectedNodes ( ) instanceof HashNode ) || ( config . getSelectedNodes ( ) instanceof FixnumNode ) || ( config . getSelectedNodes ( ) instanceof BignumNode ) || ( config . getSelectedNodes ( ) instanceof NilNode ) || ( config . getSelectedNodes ( ) instanceof TrueNode ) || ( config . getSelectedNodes ( ) instanceof FalseNode | |
473 | <s> package net . sf . sveditor . ui . text ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . ui . editor . SVEditor ; import net . sf . sveditor . ui . svcp . SVDBDecoratingLabelProvider ; import net . sf . sveditor . ui . svcp . SVTreeContentProvider ; import net . sf . sveditor . ui . svcp . SVTreeLabelProvider ; import org . eclipse . jface . viewers . DoubleClickEvent ; import org . eclipse . jface . viewers . IDoubleClickListener ; import org . eclipse . jface . viewers . IElementComparer ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . TreeViewer ; import org . eclipse . jface . viewers . ViewerComparator ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . swt . widgets . Tree ; import org . eclipse . ui . dialogs . FilteredTree ; import org . eclipse . ui . dialogs . PatternFilter ; public class OutlineInformationControl extends AbstractInformationControl { public OutlineInformationControl ( Shell parent , int shellStyle , int treeStyle , String commandId ) { super ( parent , shellStyle , treeStyle , commandId , true ) ; } protected FilteredTree fObjectTree ; protected PatternFilter fPatternFilter ; protected TreeViewer fTreeViewer ; protected SVTreeContentProvider fContentProvider ; protected SVDBFile fSVDBFile ; protected SVEditor fEditor ; @ Override public void setFocus ( ) { fObjectTree . getFilterControl ( ) . setFocus ( ) ; } ; @ Override protected TreeViewer createTreeViewer ( Composite parent , int style ) { fPatternFilter = new PatternFilter ( ) ; fObjectTree = new FilteredTree ( parent , SWT . H_SCROLL | |
474 | <s> package com . asakusafw . utils . java . internal . parser . javadoc . ir ; import java . io . Serializable ; import java . text . MessageFormat ; public class IrLocation implements Serializable { private static final long serialVersionUID = 1L ; private final int startPosition ; private final int length ; public IrLocation ( int startPosition , int length ) { super ( ) ; if ( startPosition < 0 || length < 0 ) { throw new IllegalArgumentException ( ) ; } this . startPosition = startPosition ; this . length = length ; } public int getStartPosition ( ) { return this . startPosition ; } public int getLength ( ) { return this . length ; } public static IrLocation move ( IrLocation base , int offset ) { if ( base == null ) { return null ; } int fixed = base . getStartPosition ( ) + offset ; return new IrLocation ( fixed , base . length ) ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + length ; result = prime * result + startPosition ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) { | |
475 | <s> package com . asakusafw . bulkloader . tools ; import static org . junit . Assert . * ; import java . io . File ; import java . util . Arrays ; import java . util . List ; import java . util . Properties ; import org . junit . After ; import org . junit . AfterClass ; import org . junit . Before ; import org . junit . BeforeClass ; import org . junit . Test ; import com . asakusafw . bulkloader . common . BulkLoaderInitializer ; import com . asakusafw . bulkloader . common . ConfigurationLoader ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . testutil . UnitTestUtil ; import com . asakusafw . testtools . TestUtils ; import com . asakusafw . testtools . inspect . Cause ; public class DBCleanerTest { private static List < String > propertys = Arrays . asList ( new String [ ] { "" } ) ; private static String jobflowId = "JOB_FLOW01" ; private static String executionId = "" ; private static String targetName = "target1" ; @ BeforeClass public static void setUpBeforeClass ( ) throws Exception { UnitTestUtil . setUpBeforeClass ( ) ; UnitTestUtil . setUpEnv ( ) ; BulkLoaderInitializer . initDBServer ( jobflowId , executionId , propertys , targetName ) ; UnitTestUtil . setUpDB ( ) ; } @ AfterClass public static void tearDownAfterClass ( ) throws Exception { UnitTestUtil . setUpEnv ( ) ; UnitTestUtil . tearDownDB ( ) ; UnitTestUtil . tearDownAfterClass ( ) ; } @ Before public void setUp ( ) throws Exception { UnitTestUtil . startUp ( ) ; } @ After public void tearDown ( ) throws Exception { UnitTestUtil . tearDown ( ) ; } @ Test public void executeTest01 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; createTempTable1 ( ) ; createTempTable2 ( ) ; String [ ] args = new String [ ] { targetName } ; DBCleaner cleaner = new DBCleaner ( ) ; int result = cleaner . execute ( args ) ; assertEquals ( 0 , result ) ; util . loadFromDatabase ( ) ; if ( ! util . inspect ( ) ) { for ( Cause cause : util . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; } fail ( util . getCauseMessage ( ) ) ; } assertFalse ( UnitTestUtil . isExistTable ( "" ) ) ; assertFalse ( UnitTestUtil . isExistTable ( "" ) ) ; assertFalse ( UnitTestUtil . isExistTable ( "" ) ) ; } @ Test public void executeTest02 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; createTempTable1 ( ) ; createTempTable2 ( ) ; String [ ] args = new String [ ] { targetName } ; DBCleaner cleaner = new DBCleaner ( ) ; int result = cleaner . execute ( | |
476 | <s> package org . rubypeople . rdt . internal . ui . text . comment ; import java . util . LinkedList ; import java . util . Map ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . TextUtilities ; import org . eclipse . jface . text . TypedPosition ; import org . eclipse . jface . text . formatter . ContextBasedFormattingStrategy ; import org . eclipse . jface . text . formatter . FormattingContextProperties ; import org . eclipse . jface . text . formatter . IFormattingContext ; import org . eclipse . text . edits . MalformedTreeException ; import org . eclipse . text . edits . TextEdit ; import org . rubypeople . rdt . core . ToolFactory ; import org . rubypeople . rdt . core . formatter . DefaultCodeFormatterConstants ; import org . rubypeople . rdt . core . formatter . CodeFormatter ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . text . IRubyPartitions ; public class CommentFormattingStrategy extends ContextBasedFormattingStrategy { private final LinkedList fDocuments = new LinkedList ( ) ; private final LinkedList fPartitions = new LinkedList ( ) ; private int fLastDocumentHash ; private int fLastHeaderHash ; private int fLastMainTokenEnd = - 1 ; private int fLastDocumentsHeaderEnd ; public void format ( ) { super . format ( ) ; final IDocument document = ( IDocument ) fDocuments . removeFirst ( ) ; final TypedPosition position = ( TypedPosition ) fPartitions . removeFirst ( ) ; if ( document == null || position == null ) return ; Map preferences = getPreferences ( ) ; final boolean isFormattingHeader = Boolean . toString ( true ) . equals ( preferences . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_HEADER ) ) ; int documentsHeaderEnd = computeHeaderEnd ( document ) ; if ( isFormattingHeader || position . offset >= documentsHeaderEnd ) { TextEdit edit = null ; try { int sourceOffset = document . getLineOffset ( document . getLineOfOffset ( position . getOffset ( ) ) ) ; int partitionOffset = position . getOffset ( ) - sourceOffset ; int sourceLength = partitionOffset + position . getLength ( ) ; String source = document . get ( sourceOffset , sourceLength ) ; CodeFormatter commentFormatter = ToolFactory . createCodeFormatter ( preferences ) ; int indentationLevel = inferIndentationLevel ( source . substring ( 0 , partitionOffset ) , getTabSize ( preferences ) ) ; edit = commentFormatter . format ( getKindForPartitionType ( position . getType ( ) ) , source , partitionOffset , position . getLength ( ) , indentationLevel , TextUtilities . getDefaultLineDelimiter ( document ) ) ; if ( edit != null ) edit . moveTree ( sourceOffset ) ; } catch ( BadLocationException x ) { RubyPlugin . log ( x ) ; } try { if ( edit != null ) edit . apply ( document ) ; } catch ( MalformedTreeException x ) { RubyPlugin . log ( x ) ; } catch ( BadLocationException x ) { RubyPlugin . log ( x ) ; } } } public void formatterStarts ( IFormattingContext context ) { super . formatterStarts ( context ) ; fPartitions . addLast ( context . getProperty ( FormattingContextProperties . CONTEXT_PARTITION ) ) ; fDocuments . addLast ( context . getProperty ( FormattingContextProperties . CONTEXT_MEDIUM ) ) ; } public void formatterStops ( ) { fPartitions . clear ( ) ; fDocuments . clear ( ) ; super . formatterStops ( ) ; } private static int getKindForPartitionType ( String type ) { if ( IRubyPartitions . RUBY_SINGLE_LINE_COMMENT . equals ( type ) ) return CodeFormatter . K_SINGLE_LINE_COMMENT ; if ( IRubyPartitions . RUBY_MULTI_LINE_COMMENT . equals ( type ) ) return CodeFormatter . K_MULTI_LINE_COMMENT ; return CodeFormatter . K_UNKNOWN ; } private int inferIndentationLevel ( String reference , int tabSize ) { StringBuffer expanded = expandTabs ( reference , tabSize ) ; int referenceWidth = expanded . length ( ) ; if ( tabSize == 0 ) return referenceWidth ; | |
477 | <s> package org . oddjob . io ; import java . io . FilterOutputStream ; import java . io . IOException ; import java . io . OutputStream ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . | |
478 | <s> package com . asakusafw . modelgen . util ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . EnumSet ; import java . util . List ; import java . util . Set ; import com . asakusafw . modelgen . model . Aggregator ; import com . asakusafw . modelgen . model . Attribute ; import com . asakusafw . modelgen . model . BasicType ; import com . asakusafw . modelgen . model . ModelProperty ; import com . asakusafw . modelgen . model . PropertyType ; import com . asakusafw . modelgen . model . PropertyTypeKind ; import com . asakusafw . modelgen . model . Source ; import com . asakusafw . modelgen . model . TableModelDescription ; public class TableModelBuilder extends ModelBuilder < TableModelBuilder > { private List < Column > columns ; public TableModelBuilder ( String tableName ) { super ( tableName ) ; this . columns = new ArrayList < Column > ( ) ; } public TableModelBuilder add ( String comment , String columnName , PropertyTypeKind basicTypeKind , Attribute ... attributes ) { if ( columnName == null ) { throw new IllegalArgumentException ( "" ) ; } if ( basicTypeKind == null ) { throw new IllegalArgumentException ( "" ) ; } if ( attributes == null ) { throw new IllegalArgumentException ( "" ) ; } Column column = new Column ( columnName , new BasicType ( basicTypeKind ) , attributes ) ; columns . add ( column ) ; return this ; } public TableModelBuilder add ( String comment , String columnName , PropertyType columnType , Attribute ... attributes ) { if ( columnName == null ) { throw new IllegalArgumentException ( "" ) ; } if ( columnType == | |
479 | <s> package com . asakusafw . compiler . fileio . io ; import java . io . IOException ; import com . asakusafw . compiler . fileio . model . Ex1 ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io | |
480 | <s> package org . rubypeople . rdt . internal . corext . template . ruby ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITypedRegion ; import org . eclipse . jface . text . templates . DocumentTemplateContext ; import org . eclipse . jface . text . templates . GlobalTemplateVariables ; import org . eclipse . jface . text . templates . TemplateBuffer ; import org . eclipse . jface . text . templates . TemplateContext ; import org . eclipse . jface . text . templates . TemplateVariable ; import org . eclipse . text . edits . DeleteEdit ; import org . eclipse . text . edits . InsertEdit ; import org . eclipse . text . edits . MalformedTreeException ; import org . eclipse . text . edits . MultiTextEdit ; import org . eclipse . text . edits . RangeMarker ; import org . eclipse . text . edits . ReplaceEdit ; import org . eclipse . text . edits . TextEdit ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . formatter . CodeFormatter ; import org . rubypeople . rdt . internal . corext . util . CodeFormatterUtil ; import org . rubypeople . rdt . internal . corext . util . Strings ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . text . IRubyPartitions ; import org . rubypeople . rdt . internal . ui . text . RubyHeuristicScanner ; public class RubyFormatter { private static final String MARKER = "/*${" + GlobalTemplateVariables . Cursor . NAME + "}*/" ; private final String fLineDelimiter ; private final int fInitialIndentLevel ; private boolean fUseCodeFormatter ; private final IRubyProject fProject ; public RubyFormatter ( String lineDelimiter , int initialIndentLevel , boolean useCodeFormatter , IRubyProject project ) { fLineDelimiter = lineDelimiter ; fUseCodeFormatter = useCodeFormatter ; fInitialIndentLevel = initialIndentLevel ; fProject = project ; } public void format ( TemplateBuffer buffer , TemplateContext context ) throws BadLocationException { try { if ( | |
481 | <s> package com . asakusafw . compiler . testing . flow ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . testing . TemporaryOutputDescription ; public class Out1ExporterDesc extends | |
482 | <s> package com . asakusafw . testdriver . testing . operator ; import com . asakusafw . testdriver . testing . model . Simple ; import com . asakusafw . vocabulary . operator . Update ; public abstract class SimpleOperator { @ Update public void setValue ( | |
483 | <s> package com . asakusafw . dmdl . thundergate . model ; public class BasicType implements PropertyType { private PropertyTypeKind kind ; public BasicType ( PropertyTypeKind kind ) { if ( kind == null ) { throw new IllegalArgumentException ( "" ) ; } if ( kind . variant ) { throw new IllegalArgumentException ( "" ) ; } this . kind = kind ; } @ Override public PropertyTypeKind getKind ( ) { return kind ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + kind . hashCode ( ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null ) { return false ; } if ( getClass ( ) != obj | |
484 | <s> package de . fuberlin . wiwiss . d2rq ; import com . hp . hpl . jena . util . FileManager ; import de . fuberlin . wiwiss . d2rq . jena . GraphD2RQ ; import de . fuberlin . wiwiss . d2rq . jena . ModelD2RQ ; import junit . framework . TestCase ; public class JenaAPITest extends TestCase { public void testCopyPrefixesFromMapModelToD2RQModel ( ) { ModelD2RQ m = new ModelD2RQ ( D2RQTestSuite . DIRECTORY_URL + "prefixes.ttl" ) ; assertEquals ( "" , m . | |
485 | <s> package org . oddjob . beanbus ; import java . util . ArrayList ; import java . util . List ; import org . apache . log4j . Logger ; public class SimpleBus < T > implements BeanBus { private static final Logger logger = Logger . getLogger ( SimpleBus . class ) ; private Driver < ? extends T > driver ; private StageNotifier conductor ; private List < BusListener > busListeners = new ArrayList < BusListener > ( ) ; @ Override public void run ( ) { if ( driver == null ) { throw new NullPointerException ( "From." ) ; } if ( driver instanceof BusAware ) { ( ( BusAware ) driver ) . setBus ( this ) ; } try { fireBusStarting ( ) ; driver . go ( ) ; fireBusStopping ( ) ; } catch ( BusException e ) { fireBusCrashed ( e ) ; throw new RuntimeException ( e ) ; } finally { fireBusTerminated ( ) ; } } @ Override public void stop ( ) { driver . stop ( ) ; } public Driver < ? extends T > getDriver ( ) { return driver ; } public void setDriver ( Driver < ? extends T > from ) { this . driver = from ; if ( conductor == null && driver instanceof StageNotifier ) { conductor = ( ( StageNotifier ) driver ) ; } } @ Override public void addBusListener ( BusListener listener ) { busListeners . add ( listener ) ; } @ Override public void removeBusListener ( BusListener listener ) { busListeners . remove ( listener ) ; } @ Override public void addStageListener ( StageListener listener ) { if ( conductor != null ) { conductor . addStageListener ( listener ) ; } } @ Override public void removeStageListener ( StageListener listener ) { if ( conductor != null ) { conductor . removeStageListener ( listener ) ; } } protected void fireBusStarting ( ) throws CrashBusException { List < BusListener > copy = new ArrayList < BusListener > ( busListeners ) ; BusEvent event = new BusEvent ( this ) ; for ( BusListener listener : copy ) { listener . busStarting ( event ) ; } } protected void fireBusStopping ( ) throws CrashBusException { List < BusListener > copy = new ArrayList < BusListener > ( busListeners ) ; BusEvent event = new BusEvent ( this ) ; for ( BusListener listener : copy ) { listener . busStopping ( event ) ; } } protected void fireBusTerminated ( ) { List < BusListener > copy = new ArrayList < BusListener > ( busListeners ) ; BusEvent event = new BusEvent ( this ) ; for ( BusListener listener : copy ) | |
486 | <s> package org . oddjob . jmx . server ; import java . util . ArrayList ; import java . util . List ; import javax . management . MBeanOperationInfo ; import javax . management . MBeanParameterInfo ; public class JMXOperationPlus < T > extends JMXOperation < T > { private final String actionName ; private final Class < T > returnType ; private final String description ; private final int impact ; private final List < Param > params = new ArrayList < Param > ( ) ; public JMXOperationPlus ( String actionName , String description , Class < T > returnType , int impact ) { this . actionName = actionName ; this . returnType = returnType ; this . description = description ; this . impact = impact ; } public String getActionName ( ) { return actionName ; } public String [ ] getSignature ( ) { String [ ] signature = new String [ params . size ( ) ] ; int i = 0 ; for ( Param param : params ) { signature [ i ++ ] = param . type . getName ( ) ; } return signature ; } public MBeanOperationInfo getOpInfo ( ) { MBeanParameterInfo [ ] paramInfos = new MBeanParameterInfo [ params . size ( ) ] ; int i = 0 ; for ( Param param : params ) { paramInfos [ i ++ ] = new MBeanParameterInfo ( param . name , param . type . getName ( ) , param . description ) ; } return new MBeanOperationInfo ( actionName , description , paramInfos , returnType . getName ( ) , impact ) ; } public JMXOperationPlus < T > addParam | |
487 | <s> package com . asakusafw . runtime . stage . collector ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . util . Arrays ; import org . apache . hadoop . io . DataInputBuffer ; import org . apache . hadoop . io . DataOutputBuffer ; import org . apache . hadoop . io . Writable ; import org . junit . Test ; import com . asakusafw . runtime . value . IntOption ; public class WritableSlotTest { @ SuppressWarnings ( "deprecation" ) @ Test public void loadStore ( ) throws Exception { WritableSlot slot = new WritableSlot ( ) ; IntOption value = new IntOption ( 100 ) ; IntOption copy = new IntOption ( ) ; slot . store ( value ) ; slot . loadTo ( copy ) ; assertThat ( copy , is ( value ) ) ; value . modify ( 200 ) ; slot . store ( value ) ; slot . loadTo ( copy ) ; assertThat ( copy , is ( value ) ) ; } @ SuppressWarnings ( "deprecation" ) @ Test public void writable ( ) throws Exception { WritableSlot slot = new WritableSlot ( ) ; IntOption value = new IntOption ( 100 ) ; IntOption copy = new IntOption ( 200 ) ; slot . store ( value ) ; WritableSlot restored1 = restore ( slot ) ; restored1 . loadTo ( copy ) ; assertThat ( copy , is ( value ) ) ; value . modify ( | |
488 | <s> package com . asakusafw . bulkloader . transfer ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . apache . commons . io . IOUtils ; import com . asakusafw . bulkloader . common . StreamRedirectThread ; public abstract class StreamFileListProvider implements FileListProvider { private final List < Thread > running = new ArrayList < Thread > ( ) ; @ Override public FileList . Reader openReader ( ) throws IOException { InputStream stream = getInputStream ( ) ; boolean succeed = false ; try { FileList . Reader channel = FileList . createReader ( stream ) ; succeed = true ; return channel ; } finally { if ( succeed == false ) { IOUtils . closeQuietly ( stream ) ; } } } @ Override public FileList . Writer openWriter ( boolean compress ) throws IOException { OutputStream stream = getOutputStream ( ) ; boolean succeed = false ; try { FileList . Writer channel = FileList . createWriter ( stream , compress ) ; | |
489 | <s> package com . asakusafw . dmdl . thundergate ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . List ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . jsr199 . testing . VolatileJavaFile ; import com . asakusafw . utils . java . model . syntax . PackageDeclaration ; import | |
490 | <s> package org . rubypeople . rdt . ui ; import java . io . File ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . Viewer ; import org . rubypeople . rdt . core . IParent ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyElementDelta ; import org . rubypeople . rdt . core . IRubyModel ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . ISourceReference ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . core . RubyBlock ; public class StandardRubyElementContentProvider implements ITreeContentProvider { protected static final Object [ ] NO_CHILDREN = new Object [ 0 ] ; protected boolean fProvideMembers ; protected boolean fProvideWorkingCopy ; public StandardRubyElementContentProvider ( ) { this ( false ) ; } public StandardRubyElementContentProvider ( boolean provideMembers , boolean provideWorkingCopy ) { this ( provideMembers ) ; } public StandardRubyElementContentProvider ( boolean provideMembers ) { fProvideMembers = provideMembers ; fProvideWorkingCopy = provideMembers ; } public boolean getProvideMembers ( ) { return fProvideMembers ; } public void setProvideMembers ( boolean b ) { fProvideMembers = b ; } public boolean getProvideWorkingCopy ( ) { return fProvideWorkingCopy ; } public void setProvideWorkingCopy ( boolean b ) { fProvideWorkingCopy = b ; } public boolean providesWorkingCopies ( ) { return getProvideWorkingCopy ( ) ; } public Object [ ] getElements ( Object parent ) { return getChildren ( parent ) ; } public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } public void dispose ( ) { } public Object [ ] getChildren ( Object element ) { if ( ! exists ( element ) ) return NO_CHILDREN ; try { if ( element instanceof IRubyModel ) return getRubyProjects ( ( IRubyModel ) element ) ; if ( element instanceof IRubyProject ) return getSourceFolderRoots ( ( IRubyProject ) element ) ; if ( element instanceof ISourceFolderRoot ) return getSourceFolders ( ( ISourceFolderRoot ) element ) ; if ( element instanceof ISourceFolder ) return getFoldersAndRubyScripts ( ( ISourceFolder ) element ) ; if ( element instanceof IFolder ) return getResources ( ( IFolder ) element ) ; if ( getProvideMembers ( ) && element instanceof ISourceReference && element instanceof IParent ) { return removeBlocks ( ( ( IParent ) element ) . getChildren ( ) ) ; } } catch ( RubyModelException e ) { return NO_CHILDREN ; } return NO_CHILDREN ; } protected Object [ ] removeBlocks ( Object [ ] members ) { ArrayList tempResult = new ArrayList ( members . length ) ; for ( int i = 0 ; i < members . length ; i ++ ) if ( ! ( members [ i ] instanceof RubyBlock ) ) tempResult . add ( members [ i ] ) ; return tempResult . toArray ( ) ; } private Object [ ] getSourceFolders ( ISourceFolderRoot root ) throws RubyModelException { IRubyElement [ ] fragments = root . getChildren ( ) ; List < IRubyElement > list = new ArrayList < IRubyElement > ( ) ; for ( int i = 0 ; i < fragments . length ; i ++ ) { if ( ! ( fragments [ i ] instanceof ISourceFolder ) ) continue ; ISourceFolder folder = ( ISourceFolder ) fragments [ i ] ; if ( folder . isDefaultPackage ( ) ) { list . addAll ( Arrays . asList ( folder . getRubyScripts ( ) ) ) ; continue ; } String name = folder . getElementName ( ) ; int index = name . indexOf ( File . separatorChar ) ; if ( index == - 1 ) list . add ( folder ) ; } fragments = new IRubyElement [ list . size ( ) ] ; fragments = list . toArray ( fragments ) ; Object [ ] nonRubyResources = root . getNonRubyResources ( ) ; if ( nonRubyResources == null ) return fragments ; return concatenate ( fragments , nonRubyResources ) ; } private Object [ ] getSourceFolderRoots ( IRubyProject project ) throws RubyModelException { if ( ! project . getProject ( ) . isOpen ( ) ) return NO_CHILDREN ; ISourceFolderRoot [ ] roots = project . getSourceFolderRoots ( ) ; List list = new ArrayList ( roots . length ) ; for ( int i = 0 ; i < roots . length ; i ++ ) { ISourceFolderRoot root = roots [ i ] ; if ( isProjectSourceFolderRoot ( root ) ) { Object [ ] children = getChildren ( root ) ; for ( int k = 0 ; k < children . length ; k ++ ) list . add ( children [ k ] ) ; } else if ( hasChildren ( root ) ) { list . add ( root ) ; } } return concatenate ( list . toArray ( ) , project . getNonRubyResources ( ) ) ; } protected boolean isProjectSourceFolderRoot ( ISourceFolderRoot root ) { IResource resource = root . getResource ( ) ; return ( resource instanceof IProject ) ; } private Object [ ] getFoldersAndRubyScripts ( ISourceFolder folder ) throws RubyModelException { ISourceFolderRoot root = ( ISourceFolderRoot ) folder . getParent ( ) ; IRubyElement [ ] children = root . getChildren ( ) ; List < IRubyElement > list = new ArrayList < IRubyElement > ( ) ; for ( int i = 0 ; i < children . length ; i ++ ) { if ( children [ i ] . equals ( folder ) ) continue ; if ( ! children [ i ] . getElementName ( ) . startsWith ( folder . getElementName ( ) ) ) continue ; String name = children [ i ] . getElementName ( ) ; name = name . substring ( folder . getElementName ( ) . length ( ) + 1 ) ; int index = name . indexOf ( File . separator ) ; if ( index != - 1 ) continue ; list . add ( children [ i ] ) ; } IRubyElement [ ] folders = new IRubyElement [ list . size ( ) ] ; folders = list . toArray ( folders ) ; return concatenate ( folders , concatenate ( folder . getRubyScripts ( ) , folder . getNonRubyResources ( ) ) ) ; } public boolean hasChildren ( Object element ) { if ( getProvideMembers ( ) ) { if ( element instanceof IRubyScript ) { return true ; } } else { if ( element instanceof IRubyScript || element instanceof IFile ) return false ; } if ( element instanceof IRubyProject ) { IRubyProject jp = ( IRubyProject ) element ; if ( ! jp . getProject ( ) . isOpen ( ) ) { return false ; } } if ( element instanceof IParent ) { try { if ( ( ( IParent ) element ) . hasChildren ( ) ) return true ; } catch ( RubyModelException e ) { return true ; } } Object [ ] children = getChildren ( element ) ; return ( children != null ) && children . length > 0 ; } public Object getParent ( Object element ) { if ( ! exists ( element ) ) return null ; return internalGetParent ( element ) ; } protected Object [ ] getRubyProjects ( IRubyModel jm ) throws RubyModelException { return jm . getRubyProjects ( ) ; } private Object [ ] getResources ( IFolder folder ) { try { IResource [ ] members = folder . members ( ) ; IRubyProject javaProject = RubyCore . create ( folder . | |
491 | <s> package org . oddjob . designer . view ; import org . oddjob . arooa . design . screem . BorderedGroup ; import org . oddjob . arooa . design . screem . FieldSelection ; import org . oddjob . arooa . design . screem . FormItem ; import org . oddjob . arooa . design . screem . MultiTypeTable ; import org . oddjob . arooa . design . screem . SingleTypeSelection ; import org . oddjob . arooa . design . screem . TextField ; public class DummyItemViewFactory { public static DummyItemView create ( FormItem item ) { if ( item instanceof BorderedGroup ) { return new FieldGroupDummy ( ( BorderedGroup ) item ) ; } else if ( item instanceof SingleTypeSelection ) { return new TypeSelectionDummy ( ( SingleTypeSelection ) item ) ; } else if ( item instanceof MultiTypeTable ) { return new MultiTypeTableDummy | |
492 | <s> package com . asakusafw . yaess . basic ; import java . io . IOException ; import java . text . MessageFormat ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . runtime . core . context . SimulationSupport ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . ExecutionMonitorProvider ; import com . asakusafw . yaess . core . PhaseMonitor ; import com . asakusafw . yaess . core . ServiceProfile ; @ SimulationSupport public class BasicMonitorProvider extends ExecutionMonitorProvider { static final Logger LOG = LoggerFactory . getLogger ( BasicMonitorProvider . class ) ; private volatile double stepUnit ; public static final String KEY_STEP_UNIT = "stepUnit" ; @ Override protected void doConfigure ( ServiceProfile < ? > profile ) throws InterruptedException , IOException { configureStepUnit ( profile ) ; } private void configureStepUnit ( ServiceProfile < ? > profile ) throws IOException { assert profile != null ; String stepUnitString = profile . getConfiguration ( KEY_STEP_UNIT , false , true ) ; if ( stepUnitString == null ) { LOG . debug ( "" , KEY_STEP_UNIT , profile . getPrefix ( ) ) ; } else { try { stepUnit = Double . | |
493 | <s> package org . oddjob . framework ; import java . io . IOException ; import java . io . ObjectInputStream ; import java . io . ObjectOutputStream ; import java . io . Serializable ; import java . util . concurrent . Callable ; import java . util . concurrent . atomic . AtomicReference ; import org . apache . commons . beanutils . DynaBean ; import org . oddjob . FailedToStopException ; import org . oddjob . Forceable ; import org . oddjob . Resetable ; import org . oddjob . Stoppable ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . life . ComponentPersistException ; import org . oddjob . images . StateIcons ; import org . oddjob . persist . Persistable ; import org . oddjob . state . IsAnyState ; import org . oddjob . state . IsExecutable ; import org . oddjob . state . IsHardResetable ; import org . oddjob . state . IsSoftResetable ; import org . oddjob . state . IsStoppable ; import org . oddjob . state . JobState ; import org . oddjob . state . JobStateChanger ; import org . oddjob . state . JobStateHandler ; import org . oddjob . state . StateEvent ; public class RunnableWrapper extends BaseWrapper implements ComponentWrapper , Serializable , Forceable { private static final long serialVersionUID = 20012052320051231L ; private transient JobStateHandler stateHandler ; private transient JobStateChanger stateChanger ; private Object wrapped ; private transient DynaBean dynaBean ; private volatile transient Thread thread ; private final Object proxy ; private transient Resetable resetableAdaptor ; public RunnableWrapper ( Object wrapped , Object proxy ) { this . wrapped = wrapped ; this . proxy = proxy ; completeConstruction ( ) ; } private void completeConstruction ( ) { this . dynaBean = new WrapDynaBean ( wrapped ) ; stateHandler = new JobStateHandler ( this ) ; stateChanger = new JobStateChanger ( stateHandler , iconHelper , new Persistable ( ) { @ Override public void persist ( ) throws ComponentPersistException { save ( ) ; } } ) ; } @ Override public void setArooaSession ( ArooaSession session ) { super . setArooaSession ( session ) ; resetableAdaptor = new ResetableAdaptorFactory ( ) . resetableFor ( wrapped , session ) ; } @ Override protected JobStateHandler stateHandler ( ) { return stateHandler ; } protected JobStateChanger getStateChanger ( ) { return stateChanger ; } public | |
494 | <s> package com . sun . tools . hat . internal . model ; | |
495 | <s> package com . aptana . rdt . internal . parser . warnings ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . jruby . ast . ArgsNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . ListNode ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . ast . LocalVarNode ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . IDESourcePosition ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . core . compiler . IProblem ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import com . aptana . rdt . AptanaRDTPlugin ; public class UnusedParameterVisitor extends RubyLintVisitor { private Map < String , Node > declared ; private boolean inArgsNode = false ; public UnusedParameterVisitor ( String contents ) { super ( AptanaRDTPlugin . getDefault ( ) . getOptions ( ) , contents ) ; declared = new HashMap < String , Node > ( ) ; } @ Override protected String getOptionKey ( ) { return AptanaRDTPlugin . COMPILER_PB_UNUSED_PARAMETER ; } public Object visitDefnNode ( DefnNode iVisited ) { List < Node > args = getArgs ( iVisited . getArgsNode ( ) ) ; for ( Node arg : args ) { declared . put ( ASTUtil . getNameReflectively ( arg ) , arg ) ; } return null ; } @ Override public Object visitArgsNode ( ArgsNode visited ) { inArgsNode = true ; return super . visitArgsNode ( visited ) ; } @ Override public void exitArgsNode ( ArgsNode visited ) { inArgsNode = false ; super . exitArgsNode ( visited ) ; } @ Override public Object visitLocalAsgnNode ( LocalAsgnNode iVisited ) { if ( inArgsNode ) { declared . put ( iVisited . getName ( ) , iVisited ) ; } return super . visitLocalAsgnNode ( iVisited ) ; } public void exitDefnNode ( DefnNode iVisited ) { for ( Node unused : declared . values ( ) ) { String name = ASTUtil . getNameReflectively ( unused ) ; ISourcePosition original = unused . getPosition ( ) ; ISourcePosition pos = new IDESourcePosition ( original . getFile ( ) , original . getStartLine ( ) , original . getEndLine ( ) , original . getStartOffset ( ) , original . getStartOffset ( ) + name . length ( ) ) ; createProblem ( pos , "" + name | |
496 | <s> package com . asakusafw . bulkloader . cache ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . IOException ; import java . net . URI ; import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . ArrayList ; import java . util . Calendar ; import java . util . Collection ; import java . util . Collections ; import java . util . Date ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . fs . FileStatus ; import org . apache . hadoop . fs . FileSystem ; import org . apache . hadoop . fs . Path ; import org . junit . Before ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . common . FileNameUtil ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . transfer . FileListProvider ; import com . asakusafw . bulkloader . transfer . ProcessFileListProvider ; import com . asakusafw . runtime . configuration . FrameworkDeployer ; import com . asakusafw . runtime . configuration . HadoopEnvironmentChecker ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . stage . temporary . TemporaryStorage ; import com . asakusafw . runtime . util . hadoop . ConfigurationProvider ; import com . asakusafw . thundergate . runtime . cache . CacheInfo ; import com . asakusafw . thundergate . runtime . cache . CacheStorage ; import com . asakusafw . thundergate . runtime . cache . mapreduce . CacheBuildClient ; public class CacheBuildTest { @ Rule public HadoopEnvironmentChecker check = new HadoopEnvironmentChecker ( false ) ; @ Rule public final FrameworkDeployer framework = new FrameworkDeployer ( ) { @ Override protected void deploy ( ) throws IOException { deployLibrary ( CacheInfo . class , "" ) ; } } ; @ Before public void setUp ( ) throws Exception { URI uri = getTargetUri ( ) ; FileSystem fs = FileSystem . get ( uri , getConfiguration ( ) ) ; fs . delete ( new Path ( uri ) , true ) ; } @ Test public void create ( ) throws Exception { CacheInfo info = new CacheInfo ( "a" , "id" , calendar ( "" ) , "EXAMPLE" , Collections . singleton ( "COL" ) , "" , 123L ) ; framework . deployLibrary ( TestDataModel . class , "" ) ; CacheStorage storage = new CacheStorage ( getConfiguration ( ) , getTargetUri ( ) ) ; try { storage . putPatchCacheInfo ( info ) ; ModelOutput < TestDataModel > output = create ( storage , storage . getPatchContents ( "0" ) ) ; try { TestDataModel model = new TestDataModel ( ) ; | |
497 | <s> package net . sf . sveditor . core . db . search ; import net . sf . sveditor . core . db . ISVDBNamedItem ; import net . | |
498 | <s> package de . fuberlin . wiwiss . d2rq . nodes ; import java . util . Arrays ; import junit . framework . TestCase ; import com . hp . hpl . jena . datatypes . xsd . XSDDatatype ; import com . hp . hpl . jena . graph . Node ; import com . hp . hpl . jena . rdf . model . AnonId ; import de . fuberlin . wiwiss . d2rq . algebra . Attribute ; import de . fuberlin . wiwiss . d2rq . values . BlankNodeID ; import de . fuberlin . wiwiss . d2rq . values . Column ; | |
499 | <s> package com . asakusafw . testdriver . core ; import java . math . BigDecimal ; import java . math . BigInteger ; public abstract class DataModelScanner < C , E extends Throwable > { public void scan ( DataModelDefinition < ? > definition , C context ) throws E { if ( definition == null ) { throw new IllegalArgumentException ( "" ) ; } for ( PropertyName name : definition . getProperties ( ) ) { scan ( definition , name , context ) ; } } public void scan ( DataModelDefinition < ? > definition , PropertyName name , C context ) throws E { if ( definition == null ) { throw new IllegalArgumentException ( "" ) ; } if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } PropertyType type = definition . getType ( name ) ; if ( type == null ) { anyProperty ( name , context ) ; } else { switch ( type ) { case BOOLEAN : booleanProperty ( name , context ) ; break ; case BYTE : byteProperty ( name , context ) ; break ; case DATE : dateProperty ( name , context ) ; break ; case DATETIME : datetimeProperty ( name , context ) ; break ; case DECIMAL : decimalProperty ( name , context ) ; break ; case DOUBLE : doubleProperty ( name , context ) ; break ; case FLOAT : floatProperty ( name , context ) ; break ; case INT : intProperty ( name , context ) ; break ; case INTEGER : integerProperty ( name , context ) ; break ; case LONG : longProperty ( name , context ) ; break ; case OBJECT : objectProperty ( name , |