id
int32
0
3k
input
stringlengths
43
33.8k
gt
stringclasses
1 value
300
<s> package com . asakusafw . windgate . stream ; import java . io . Closeable ; import java . io . IOException ; import java . io . OutputStream ; public abstract class OutputStreamProvider implements Closeable { public long getDesiredStreamSize ( ) { return 0L ; } public abstract void next ( ) throws IOException ; public abstract
301
<s> package com . asakusafw . dmdl . directio . csv . driver ; import com . asakusafw . dmdl . directio . csv . driver . CsvFieldTrait . Kind ; import com . asakusafw . dmdl . model . AstAttribute ; import com . asakusafw . dmdl . model . BasicTypeKind ; import com . asakusafw . dmdl . semantics . DmdlSemantics ; import com . asakusafw . dmdl . semantics . PropertyDeclaration ; import com . asakusafw . dmdl . spi . PropertyAttributeDriver ; import com . asakusafw . dmdl . util . AttributeUtil ; public class CsvLineNumberDriver
302
<s> package net . ggtools . grand . ui . graph . draw2d ; import org . eclipse . draw2d . text . FlowPage ; import org . eclipse . draw2d . text . LineBox ; import org . eclipse . draw2d . text . PageFlowLayout ; public class ConstrainedPageFlowLayout extends PageFlowLayout { private int maxFlowWidth = - 1 ; public ConstrainedPageFlowLayout ( final FlowPage page ) { super ( page ) ; } public int getMaxFlowWidth ( ) { return maxFlowWidth ; } public void setMaxFlowWidth ( final int maxFlowWidth ) { this . maxFlowWidth = maxFlowWidth ; invalidate ( ) ; } @ Override protected void setupLine ( final LineBox line ) { super
303
<s> package com . asakusafw . compiler . fileio . flow ; import com . asakusafw . compiler . fileio . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . fileio . model . Ex1 ; import com . asakusafw . compiler . fileio . operator . ExOperatorFactory ; import com . asakusafw . compiler . fileio . operator . ExOperatorFactory . Update ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . Import ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . JobFlow ; import com . asakusafw . vocabulary . flow . Out ; @ JobFlow ( name = "job" ) public class MultipleOutputJob extends FlowDescription { private final In <
304
<s> package org . rubypeople . rdt . debug . ui ; import java . io . File ; import java . net . MalformedURLException ; import java . net . URL ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Platform ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . dialogs . IDialogConstants ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . DisposeEvent ; import org . eclipse . swt . events . DisposeListener ; import org . eclipse . swt . events . SelectionAdapter ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . graphics . Font ; import org . eclipse . swt . graphics . FontData ; 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 . Label ; import org . eclipse . swt . widgets . Link ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . browser . IWorkbenchBrowserSupport ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . debug . ui . RdtDebugUiMessages ; import org . rubypeople . rdt . internal . debug . ui . RdtDebugUiPlugin ; import org . rubypeople . rdt . launching . IVMInstall ; import org . rubypeople . rdt . launching . RubyRuntime ; public class InstallDeveloperToolsDialog extends Dialog { public InstallDeveloperToolsDialog ( Shell parentShell ) { super ( parentShell ) ; setShellStyle ( getDefaultOrientation ( ) | SWT . RESIZE | SWT . APPLICATION_MODAL | SWT . DIALOG_TRIM ) ; } protected void configureShell ( Shell newShell ) { super . configureShell ( newShell ) ; newShell . setText ( RdtDebugUiMessages . ToolChainNotFound_title ) ; } protected Control createDialogArea ( Composite parent ) { Composite composite = ( Composite ) super . createDialogArea ( parent ) ; Composite control = new Composite ( composite , SWT . NULL ) ; GridLayout layout = new GridLayout ( 1 , false ) ; control . setLayout ( layout ) ; control . setLayoutData ( new GridData ( SWT . FILL , SWT . FILL , true , true ) ) ; if ( Platform . getOS ( ) . equals ( Platform . OS_MACOSX ) ) { createMacDialog ( control ) ; } else { createLinuxDialog ( control ) ; } GridData data = new GridData ( SWT . FILL , SWT . FILL , true , true ) ; control . setLayoutData ( data ) ; return composite ; } private void createLinuxDialog ( Composite parent ) { Label label = new Label ( parent , SWT . LEFT | SWT . WRAP ) ; label . setText ( RdtDebugUiMessages . ToolChainNotFound_msg ) ; GridData data = new GridData ( SWT . FILL , SWT . FILL , true , false ) ; data . widthHint = 300 ; label . setLayoutData ( data ) ; } private void createMacDialog ( Composite parent ) { FontData [ ] fds = parent . getFont ( ) . getFontData ( ) ; for ( FontData fd : fds ) { fd . setHeight ( fd . getHeight ( ) + 4 ) ; fd . setStyle ( SWT . BOLD ) ; } final Font font = new Font ( parent . getDisplay ( ) , fds ) ; fds = parent . getFont ( ) . getFontData ( ) ; for ( FontData fd : fds ) { fd . setHeight ( fd . getHeight ( ) + 2 ) ; fd . setStyle ( SWT . BOLD ) ; } final Font font2 = new Font ( parent . getDisplay ( ) , fds ) ; Composite top = new Composite ( parent , SWT . NONE ) ; top . addDisposeListener ( new DisposeListener ( ) { public void widgetDisposed ( DisposeEvent e ) { if ( font != null && ! font . isDisposed ( ) ) { font . dispose ( ) ; } if ( font2 != null && ! font2 . isDisposed ( ) ) { font2 . dispose ( ) ; } } } ) ; GridLayout tLayout = new GridLayout ( 2 , false ) ; tLayout . marginHeight = 0 ; tLayout . marginWidth = 0 ; tLayout . marginBottom = 10 ; top . setLayout ( tLayout ) ; top . setLayoutData ( new GridData ( SWT . FILL , SWT . FILL , true , false ) ) ; GridData iconData = new GridData ( SWT . FILL , SWT . TOP , true , false ) ; iconData . verticalIndent = 5 ; Label icon = new Label ( top , SWT . LEFT ) ; icon . setImage ( RdtDebugUiPlugin . getImage ( "" ) ) ; icon . setLayoutData ( iconData ) ; Composite rightTop = new Composite ( top , SWT . NONE ) ; GridLayout rtLayout = new GridLayout ( 1 , false ) ; rtLayout . marginHeight = 0 ; rtLayout . marginWidth = 0 ; rightTop . setLayout ( rtLayout ) ; Label title = new Label ( rightTop , SWT . LEFT ) ; title . setFont ( font ) ; title . setText ( "" ) ; title . setLayoutData ( new GridData ( SWT . FILL , SWT . TOP , true , false ) ) ; Label line1 = new Label ( rightTop , SWT . LEFT ) ; line1 . setText ( "" ) ; Label line2 = new Label ( rightTop , SWT . LEFT ) ; line2 . setText ( "" ) ; Label installDiskLabel = new Label ( parent , SWT . LEFT ) ; installDiskLabel . setImage ( RdtDebugUiPlugin . getImage ( "" ) ) ; installDiskLabel . setLayoutData ( new GridData ( SWT . CENTER , SWT . END , true , false ) ) ; GridData oData = new GridData ( SWT . FILL , SWT . FILL , true , false ) ; oData . horizontalIndent = 10 ; Label optionA = new Label ( parent , SWT . LEFT ) ; optionA . setLayoutData ( oData ) ; optionA . setFont ( font2 ) ; optionA . setText ( "" ) ; GridData iData = new GridData ( SWT . FILL , SWT . FILL , true , false ) ; iData . horizontalIndent = 25 ; Label instructionA = new Label ( parent , SWT . LEFT ) ; instructionA . setLayoutData ( iData ) ; instructionA . setText ( "" ) ; Label optionB = new Label ( parent , SWT . LEFT ) ; GridData oData2 = new GridData ( SWT . FILL , SWT . FILL , true , false ) ; oData2 . horizontalIndent = 10 ; oData2 . verticalIndent = 10 ; optionB . setFont ( font2 ) ; optionB . setLayoutData ( oData2 ) ; optionB . setText ( "" ) ; Link instructionsB = new Link ( parent , SWT . LEFT ) ; instructionsB . setText ( "" ) ; instructionsB . setLayoutData ( iData ) ; instructionsB . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { try { IWorkbenchBrowserSupport support = PlatformUI . getWorkbench (
305
<s> package net . sf . sveditor . core . docs ; import java . io . File ; import net . sf . sveditor . core . docs . model . DocModel ; public interface IDocWriter { public
306
<s> package com . pogofish . jadt ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . Reader ; import java . net . URL ; import java . util . Properties ; import com . pogofish . jadt . util . ExceptionAction ; import com . pogofish . jadt . util . Util ; public class Version { String MODULE_PROPERTIES = "" ; String MODULE_VERSION = "" ; public String getVersion ( ) { return Util . execute ( new ExceptionAction < String > ( ) { @ Override public String doAction ( ) throws IOException { final URL resource = Version . class . getClassLoader ( ) . getResource ( MODULE_PROPERTIES ) ; if ( resource == null ) { throw new FileNotFoundException ( "" + MODULE_PROPERTIES ) ; } final Reader reader = new InputStreamReader ( resource . openStream ( ) , "UTF-8" ) ; try { final Properties properties = new Properties
307
<s> package net . sf . sveditor . ui . svt . editor ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . Viewer ; import org . w3c . dom . Document ; import org . w3c . dom . Element ; import org . w3c . dom . Node ; import org . w3c . dom . NodeList ; public class SVTContentProvider implements ITreeContentProvider { private Document fDocument ; private Element fRoot ; public void dispose ( ) { } public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { fDocument = ( Document ) newInput ; if ( fDocument != null ) { NodeList nl = fDocument . getElementsByTagName ( "sv_template" ) ; if ( nl . getLength ( ) > 0 ) { fRoot = ( Element ) nl . item ( 0 ) ; } else { fRoot = null ; } } } public Object [ ] getElements ( Object inputElement ) { return new Object [ ] { "Templates" , "Categories" } ; } public Object [ ] getChildren ( Object parentElement ) { if ( parentElement instanceof String ) { NodeList nl = fDocument . getElementsByTagName ( "sv_template" ) ; List < Node > ret = new ArrayList < Node > ( ) ; String s = ( String ) parentElement ; if ( nl . getLength ( ) > 0 ) { Element sv_template = ( Element ) nl . item ( 0 ) ; if ( s . equals ( "Templates" ) ) { if ( sv_template != null ) { nl = sv_template . getElementsByTagName ( "template" ) ; } } else if ( s . equals ( "Categories" ) ) { if ( sv_template != null ) { nl = sv_template . getElementsByTagName ( "category" ) ; } } for ( int i = 0 ; i < nl . getLength ( ) ; i ++ ) { ret . add ( nl . item ( i ) ) ; } } return ret . toArray ( ) ; } else { Element e = ( Element ) parentElement ; if ( e . getNodeName ( ) . equals
308
<s> package com . asakusafw . compiler . flow . processor ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . List ; import org . junit . Test ; import com . asakusafw . compiler . flow . JobflowCompilerTestRoot ; import com . asakusafw . compiler . flow . processor . flow . UpdateFlowSimple ; import com . asakusafw . compiler . flow . processor . flow . UpdateFlowWithParameter ; import com . asakusafw . compiler . flow . stage . StageModel ; import com . asakusafw . compiler . flow . stage . StageModel . Fragment ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . runtime . core . Result ; import com . asakusafw . runtime . testing . MockResult ; import com . asakusafw . utils . java . model . syntax . Name ; public class UpdateFlowProcessorTest extends JobflowCompilerTestRoot { @ Test public void simple ( ) { List < StageModel > stages = compile ( UpdateFlowSimple . class ) ; Fragment fragment = stages . get ( 0 ) . getMapUnits ( ) . get ( 0 ) . getFragments ( ) . get ( 0 ) ; Name name = fragment . getCompiled ( ) . getQualifiedName ( ) ; ClassLoader loader = start ( ) ; PortMapper mapper = new PortMapper ( fragment ) ; MockResult < Ex1 > result = mapper . create ( "out" ) ; @ SuppressWarnings ( "unchecked" ) Result < Ex1 > f = ( Result < Ex1 > ) create ( loader , name , mapper . toArguments ( ) ) ; Ex1 ex1 = new Ex1 ( ) ; ex1 . setValue ( 100 ) ; f . add ( ex1 ) ; assertThat ( result . getResults ( ) . size ( ) , is ( 1 ) ) ;
309
<s> package com . asakusafw . testdriver . core ; import java . io . Serializable ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . LinkedHashMap ; import java . util . Map ; public class DataModelReflection implements Serializable { private static final long serialVersionUID = - 7083466307911956679L ; protected final Map < PropertyName , ? > properties ; public DataModelReflection ( Map < PropertyName , ? > properties ) { if ( properties == null ) { throw new IllegalArgumentException ( "" ) ; } this . properties = normalize ( properties ) ; } private static Map < PropertyName , ? > normalize ( Map < PropertyName , ? > properties ) { assert properties != null ; Map < PropertyName , Object > results = new LinkedHashMap < PropertyName , Object > ( ) ; for ( Map . Entry < PropertyName , ? > entry : properties . entrySet ( ) ) { if ( entry . getKey ( ) != null ) { results . put ( entry . getKey ( )
310
<s> package de . fuberlin . wiwiss . pubby . negotiation ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . List ; import java . util . regex . Pattern ; public class ContentTypeNegotiator { private List < VariantSpec > variantSpecs = new ArrayList < VariantSpec > ( ) ; private List < MediaRangeSpec > defaultAcceptRanges = Collections . singletonList ( MediaRangeSpec . parseRange ( "*/*" ) ) ; private Collection < AcceptHeaderOverride > userAgentOverrides = new ArrayList < AcceptHeaderOverride > ( ) ; public VariantSpec addVariant ( String mediaType ) { VariantSpec result = new VariantSpec ( mediaType ) ; variantSpecs . add ( result ) ; return result ; } public void setDefaultAccept ( String accept ) { this . defaultAcceptRanges = MediaRangeSpec . parseAccept ( accept ) ; } public void addUserAgentOverride ( Pattern userAgentString , String originalAcceptHeader , String newAcceptHeader ) { this . userAgentOverrides . add ( new AcceptHeaderOverride ( userAgentString , originalAcceptHeader , newAcceptHeader ) ) ; } public MediaRangeSpec getBestMatch ( String accept ) { return
311
<s> package com . asakusafw . windgate . hadoopfs . ssh ; 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 . io . OutputStream ; import java . util . Collections ; import java . util . HashMap ; 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 . After ; import org . junit . Before ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . runtime . core . context . RuntimeContext ; import com . asakusafw . runtime . core . context . RuntimeContext . ExecutionMode ; import com . asakusafw . runtime . core . context . RuntimeContextKeeper ; public class WindGateHadoopPutTest { @ Rule public final RuntimeContextKeeper rc = new RuntimeContextKeeper ( ) ; private static final Path PREFIX = new Path ( "" ) ; private Configuration conf ; private FileSystem fs ; private InputStream stdin ; @ Before public void setUp ( ) throws Exception { conf = new Configuration ( ) ; fs = FileSystem . get ( conf ) ; clear ( ) ; stdin = System . in ; } @ After public void tearDown ( ) throws Exception { if ( stdin != null ) { System . setIn ( stdin ) ; } clear ( ) ; } private void clear ( ) throws IOException { if ( fs == null ) { return ; } fs . delete ( PREFIX , true ) ; } @ Test public void simple ( ) throws Exception { ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; FileList . Writer writer = FileList . createWriter ( buffer ) ; Path testing = new Path ( PREFIX , "testing" ) ; put ( writer , testing , "" ) ; writer . close ( ) ; ByteArrayInputStream in = new ByteArrayInputStream ( buffer . toByteArray ( ) ) ; int result = new WindGateHadoopPut ( conf ) . execute ( in ) ; assertThat ( result , is ( 0 ) ) ; Map < String , String > contents = get ( ) ; assertThat ( contents . size ( ) , is ( 1 ) ) ; assertThat ( contents . get ( "testing" ) , is ( "" ) ) ; } @ Test public void multiple ( ) throws Exception { ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; FileList . Writer writer = FileList . createWriter ( buffer ) ; Path testing1 = new Path ( PREFIX , "testing-1" ) ; Path testing2 = new Path ( PREFIX , "testing-2" ) ; Path testing3 = new Path ( PREFIX , "testing-3" ) ; put ( writer , testing1 , "" ) ; put ( writer , testing2 , "" ) ; put ( writer , testing3 , "" ) ; writer . close ( ) ; ByteArrayInputStream in = new ByteArrayInputStream ( buffer . toByteArray ( ) ) ; int result = new WindGateHadoopPut ( conf ) . execute ( in ) ; assertThat ( result , is ( 0 ) ) ; Map < String , String > contents = get ( ) ; assertThat ( contents . size ( ) , is ( 3 ) ) ; assertThat ( contents . get ( "testing-1" ) , is ( "" ) ) ; assertThat ( contents . get ( "testing-2" ) , is ( "" ) ) ; assertThat ( contents . get ( "testing-3" ) , is ( "" ) ) ; } @ Test public void empty ( ) throws Exception { ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; FileList . Writer writer = FileList . createWriter ( buffer ) ; writer . close ( ) ; ByteArrayInputStream in = new ByteArrayInputStream ( buffer . toByteArray ( ) ) ; int result = new WindGateHadoopPut ( conf ) . execute ( in ) ; assertThat ( result , is ( 0 ) ) ; Map < String , String > contents = get ( ) ; assertThat ( contents . size ( ) , is ( 0 ) ) ; } @ Test public void arguments ( ) throws Exception { ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; FileList . Writer writer = FileList . createWriter ( buffer ) ; Path testing = new Path ( PREFIX , "testing" ) ; put ( writer , testing , "" ) ; writer . close ( ) ; ByteArrayInputStream in = new ByteArrayInputStream ( buffer . toByteArray ( ) ) ; int result = new WindGateHadoopPut ( conf ) . execute ( in , testing . toString ( ) ) ; assertThat ( result , is ( not ( 0 ) ) ) ; } @ Test public void broken ( ) throws Exception { ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; FileList . Writer writer = FileList . createWriter ( buffer ) ; Path testing = new Path ( PREFIX , "testing" ) ; put ( writer , testing , "" ) ; ByteArrayInputStream in = new ByteArrayInputStream ( buffer . toByteArray ( ) ) ; int result = new WindGateHadoopPut ( conf ) . execute ( in ) ; assertThat ( result , is ( not ( 0 ) ) ) ; } @ Test
312
<s> package org . rubypeople . rdt . ui . wizards ; import java . lang . reflect . InvocationTargetException ; import java . net . URI ; import org . eclipse . core . filesystem . URIUtil ; import org . eclipse . core . resources . IProject ; 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 . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . operation . IRunnableWithProgress ; import org . eclipse . swt . SWT ; 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 . ui . PlatformUI ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . internal . corext . util . BusyIndicatorRunnableContext ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . wizards . IStatusChangeListener ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . BuildPathsBlock ; public class RubyCapabilityConfigurationPage extends NewElementWizardPage { private static final String PAGE_NAME = "" ; private IRubyProject fRubyProject ; private BuildPathsBlock fBuildPathsBlock ; public RubyCapabilityConfigurationPage ( ) { super ( PAGE_NAME ) ; fRubyProject = null ; setTitle ( NewWizardMessages . RubyCapabilityConfigurationPage_title ) ; setDescription (
313
<s> package net . sf . sveditor . core . db . index . cache ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . io . RandomAccessFile ; import java . nio . ByteBuffer ; import java . nio . channels . FileChannel ; import java . nio . channels . FileChannel . MapMode ; public class MappedByteBufferInputStream extends InputStream { private RandomAccessFile fIn ; private ByteBuffer fByteBuffer ; private int fBufferIdx ; private byte fTmp [ ] = new byte [ 1 ] ; public MappedByteBufferInputStream ( File path ) throws IOException { fIn = new RandomAccessFile ( path , "r" ) ; FileChannel channel = fIn . getChannel ( ) ; fByteBuffer = channel . map ( MapMode . READ_ONLY , 0 , channel . size ( ) ) ; fBufferIdx = 0 ; } @ Override public int available ( ) throws IOException { return ( fByteBuffer . limit ( ) - fBufferIdx ) ; } @ Override public void close ( ) throws IOException { fIn . close ( ) ; } @ Override public boolean markSupported ( ) { return false ; } @ Override public int read ( ) throws IOException { int ret = read ( fTmp , 0 , 1 ) ; if ( ret <= 0 ) { return - 1 ; } else { return fTmp [ 0 ] ; } } @ Override public int read ( byte [ ] b , int off , int len ) throws IOException { int ret = - 1 ; if ( fByteBuffer . remaining ( ) > 0
314
<s> package org . rubypeople . rdt . internal . core . search . indexing ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . internal . core . index . Index ; class RemoveFromIndex extends IndexRequest { String resourceName ; public RemoveFromIndex ( String resourceName , IPath containerPath
315
<s> package com . sun . tools . hat . internal . model ; public abstract class JavaValue extends JavaThing { protected JavaValue ( ) { } public boolean isHeapAllocated ( ) { return false ; }
316
<s> package net . sf . sveditor . core . tests . index . persistence ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . DataInput ; import java . io . DataInputStream ; import java . io . DataOutput ; import java . io . DataOutputStream ; import junit . framework . TestCase ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . index . SVDBBaseIndexCacheData ; import net . sf . sveditor . core . db . persistence . DBFormatException ; import net . sf . sveditor . core . db . persistence . DBWriteException ; import net . sf . sveditor . core . db . persistence . IDBReader ; import net . sf . sveditor . core . db . persistence . IDBWriter ; import net . sf . sveditor . core . db . persistence . SVDBPersistenceRW ; import net . sf . sveditor . core . db . refs . SVDBRefCacheEntry ; import net . sf . sveditor . core . db . refs . SVDBRefType ; public class TestPersistenceUnit extends TestCase { public void testRWRefCacheEntry ( ) throws DBFormatException , DBWriteException { IDBWriter writer = new SVDBPersistenceRW ( ) ; IDBReader reader
317
<s> package org . oddjob . sql ; import java . sql . SQLException ; import org . oddjob . arooa . registry . Path ; public interface SQLSerialization { public void persist ( Path path , String id , Object o ) throws SQLException ; public Object restore ( Path path , String id ,
318
<s> package org . oddjob . launch ; import java . io . File ; import java . io . IOException ; import java . net . URL ; class ClassPathHelper { static final String CLASS_PATH_PROPERTY = "" ; private final File [ ] files ; public ClassPathHelper ( File [ ] files ) { this . files = files ; } public URL [ ] toURLs ( ) { URL [ ] urls = new URL [ files . length ] ; for ( int i = 0 ; i < urls . length ; ++ i ) { try { urls [ i ] = files [ i ] . toURI ( ) . toURL ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "Classpath " + files [ i ] + " is invalid" , e ) ; } } return urls ; } public void appendToJavaClassPath ( ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( System . getProperty ( CLASS_PATH_PROPERTY ) ) ; for ( int i = 1 ; i < files . length ; ++ i ) { if ( builder . length ( ) > 0 ) { builder . append ( File . pathSeparator ) ; } try { builder . append (
319
<s> package com . asakusafw . vocabulary . operator ; import java . lang . annotation
320
<s> package osgiutils . services ; import java . util . Collection ; import java . util . Collections ; public abstract class DefaultCollectionServiceRunnable < T , R > extends DefaultServiceRunnable < T
321
<s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . io . File ; import java . util . List ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . jface . dialogs . IDialogSettings ; import org . eclipse . jface . dialogs . StatusDialog ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . DirectoryDialog ; import org . eclipse . swt . widgets . FileDialog ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . IUIConstants ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . dialogs . StatusUtil ; 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 . IStringButtonAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . LayoutUtil ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . SelectionButtonDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . StringButtonDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . StringDialogField ; public class VariableCreationDialog extends StatusDialog { private IDialogSettings fDialogSettings ; private StringDialogField fNameField ; private StatusInfo fNameStatus ; private StringButtonDialogField fPathField ; private StatusInfo fPathStatus ; private SelectionButtonDialogField fDirButton ; private CPVariableElement fElement ; private List fExistingNames ; public VariableCreationDialog ( Shell parent , CPVariableElement element , List existingNames ) { super ( parent ) ; if ( element == null ) { setTitle ( NewWizardMessages . VariableCreationDialog_titlenew ) ; } else { setTitle ( NewWizardMessages . VariableCreationDialog_titleedit ) ; } fDialogSettings = RubyPlugin . getDefault ( ) . getDialogSettings ( ) ; fElement = element ; fNameStatus = new StatusInfo ( ) ; fPathStatus = new StatusInfo ( ) ; NewVariableAdapter adapter = new NewVariableAdapter ( ) ; fNameField = new StringDialogField ( ) ; fNameField . setDialogFieldListener ( adapter ) ; fNameField . setLabelText ( NewWizardMessages . VariableCreationDialog_name_label ) ; fPathField = new StringButtonDialogField ( adapter ) ; fPathField . setDialogFieldListener ( adapter ) ; fPathField . setLabelText ( NewWizardMessages . VariableCreationDialog_path_label ) ; fPathField . setButtonLabel ( NewWizardMessages . VariableCreationDialog_path_file_button ) ; fDirButton = new SelectionButtonDialogField ( SWT . PUSH ) ; fDirButton . setDialogFieldListener ( adapter ) ; fDirButton . setLabelText ( NewWizardMessages . VariableCreationDialog_path_dir_button ) ; fExistingNames = existingNames ; if ( element != null ) { fNameField . setText ( element . getName ( ) ) ; fPathField . setText ( element . getPath ( ) . toString ( ) ) ; fExistingNames . remove ( element . getName ( ) ) ; } else { fNameField . setText ( "" ) ; fPathField . setText ( "" ) ; } } protected void configureShell ( Shell newShell ) { super . configureShell ( newShell ) ; PlatformUI . getWorkbench ( ) . getHelpSystem ( ) . setHelp ( newShell , IRubyHelpContextIds . VARIABLE_CREATION_DIALOG ) ; } public CPVariableElement getClasspathElement ( ) { return new CPVariableElement ( fNameField . getText ( ) , new IPath [ ] { new Path ( fPathField . getText ( ) ) } , false ) ; } protected Control createDialogArea ( Composite parent ) { Composite composite = ( Composite ) super . createDialogArea ( parent ) ; Composite inner = new Composite ( composite , SWT . NONE ) ; inner . setFont ( composite . getFont ( ) ) ; GridLayout layout = new GridLayout ( ) ; layout . marginWidth = 0 ; layout . marginHeight = 0 ; layout . numColumns = 3 ; inner . setLayout ( layout ) ; int fieldWidthHint = convertWidthInCharsToPixels ( 50 ) ; fNameField . doFillIntoGrid ( inner , 2 ) ; LayoutUtil . setWidthHint ( fNameField . getTextControl ( null ) , fieldWidthHint ) ; LayoutUtil . setHorizontalGrabbing ( fNameField . getTextControl ( null ) ) ; DialogField . createEmptySpace ( inner , 1 ) ; fPathField . doFillIntoGrid ( inner , 3 ) ; LayoutUtil . setWidthHint ( fPathField . getTextControl ( null ) , fieldWidthHint ) ; DialogField . createEmptySpace ( inner , 2 ) ; fDirButton . doFillIntoGrid ( inner , 1 ) ; DialogField focusField = ( fElement == null ) ? fNameField : fPathField ; focusField . postSetFocusOnDialogField ( parent . getDisplay ( ) ) ; applyDialogFont ( composite ) ; return composite ; } private class NewVariableAdapter implements IDialogFieldListener , IStringButtonAdapter { public void dialogFieldChanged ( DialogField field ) { doFieldUpdated ( field ) ; } public void changeControlPressed ( DialogField field ) { doChangeControlPressed ( field ) ; } } private void doChangeControlPressed ( DialogField field ) { if ( field == fPathField ) { IPath path = chooseExtJarFile ( ) ; if ( path != null ) { fPathField . setText ( path . toString ( ) ) ; } } } private void doFieldUpdated ( DialogField field ) { if ( field == fNameField ) { fNameStatus = nameUpdated ( ) ; }
322
<s> package org . rubypeople . rdt . refactoring . core . renamemodule ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . ConstNode ; import org . rubypeople . rdt . refactoring . editprovider . FileEditProvider ; import org . rubypeople . rdt . refactoring . editprovider . SimpleNodeEditProvider ; public
323
<s> package de . fuberlin . wiwiss . d2rq . server ; import java . io . IOException ; import java . util . Map ; import java . util . TreeMap ; import javax . servlet . ServletException ; import javax . servlet . http . HttpServlet ; import javax . servlet . http . HttpServletRequest ; import javax . servlet . http . HttpServletResponse ; import org . apache . velocity . context . Context ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . ResIterator ; import com . hp . hpl . jena . rdf . model . Resource ; import com . hp . hpl . jena . rdf . model . Statement ; import de
324
<s> package org . rubypeople . rdt . refactoring . core . renamefield ; import java . util . Collection ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . refactoring . core . renamefield . fielditems . FieldItem ; import org . rubypeople . rdt . refactoring . core . renamemethod . MethodRenamer ; import org . rubypeople . rdt . refactoring . core . renamemethod . RenameMethodConditionChecker ; import org . rubypeople . rdt . refactoring . core . renamemethod . RenameMethodConfig ; import org . rubypeople . rdt . refactoring . editprovider . EditProvider ; import org . rubypeople . rdt . refactoring . editprovider . FileEditProvider ; import org . rubypeople . rdt . refactoring . editprovider . FileMultiEditProvider ; import org . rubypeople . rdt . refactoring . editprovider . IMultiFileEditProvider ; import org . rubypeople . rdt . refactoring . editprovider . MultiFileEditProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . INodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . MethodNodeWrapper ; public class FieldRenamer implements IMultiFileEditProvider { private RenameFieldConfig config ; public FieldRenamer ( RenameFieldConfig config ) { this . config = config ; } public Collection < FileMultiEditProvider > getFileEditProviders ( ) { MultiFileEditProvider fileEdits = new MultiFileEditProvider ( ) ;
325
<s> package com . asakusafw . bulkloader . exception ; import java . sql . SQLException ; public class BulkLoaderSystemException extends Exception { private final Class < ? > clazz ; private final String messageId ; private final Object [ ] messageArgs ; private static final long serialVersionUID = 1L ; public BulkLoaderSystemException ( Throwable cause , Class < ? > clazz , String messageId , Object ... messageArgs ) { super ( cause ) ; this . clazz = clazz ; this . messageId = messageId ; this . messageArgs = messageArgs . clone ( ) ; } public BulkLoaderSystemException ( Class < ? > clazz , String messageId , Object ... messageArgs ) { this . clazz = clazz ; this . messageId = messageId ; this . messageArgs = messageArgs . clone ( ) ; } public Class < ? > getClazz ( ) { return clazz ; } public String getMessageId ( ) { return messageId ; } public Object [ ] getMessageArgs ( ) { return messageArgs . clone
326
<s> package org . rubypeople . rdt . internal . ui . text ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . dialogs . IDialogSettings ; import org . eclipse . jface . dialogs . PopupDialog ; import org . eclipse . jface . text . IInformationControl ; import org . eclipse . jface . text . IInformationControlExtension ; import org . eclipse . jface . text . IInformationControlExtension2 ; import org . eclipse . jface . viewers . ILabelProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . viewers . TreeViewer ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerFilter ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . DisposeEvent ; import org . eclipse . swt . events . DisposeListener ; import org . eclipse . swt . events . FocusListener ; import org . eclipse . swt . events . KeyEvent ; import org . eclipse . swt . events . KeyListener ; import org . eclipse . swt . events . ModifyEvent ; import org . eclipse . swt . events . ModifyListener ; import org . eclipse . swt . events . MouseAdapter ; import org . eclipse . swt . events . MouseEvent ; import org . eclipse . swt . events . MouseMoveListener ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . graphics . FontMetrics ; import org . eclipse . swt . graphics . GC ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Item ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . swt . widgets . Text ; import org . eclipse . swt . widgets . Tree ; import org . eclipse . swt . widgets . TreeItem ; import org . eclipse . ui . IKeyBindingService ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . IWorkbenchPartSite ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . commands . ActionHandler ; import org . eclipse . ui . commands . HandlerSubmission ; import org . eclipse . ui . commands . ICommand ; import org . eclipse . ui . commands . ICommandManager ; import org . eclipse . ui . commands . IKeySequenceBinding ; import org . eclipse . ui . commands . Priority ; import org . eclipse . ui . contexts . IWorkbenchContextSupport ; import org . eclipse . ui . keys . KeySequence ; import org . rubypeople . rdt . core . IParent ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . actions . OpenActionUtil ; import org . rubypeople . rdt . internal . ui . util . StringMatcher ; import org . rubypeople . rdt . ui . actions . CustomFiltersActionGroup ; public abstract class AbstractInformationControl extends PopupDialog implements IInformationControl , IInformationControlExtension , IInformationControlExtension2 , DisposeListener { protected class NamePatternFilter extends ViewerFilter { public NamePatternFilter ( ) { } public boolean select ( Viewer viewer , Object parentElement , Object element ) { StringMatcher matcher = getMatcher ( ) ; if ( matcher == null || ! ( viewer instanceof TreeViewer ) ) return true ; TreeViewer treeViewer = ( TreeViewer ) viewer ; String matchName = ( ( ILabelProvider ) treeViewer . getLabelProvider (
327
<s> package com . asakusafw . utils . java . internal . model . util ; import com . asakusafw . utils . java . model . syntax . ArrayCreationExpression ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . InfixExpression ; import com . asakusafw . utils . java . model . syntax . InfixOperator ; public enum ExpressionPriority { PRIMARY , ARRAY_INITIALIZER , UNARY , CAST , MULTIPLICATIVE , ADDITIVE , SHIFT , RELATIONAL , EQUALITY , LOGICAL , CONDITIONAL_AND , CONDITIONAL_OR , CONDITIONAL , ASSIGNMENT , ; public static ExpressionPriority valueOf ( InfixOperator operator ) { if ( operator == null ) { throw new IllegalArgumentException ( "" ) ; } switch ( operator ) { case TIMES : case DIVIDE : case REMAINDER : return MULTIPLICATIVE ; case PLUS : case MINUS : return ADDITIVE ; case LEFT_SHIFT : case RIGHT_SHIFT_SIGNED : case RIGHT_SHIFT_UNSIGNED : return SHIFT ; case GREATER : case GREATER_EQUALS : case LESS : case LESS_EQUALS : return RELATIONAL ; case EQUALS : case
328
<s> package org . rubypeople . rdt . internal . ui . infoviews ; import java . util . LinkedList ; import java . util . List ; import org . rubypeople . rdt . ui . text . ansi . ANSIParser ; import org . rubypeople . rdt . ui . text . ansi . ANSIToken ; public class FastRIParser extends ANSIParser { public List < ANSIToken > parse ( String s ) { if ( s == null ) return null ; List < ANSIToken > tokens = new LinkedList < ANSIToken > ( ) ; ANSIToken t = new ANSIToken ( ) ; char open = 0 ; StringBuffer buffer = new StringBuffer ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s
329
<s> package org . oddjob . beanbus ; import java . util . EventObject ; public class BusEvent extends EventObject { private static final long serialVersionUID = 2010021800L ; public
330
<s> package net . sf . sveditor . core . db . expr ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBNamedArgExpr extends SVDBExpr { public String fArgName ; public SVDBExpr fExpr ; public SVDBNamedArgExpr ( ) { super ( SVDBItemType . NamedArgExpr ) ; } public void setArgName ( String name ) { fArgName = name ; } public String getArgName ( ) { return
331
<s> package org . oddjob . designer . components ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaType ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignParser ; import org . oddjob . arooa . design . view . ViewMainHelper ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; public class ForEachDCTest extends TestCase { private static final Logger logger = Logger . getLogger ( ForEachDCTest . class ) ; public void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; } DesignInstance design ;
332
<s> package com . asakusafw . dmdl . directio . csv . driver ; import com . asakusafw . dmdl . model . AstNode ; import com . asakusafw . dmdl . semantics . PropertyDeclaration ; import com . asakusafw . dmdl . semantics . Trait ; public class CsvFieldTrait implements Trait < CsvFieldTrait > { private final AstNode originalAst ; private final Kind kind ; private final String name ; public CsvFieldTrait ( AstNode originalAst , Kind kind , String name ) { if ( kind == null ) { throw new IllegalArgumentException ( "" ) ; } this . originalAst = originalAst ; this . kind = kind ; this . name = name ; } @ Override public AstNode getOriginalAst ( ) { return originalAst ; } public static Kind getKind ( PropertyDeclaration property , Kind defaultKind ) { if ( property == null ) { throw new IllegalArgumentException ( "" ) ; } CsvFieldTrait trait = property
333
<s> package org . rubypeople . rdt . internal . debug . ui ; import java . text . MessageFormat ; import java . util . MissingResourceException ; import java . util . ResourceBundle ; import org . eclipse . osgi . util . NLS ; public class RdtDebugUiMessages { private static final String BUNDLE_NAME = RdtDebugUiMessages . class . getName ( ) ; private RdtDebugUiMessages ( ) { } public static String LaunchConfigurationTab_RubyArguments_working_dir_error_message ; public static String LaunchConfigurationTab_RubyEntryPoint_invalidProjectSelectionMessage ; public static String LaunchConfigurationTab_RubyEntryPoint_invalidFileSelectionMessage ; public static String LaunchConfigurationTab_RubyEnvironment_interpreter_not_selected_error_message ; public static String RdtDebugUiPlugin_internalErrorOccurred ; public static String LaunchConfigurationTab_RubyArguments_interpreter_args_box_title ; public static String LaunchConfigurationTab_RubyArguments_program_args_box_title ; public static
334
<s> package org . oddjob . logging ; import java . util . Stack ; import org . apache . log4j . MDC ; public class OddjobNDC implements LoggingConstants { private static InheritableThreadLocal < Stack < LoggerAndJob > > local = new InheritableThreadLocal < Stack < LoggerAndJob > > ( ) { protected Stack < LoggerAndJob > initialValue ( ) { return new Stack < LoggerAndJob > ( ) ; } @ SuppressWarnings ( "unchecked" ) protected Stack < LoggerAndJob > childValue ( Stack < LoggerAndJob > parentValue ) { if
335
<s> package com . asakusafw . compiler . flow . processor . flow ; import com . asakusafw . compiler . flow . processor . FoldFlowProcessor ; import com . asakusafw . compiler . flow . processor . operator . FoldFlowFactory ; import com . asakusafw . compiler . flow . processor . operator . FoldFlowFactory . WithParameter ; import com . asakusafw . compiler . flow . testing . external . Ex1MockExporterDescription ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . model
336
<s> package com . asakusafw . runtime . flow . join ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . List ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . fs . Path ; import org . apache . hadoop . io . Writable ; import com . asakusafw . runtime . flow . FlowResource ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . stage . resource . StageResourceDriver ; import com . asakusafw . runtime . stage . temporary . TemporaryStorage ; public abstract class JoinResource < L extends Writable , R > implements FlowResource { static final Log LOG = LogFactory . getLog ( JoinResource . class ) ; private final LookUpKey lookupKeyBuffer = new LookUpKey ( ) ; private LookUpTable < L > table ; @ Override public void setup ( Configuration configuration ) throws IOException , InterruptedException { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( MessageFormat . format ( "" , getCacheName ( ) ) ) ; } StageResourceDriver driver = new StageResourceDriver ( configuration ) ; try { List < Path > paths = driver . findCache ( getCacheName ( ) ) ; if ( paths . isEmpty ( ) ) { throw new FileNotFoundException ( MessageFormat . format ( "" , getCacheName ( ) ) ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( MessageFormat . format ( "" , getCacheName ( ) , paths ) ) ; } try { table = createTable ( driver , paths ) ; } catch ( IOException e )
337
<s> package com . asakusafw . runtime . io ; import static com . asakusafw . runtime . io . TsvConstants . * ; import java . io . IOException ; import java . io . Writer ; import java . nio . ByteBuffer ; import java . nio . CharBuffer ; import java . nio . charset . Charset ; import java . nio . charset . CharsetDecoder ; import java . nio . charset . CoderResult ; import java . nio . charset . CodingErrorAction ; import java . text . MessageFormat ; import org . apache . hadoop . io . Text ; import com . asakusafw . runtime . value . BooleanOption ; import com . asakusafw . runtime . value . ByteOption ; import com . asakusafw . runtime . value . DateOption ; import com . asakusafw . runtime . value . DateTimeOption ; import com . asakusafw . runtime . value . DateUtil ; import com . asakusafw . runtime . value . DecimalOption ; import com . asakusafw . runtime . value . DoubleOption ; import com . asakusafw . runtime . value . FloatOption ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . ShortOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . runtime . value . ValueOption ; public class TsvEmitter implements RecordEmitter { private static final Charset TEXT_ENCODE = Charset . forName ( "UTF-8" ) ; private static final int BUFFER_SIZE = 2048 ; private final Writer writer ; private final CharsetDecoder decoder ; private final StringBuilder lineBuffer ; private final char [ ] writeBuffer ; private boolean headOfLine ; private final CharBuffer decodeBuffer ; public TsvEmitter ( Writer writer ) throws IOException { if ( writer == null ) { throw new IllegalArgumentException ( "" ) ; } this . writer = writer ; this . decoder = TEXT_ENCODE . newDecoder ( ) . onMalformedInput ( CodingErrorAction . REPORT ) . onUnmappableCharacter ( CodingErrorAction . REPORT ) ; this . lineBuffer = new StringBuilder ( ) ; this . writeBuffer = new char [ BUFFER_SIZE ] ; this . headOfLine = true ; this . decodeBuffer = CharBuffer . wrap ( writeBuffer ) ; } @ Override public void endRecord ( ) throws IOException { flushLineBuffer ( ) ; writer . write ( RECORD_SEPARATOR ) ; headOfLine = true ; } private void flushLineBuffer ( ) throws IOException { int rest = lineBuffer . length ( ) ; int cursor = 0 ; while ( rest > 0 ) { int chunkSize = Math . min ( rest , writeBuffer . length ) ; lineBuffer . getChars ( cursor , cursor + chunkSize , writeBuffer , 0 ) ; writer . write ( writeBuffer , 0 , chunkSize ) ; rest -= chunkSize ; cursor += chunkSize ; } lineBuffer . setLength ( 0 ) ; } private void startCell ( ) { if ( headOfLine == false ) { lineBuffer . append ( CELL_SEPARATOR ) ; } headOfLine = false ; } @ Override public void emit ( BooleanOption option ) throws IOException { startCell ( ) ; if ( emitNull ( option ) ) { return ; } lineBuffer . append ( option . get ( ) ? BOOLEAN_TRUE : BOOLEAN_FALSE ) ; } @ Override public void emit ( ByteOption option ) throws IOException { startCell ( ) ; if ( emitNull ( option ) ) { return ; } lineBuffer . append ( option . get ( ) ) ; } @ Override public void emit ( ShortOption option ) throws IOException { startCell ( ) ; if ( emitNull ( option ) ) { return ; } lineBuffer . append ( option . get ( ) ) ; } @ Override public void emit ( IntOption option ) throws IOException { startCell ( ) ; if ( emitNull ( option ) ) { return ; } lineBuffer . append ( option . get ( ) ) ; } @ Override public void emit ( LongOption option ) throws IOException { startCell ( ) ; if ( emitNull ( option ) ) { return ; } lineBuffer . append ( option . get ( ) ) ; } @ Override public void emit ( FloatOption option ) throws IOException { startCell ( ) ; if ( emitNull ( option ) ) { return ; } lineBuffer . append ( option . get ( ) ) ; } @ Override public void emit ( DoubleOption option ) throws IOException { startCell ( ) ; if ( emitNull ( option ) ) { return ; } lineBuffer . append ( option . get ( ) ) ; } @ Override public void emit ( DecimalOption option ) throws IOException { startCell ( ) ; if ( emitNull ( option ) ) { return ; } lineBuffer . append ( option . get ( ) ) ; } @ Override public void emit ( StringOption option ) throws IOException { startCell ( ) ; if ( emitNull ( option ) ) { return ; } Text text = option . get ( ) ; if ( text . getLength ( ) == 0 ) { return ; } byte [ ] bytes = text . getBytes ( ) ; ByteBuffer source = ByteBuffer . wrap ( bytes , 0 , text . getLength ( ) ) ; decoder . reset ( ) ; decodeBuffer . clear ( ) ; while ( true ) { CoderResult result = decoder . decode ( source , decodeBuffer , true ) ; if ( result . isError ( ) ) { throw new RecordFormatException ( MessageFormat . format ( "" , result ) ) ; } if ( result . isUnderflow ( ) ) { consumeDecoded ( ) ; break ; } if ( result . isOverflow ( ) ) { consumeDecoded ( ) ; } } while ( true ) { CoderResult result = decoder . flush ( decodeBuffer ) ; if ( result . isError ( ) ) { throw
338
<s> package org . rubypeople . rdt . internal . core . search ; import java . util . HashSet ; import java . util . Iterator ; import org . rubypeople . rdt . core . search . SearchParticipant ; import org . rubypeople . rdt . core . search . SearchPattern ; public class PathCollector
339
<s> package org . oddjob . structural ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Set ; import org . oddjob . FailedToStopException ; import org . oddjob . Resetable ; import org . oddjob . Stoppable ; import org . oddjob . Structural ; public class ChildHelper < E > implements Structural , Iterable < E > , ChildList < E > { private final List < E > jobList = new ArrayList < E > ( ) ; private final List < StructuralListener > listeners = new ArrayList < StructuralListener > ( ) ; private final Set < List < ChildAction > > missed = new HashSet < List < ChildAction > > ( ) ; private final Structural source ; public ChildHelper ( Structural source ) { this . source = source ; } @ Override public void insertChild ( int index , E child ) { if ( child == null ) { throw new NullPointerException ( "" ) ; } StructuralEvent event = null ; synchronized ( missed ) { jobList . add ( index , child ) ; event = new StructuralEvent ( source , child , index ) ; for ( List < ChildAction > missing : missed ) { missing . add ( new ChildAdded ( event ) ) ; } } notifyChildAdded ( event ) ; } @ Override public int addChild ( E child ) { if ( child == null ) { throw new NullPointerException ( "" ) ; } int index = - 1 ; StructuralEvent event = null ; synchronized ( missed ) { index = jobList . size ( ) ; jobList . add ( index , child ) ; event = new StructuralEvent ( source , child , index ) ; for ( List < ChildAction > missing : missed ) { missing . add ( new ChildAdded ( event ) ) ; } } notifyChildAdded ( event ) ; return index ; } @ Override public E removeChildAt ( int index ) throws IndexOutOfBoundsException { E child = null ; StructuralEvent event ; synchronized ( missed ) { child = jobList . remove ( index ) ; event = new StructuralEvent ( source , child , index ) ; for ( List < ChildAction > missing : missed ) { missing . add ( new ChildRemoved ( event ) ) ; } } notifyChildRemoved ( event ) ; return child ; } @ Override public int removeChild ( Object child ) throws IllegalStateException { int index = - 1 ; StructuralEvent event ; synchronized ( missed ) { index = jobList . indexOf ( child ) ; if ( index < 0 ) { throw new IllegalStateException ( "" + child + "" ) ; } jobList . remove ( child ) ; event = new StructuralEvent ( source , child , index ) ; for ( List < ChildAction > missing : missed ) { missing . add ( new ChildRemoved ( event ) ) ; } } notifyChildRemoved ( event ) ; return index ; } public void removeAllChildren ( ) { while ( true ) { int size = jobList . size ( ) ; if ( size == 0 ) { break ; } removeChildAt ( size - 1 ) ; } } public void stopChildren ( ) throws FailedToStopException { Object [ ] children = getChildren ( ) ; FailedToStopException failed = null ; for ( int i = children . length - 1 ; i > - 1 ; -- i ) { Object child = children [ i ] ; if ( child instanceof Stoppable ) { try { ( ( Stoppable ) child ) . stop ( ) ; } catch ( FailedToStopException e ) { failed = e ; } catch ( RuntimeException e ) { failed = new FailedToStopException ( child , "[" + child + "" , e ) ; } } } if ( failed != null ) { throw failed ; } } public void softResetChildren ( ) { Object [ ] children = getChildren ( ) ; for ( int i = 0 ; i < children . length ; ++ i ) { if ( children [ i ] instanceof Resetable ) { ( ( Resetable ) children [ i ] ) . softReset ( ) ; } } } public void hardResetChildren ( ) { Object [ ] children = getChildren ( ) ; for ( int i = 0 ; i < children . length ; ++ i ) { if ( children [ i ] instanceof Resetable ) { ( ( Resetable ) children [ i ] ) . hardReset ( ) ; } } } public Object [ ] getChildren ( ) { synchronized ( missed ) { return jobList
340
<s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import com . asakusafw . utils . java . internal . model . util . ExpressionPriority ; import com . asakusafw . utils . java . model . syntax . * ; public class ModelFactoryImpl implements ModelFactory { @ Override public AlternateConstructorInvocation newAlternateConstructorInvocation ( Expression ... arguments ) { Util . notNull ( arguments , "arguments" ) ; return this . newAlternateConstructorInvocation0 ( Collections . < Type > emptyList ( ) , Arrays . asList ( arguments ) ) ; } @ Override public AlternateConstructorInvocation newAlternateConstructorInvocation ( List < ? extends Expression > arguments ) { return this . newAlternateConstructorInvocation0 ( Collections . < Type > emptyList ( ) , arguments ) ; } @ Override public AlternateConstructorInvocation newAlternateConstructorInvocation ( List < ? extends Type > typeArguments , List < ? extends Expression > arguments ) { return this . newAlternateConstructorInvocation0 ( typeArguments , arguments ) ; } private AlternateConstructorInvocationImpl newAlternateConstructorInvocation0 ( List < ? extends Type > typeArguments , List < ? extends Expression > arguments ) { Util . notNull ( typeArguments , "" ) ; Util . notContainNull ( typeArguments , "" ) ; Util . notNull ( arguments , "arguments" ) ; Util . notContainNull ( arguments , "arguments" ) ; AlternateConstructorInvocationImpl result = new AlternateConstructorInvocationImpl ( ) ; result . setTypeArguments ( typeArguments ) ; result . setArguments ( arguments ) ; return result ; } @ Override public AnnotationDeclaration newAnnotationDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends TypeBodyDeclaration > bodyDeclarations ) { return this . newAnnotationDeclaration0 ( javadoc , modifiers , name , bodyDeclarations ) ; } private AnnotationDeclarationImpl newAnnotationDeclaration0 ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends TypeBodyDeclaration > bodyDeclarations ) { Util . notNull ( modifiers , "modifiers" ) ; Util . notContainNull ( modifiers , "modifiers" ) ; Util . notNull ( name , "name" ) ; Util . notNull ( bodyDeclarations , "" ) ; Util . notContainNull ( bodyDeclarations , "" ) ; AnnotationDeclarationImpl result = new AnnotationDeclarationImpl ( ) ; result . setJavadoc ( javadoc ) ; result . setModifiers ( modifiers ) ; result . setName ( name ) ; result . setBodyDeclarations ( bodyDeclarations ) ; return result ; } @ Override public AnnotationElement newAnnotationElement ( SimpleName name , Expression expression ) { return this . newAnnotationElement0 ( name , expression ) ; } private AnnotationElementImpl newAnnotationElement0 ( SimpleName name , Expression expression ) { Util . notNull ( name , "name" ) ; Util . notNull ( expression , "expression" ) ; AnnotationElementImpl result = new AnnotationElementImpl ( ) ; result . setName ( name ) ; result . setExpression ( expression ) ; return result ; } @ Override public AnnotationElementDeclaration newAnnotationElementDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , Type type , SimpleName name , Expression defaultExpression ) { return this . newAnnotationElementDeclaration0 ( javadoc , modifiers , type , name , defaultExpression ) ; } private AnnotationElementDeclarationImpl newAnnotationElementDeclaration0 ( Javadoc javadoc , List < ? extends Attribute > modifiers , Type type , SimpleName name , Expression defaultExpression ) { Util . notNull ( modifiers , "modifiers" ) ; Util . notContainNull ( modifiers , "modifiers" ) ; Util . notNull ( type , "type" ) ; Util . notNull ( name , "name" ) ; AnnotationElementDeclarationImpl result = new AnnotationElementDeclarationImpl ( ) ; result . setJavadoc ( javadoc ) ; result . setModifiers ( modifiers ) ; result . setType ( type ) ; result . setName ( name ) ; result . setDefaultExpression ( defaultExpression ) ; return result ; } @ Override public ArrayAccessExpression newArrayAccessExpression ( Expression array , Expression index ) { return this . newArrayAccessExpression0 ( array , index ) ; } private ArrayAccessExpressionImpl newArrayAccessExpression0 ( Expression array , Expression index ) { Util . notNull ( array , "array" ) ; Util . notNull ( index , "index" ) ; ArrayAccessExpressionImpl result = new ArrayAccessExpressionImpl ( ) ; result . setArray ( parenthesize ( array , ExpressionPriority . PRIMARY ) ) ; result . setIndex ( index ) ; return result ; } @ Override public ArrayCreationExpression newArrayCreationExpression ( ArrayType type , ArrayInitializer arrayInitializer ) { return this . newArrayCreationExpression0 ( type , Collections . < Expression > emptyList ( ) , arrayInitializer ) ; } @ Override public ArrayCreationExpression newArrayCreationExpression ( ArrayType type , List < ? extends Expression > dimensionExpressions , ArrayInitializer arrayInitializer ) { return this . newArrayCreationExpression0 ( type , dimensionExpressions , arrayInitializer ) ; } private ArrayCreationExpressionImpl newArrayCreationExpression0 ( ArrayType type , List < ? extends Expression > dimensionExpressions , ArrayInitializer arrayInitializer ) { Util . notNull ( type , "type" ) ; Util . notNull ( dimensionExpressions , "" ) ; Util . notContainNull ( dimensionExpressions , "" ) ; ArrayCreationExpressionImpl result = new ArrayCreationExpressionImpl ( ) ; result . setType ( type ) ; result . setDimensionExpressions ( dimensionExpressions ) ; result . setArrayInitializer ( arrayInitializer ) ; return result ; } @ Override public ArrayInitializer newArrayInitializer ( Expression ... elements ) { Util . notNull ( elements , "elements" ) ; return this . newArrayInitializer0 ( Arrays . asList ( elements ) ) ; } @ Override public ArrayInitializer newArrayInitializer ( List < ? extends Expression > elements ) { return this . newArrayInitializer0 ( elements ) ; } private ArrayInitializerImpl newArrayInitializer0 ( List < ? extends Expression > elements ) { Util . notNull ( elements , "elements" ) ; Util . notContainNull ( elements , "elements" ) ; ArrayInitializerImpl result = new ArrayInitializerImpl ( ) ; result . setElements ( elements ) ; return result ; } @ Override public ArrayType newArrayType ( Type componentType ) { return this . newArrayType0 ( componentType ) ; } private ArrayTypeImpl newArrayType0 ( Type componentType ) { Util . notNull ( componentType , "" ) ; ArrayTypeImpl result = new ArrayTypeImpl ( ) ; result . setComponentType ( componentType ) ; return result ; } @ Override public AssertStatement newAssertStatement ( Expression expression ) { return this . newAssertStatement0 ( expression , null ) ; } @ Override public AssertStatement newAssertStatement ( Expression expression , Expression message ) { return this . newAssertStatement0 ( expression , message ) ; } private AssertStatementImpl newAssertStatement0 ( Expression expression , Expression message ) { Util . notNull ( expression , "expression" ) ; AssertStatementImpl result = new AssertStatementImpl ( ) ; result . setExpression ( expression ) ; result . setMessage ( message ) ; return result ; } @ Override public AssignmentExpression newAssignmentExpression ( Expression leftHandSide , Expression rightHandSide ) { return this . newAssignmentExpression0 ( leftHandSide , InfixOperator . ASSIGN , rightHandSide ) ; } @ Override public AssignmentExpression newAssignmentExpression ( Expression leftHandSide , InfixOperator operator , Expression rightHandSide ) { return this . newAssignmentExpression0 ( leftHandSide , operator , rightHandSide ) ; } private AssignmentExpressionImpl newAssignmentExpression0 ( Expression leftHandSide , InfixOperator operator , Expression rightHandSide ) { Util . notNull ( leftHandSide , "leftHandSide" ) ; Util . notNull ( operator , "operator" ) ; Util . notNull ( rightHandSide , "" ) ; AssignmentExpressionImpl result = new AssignmentExpressionImpl ( ) ; result . setLeftHandSide ( parenthesize ( leftHandSide , ExpressionPriority . ASSIGNMENT ) ) ; result . setOperator ( operator ) ; result . setRightHandSide ( parenthesizeRight ( rightHandSide , ExpressionPriority . ASSIGNMENT ) ) ; return result ; } @ Override public BasicType newBasicType ( BasicTypeKind typeKind ) { return this . newBasicType0 ( typeKind ) ; } private BasicTypeImpl newBasicType0 ( BasicTypeKind typeKind ) { Util . notNull ( typeKind , "typeKind" ) ; BasicTypeImpl result = new BasicTypeImpl ( ) ; result . setTypeKind ( typeKind ) ; return result ; } @ Override public Block newBlock ( Statement ... statements ) { Util . notNull ( statements , "statements" ) ; return this . newBlock0 ( Arrays . asList ( statements ) ) ; } @ Override public Block newBlock ( List < ? extends Statement > statements ) { return this . newBlock0 ( statements ) ; } private BlockImpl newBlock0 ( List < ? extends Statement > statements ) { Util . notNull ( statements , "statements" ) ; Util . notContainNull ( statements , "statements" ) ; BlockImpl result = new BlockImpl ( ) ; result . setStatements ( statements ) ; return result ; } @ Override public BlockComment newBlockComment ( String string ) { return this . newBlockComment0 ( string ) ; } private BlockCommentImpl newBlockComment0 ( String string ) { Util . notNull ( string , "string" ) ; BlockCommentImpl result = new BlockCommentImpl ( ) ; result . setString ( string ) ; return result ; } @ Override public BreakStatement newBreakStatement ( ) { return this . newBreakStatement0 ( null ) ; } @ Override public BreakStatement newBreakStatement ( SimpleName target ) { return this . newBreakStatement0 ( target ) ; } private BreakStatementImpl newBreakStatement0 ( SimpleName target ) { BreakStatementImpl result = new BreakStatementImpl ( ) ; result . setTarget ( target ) ; return result ; } @ Override public CastExpression newCastExpression ( Type type , Expression expression ) { return this . newCastExpression0 ( type , expression ) ; } private CastExpressionImpl newCastExpression0 ( Type type , Expression expression ) { Util . notNull ( type , "type" ) ; Util . notNull ( expression , "expression" ) ; CastExpressionImpl result = new CastExpressionImpl ( ) ; result . setType ( type ) ; result . setExpression ( parenthesize ( expression , ExpressionPriority . CAST ) ) ; return result ; } @ Override public CatchClause newCatchClause ( FormalParameterDeclaration parameter , Block body ) { return this . newCatchClause0 ( parameter , body ) ; } private CatchClauseImpl newCatchClause0 ( FormalParameterDeclaration parameter , Block body ) { Util . notNull ( parameter , "parameter" ) ; Util . notNull ( body , "body" ) ; CatchClauseImpl result = new CatchClauseImpl ( ) ; result . setParameter ( parameter ) ; result . setBody ( body ) ; return result ; } @ Override public ClassBody newClassBody ( List < ? extends TypeBodyDeclaration > bodyDeclarations ) { return this . newClassBody0 ( bodyDeclarations ) ; } private ClassBodyImpl newClassBody0 ( List < ? extends TypeBodyDeclaration > bodyDeclarations ) { Util . notNull ( bodyDeclarations , "" ) ; Util . notContainNull ( bodyDeclarations , "" ) ; ClassBodyImpl result = new ClassBodyImpl ( ) ; result . setBodyDeclarations ( bodyDeclarations ) ; return result ; } @ Override public ClassDeclaration newClassDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , Type superClass , List < ? extends Type > superInterfaceTypes , List < ? extends TypeBodyDeclaration > bodyDeclarations ) { return this . newClassDeclaration0 ( javadoc , modifiers , name , Collections . < TypeParameterDeclaration > emptyList ( ) , superClass , superInterfaceTypes , bodyDeclarations ) ; } @ Override public ClassDeclaration newClassDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends TypeParameterDeclaration > typeParameters , Type superClass , List < ? extends Type > superInterfaceTypes , List < ? extends TypeBodyDeclaration > bodyDeclarations ) { return this . newClassDeclaration0 ( javadoc , modifiers , name , typeParameters , superClass , superInterfaceTypes , bodyDeclarations ) ; } private ClassDeclarationImpl newClassDeclaration0 ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends TypeParameterDeclaration > typeParameters , Type superClass , List < ? extends Type > superInterfaceTypes , List < ? extends TypeBodyDeclaration > bodyDeclarations ) { Util . notNull ( modifiers , "modifiers" ) ; Util . notContainNull ( modifiers , "modifiers" ) ; Util . notNull ( name , "name" ) ; Util . notNull ( typeParameters , "" ) ; Util . notContainNull ( typeParameters , "" ) ; Util . notNull ( superInterfaceTypes , "" ) ; Util . notContainNull ( superInterfaceTypes , "" ) ; Util . notNull ( bodyDeclarations , "" ) ; Util . notContainNull ( bodyDeclarations , "" ) ; ClassDeclarationImpl result = new ClassDeclarationImpl ( ) ; result . setJavadoc ( javadoc ) ; result . setModifiers ( modifiers ) ; result . setName ( name ) ; result . setTypeParameters ( typeParameters ) ; result . setSuperClass ( superClass ) ; result . setSuperInterfaceTypes ( superInterfaceTypes ) ; result . setBodyDeclarations ( bodyDeclarations ) ; return result ; } @ Override public ClassInstanceCreationExpression newClassInstanceCreationExpression ( Type type , Expression ... arguments ) { Util . notNull ( arguments , "arguments" ) ; return this . newClassInstanceCreationExpression0 ( null , Collections . < Type > emptyList ( ) , type , Arrays . asList ( arguments ) , null ) ; } @ Override public ClassInstanceCreationExpression newClassInstanceCreationExpression ( Type type , List < ? extends Expression > arguments ) { return this . newClassInstanceCreationExpression0 ( null , Collections . < Type > emptyList ( ) , type , arguments , null ) ; } @ Override public ClassInstanceCreationExpression newClassInstanceCreationExpression ( Expression qualifier , List < ? extends Type > typeArguments , Type type , List < ? extends Expression > arguments , ClassBody body ) { return this . newClassInstanceCreationExpression0 ( qualifier , typeArguments , type , arguments , body ) ; } private ClassInstanceCreationExpressionImpl newClassInstanceCreationExpression0 ( Expression qualifier , List < ? extends Type > typeArguments , Type type , List < ? extends Expression > arguments , ClassBody body ) { Util . notNull ( typeArguments , "" ) ; Util . notContainNull ( typeArguments , "" ) ; Util . notNull ( type , "type" ) ; Util . notNull ( arguments , "arguments" ) ; Util . notContainNull ( arguments , "arguments" ) ; ClassInstanceCreationExpressionImpl result = new ClassInstanceCreationExpressionImpl ( ) ; result . setQualifier ( parenthesize ( qualifier , ExpressionPriority . PRIMARY )
341
<s> package com . asakusafw . compiler . flow . testing . external ; import com . asakusafw . compiler
342
<s> package com . asakusafw . testdriver . testing . io ; import java . io . IOException ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; import com . asakusafw . testdriver . testing . model . Naming ; public final class NamingOutput implements ModelOutput < Naming > { private final RecordEmitter emitter ; public NamingOutput ( RecordEmitter emitter ) {
343
<s> package org . springframework . social . google . api . tasks ; import org . codehaus . jackson . map . annotate . JsonDeserialize ; import org . codehaus . jackson . map . annotate . JsonSerialize ; import org . springframework . social . google . api . impl . ApiEnumSerializer ; import org . springframework . social . google . api . tasks . impl
344
<s> package org . oddjob . monitor . view ; import java . awt . Component ; import java . awt . event . ActionEvent ; import java . beans . PropertyChangeEvent ; import java . beans . PropertyChangeListener ; import java . util . concurrent . Callable ; import javax . swing . Action ; import org . oddjob . arooa . design . actions . AbstractArooaAction ; import org . oddjob . arooa . design . screem . Form ; import org . oddjob . arooa . design . view . DialogueHelper ; import org . oddjob . arooa . design . view . SwingFormFactory ; import org . oddjob . arooa . design . view . ValueDialog ; import org . oddjob . monitor . actions . ExplorerAction ; import org . oddjob . monitor . actions . FormAction ; public class JobSwingAction extends AbstractArooaAction { private static final long serialVersionUID = 20051116 ; private final ExplorerAction jobAction ; public JobSwingAction ( ExplorerAction jobAction ) { super ( jobAction . getName ( ) ) ; putValue ( Action . MNEMONIC_KEY , jobAction . getMnemonicKey ( ) ) ; putValue ( Action . ACCELERATOR_KEY , jobAction . getAcceleratorKey ( ) ) ; setEnabled ( jobAction . isEnabled ( ) ) ; setVisible ( jobAction . isVisible ( ) ) ; jobAction . addPropertyChangeListener ( new PropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent evt ) { String propertyName = evt . getPropertyName ( ) ; if ( ExplorerAction . ENABLED_PROPERTY . equals
345
<s> package net . sf . sveditor . core . scanutils ; public class ScanLocation implements IScanLocation { private String fFile ; private int fLineno ; private int fLinepos ; public ScanLocation ( String file , int lineno , int linepos ) { fFile = file ; fLineno = lineno ; fLinepos = linepos ; } public String getFileName ( ) { return fFile ; } public void
346
<s> package net . sf . sveditor . core . batch ; import java . io . File ; import org . eclipse . core . runtime . NullProgressMonitor ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . SVDBArgFileIndexFactory ; import net . sf . sveditor . core . db . index . SVDBIndexUtil ; import net . sf . sveditor . core . db . index . cache . SVDBDirFS ; import net . sf . sveditor . core . db . index . cache . SVDBFileIndexCache ; public class SVEditorVlogIndexFactory { public static ISVDBIndex vlog ( String args [ ] ) { return vlog_loc ( System . getProperty ( "user.dir" ) , args ) ; } public static ISVDBIndex vlog_loc ( String location , String args [ ] ) { ISVDBIndex index = null ;
347
<s> package com . asakusafw . testtools . templategen ; import java . io . File ; import java . io . IOException ; import java . sql . Connection ; import java . sql . SQLException ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . List ; import com . asakusafw . testtools . Configuration ; import com . asakusafw . testtools . db . DbUtils ; public final class Main { private Connection conn ; private List < String > tableList ; private String databaseName ; private File outputDirectory ; public static void main ( String [ ] args ) throws IOException , SQLException { Main main = new Main ( args ) ; main . run ( ) ; } private Main ( String [ ] args ) throws SQLException { if ( args . length == 0 ) { throw new IllegalArgumentException ( "" ) ; } tableList = new ArrayList < String > ( args . length ) ; for ( String tablename : args ) { tableList . add ( tablename ) ; } Configuration conf = Configuration . getInstance ( ) ; String outputDirectoryName = conf . getOutputDirectory ( ) ; if ( outputDirectoryName == null ) { throw new IllegalArgumentException ( "" ) ; } outputDirectory =
348
<s> package org . rubypeople . rdt . core . compiler ; import java . util . List ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . core . IRubyProject ; public abstract class CompilationParticipant { public static int READY_FOR_BUILD = 1 ; public static int NEEDS_FULL_BUILD = 2 ; public int aboutToBuild ( IRubyProject project ) { return READY_FOR_BUILD ; } public void buildStarting ( BuildContext [ ] files , boolean isBatch , IProgressMonitor monitor ) { } public void cleanStarting ( IRubyProject project ) { } public boolean isActive ( IRubyProject project ) { return false ; } public boolean isAnnotationProcessor ( ) { return false ; } public void processAnnotations ( BuildContext [ ] files , IProgressMonitor monitor ) { } public void reconcile ( ReconcileContext context ) { } protected void addProblems ( ReconcileContext context , String type , List < CategorizedProblem > problems ) { if ( problems == null || problems . size ( ) == 0 ) return ; CategorizedProblem [ ] oldProblems = context . getProblems ( type ) ; if ( oldProblems == null || oldProblems . length == 0
349
<s> package com . asakusafw . testdata . generator . excel ; import static com . asakusafw . testdata . generator . excel . SheetFormat . * ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; public enum WorkbookFormat { DATA ( "{0}-data.xls" , data ( "data" ) ) , RULE ( "{0}-rule.xls" , rule ( "rule" ) ) , INOUT ( "" , data ( "input" ) , data ( "output" ) ) , INSPECT ( "" , data ( "expected" ) , rule ( "rule" ) ) , ALL ( "{0}.xls" , data ( "input" ) , data ( "output" ) , rule ( "rule" ) ) , ; private final String namePattern ; private final List < SheetFormat > sheets ; private WorkbookFormat ( String namePattern , SheetFormat ... sheets ) { assert namePattern != null ; assert sheets != null ;
350
<s> package com . asakusafw . dmdl . thundergate . emitter ; import java . util . Arrays ; import java . util . List ; import java . util . Map ; import com . asakusafw . dmdl . model . AstAttribute ; import com . asakusafw . dmdl . model . AstGrouping ; import com . asakusafw . dmdl . model . AstModelDefinition ; import com . asakusafw . dmdl . model . AstModelFolding ; import com . asakusafw . dmdl . model . AstModelReference ; import com . asakusafw . dmdl . model . AstPropertyFolding ; import com . asakusafw . dmdl . model . AstSimpleName ; import com . asakusafw . dmdl . model . AstSummarize ; import com . asakusafw . dmdl . model . ModelDefinitionKind ; import com . asakusafw . dmdl . thundergate . Constants ; import com . asakusafw . dmdl . thundergate . model . ModelProperty ; import com . asakusafw . dmdl . thundergate . model . ModelReference ; import
351
<s> package org . rubypeople . rdt . ui . actions ; import org . eclipse . ui . IWorkbenchSite ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . core . IField ; import org . rubypeople . rdt . core . ILocalVariable ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchEngine ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyEditor ; import org . rubypeople . rdt . internal . ui .
352
<s> package $ { package } . operator ; import java . util . List ; import $ { package } . modelgen . dmdl . model . CategorySummary ; import $ { package } . modelgen . dmdl . model . ErrorRecord ; import $ { package } . modelgen . dmdl . model . ItemInfo ; import $ { package } . modelgen . dmdl . model . JoinedSalesInfo ; import $ { package } . modelgen . dmdl . model . SalesDetail ; import $ { package } . modelgen . dmdl . model . StoreInfo ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . DateUtil ; import com . asakusafw . vocabulary . model . Key ; import com . asakusafw . vocabulary . operator . MasterCheck ; import com . asakusafw . vocabulary . operator . MasterJoin ; import com . asakusafw . vocabulary . operator . MasterSelection ; import com . asakusafw . vocabulary . operator . Summarize ; import com . asakusafw . vocabulary . operator . Update ; public abstract class CategorySummaryOperator { @ MasterCheck public abstract boolean checkStore ( @ Key ( group = "store_code" ) StoreInfo info , @ Key ( group
353
<s> package org . rubypeople . rdt . internal . codeassist ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExtensionRegistry ; import org . eclipse . core . runtime . PerformanceStats ; import org . eclipse . core . runtime . Platform ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . codeassist . CodeResolver ; import org . rubypeople . rdt . core . codeassist . ResolveContext ; public class SelectionEngine { private static final String PERFORMANCE_EVENT = "" ;
354
<s> package com . asakusafw . compiler . flow . stage ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . util . List ; import org . junit . Test ; import com . asakusafw . compiler . flow . JobflowCompilerTestRoot ; import com . asakusafw . compiler . flow . example . CoGroupStage ; import com . asakusafw . compiler . flow . example . SimpleShuffleStage ; import com . asakusafw . compiler . flow . mock . MockOutput ; import com . asakusafw . compiler . flow . plan . StageBlock ; import com . asakusafw . compiler . flow . plan . StageGraph ; import com . asakusafw . compiler . flow . stage . ShuffleModel . Segment ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . ExSummarized ; import com . asakusafw . runtime . core . Result ; import com . asakusafw . runtime . flow . SegmentedWritable ; import com . asakusafw . runtime . testing . MockResult ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . vocabulary . flow . FlowDescription ; public class ShuffleFragmentEmitterTest extends JobflowCompilerTestRoot { @ Test public void simple ( ) throws Exception { ShuffleModel analyzed = shuffle ( SimpleShuffleStage . class ) ; ShuffleFragmentEmitter emitter = new ShuffleFragmentEmitter ( environment ) ; Name key = emitKey ( analyzed ) ; Name value = emitValue ( analyzed ) ; Segment segment = analyzed . getSegments ( ) . get ( 0 ) ;
355
<s> package com . asakusafw . runtime . value ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Test ; @ SuppressWarnings ( "deprecation" ) public class BooleanOptionTest extends ValueOptionTestRoot { @ Test public void init ( ) { BooleanOption option = new BooleanOption ( ) ; assertThat ( option . isNull ( ) , is ( true ) ) ; } @ Test public void get ( ) { BooleanOption option = new BooleanOption ( ) ; option . modify ( false ) ; assertThat ( option . get ( ) , is ( false ) ) ; assertThat ( option . isNull ( ) , is ( false ) ) ; } @ Test public void or ( ) { BooleanOption option = new BooleanOption ( ) ; assertThat ( option . or ( true ) , is ( true ) ) ; assertThat ( option . isNull ( ) , is ( true ) ) ; } @ Test public void orNotNull ( ) { BooleanOption option = new BooleanOption ( ) ; option . modify ( true ) ; assertThat ( option . or ( false ) , is ( true ) ) ; } @ Test public void copy ( ) { BooleanOption option = new BooleanOption ( ) ; BooleanOption other = new BooleanOption ( ) ; other . modify ( true ) ; option . copyFrom ( other ) ; assertThat ( option . get ( ) , is ( true ) ) ; option . modify ( false ) ; assertThat ( other . get ( ) , is ( true ) ) ; } @ Test public void copyNull ( ) { BooleanOption option = new BooleanOption ( ) ; option . modify ( true ) ; BooleanOption other =
356
<s> package com . asakusafw . compiler . bulkloader . testing . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import org . apache . hadoop . io . Text ; import org . apache . hadoop . io . Writable ; import com . asakusafw . compiler . bulkloader . testing . io . Ex1Input ; import com . asakusafw . compiler . bulkloader . testing . io . Ex1Output ; import com . asakusafw . runtime . model . DataModel ; import com . asakusafw . runtime . model . DataModelKind ; import com . asakusafw . runtime . model . ModelInputLocation ; import com . asakusafw . runtime . model . ModelOutputLocation ; import com . asakusafw . runtime . model . PropertyOrder ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . vocabulary . bulkloader . ColumnOrder ; import com . asakusafw . vocabulary . bulkloader . OriginalName ; import com . asakusafw . vocabulary . bulkloader . PrimaryKey ; @ ColumnOrder ( value = { "SID" , "VALUE" , "STRING" } ) @ DataModelKind ( "DMDL" ) @ ModelInputLocation ( Ex1Input . class ) @ ModelOutputLocation ( Ex1Output . class ) @ OriginalName ( value = "EX1" ) @ PrimaryKey ( value = { "sid" } ) @ PropertyOrder ( { "sid" , "value" , "string" } ) public class Ex1 implements DataModel < Ex1 > , Writable { private final LongOption sid = new LongOption ( ) ; private final IntOption value = new IntOption ( ) ; private final StringOption string = new StringOption ( ) ; @ Override @ SuppressWarnings ( "deprecation" ) public void reset ( ) { this . sid . setNull ( ) ; this . value . setNull ( ) ; this . string . setNull ( ) ; } @ Override @ SuppressWarnings ( "deprecation" ) public void copyFrom ( Ex1 other ) { this . sid . copyFrom ( other
357
<s> package net . sf . sveditor . ui . text ; import net . sf . sveditor . ui . editor . SVEditor ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . Region ; import org . eclipse . jface . text . information . IInformationProvider ; import org . eclipse . jface . text . information . IInformationProviderExtension ; import org . eclipse . ui . IEditorPart ; public class SVEditorProvider implements IInformationProvider , IInformationProviderExtension { private SVEditor fEditor ; public SVEditorProvider ( IEditorPart editor ) { if ( editor instanceof SVEditor ) fEditor = ( SVEditor ) editor ; } public SVEditorProvider ( IEditorPart editor , boolean useCodeResolve ) { this ( editor
358
<s> package org . oddjob . state ; public class AssertNonDestroyed implements StateOperator { @ Override public ParentState evaluate ( State ... states ) throws IllegalStateException { for ( int i
359
<s> package com . asakusafw . bulkloader . exporter ; import java . sql . Connection ; import java . sql . PreparedStatement ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . util . List ; import com . asakusafw . bulkloader . bean . ExportTargetTableBean ; import com . asakusafw . bulkloader . bean . ExportTempTableBean ; import com . asakusafw . bulkloader . bean . ExporterBean ; import com . asakusafw . bulkloader . common . ConfigurationLoader ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . common . DBAccessUtil ; import com . asakusafw . bulkloader . common . DBConnection ; import com . asakusafw . bulkloader . common . ExportTempTableStatus ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . log . Log ; public class ExportDataCopy { static final Log LOG = new Log ( ExportDataCopy . class ) ; private boolean copyEnd = true ; public boolean copyData ( ExporterBean bean ) { long maxRecord = Long . parseLong ( ConfigurationLoader . getProperty ( Constants . PROP_KEY_EXP_COPY_MAX_RECORD ) ) ; Connection conn = null ; try { conn = DBConnection . getConnection ( ) ; List < ExportTempTableBean > tempBean = DBAccessUtil . getExportTempTable ( bean . getJobflowSid ( ) ) ; List < String > l = bean . getExportTargetTableList ( ) ; for ( String tableName : l ) { ExportTargetTableBean expTableBean = bean . getExportTargetTable ( tableName ) ; LOG . info ( "" , bean . getJobflowSid ( ) , tableName , expTableBean . getExportTempTableName ( ) ) ; if ( isCopyEnd ( tempBean , expTableBean , tableName ) ) { LOG . info ( "" , bean . getJobflowSid ( ) , tableName , expTableBean . getExportTempTableName ( ) ) ; continue ; } if ( expTableBean . getExportTempTableName ( ) == null ) { LOG . info ( "" , bean . getJobflowSid ( ) , tableName , expTableBean . getExportTempTableName ( ) ) ; continue ; } boolean isGetRecordLock = getRecordLock ( bean . getJobflowSid ( ) , tableName , conn ) ; copyNonDuplicateData ( expTableBean , tableName , maxRecord , bean . getJobflowSid ( ) , isGetRecordLock , conn ) ; if ( expTableBean . isDuplicateCheck ( ) ) { copyDuplicateData ( expTableBean , maxRecord , conn ) ; } boolean tableCopyEnd = copyUpdateData ( expTableBean , tableName , maxRecord , bean . getJobflowSid ( ) , conn ) ; if ( tableCopyEnd ) { copyExit ( bean . getJobflowSid ( ) , tableName , conn ) ; } else { copyEnd = false ; } LOG . info ( "" , bean . getJobflowSid ( ) , tableName , expTableBean . getExportTempTableName ( ) , tableCopyEnd ) ; } return true ; } catch ( BulkLoaderSystemException e ) { try { DBConnection . rollback ( conn ) ; } catch ( BulkLoaderSystemException e1 ) { LOG . log ( e ) ; } LOG . log ( e ) ; return false ; } finally { DBConnection . closeConn ( conn ) ; } } private boolean isCopyEnd ( List < ExportTempTableBean > tempBeans , ExportTargetTableBean tableBean , String tableName ) { if ( tempBeans == null || tempBeans . size ( ) == 0 ) { return false ; } else { for ( ExportTempTableBean tempBean : tempBeans ) { if ( tempBean . getExportTableName ( ) . equals ( tableName ) ) { if ( tableBean . getExportTempTableName ( ) == null ) { tableBean . setExportTempTableName ( tempBean . getTemporaryTableName ( ) ) ; tableBean . setDuplicateFlagTableName ( tempBean . getDuplicateFlagTableName ( ) ) ; } boolean completed = ExportTempTableStatus . COPY_EXIT . equals ( tempBean . getTempTableStatus ( ) ) ; return completed ; } } } return false ; } private void copyExit ( String jobflowSid , String tableName , Connection conn ) throws BulkLoaderSystemException { String loadExitSql = "" + "" + "" ; PreparedStatement stmt = null ; try { stmt = conn . prepareStatement ( loadExitSql ) ; stmt . setString ( 1 , ExportTempTableStatus . COPY_EXIT . getStatus ( ) ) ; stmt . setString ( 2 , jobflowSid ) ; stmt . setString ( 3 , tableName ) ; DBConnection . executeUpdate ( stmt , loadExitSql , new String [ ] { ExportTempTableStatus . COPY_EXIT . getStatus ( ) , jobflowSid , tableName } ) ; DBConnection . commit ( conn ) ; LOG . info ( "" , jobflowSid , tableName ) ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , this . getClass ( ) , loadExitSql , new String [ ] { ExportTempTableStatus . COPY_EXIT . getStatus ( ) , jobflowSid , tableName } ) ; } finally { DBConnection . closePs ( stmt ) ; } } private void copyDuplicateData ( ExportTargetTableBean expTableBean , long maxRecord , Connection conn ) throws BulkLoaderSystemException { String selectCondition = createDupSelectCondition ( expTableBean , maxRecord ) ; String copySql = createDupInsertSql ( expTableBean , selectCondition ) ; String delSql = createDupCopyDelSql ( expTableBean , selectCondition ) ; PreparedStatement stmt = null ; while ( true ) { int copyCount = 0 ; try { stmt = conn . prepareStatement ( copySql . toString ( ) ) ; copyCount = DBConnection . executeUpdate ( stmt , copySql . toString ( ) ) ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , this . getClass ( ) , copySql . toString ( ) , new String [ 0 ] ) ; } finally { DBConnection . closePs ( stmt ) ; } if ( copyCount == 0 ) { DBConnection . commit ( conn ) ; break ; } try { stmt = conn . prepareStatement ( delSql ) ; DBConnection . executeUpdate ( stmt , delSql , new String [ 0 ] ) ; DBConnection . commit ( conn ) ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , this . getClass ( ) , delSql , new String [ 0 ] ) ; } finally { DBConnection . closePs ( stmt ) ; } LOG . info ( "" , expTableBean . getErrorTableName ( ) , expTableBean . getExportTempTableName ( ) , copySql . toString ( ) , delSql ) ; } } private String createDupCopyDelSql ( ExportTargetTableBean expTableBean , String selectCondition ) { StringBuilder delSqll = new StringBuilder ( "DELETE FROM " ) ; delSqll . append ( expTableBean . getExportTempTableName ( ) ) ; delSqll . append ( selectCondition ) ; return delSqll . toString ( ) ; } private String createDupInsertSql ( ExportTargetTableBean expTableBean , String selectCondition ) { List < String > columnList = DBAccessUtil . delErrorSystemColumn ( expTableBean . getErrorTableColumns ( ) , expTableBean . getErrorCodeColumn ( ) ) ; String column = DBAccessUtil . joinColumnArray ( columnList ) ; StringBuilder copySql = new StringBuilder ( "INSERT INTO " ) ; copySql . append ( expTableBean . getErrorTableName ( ) ) ; copySql . append ( " (" ) ; copySql . append ( column ) ; copySql . append ( "," ) ; copySql . append ( Constants . getRegisteredDateTimeColumnName ( ) ) ; copySql . append ( "," ) ; copySql . append ( Constants . getUpdatedDateTimeColumnName ( ) ) ; copySql . append ( "," ) ; copySql . append ( expTableBean . getErrorCodeColumn ( ) ) ; copySql . append ( ") SELECT " ) ; copySql . append ( column ) ; copySql . append ( "" ) ; copySql . append ( expTableBean . getErrorCode ( ) ) ; copySql . append ( "' FROM " ) ; copySql . append ( expTableBean . getExportTempTableName ( ) ) ; copySql . append ( selectCondition ) ; return copySql . toString ( ) ; } private String createDupSelectCondition ( ExportTargetTableBean expTableBean , long maxRecord ) { StringBuilder selectCondition = new StringBuilder ( " WHERE " ) ; selectCondition . append ( Constants . getSidColumnName ( ) ) ; selectCondition . append ( "" ) ; selectCondition . append ( expTableBean . getDuplicateFlagTableName ( ) ) ; selectCondition . append ( "." ) ; selectCondition . append ( Constants . getTemporarySidColumnName ( ) ) ; selectCondition . append ( " FROM " ) ; selectCondition . append ( expTableBean . getDuplicateFlagTableName ( ) ) ; selectCondition . append ( " WHERE " ) ; selectCondition . append ( expTableBean . getDuplicateFlagTableName ( ) ) ; selectCondition . append ( "." ) ; selectCondition . append ( Constants . getTemporarySidColumnName ( ) ) ; selectCondition . append ( "=" ) ; selectCondition . append ( expTableBean . getExportTempTableName ( ) ) ; selectCondition . append ( "." ) ; selectCondition . append ( Constants . getTemporarySidColumnName ( ) ) ; selectCondition . append ( ")" ) ; selectCondition . append ( " ORDER BY " ) ; selectCondition . append ( Constants . getTemporarySidColumnName ( ) ) ; selectCondition . append ( " LIMIT " ) ; selectCondition . append ( maxRecord ) ; return selectCondition . toString ( ) ; } private boolean copyUpdateData ( ExportTargetTableBean tableBean , String tableName , long maxRecord , String jobflowSid , Connection conn ) throws BulkLoaderSystemException { String tempTableName = tableBean . getExportTempTableName ( ) ; String minTempSidSql = createMinTempSidSql ( Constants . getTemporarySidColumnName ( ) , tempTableName ) ; String maxTempSidSql = createMaxTempSidSql ( Constants . getTemporarySidColumnName ( ) , tempTableName ) ; String countTempSql = createCountTempSql ( tempTableName ) ; String selectCondition = createUpdateSelectCondition ( tableName , tempTableName ) ; String copySql = createUpdateCopySql ( tableName , tempTableName , selectCondition , tableBean . getExportTableColumns ( ) ) ; String delSql = createUpdateRecordDelSql ( tableName , tempTableName ) ; String errTempSql = createSelectErrTempRecordSql ( tempTableName ) ; PreparedStatement stmt = null ; long minTempSid = 0 ; ResultSet rs = null ; try { stmt = conn . prepareStatement ( minTempSidSql ) ; rs = DBConnection . executeQuery ( stmt , minTempSidSql , new String [ 0 ] ) ; rs . next ( ) ; minTempSid = rs . getLong ( 1 ) ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , this . getClass ( ) , minTempSidSql , new String [ 0 ] ) ; } finally { DBConnection . closeRs ( rs ) ; DBConnection . closePs ( stmt ) ; } long maxTempSid = 0 ; try { stmt = conn . prepareStatement ( maxTempSidSql ) ; rs = DBConnection . executeQuery ( stmt , maxTempSidSql , new String [ 0 ] ) ; rs . next ( ) ; maxTempSid = rs . getLong ( 1 ) ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , this . getClass ( ) , maxTempSidSql , new String [ 0 ] ) ; } finally { DBConnection . closeRs ( rs ) ; DBConnection . closePs ( stmt ) ; } long currentCount = minTempSid ; while ( true ) { Long maxCount = currentCount + maxRecord ; int copyCount = 0 ; try { stmt = conn . prepareStatement ( copySql ) ; stmt . setLong ( 1 , currentCount ) ; stmt . setLong ( 2 , maxCount ) ; copyCount = DBConnection . executeUpdate ( stmt , copySql , new String [ ] { String . valueOf ( currentCount ) , String . valueOf ( maxCount ) } ) ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , this . getClass ( ) , copySql , new String [ ] { String . valueOf ( currentCount ) , String . valueOf ( maxCount ) } ) ; } finally { DBConnection . closePs ( stmt ) ; } if ( copyCount > 0 ) { try { stmt = conn . prepareStatement ( delSql ) ; stmt . setLong ( 1 , currentCount ) ; stmt . setLong ( 2 , maxCount ) ; DBConnection . executeUpdate ( stmt , delSql , new String [ ] { String . valueOf ( currentCount ) , String . valueOf ( maxCount ) } ) ; DBConnection . commit ( conn ) ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , this . getClass ( ) , delSql , new String [ ] { String . valueOf ( currentCount ) , String . valueOf ( maxCount ) } ) ; } finally { DBConnection . closePs ( stmt ) ; } } LOG . info ( "" , tableName , tableBean . getExportTempTableName ( ) , copySql , delSql , currentCount , maxCount ) ; currentCount = maxCount + 1 ; if ( currentCount > maxTempSid ) { DBConnection . commit ( conn ) ; break ; } } long tempCount = 0 ; try { stmt = conn . prepareStatement ( countTempSql ) ; rs = DBConnection . executeQuery ( stmt , countTempSql , new String [ 0 ] ) ; rs . next ( ) ; tempCount = rs . getLong ( 1 ) ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , this . getClass ( ) , countTempSql , new String [ 0 ] ) ; } finally { DBConnection . closeRs ( rs ) ; DBConnection . closePs ( stmt ) ; } if ( tempCount == 0 ) { LOG . info ( "" , tableName , tableBean . getExportTempTableName ( ) ) ; return true ; } else { StringBuilder errSid = new StringBuilder ( ) ; try { stmt = conn . prepareStatement ( errTempSql ) ; rs = DBConnection . executeQuery ( stmt , errTempSql , new String [ 0 ] ) ; while ( rs . next ( ) ) { errSid . append ( Constants . getSidColumnName ( ) ) ; errSid . append ( "=" ) ; errSid . append ( rs . getLong ( Constants . getSidColumnName ( ) ) ) ; errSid . append ( "," ) ; errSid . append ( Constants . getTemporarySidColumnName ( ) ) ; errSid . append ( "=" ) ; errSid . append ( rs . getLong ( Constants . getTemporarySidColumnName ( ) ) ) ; errSid . append ( " " ) ; } } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , this . getClass ( ) , errTempSql . toString ( ) , new String [ 0 ] ) ; } finally { DBConnection . closeRs ( rs ) ; DBConnection . closePs ( stmt ) ; } LOG . error ( "" , tableName , tempTableName , errSid . toString ( ) ) ; return false ; } } private String createSelectErrTempRecordSql ( String tempTableName ) { StringBuilder errTempSql = new StringBuilder ( "SELECT " ) ; errTempSql . append ( Constants . getTemporarySidColumnName ( ) ) ; errTempSql . append ( "," ) ; errTempSql . append ( Constants . getSidColumnName ( ) ) ; errTempSql . append ( " FROM " ) ; errTempSql . append ( tempTableName ) ; return errTempSql . toString ( ) ; } private String createUpdateRecordDelSql ( String tableName , String tempTableName ) { StringBuilder delSql = new StringBuilder ( "DELETE FROM " ) ; delSql . append ( tempTableName ) ; delSql . append ( "" ) ; delSql . append ( Constants . getTemporarySidColumnName ( ) ) ; delSql . append ( " FROM " ) ; delSql . append ( tableName ) ; delSql . append ( " WHERE " ) ; delSql . append ( tableName ) ; delSql . append ( "." ) ; delSql . append ( Constants . getSidColumnName ( ) ) ; delSql . append ( "=" ) ; delSql . append ( tempTableName ) ; delSql . append ( "." ) ; delSql . append ( Constants . getSidColumnName ( ) ) ; delSql . append ( ") AND " ) ; delSql . append ( Constants . getSidColumnName ( ) ) ; delSql . append ( "" ) ; delSql . append ( Constants . getTemporarySidColumnName ( ) ) ; delSql . append ( "" ) ; return delSql . toString ( ) ; } private String createUpdateCopySql ( String tableName , String tempTableName , String selectCondition , List < String > exportTableColumns ) { List < String > updateColumnList = DBAccessUtil . delSystemColumn ( exportTableColumns ) ; StringBuilder copySql = new StringBuilder ( "UPDATE " ) ; copySql . append ( tableName ) ; copySql . append ( "," ) ; copySql . append ( tempTableName ) ; copySql . append ( " SET " ) ; copySql . append ( tableName ) ; copySql . append ( "." ) ; copySql . append ( Constants . getSidColumnName ( ) ) ; copySql . append ( "=" ) ; copySql . append ( tempTableName ) ; copySql . append ( "." ) ; copySql . append ( Constants . getSidColumnName ( ) ) ; copySql . append ( "," ) ; copySql . append ( tableName ) ; copySql . append ( "." ) ; copySql . append ( Constants . getVersionColumnName ( ) ) ; copySql . append ( "=" ) ; copySql . append ( tableName ) ; copySql . append ( "." ) ; copySql . append ( Constants . getVersionColumnName ( ) ) ; copySql . append ( "+" ) ; copySql . append ( Constants . SYS_COLUMN_INCREMENT_VERSION_NO ) ; copySql . append ( "," ) ; copySql . append ( tableName ) ; copySql . append ( "." ) ; copySql . append ( Constants . getUpdatedDateTimeColumnName ( ) ) ; copySql . append ( "=NOW()," ) ; int updateColumnSize = updateColumnList . size ( ) ; for ( int i = 0 ; i < updateColumnSize ; i ++ ) { copySql . append ( tableName ) ; copySql . append ( "." ) ; copySql . append ( updateColumnList . get ( i ) ) ; copySql . append ( "=" ) ; copySql . append ( tempTableName ) ; copySql . append ( "." ) ; copySql . append ( updateColumnList . get ( i ) ) ; if ( i + 1 < updateColumnSize ) { copySql . append ( "," ) ; } } copySql . append ( selectCondition ) ; return copySql . toString ( ) ; } private String createUpdateSelectCondition ( String tableName , String tempTableName ) { StringBuilder selectCondition = new StringBuilder ( " WHERE " ) ; selectCondition . append ( tableName ) ; selectCondition . append ( "." ) ; selectCondition . append ( Constants . getSidColumnName ( ) ) ; selectCondition . append ( "=" ) ; selectCondition . append ( tempTableName ) ; selectCondition . append ( "." ) ; selectCondition . append ( Constants . getSidColumnName ( ) ) ; selectCondition . append ( " AND " ) ; selectCondition . append ( tempTableName ) ; selectCondition . append ( "." ) ; selectCondition . append ( Constants . getSidColumnName ( ) ) ; selectCondition . append ( "" ) ; selectCondition . append ( tempTableName ) ; selectCondition . append ( "." ) ; selectCondition . append ( Constants . getTemporarySidColumnName ( ) ) ; selectCondition . append ( "" ) ; return selectCondition . toString ( ) ; } private String createCountTempSql ( String tempTableName ) { StringBuilder countTempSql = new StringBuilder ( "" ) ; countTempSql . append ( tempTableName ) ; return countTempSql . toString ( ) ; } private String createMaxTempSidSql ( String temporarySidColumnName , String tempTableName ) { StringBuilder maxTempSidSql = new StringBuilder ( "SELECT MAX(" ) ; maxTempSidSql . append ( Constants . getTemporarySidColumnName ( ) ) ; maxTempSidSql . append ( ") FROM " ) ; maxTempSidSql . append ( tempTableName ) ; return maxTempSidSql . toString ( ) ; } private String createMinTempSidSql ( String temporarySidColumnName , String tempTableName ) { StringBuilder minTempSidSql = new StringBuilder ( "SELECT MIN(" ) ; minTempSidSql . append ( Constants . getTemporarySidColumnName ( ) ) ; minTempSidSql . append ( ") FROM " ) ; minTempSidSql . append ( tempTableName ) ; return minTempSidSql . toString ( ) ; } private void copyNonDuplicateData ( ExportTargetTableBean
360
<s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jface . wizard . IWizardPage ; import org . eclipse . jface . wizard . Wizard ; import org . eclipse . jface . wizard . WizardDialog ; import org . eclipse . swt . widgets . Shell ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . ui . wizards . ILoadpathContainerPage ; import org . rubypeople . rdt . ui . wizards . ILoadpathContainerPageExtension ; import org . rubypeople . rdt . ui . wizards . ILoadpathContainerPageExtension2 ; public class LoadpathContainerWizard extends Wizard { private LoadpathContainerDescriptor fPageDesc ; private ILoadpathEntry fEntryToEdit ; private ILoadpathEntry [ ] fNewEntries ; private ILoadpathContainerPage fContainerPage ; private IRubyProject fCurrProject ; private
361
<s> package com . asakusafw . windgate . core ; import java . text . MessageFormat ; import java . util . Map ; import java . util . Properties ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . windgate . core . util . PropertiesUtil ; public class CoreProfile { static final WindGateLogger WGLOG = new WindGateCoreLogger ( CoreProfile . class ) ; static final Logger LOG = LoggerFactory . getLogger ( CoreProfile . class ) ; private static final char QUALIFIER = '.' ; public static final String KEY_PREFIX = "core" + QUALIFIER ; @ Deprecated public static final String KEY_MAX_THREADS = "maxThreads" ; public static final String KEY_MAX_PROCESSES = "maxProcesses" ; public static final int DEFAULT_MAX_PROCESSES = 1 ; private final int maxProcesses ; public CoreProfile ( int maxProcesses ) { if ( maxProcesses < 1 ) { throw new IllegalArgumentException ( "" ) ; } this . maxProcesses = maxProcesses ; } public int getMaxProcesses ( ) { return maxProcesses ; } @ Deprecated public static CoreProfile loadFrom ( Properties properties , ClassLoader loader ) { if ( properties == null ) { throw new IllegalArgumentException ( "" ) ; } if ( loader == null ) { throw new IllegalArgumentException ( "" ) ; } return loadFrom ( properties , ProfileContext . system ( loader ) ) ; } public static CoreProfile loadFrom ( Properties properties , ProfileContext context ) { if ( properties == null ) { throw new IllegalArgumentException ( "" ) ; } if ( context == null ) { throw new IllegalArgumentException ( "" ) ; } LOG . debug ( "" ) ; Map < String , String > config = PropertiesUtil . createPrefixMap ( properties , KEY_PREFIX ) ; int maxProcesses ; if ( config . containsKey ( KEY_MAX_PROCESSES ) ) { maxProcesses = getMaxProcesses ( config , KEY_MAX_PROCESSES ) ; } else { maxProcesses = getMaxProcesses ( config , KEY_MAX_THREADS
362
<s> package com . asakusafw . bulkloader . cache ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; 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 . Collections ; import java . util . Date ; import java . util . List ; import org . junit . AfterClass ; import org . junit . Before ; import org . junit . BeforeClass ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; import com . asakusafw . bulkloader . common . ConfigurationLoader ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . common . FileNameUtil ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . testutil . UnitTestUtil ; import com . asakusafw . bulkloader . transfer . FileList ; import com . asakusafw . bulkloader . transfer . FileProtocol ; import com . asakusafw . runtime . util . hadoop . ConfigurationProvider ; import com . asakusafw . thundergate . runtime . cache . CacheInfo ; import com . asakusafw . thundergate . runtime . cache . CacheStorage ; public class DeleteCacheStorageRemoteTest { @ Rule public final TemporaryFolder folder = new TemporaryFolder ( ) ; private final DeleteCacheStorageRemote service = new DeleteCacheStorageRemote ( ) ; private final ByteArrayOutputStream writerBuffer = new ByteArrayOutputStream ( ) ; @ BeforeClass public static void setUpBeforeClass ( ) throws Exception { UnitTestUtil . setUpBeforeClass ( ) ; UnitTestUtil . setUpEnv ( ) ; } @ AfterClass public static void tearDownAfterClass ( ) throws Exception { UnitTestUtil . tearDownEnv ( ) ; UnitTestUtil . tearDownAfterClass ( ) ; } @ SuppressWarnings ( "deprecation" ) @ Before public void setUp ( ) throws Exception { UnitTestUtil . startUp ( ) ; service . initialize ( "target" , "tester" ) ; service . setConf ( new ConfigurationProvider ( ) . newInstance ( ) ) ; ConfigurationLoader . getProperty ( ) . setProperty ( Constants . PROP_KEY_BASE_PATH , folder . getRoot ( ) . getAbsoluteFile ( ) . toURI ( ) . toString ( ) ) ; } @ Test public void nothing ( ) throws Exception { FileList . Reader reader = prepare ( "nothing" ) ; FileList . Writer writer = FileList . createWriter ( writerBuffer , false ) ; service . execute ( reader , writer ) ; writer . close ( ) ; List < FileProtocol > results = collect ( writerBuffer . toByteArray ( ) ) ; assertThat ( results . size ( ) , is ( 1 ) ) ; assertThat ( results . get ( 0 ) . getLocation ( ) , endsWith ( "nothing" ) ) ; assertThat ( results . get ( 0 ) . getKind ( ) , is ( FileProtocol . Kind . RESPONSE_NOT_FOUND ) ) ; } @ Test public void found ( ) throws Exception { CacheInfo info = new CacheInfo ( "a" , "id" , calendar ( "" ) , "EXAMPLE" , Collections . singleton ( "COL" ) , "" , 123L ) ; CacheStorage storage = new CacheStorage ( service . getConf ( ) , uri ( "available" ) ) ; try { storage . putHeadCacheInfo ( info ) ; assertThat ( storage . getHeadCacheInfo ( ) , is ( notNullValue ( ) ) ) ; FileList . Reader reader = prepare ( "available" ) ; FileList . Writer writer = FileList . createWriter ( writerBuffer , false ) ; service . execute ( reader , writer ) ; writer . close ( ) ; List < FileProtocol > results = collect ( writerBuffer . toByteArray ( ) ) ; assertThat ( results . size ( ) , is ( 1 ) ) ; assertThat ( results . get ( 0 ) . getLocation ( ) , endsWith ( "available" ) ) ; assertThat ( results . get ( 0 ) . getKind ( ) , is ( FileProtocol . Kind . RESPONSE_DELETED ) ) ; assertThat ( storage . getHeadCacheInfo ( ) , is ( nullValue ( ) ) ) ; } finally { storage . close ( ) ; } } @ Test public void mixed ( ) throws Exception { CacheInfo info = new CacheInfo ( "a" , "id" , calendar ( "" ) , "EXAMPLE" , Collections . singleton ( "COL" ) , "" , 123L ) ; CacheStorage storage = new CacheStorage ( service . getConf ( ) , uri ( "available" ) ) ; try { storage . putHeadCacheInfo ( info ) ; assertThat ( storage . getHeadCacheInfo ( ) , is ( notNullValue ( ) ) ) ; FileList . Reader reader = prepare ( "nothing1" , "nothing2" , "available" , "nothing3" ) ; FileList . Writer writer = FileList . createWriter ( writerBuffer , false ) ; service . execute ( reader , writer ) ; writer . close ( ) ; List < FileProtocol > results = collect ( writerBuffer . toByteArray ( ) ) ; assertThat ( results . size ( ) , is ( 4 ) ) ; assertThat ( results . get ( 0 ) . getLocation ( ) , endsWith ( "nothing1" ) ) ; assertThat ( results . get ( 0 ) . getKind ( ) , is ( FileProtocol . Kind . RESPONSE_NOT_FOUND ) ) ; assertThat ( results . get ( 1 ) . getLocation ( ) , endsWith ( "nothing2" ) ) ; assertThat ( results . get ( 1 ) . getKind ( ) , is ( FileProtocol . Kind . RESPONSE_NOT_FOUND ) ) ; assertThat ( results . get ( 2 ) . getLocation ( ) , endsWith ( "available" ) ) ; assertThat ( results . get ( 2 ) . getKind ( ) , is ( FileProtocol . Kind . RESPONSE_DELETED ) ) ; assertThat ( results . get ( 3 ) . getLocation ( ) , endsWith ( "nothing3" ) ) ; assertThat ( results . get ( 3 ) . getKind ( ) , is ( FileProtocol . Kind . RESPONSE_NOT_FOUND ) ) ; assertThat ( storage . getHeadCacheInfo ( ) , is ( nullValue ( ) ) ) ; } finally { storage . close
363
<s> package org . springframework . social . google . api . plus . person ; public class Phone { private String type ;
364
<s> package org . oddjob . tools . includes ; import junit . framework . TestCase ; public class FilterFactoryTest extends TestCase { public void testForSnippet ( ) {
365
<s> package org . rubypeople . rdt . internal . ui . text . ruby ; import java . lang . reflect . Field ; public class RubyTokenCategories { protected RubyTokenCategories ( ) { } public static final int UNKNOWN = - 1 ; public static final int ERROR = 0 ; public static final int WHITESPACE = 1 ; public static final int IDENTIFIER = 2 ; public static final int KEYWORD = 3 ; public static final int PUNCTUATOR = 4 ; public static final int LITERAL = 5 ; public static final int COMMENT = 6 ; public static final int MAX_VALUE = COMMENT ; public static String [ ] getNames ( ) { String [ ] result = new String [ MAX_VALUE + 1 ] ; for ( int i = 0 ; i <= MAX_VALUE ; i ++ ) { result [ i ] = getName ( i ) ; } return result ; } public static
366
<s> package org . rubypeople . rdt . internal . debug . core . model ; import org . eclipse . debug . core . DebugException ; import org . eclipse . debug . core . model . IThread ; import org . eclipse . debug . core . model
367
<s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . MethodInvocationExpression ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class MethodInvocationExpressionImpl extends ModelRoot implements MethodInvocationExpression { private Expression qualifier ; private List < ? extends Type > typeArguments ; private SimpleName name ; private List < ? extends Expression > arguments ; @ Override public Expression getQualifier ( ) { return this . qualifier ; } public void setQualifier ( Expression qualifier ) { this . qualifier = qualifier ; } @ Override public List < ? extends Type > getTypeArguments ( ) { return this . typeArguments ; } public void setTypeArguments ( List < ? extends Type > typeArguments ) { Util . notNull ( typeArguments , "" ) ; Util . notContainNull ( typeArguments , "" ) ; this . typeArguments = Util . freeze ( typeArguments ) ; } @ Override public SimpleName getName ( ) { return this . name ; } public void setName ( SimpleName name ) { Util . notNull ( name , "name" ) ; this . name = name ; } @ Override public List < ? extends Expression > getArguments ( ) { return this . arguments ; } public void setArguments ( List < ? extends Expression > arguments ) { Util . notNull ( arguments , "arguments" ) ; Util . notContainNull ( arguments
368
<s> package org . rubypeople . rdt . refactoring . core . convertlocaltofield ; import org . eclipse . osgi . util . NLS ; public class Messages extends NLS { private static final String BUNDLE_NAME = "" ; public static String ConvertLocalToFieldRefactoring_Name ; public static String TempToFieldConditionChecker_AlreadyExists ; public static String TempToFieldConditionChecker_CannotConvertBlockParameters ; public static String TempToFieldConditionChecker_CannotConvertMethodParameters ; public static String TempToFieldConditionChecker_CannotConvertNonlocalVars ; public static String TempToFieldConditionChecker_FieldWithName ; public static String
369
<s> package net . sf . sveditor . core . tests . open_decl ; import junit . framework
370
<s> package com . mcbans . firestar . mcbans . org . json ; @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public class XMLTokener extends JSONTokener { public static final java . util . HashMap entity ; static { entity = new java . util . HashMap ( 8 ) ; entity . put ( "amp" , XML . AMP ) ; entity . put ( "apos" , XML . APOS ) ; entity . put ( "gt" , XML . GT ) ; entity . put ( "lt" , XML . LT ) ; entity . put ( "quot" , XML . QUOT ) ; } public XMLTokener ( String s ) { super ( s ) ; } public String nextCDATA ( ) throws JSONException { char c ; int i ; StringBuffer sb = new StringBuffer ( ) ; for ( ; ; ) { c = next ( ) ; if ( end ( ) ) { throw syntaxError ( "" ) ; } sb . append ( c ) ; i = sb . length ( ) - 3 ; if ( i >= 0 && sb . charAt ( i ) == ']' && sb . charAt ( i + 1 ) == ']' && sb . charAt ( i + 2 ) == '>' ) { sb . setLength ( i ) ; return sb . toString ( ) ; } } } public Object nextContent ( ) throws JSONException { char c ; StringBuffer sb ; do { c = next ( ) ; } while ( Character . isWhitespace ( c ) ) ; if ( c == 0 ) { return null ; } if ( c == '<' ) { return XML . LT ; } sb = new StringBuffer ( ) ; for ( ; ; ) { if ( c == '<' || c == 0 ) { back ( ) ; return sb . toString ( ) . trim ( ) ; } if ( c == '&' ) { sb . append ( nextEntity ( c ) ) ; } else { sb . append ( c ) ; } c = next ( ) ; } } public Object nextEntity ( char ampersand ) throws JSONException { StringBuffer sb = new StringBuffer ( ) ; for ( ; ; ) { char c = next ( ) ; if ( Character . isLetterOrDigit ( c ) || c == '#' ) { sb . append ( Character . toLowerCase ( c ) ) ; } else if ( c == ';' ) { break ; } else { throw syntaxError ( "" + sb ) ; } } String string = sb . toString ( ) ; Object object = entity . get ( string ) ; return object != null ? object : ampersand + string + ";" ; } public Object nextMeta ( ) throws JSONException { char c ; char q ; do { c = next ( ) ; } while ( Character . isWhitespace ( c ) ) ; switch ( c ) { case 0 : throw syntaxError ( "" ) ; case '<' : return XML . LT ; case '>' : return XML . GT ; case '/' : return XML . SLASH ; case '=' : return XML . EQ ; case '!' : return XML . BANG ; case '?' : return XML . QUEST ; case '"' : case '\'' : q = c ; for ( ; ; ) { c = next ( ) ; if ( c == 0 ) { throw syntaxError ( "" ) ; } if ( c == q ) { return Boolean . TRUE ; } } default : for ( ; ; ) { c = next ( ) ; if ( Character . isWhitespace ( c ) ) { return Boolean . TRUE ; } switch ( c ) { case 0 : case '<' : case '>' : case '/' : case '=' : case '!' : case '?' : case '"' : case '\'' : back ( ) ; return Boolean . TRUE ; } } } } public Object nextToken ( ) throws JSONException { char c ; char q ; StringBuffer sb ; do { c = next ( ) ; } while ( Character . isWhitespace ( c ) ) ; switch ( c ) { case 0 : throw syntaxError ( "" ) ; case '<' : throw syntaxError ( "" ) ; case '>' : return XML . GT ; case '/' : return XML . SLASH ; case '=' : return XML . EQ ; case '!' : return XML . BANG ; case '?' : return XML . QUEST ; case '"' : case '\'' : q = c ; sb = new StringBuffer ( ) ; for ( ; ; ) { c = next ( ) ; if ( c == 0 )
371
<s> package com . asakusafw . bulkloader . importer ; import java . sql . Connection ; import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . List ; import com . asakusafw . bulkloader . bean . ImportBean ; import com . asakusafw . bulkloader . common . BulkLoaderInitializer ; import com . asakusafw . bulkloader . common . ConfigurationLoader ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . common . DBAccessUtil ; import com . asakusafw . bulkloader . common . DBConnection ; import com . asakusafw . bulkloader . common . ImportType ; import com . asakusafw . bulkloader . common . JobFlowParamLoader ; import com . asakusafw . bulkloader . common . TsvDeleteType ; import com . asakusafw . bulkloader . exception . BulkLoaderReRunnableException ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . log . Log ; import com . asakusafw . runtime . core . context . RuntimeContext ; public class Importer { static final Log LOG = new Log ( Importer . class ) ; private static final List < String > PROPERTIES = Constants . PROPERTIES_DB ; public static void main ( String [ ] args ) { RuntimeContext . set ( RuntimeContext . DEFAULT . apply ( System . getenv ( ) ) ) ; RuntimeContext . get ( ) . verifyApplication ( Importer . class . getClassLoader ( ) ) ; Importer importer = new Importer ( ) ; int result = importer . execute ( args ) ; System . exit ( result ) ; } protected int execute ( String [ ] args ) { if ( args . length != 6 && args . length != 7 ) { System . err . println ( "" + args . length ) ; return Constants . EXIT_CODE_ERROR ; } String importerType = args [ 0 ] ; String targetName = args [ 1 ] ; String batchId = args [ 2 ] ; String jobflowId = args [ 3 ] ; String executionId = args [ 4 ] ; String endDate = args [ 5 ] ; String recoveryTable = null ; if ( args . length == 7 ) { recoveryTable = args [ 6 ] ; } try { if ( ! BulkLoaderInitializer . initDBServer ( jobflowId , executionId , PROPERTIES , targetName ) ) { LOG . error ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_ERROR ; } LOG . info ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; ImportBean bean = createBean ( importerType , targetName , batchId , jobflowId , executionId , endDate , recoveryTable ) ; if ( bean == null ) { LOG . error ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_ERROR ; } if ( RuntimeContext . get ( ) . isSimulation ( ) ) { DBConnection . getConnection ( ) . close ( ) ; return Constants . EXIT_CODE_SUCCESS ; } int exitCode = importTables ( bean ) ; return exitCode ; } catch ( BulkLoaderReRunnableException e ) { LOG . log ( e ) ; return Constants . EXIT_CODE_RETRYABLE ; } catch ( BulkLoaderSystemException e ) { LOG . log ( e ) ; return Constants . EXIT_CODE_ERROR ; } catch ( Exception e ) { try { LOG . error ( e , "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_ERROR ; } catch ( Exception e1 ) { System . err . print ( "" ) ; e1 . printStackTrace ( ) ; return Constants . EXIT_CODE_ERROR ; } } } public int importTables ( ImportBean bean ) throws BulkLoaderSystemException , BulkLoaderReRunnableException { if ( bean == null ) { throw new IllegalArgumentException ( "" ) ; } String importerType = ( bean . isPrimary ( ) ? ImportType . PRIMARY : ImportType . SECONDARY ) . toString ( ) ; String targetName = bean . getTargetName ( ) ; String batchId = bean . getBatchId ( ) ; String jobflowId = bean . getJobflowId ( ) ; String executionId = bean . getExecutionId ( ) ; Connection lockConn = null ; boolean protocolDecided = false ; try { String jobflowSid ; if ( bean . isPrimary ( ) ) { LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; try { lockConn = DBConnection . getConnection ( ) ; if ( ! DBAccessUtil . getJobflowInstanceLock ( bean . getExecutionId ( ) , lockConn ) ) { LOG . error ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_ERROR ; } else { LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; } } catch ( BulkLoaderSystemException e ) { LOG . log ( e ) ; LOG . error ( e , "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_ERROR ; } ImportProtocolDecide protocolDecide = createImportProtocolDecide ( ) ; protocolDecide . execute ( bean ) ; protocolDecided = true ; TargetDataLock targetLock = createTargetDataLock ( ) ; List < String > list = bean . getImportTargetTableList ( ) ; if ( list != null && list . size ( ) > 0 ) { LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; if ( ! targetLock . lock ( bean ) ) { LOG . error ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_ERROR ; } else { LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; jobflowSid = targetLock . getJobFlowSid ( ) ; } } else { LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; jobflowSid = targetLock . insertRunningJobFlow ( bean . getTargetName ( ) , bean . getBatchId ( ) , bean . getJobflowId ( ) , bean . getExecutionId ( ) , bean . getJobnetEndTime ( ) ) ; if ( jobflowSid != null ) { LOG . info ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_SUCCESS ; } else { LOG . error ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_ERROR ; } } } else { List < String > list = bean . getImportTargetTableList ( ) ; if ( list == null || list . size ( ) == 0 ) { LOG . info ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_SUCCESS ; } else { ImportProtocolDecide protocolDecide = createImportProtocolDecide ( ) ; protocolDecide . execute ( bean ) ; jobflowSid = null ; } } LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; ImportFileCreate fileCreate = createImportFileCreate ( ) ; if ( ! fileCreate . createImportFile ( bean , jobflowSid ) ) { LOG . error ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_ERROR ; } else { LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; } LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; ImportFileSend fileSend = createImportFileSend ( ) ; if ( ! fileSend . sendImportFile ( bean ) ) { LOG . error ( "" , new Date ( ) , importerType , targetName , batchId , jobflowId , executionId ) ; return Constants . EXIT_CODE_ERROR ; } else { LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; } String deleteTsv = ConfigurationLoader . getProperty ( Constants . PROP_KEY_IMPORT_TSV_DELETE ) ; TsvDeleteType delType = TsvDeleteType . find ( deleteTsv ) ; if ( TsvDeleteType . TRUE . equals ( delType ) ) { LOG . info ( "" , importerType , targetName , batchId , jobflowId , executionId ) ; ImportFileDelete fileDelete = createImportFileDelete ( ) ; fileDelete . deleteFile ( bean ) ; }
372
<s> package org . oddjob . framework ; import java . util . Stack ; public class ContextClassloaders { private static InheritableThreadLocal < Stack < ClassLoader > > local = new InheritableThreadLocal < Stack < ClassLoader > > ( ) { @ Override protected Stack < ClassLoader > initialValue ( ) { return new Stack < ClassLoader > ( ) ; } @ Override @ SuppressWarnings ( "unchecked" ) protected Stack < ClassLoader > childValue ( Stack < ClassLoader > parentValue ) { return ( Stack < ClassLoader > ) parentValue . clone ( ) ; } } ; private ContextClassloaders ( ) { }
373
<s> package org . rubypeople . rdt . refactoring . ui ; import
374
<s> package net . sf . sveditor . core . tests . open_decl ; import java . util . List ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . Tuple ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . open_decl . OpenDeclUtils ; import net . sf . sveditor . core . scanutils . StringBIDITextScanner ; import net . sf . sveditor . core . tests . FileIndexIterator ; import net . sf . sveditor . core . tests . SVDBTestUtils ; import junit . framework . TestCase ; public class TestOpenModIfc extends TestCase { public void testOpenModuleDecl ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String doc = "module m1;n" + "twire A, B;n" + "endmodulen" + "n" + "module m2;n" + "tm1 u1();n" + "endmodulen" ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "m1" , "m2" ) ; StringBIDITextScanner scanner = new StringBIDITextScanner ( doc ) ; int idx = doc . indexOf ( "m1 u1" ) ; log . debug ( "index: " + idx ) ; scanner . seek ( idx + 1 ) ; ISVDBIndexIterator target_index = new FileIndexIterator ( file ) ; List < Tuple < ISVDBItemBase , SVDBFile > > ret = OpenDeclUtils . openDecl_2 ( file , 4 , scanner , target_index ) ; log . debug ( ret . size ( ) + " items" ) ; assertEquals ( 1 , ret . size ( ) ) ; assertEquals ( SVDBItemType . ModuleDecl , ret . get ( 0 ) . first ( ) . getType ( ) ) ; assertEquals ( "m1" , SVDBItem . getName ( ret . get ( 0 ) . first ( ) ) ) ; LogFactory . removeLogHandle ( log ) ; } public void testOpenInterfaceDecl ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String doc = "" + "twire A, B;n" + "" + "n" + "" + "tm1 u1();n" + "" ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "m1" , "m2" ) ; StringBIDITextScanner scanner = new StringBIDITextScanner ( doc ) ; int idx = doc . indexOf ( "m1 u1" ) ; log . debug ( "index: " + idx ) ; scanner . seek ( idx + 1 ) ; ISVDBIndexIterator target_index = new FileIndexIterator ( file ) ; List < Tuple < ISVDBItemBase , SVDBFile > > ret = OpenDeclUtils . openDecl_2 ( file , 4 , scanner , target_index ) ; log . debug ( ret . size ( ) + " items" ) ; assertEquals ( 1 , ret . size ( ) ) ; assertEquals ( SVDBItemType . InterfaceDecl , ret . get ( 0 ) . first ( ) . getType ( ) ) ; assertEquals ( "m1" , SVDBItem . getName ( ret . get ( 0 ) . first ( ) ) ) ; LogFactory . removeLogHandle ( log ) ; } public void disabled_testOpenModuleDeclwPreComment ( ) { String testname = "" ; LogHandle log = LogFactory . getLogHandle ( testname ) ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String doc = "" + "" + "endmodulen" + "n" + "" + "t// a.n" + "" + "endmodulen" + "n" ; SVDBFile file = SVDBTestUtils . parse ( doc , testname ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "a" , "b" ) ; StringBIDITextScanner scanner = new StringBIDITextScanner ( doc ) ; int idx = doc . indexOf ( "a a0" ) ; scanner . seek ( idx + 1 ) ; ISVDBIndexIterator target_index = new FileIndexIterator ( file ) ; List < Tuple < ISVDBItemBase , SVDBFile > > ret = OpenDeclUtils . openDecl_2 ( file , 7 , scanner , target_index ) ; log . debug ( ret . size ( ) + " items" ) ; assertEquals ( 1 , ret . size ( ) ) ; assertEquals ( SVDBItemType . ModuleDecl , ret . get ( 0 ) . first ( ) . getType ( ) ) ; assertEquals ( "a" , SVDBItem . getName ( ret . get ( 0 ) . first ( ) ) ) ; LogFactory . removeLogHandle ( log ) ; } public void testStructFieldModuleScope ( ) { String testname = "" ;
375
<s> package org . rubypeople . rdt . internal . core . builder ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . SubMonitor ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . compiler . BuildContext ; import org . rubypeople . rdt . core . compiler . CategorizedProblem ; import org . rubypeople . rdt . core . compiler . CompilationParticipant ; import org . rubypeople . rdt . internal . core . RubyModelManager ; public abstract class AbstractRdtCompiler { protected final IProject project ; protected final IMarkerManager markerManager ; protected CompilationParticipant [ ] fParticipants ; private IRubyProject fRubyProject ; public AbstractRdtCompiler ( IProject project , IMarkerManager markerManager ) { this . project = project ; this . markerManager = markerManager ; this . fRubyProject = getRubyProject ( ) ; fParticipants = RubyModelManager . getRubyModelManager ( ) . compilationParticipants . getCompilationParticipants ( fRubyProject ) ; } protected abstract void removeMarkers ( IMarkerManager markerManager , IProgressMonitor monitor ) ; public void compile ( IProgressMonitor monitor ) throws CoreException { SubMonitor sub = SubMonitor . convert ( monitor , "Building " + project . getName ( ) + "..." , 100 ) ; notifyParticipants ( sub . newChild ( 5 ) ) ; BuildContext [ ] files = getBuildContexts ( ) ; sub . worked ( 5 ) ; int workUnitsPerTask = 90 / ( fParticipants . length + 1 ) ; if ( monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; removeMarkers ( markerManager , sub . newChild ( workUnitsPerTask ) ) ; if ( sub . isCanceled ( ) ) throw new OperationCanceledException ( ) ; compileFiles ( files , sub . newChild
376
<s> package com . asakusafw . windgate . retryable ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . Map ; import com . asakusafw . windgate . core . WindGateLogger ; import com . asakusafw . windgate . core . process . ProcessProfile ; import com . asakusafw . windgate . core . process . ProcessProvider ; import com . asakusafw . windgate . core . util . PropertiesUtil ; public class RetryableProcessProfile { static final WindGateLogger WGLOG = new RetryableProcessLogger ( RetryableProcessProfile . class ) ; private static final char SEPARATOR = '.' ; public static final String KEY_RETRY_COUNT = "retryCount" ; public static final String KEY_COMPONENT = "component" ; public static final String PREFIX_COMPONENT = KEY_COMPONENT + SEPARATOR ; private final ProcessProvider component ; private final int retryCount ; public RetryableProcessProfile ( ProcessProvider component , int retryCount ) { if ( component == null ) { throw new IllegalArgumentException ( "" ) ; } if ( retryCount <= 0 ) { throw new IllegalArgumentException ( "" ) ; } this . component = component ; this . retryCount = retryCount ; } public static RetryableProcessProfile convert ( ProcessProfile profile ) throws IOException { if ( profile == null ) { throw new IllegalArgumentException ( "" ) ; } int retryCount = extractInt ( profile , KEY_RETRY_COUNT , 1 ) ; String componentName = profile . getName ( ) + '-' + KEY_COMPONENT ; String componentClassName = extract ( profile , KEY_COMPONENT , false ) ; Class < ? extends ProcessProvider > componentClass ; try { Class < ? > aClass = Class . forName ( componentClassName , false , profile . getContext ( ) . getClassLoader ( ) ) ; componentClass = aClass . asSubclass ( ProcessProvider . class ) ; } catch ( Exception e ) { WGLOG . error ( e , "E00001" , profile . getName ( ) , KEY_COMPONENT , componentClassName ) ; throw new IllegalArgumentException ( MessageFormat . format ( "" , profile . getName ( ) , componentClassName ) , e ) ; } Map < String , String > conf = profile . getConfiguration ( ) ; Map < String , String > componentConf = PropertiesUtil . createPrefixMap ( conf , PREFIX_COMPONENT ) ; ProcessProfile componentProfile = new ProcessProfile ( componentName , componentClass , profile . getContext ( ) , componentConf ) ; ProcessProvider component ; try { component = componentProfile . createProvider ( ) ; } catch ( IOException e ) { WGLOG . error ( e , "E00001" , profile . getName ( ) , KEY_COMPONENT , componentClassName ) ; throw e ; } return new RetryableProcessProfile ( component , retryCount ) ; } private static String extract ( ProcessProfile profile , String configKey , boolean mandatory ) { assert profile != null ; assert configKey != null ; String value = profile . getConfiguration ( ) . get ( configKey ) ; if ( value == null
377
<s> package org . springframework . social . quickstart . tasks ; import static org . springframework . util . StringUtils . hasText ; import static org . springframework . format . annotation . DateTimeFormat . ISO . DATE ; import java . util . Date ; import org . hibernate . validator . constraints . NotBlank ; import org . springframework . format . annotation . DateTimeFormat ; public class TaskForm { private String list ; private String id ; @ NotBlank ( message = "" ) private String title ; private String notes ; @ DateTimeFormat ( iso = DATE ) private Date due ; @ DateTimeFormat ( iso = DATE ) private Date completed ; public TaskForm ( ) { } public TaskForm ( String id , String title , Date due , String notes , Date completed ) { this . id = id ; this . title = title ; this . due = due ; this . notes = notes ; this . completed = completed ; } public String getList ( ) { return hasText ( list ) ? list : "@default" ; } public void setList ( String list ) { this . list = list ; } public String getId ( ) {
378
<s> package org . rubypeople . rdt . internal . ui . packageview ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IResource ; import org . eclipse . swt . dnd . DragSourceAdapter ; import org . eclipse . swt . dnd . DragSourceEvent ; import org . eclipse . swt . dnd . Transfer ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . util . TransferDragSourceListener ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . ui . part . ResourceTransfer ; public class ResourceTransferDragAdapter extends DragSourceAdapter implements TransferDragSourceListener { private ISelectionProvider fProvider ; public ResourceTransferDragAdapter ( ISelectionProvider provider ) { fProvider = provider ; Assert . isNotNull ( fProvider ) ; } public Transfer getTransfer ( ) { return ResourceTransfer . getInstance ( ) ; } public void dragStart ( DragSourceEvent event ) { event . doit = convertSelection ( ) . size ( ) > 0 ; } public void dragSetData ( DragSourceEvent event ) { List resources = convertSelection ( ) ; event . data = resources . toArray ( new IResource [ resources . size ( ) ] ) ; } public void dragFinished ( DragSourceEvent event ) { if ( ! event . doit ) return ; } private List convertSelection ( ) { ISelection s = fProvider . getSelection ( ) ; if ( ! ( s instanceof IStructuredSelection ) )
379
<s> package com . asakusafw . dmdl . windgate . csv . driver ; import com . asakusafw . dmdl . model . AstNode ; import com . asakusafw . dmdl . semantics . PropertyDeclaration ; import com . asakusafw . dmdl . semantics . Trait ; public class CsvFieldTrait implements Trait < CsvFieldTrait > { private final AstNode originalAst ; private final Kind kind ; private final String name ; public CsvFieldTrait ( AstNode originalAst , Kind kind , String name ) { if ( kind == null ) { throw new IllegalArgumentException ( "" ) ; } this . originalAst = originalAst ; this . kind = kind ; this .
380
<s> package net . sf . sveditor . core . indent ; public class SVIndentToken { protected SVIndentTokenType fType ; protected String fLeadingWS ; protected String fTrailingWS = "" ; protected String fImage ; protected boolean fEndLine ; protected boolean fStartLine ; protected boolean fDoIt ; protected int fPos ; protected int fLineno ; public SVIndentToken ( SVIndentTokenType type , String leading_ws , String image ) { fType = type ; fLeadingWS = leading_ws ; fTrailingWS = "" ; fImage = image ; fDoIt = true ; } protected SVIndentToken ( SVIndentTokenType type , String leading_ws ) { fType = type ; fLeadingWS = leading_ws ; fTrailingWS = "" ; fImage = "" ; fDoIt = true ; } public boolean isId ( String s ) { return ( getType ( ) == SVIndentTokenType . Identifier && getImage ( ) . equals
381
<s> package com . asakusafw . compiler . batch . batch ; import com . asakusafw . vocabulary . batch . Batch ; import com . asakusafw . vocabulary . batch . BatchDescription ; @ Batch ( name = "testing" ) public class DescribeFailBatch extends BatchDescription {
382
<s> package de . fuberlin . wiwiss . d2rq . expr ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Set ; import de . fuberlin . wiwiss . d2rq . algebra . AliasMap ; import de . fuberlin . wiwiss . d2rq . algebra . Attribute ; import de . fuberlin . wiwiss . d2rq . algebra . ColumnRenamer ; import de . fuberlin . wiwiss . d2rq . sql . ConnectedDB ; public class Concatenation extends Expression { public static Expression create ( List < Expression > expressions ) { List < Expression > nonEmpty = new ArrayList < Expression > ( expressions . size ( ) ) ; for ( Expression expression : expressions ) { if ( expression instanceof Constant && "" . equals ( ( ( Constant ) expression ) . value ( ) ) ) { continue ; } nonEmpty . add ( expression ) ; } if ( nonEmpty . isEmpty ( ) ) { return new Constant ( "" ) ; } if ( nonEmpty . size ( ) == 1 ) { return nonEmpty . get ( 0 ) ; } return new Concatenation ( nonEmpty ) ; } private final List < Expression > parts ; private final Set < Attribute > attributes = new HashSet < Attribute > ( ) ; private Concatenation ( List < Expression > parts ) { this . parts = parts ; for ( Expression expression : parts ) { attributes . addAll ( expression . attributes ( ) ) ; } } public Set < Attribute > attributes ( ) { return attributes ; } public boolean isFalse ( )
383
<s> package org . oddjob . state ; import junit . framework . TestCase ; public class FlagStateTest extends TestCase { public void testSettingStateDestoyed ( ) { FlagState test
384
<s> package br . com . caelum . vraptor . dash . runtime ; import java . text . NumberFormat ; import br . com . caelum . vraptor . Result ; import br . com . caelum . vraptor . dash . statistics . Collector ; public class RuntimeStatisticsCollector implements Collector { private Runtime runtime ; public RuntimeStatisticsCollector ( Runtime runtime ) { this .
385
<s> package org . oddjob . designer . components ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Helper ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaType ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignParser ; import org . oddjob . arooa . design . view . ViewMainHelper ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . jobs . job . RunJob ; import org . oddjob . jobs . job . StopJob ; public class JustJobDCTest extends TestCase { private static final Logger logger = Logger . getLogger ( JustJobDCTest . class ) ; public void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; } DesignInstance design ; public void testRun ( ) throws ArooaParseException { String xml = "" ; ArooaDescriptor descriptor = new OddjobDescriptorFactory ( ) . createDescriptor ( getClass ( ) . getClassLoader ( ) ) ; DesignParser parser = new DesignParser ( new StandardArooaSession ( descriptor ) ) ; parser . setArooaType ( ArooaType . COMPONENT ) ; parser . parse ( new XMLConfiguration ( "TEST" , xml ) ) ; design = parser . getDesign ( ) ; assertEquals ( JustJobDesign . class , design . getClass ( ) ) ; RunJob test = ( RunJob ) Helper . createComponentFromConfiguration ( design . getArooaContext ( ) . getConfigurationNode ( ) ) ; assertEquals ( "Test" , test . getName ( ) ) ; assertEquals ( test , test . getJob ( ) ) ; } public void testStop ( ) throws ArooaParseException { String xml = "" ; ArooaDescriptor descriptor = new OddjobDescriptorFactory ( )
386
<s> package org . rubypeople . rdt . core . formatter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Map ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . DefaultLineTracker ; import org . eclipse . jface . text . ILineTracker ; import org . eclipse . jface . text . IRegion ; import org . eclipse . text . edits . ReplaceEdit ; import org . rubypeople . rdt . internal . compiler . parser . ScannerHelper ; public final class IndentManipulation { public static final String EMPTY_STRING = "" ; private IndentManipulation ( ) { } public static boolean isIndentChar ( char ch ) { return ScannerHelper . isWhitespace ( ch ) && ! isLineDelimiterChar ( ch ) ; } public static boolean isLineDelimiterChar ( char ch ) { return ch == '\n' || ch == '\r' ; } public static int measureIndentUnits ( CharSequence line , int tabWidth , int indentWidth ) { if ( indentWidth <= 0 || tabWidth < 0 || line == null ) { throw new IllegalArgumentException ( ) ; } int visualLength = measureIndentInSpaces ( line , tabWidth ) ; return visualLength / indentWidth ; } public static int measureIndentInSpaces ( CharSequence line , int tabWidth ) { if ( tabWidth < 0 || line == null ) { throw new IllegalArgumentException ( ) ; } int length = 0 ; int max = line . length ( ) ; for ( int i = 0 ; i < max ; i ++ ) { char ch = line . charAt ( i ) ; if ( ch == '\t' ) { int reminder = length % tabWidth ; length += tabWidth - reminder ; } else if ( isIndentChar ( ch ) ) { length ++ ; } else { return length ; } } return length ; } public static String extractIndentString ( String line , int tabWidth , int indentWidth ) { if ( tabWidth < 0 || indentWidth <= 0 || line == null ) { throw new IllegalArgumentException ( ) ; } int size = line . length ( ) ; int end = 0 ; int spaceEquivs = 0 ; int characters = 0 ; for ( int i = 0 ; i < size ; i ++ ) { char c = line . charAt ( i ) ; if ( c == '\t' ) { int remainder = spaceEquivs % tabWidth ; spaceEquivs += tabWidth - remainder ; characters ++ ; } else if ( isIndentChar ( c ) ) { spaceEquivs ++ ; characters ++ ; } else { break ; } if ( spaceEquivs >= indentWidth ) { end += characters ; characters = 0 ; spaceEquivs = spaceEquivs % indentWidth ; } } if ( end == 0 ) { return EMPTY_STRING ; } else if ( end == size ) { return line ; } else { return line . substring ( 0 , end ) ; } } public static String trimIndent ( String line , int indentUnitsToRemove , int tabWidth , int indentWidth ) { if ( tabWidth < 0 || indentWidth <= 0 || line == null ) { throw new IllegalArgumentException ( ) ; } if ( indentUnitsToRemove <= 0 ) return line ; final int spaceEquivalentsToRemove = indentUnitsToRemove * indentWidth ; int start = 0 ; int spaceEquivalents = 0 ; int size = line . length ( ) ; String prefix = null ; for ( int i = 0 ; i < size ; i ++ ) { char c = line . charAt ( i ) ; if ( c == '\t' ) { int remainder = spaceEquivalents % tabWidth ; spaceEquivalents += tabWidth - remainder ; } else if ( isIndentChar ( c ) ) { spaceEquivalents ++ ; } else { start = i ; break ; } if ( spaceEquivalents == spaceEquivalentsToRemove ) { start = i + 1 ; break ; } if ( spaceEquivalents > spaceEquivalentsToRemove ) { start = i + 1 ; char [ ] missing = new char [ spaceEquivalents - spaceEquivalentsToRemove ] ; Arrays . fill ( missing , ' ' ) ; prefix = new String ( missing ) ; break ; } } String trimmed ; if ( start == size ) trimmed = EMPTY_STRING ; else trimmed = line . substring ( start ) ; if ( prefix == null ) return trimmed ; return prefix + trimmed ; } public static String changeIndent ( String code , int indentUnitsToRemove , int tabWidth , int indentWidth , String newIndentString , String lineDelim ) { if ( tabWidth < 0 || indentWidth <= 0 || code == null || indentUnitsToRemove < 0 || newIndentString == null || lineDelim == null ) { throw new IllegalArgumentException ( ) ; } try { ILineTracker tracker = new DefaultLineTracker ( ) ; tracker . set ( code ) ; int nLines = tracker . getNumberOfLines ( ) ; if ( nLines == 1 ) { return code ; } StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < nLines ; i ++ ) { IRegion region = tracker . getLineInformation ( i ) ; int start = region . getOffset ( ) ; int end = start + region . getLength ( ) ; String line = code . substring ( start , end ) ; if ( i == 0 ) { buf . append ( line ) ; }
387
<s> package org . rubypeople . rdt . core . formatter ; import org . rubypeople . rdt . internal . formatter . rewriter . DRegxReWriteVisitor ; import org . rubypeople . rdt . internal . formatter . rewriter . HereDocReWriteVisitor ; import org . rubypeople . rdt . internal . formatter . rewriter . IgnoreCommentsReWriteVisitor ; import org . rubypeople . rdt . internal . formatter . rewriter . MultipleAssignmentReWriteVisitor ; import org . rubypeople . rdt . internal . formatter . rewriter . ShortIfNodeReWriteVisitor ; public class ReWriterFactory { private ReWriterContext config ; public ReWriterFactory ( ReWriterContext config )
388
<s> package com . asakusafw . windgate . core . resource ; import java . io . IOException ; import com . asakusafw . windgate . core . ProcessScript ; public abstract class ResourceManipulator { public abstract String getName ( ) ; public abstract void cleanupSource ( ProcessScript < ? > script ) throws IOException ; public abstract void cleanupDrain ( ProcessScript < ? > script ) throws IOException ; public abstract < T > SourceDriver < T > createSourceForSource ( ProcessScript < T > script ) throws IOException ; public abstract < T > DrainDriver < T > createDrainForSource ( ProcessScript < T > script ) throws IOException ; public abstract < T > SourceDriver
389
<s> package org . rubypeople . rdt . refactoring . nodewrapper ; import java . util . Collection ; import java . util . HashMap ; import java . util . Map ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . ast . LocalVarNode ; import org . jruby . ast . Node ; import org . jruby . ast . SClassNode ; import org . jruby . ast . VCallNode ; import org . jruby . ast . types . INameNode ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . exception . UnknownReferenceException ; public class SClassNodeWrapper extends PartialClassNodeWrapper { private SClassNode wrappedNode ; Map < Integer , Node > references ; public SClassNodeWrapper ( Node node , Node rootNode ) { super ( node ) ; wrappedNode = ( SClassNode ) node ; this . references = buildReferences ( rootNode ) ; } @ Override public String getSuperClassName ( ) { return "" ; } @ Override public String getClassName ( ) { Node receiverNode = wrappedNode . getReceiverNode ( ) ; if ( receiverNode instanceof LocalVarNode ) { LocalVarNode localVarNode = ( LocalVarNode ) receiverNode ; Node referencedNode ; try { referencedNode = getReferencedNode ( localVarNode . getIndex ( ) , references ) ; if ( referencedNode instanceof INameNode ) { return getModulePrefix ( ) + ( ( INameNode ) referencedNode ) . getName ( ) ; } } catch ( UnknownReferenceException e ) { e . printStackTrace ( ) ; } } else if ( receiverNode instanceof VCallNode ) { VCallNode vCallNode = ( VCallNode ) receiverNode ; return getModulePrefix ( )
390
<s> package com . lmax . disruptor ; import java . util . concurrent . TimeUnit ; import java . util . concurrent . locks . Condition ; import java . util . concurrent . locks . Lock ; import java . util . concurrent . locks . ReentrantLock ; import static com . lmax . disruptor . AlertException . ALERT_EXCEPTION ; import static com . lmax . disruptor . Util . getMinimumSequence ; public interface WaitStrategy { long waitFor ( Consumer [ ] consumers , RingBuffer ringBuffer , ConsumerBarrier barrier , long sequence ) throws AlertException , InterruptedException ; long waitFor ( Consumer [ ] consumers , RingBuffer ringBuffer , ConsumerBarrier barrier , long sequence , long timeout , TimeUnit units ) throws AlertException , InterruptedException ; void signalAll ( ) ; enum Option { BLOCKING { @ Override public WaitStrategy newInstance ( ) { return new BlockingStrategy ( ) ; } } , YIELDING { @ Override public WaitStrategy newInstance ( ) { return new YieldingStrategy ( ) ; } } , BUSY_SPIN { @ Override public WaitStrategy newInstance ( ) { return new BusySpinStrategy ( ) ; } } ; abstract WaitStrategy newInstance ( ) ; } static final class BlockingStrategy implements WaitStrategy { private final Lock lock = new ReentrantLock ( ) ; private final Condition consumerNotifyCondition = lock . newCondition ( ) ; @ Override public long waitFor ( final Consumer [ ] consumers , final RingBuffer ringBuffer , final ConsumerBarrier barrier , final long sequence ) throws AlertException , InterruptedException { long availableSequence ; if ( ( availableSequence = ringBuffer . getCursor ( ) ) < sequence ) { lock . lock ( ) ; try { while ( ( availableSequence = ringBuffer . getCursor ( ) ) < sequence ) { if ( barrier . isAlerted ( ) ) { throw ALERT_EXCEPTION ; } consumerNotifyCondition . await ( ) ; } } finally { lock . unlock ( ) ; } } if ( 0 != consumers . length ) { while ( ( availableSequence = getMinimumSequence ( consumers ) ) < sequence ) { if ( barrier . isAlerted ( ) ) { throw ALERT_EXCEPTION ; } } } return availableSequence ; } @ Override public long waitFor ( final Consumer [ ] consumers , final RingBuffer ringBuffer , final ConsumerBarrier barrier , final long sequence , final long timeout , final TimeUnit units ) throws AlertException , InterruptedException { long availableSequence ; if ( ( availableSequence = ringBuffer . getCursor ( ) ) < sequence ) { lock . lock ( ) ; try { while ( ( availableSequence = ringBuffer . getCursor ( ) ) < sequence ) { if ( barrier . isAlerted ( ) ) { throw ALERT_EXCEPTION ; } if ( ! consumerNotifyCondition . await ( timeout , units ) ) { break ; } } } finally { lock . unlock ( ) ; } }
391
<s> package com . pogofish . jadt . samples . whathow ; import com . pogofish . jadt . samples . whathow . data . IntBinaryTree ; import com . pogofish . jadt . samples . whathow . data . IntBinaryTree . * ; import static com . pogofish . jadt . samples . whathow . data . IntBinaryTree . * ; public class IntBinaryTreeUsage { public IntBinaryTree createExample ( ) { IntBinaryTree tree = _Node ( 42 , _Node ( 12 , _EmptyTree ( ) , _EmptyTree ( ) ) ,
392
<s> package org . rubypeople . rdt . internal . launching ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . debug . core . ILaunchConfiguration ; import org . rubypeople . rdt . launching . IRuntimeLoadpathEntry ; import org . w3c . dom . Document ; import org . w3c . dom . Element ; public class VariableLoadpathEntry extends AbstractRuntimeLoadpathEntry { public static final String TYPE_ID = "" ; private String variableString ; public VariableLoadpathEntry ( ) { } public VariableLoadpathEntry ( String variableString ) { this . variableString = variableString ; } protected void buildMemento ( Document document , Element memento ) throws CoreException { memento . setAttribute ( "" , variableString ) ; } public void initializeFrom ( Element memento ) throws CoreException { variableString = memento . getAttribute ( "" ) ; } public String getTypeId ( ) { return TYPE_ID ; } public IRuntimeLoadpathEntry [ ] getRuntimeLoadpathEntries ( ILaunchConfiguration configuration ) throws CoreException { return new IRuntimeLoadpathEntry [ 0 ] ; } public String getName ( ) { return variableString ; } public int getType ( ) { return OTHER ; } public
393
<s> package com . asakusafw . compiler . flow ; import java . lang . annotation . Annotation ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import java . util . NoSuchElementException ; import com . asakusafw . compiler . common . NameGenerator ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . runtime . flow . ArrayListBuffer ; import com . asakusafw . runtime . flow . FileMapListBuffer ; import com . asakusafw . runtime . flow . ListBuffer ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . FieldDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . util . AttributeBuilder ; import com . asakusafw . utils . java . model . util . ExpressionBuilder ; import com . asakusafw . utils . java . model . util . ImportBuilder ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; import com . asakusafw . vocabulary . flow . graph . FlowElementAttribute ; import com . asakusafw . vocabulary . flow . graph . FlowElementAttributeProvider ; import com . asakusafw . vocabulary . flow . graph . FlowElementDescription ; import com . asakusafw . vocabulary . flow . graph . FlowElementPortDescription ; import com . asakusafw . vocabulary . flow . graph . FlowResourceDescription ; import com . asakusafw . vocabulary . flow . graph . OperatorDescription ; import com . asakusafw . vocabulary . flow . processor . InputBuffer ; public interface FlowElementProcessor extends FlowCompilingEnvironment . Initializable { String RESULT_METHOD_NAME = "add" ; FlowElementProcessor . Kind getKind ( ) ; Class < ? extends Annotation > getTargetAnnotationType ( ) ; public abstract static class AbstractProcessorContext implements FlowElementAttributeProvider { protected final FlowCompilingEnvironment environment ; private final FlowElementAttributeProvider element ; protected final ModelFactory factory ; protected final ImportBuilder importer ; protected final NameGenerator names ; protected final OperatorDescription description ; protected final Map < FlowResourceDescription , Expression > resources ; protected final List < FieldDeclaration > generatedFields ; public AbstractProcessorContext ( FlowCompilingEnvironment environment , FlowElementAttributeProvider element , ImportBuilder importer , NameGenerator names , OperatorDescription desc , Map < FlowResourceDescription , Expression > resources ) { Precondition . checkMustNotBeNull ( environment , "environment" ) ; Precondition . checkMustNotBeNull ( importer , "importer" ) ; Precondition . checkMustNotBeNull ( element , "element" ) ; Precondition . checkMustNotBeNull ( names , "names" ) ; Precondition . checkMustNotBeNull ( desc , "desc" ) ; Precondition . checkMustNotBeNull ( resources , "resources" ) ; this . environment = environment ; this . element = element ; this . factory = environment . getModelFactory ( ) ; this . importer = importer ; this . names = names ; this . description = desc ; this . resources = resources ; this . generatedFields = Lists . create ( ) ; } public OperatorDescription getOperatorDescription ( ) { return description ; } @ Override public < T extends FlowElementAttribute > T getAttribute ( Class < T > attributeClass ) { if ( attributeClass == null ) { throw new IllegalArgumentException ( "" ) ; } return element . getAttribute ( attributeClass ) ; } public FlowElementPortDescription getInputPort ( int portNumber ) { if ( portNumber < 0 || portNumber >= description . getInputPorts ( ) . size ( ) ) { throw new IllegalArgumentException ( "" ) ; } return description . getInputPorts ( ) . get ( portNumber ) ; } public FlowElementPortDescription getOutputPort ( int portNumber ) { if ( portNumber < 0 || portNumber >= description . getOutputPorts ( ) . size ( ) ) { throw new IllegalArgumentException ( "" ) ; } return description . getOutputPorts ( ) . get ( portNumber ) ; } public FlowResourceDescription getResourceDescription ( int resourceNumber ) { if ( resourceNumber < 0 || resourceNumber >= description . getResources ( )
394
<s> package net . sf . sveditor . core . db . expr ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBRangeExpr extends SVDBExpr { public SVDBExpr
395
<s> package org . oddjob . tools . doclet . utils ; import org . oddjob . tools
396
<s> package net . sf . sveditor . ui . editor . actions ; import java . util . ResourceBundle ; import net . sf . sveditor . core . scanner . SVCharacter ; import net . sf . sveditor . ui . editor . SVEditor ; import org . eclipse . swt . custom . StyledText ; import org . eclipse . ui . texteditor . TextEditorAction ;
397
<s> package com . asakusafw . bulkloader . log ; import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import org . apache . log4j . xml . DOMConfigurator ; public final class LogInitializer { private static boolean isInitialized = false ;
398
<s> package com . asakusafw . testdriver . windgate ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . Closeable ; import java . io . File ; import java . io . IOException ; import java . util . Collections ; import java . util . Properties ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . vocabulary . windgate . WindGateExporterDescription ; import com . asakusafw . vocabulary . windgate . WindGateImporterDescription ; import com . asakusafw . vocabulary . windgate . WindGateProcessDescription ; import com . asakusafw . windgate . core . DriverScript ; import com . asakusafw . windgate . core . ParameterList ; import com . asakusafw . windgate . core . ProcessScript ; import com . asakusafw . windgate . core . resource . ResourceManipulator ; import com . asakusafw . windgate . core . vocabulary . FileProcess ; import com . asakusafw . windgate . file . resource . FileResourceProvider ; import com . asakusafw . windgate . file . resource . Preparable ; public class WindGateTestHelperTest { @ Rule public TemporaryFolder folder = new TemporaryFolder ( ) ; @ Rule public ProfileContext context = new ProfileContext ( ) ; @ Test public void createImporterProcessScript ( ) throws Exception { File file = folder . newFile ( "file" ) ; DriverScript driver = new DriverScript ( "file" , Collections . singletonMap ( FileProcess . FILE . key ( ) , file . getAbsolutePath ( ) ) ) ; WindGateImporterDescription description = new MockImporterDescription ( String . class , "dummy" , driver ) ; ProcessScript < String > script = WindGateTestHelper . createProcessScript ( String . class , description ) ; assertThat ( script . getDataClass ( ) , equalTo ( String . class ) ) ; assertThat ( script . getSourceScript ( ) . getResourceName ( ) , is ( "file" ) ) ; assertThat ( script . getSourceScript ( ) . getConfiguration ( ) , is ( driver . getConfiguration ( ) ) ) ; } @ Test public void createExporterProcessScript ( ) throws Exception { File file = folder . newFile ( "file" ) ; DriverScript driver = new DriverScript ( "file" , Collections . singletonMap ( FileProcess . FILE . key ( ) , file . getAbsolutePath ( ) ) ) ; WindGateExporterDescription description = new MockExporterDescription ( String . class , "dummy" , driver ) ; ProcessScript < String > script = WindGateTestHelper . createProcessScript ( String . class , description ) ; assertThat ( script . getDataClass ( ) , equalTo ( String . class ) ) ; assertThat ( script . getDrainScript ( ) . getResourceName ( ) , is ( "file" ) ) ; assertThat ( script . getDrainScript ( ) . getConfiguration ( ) , is ( driver . getConfiguration ( ) ) ) ; } @ Test public void createResourceManipulator ( ) throws Exception { Properties profile = context . getTemplate ( ) ; profile . setProperty ( "" , FileResourceProvider . class . getName ( ) ) ; context . put ( "testing" , profile ) ; File file = folder . newFile ( "file" ) ; DriverScript driver = new DriverScript ( "file" , Collections . singletonMap ( FileProcess . FILE . key ( ) , file . getAbsolutePath ( ) ) ) ; WindGateImporterDescription description = new MockImporterDescription ( String . class , "testing" , driver ) ; ResourceManipulator manipulator = WindGateTestHelper .
399
<s> package com . asakusafw . compiler . directio ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; import org . apache . hadoop . fs . FileStatus ; import org . apache . hadoop . fs . FileSystem ; import org . apache . hadoop . fs . Path ; import org . apache . hadoop . io . Text ; import org . junit . Rule ; import org . junit . Test ; import org . junit . runner . RunWith ; import org . junit . runners . Parameterized ; import org . junit . runners . Parameterized . Parameters ; import com . asakusafw . compiler . directio . testing . model . Line1 ; import com . asakusafw . compiler . directio . testing . model . Line2 ; import com . asakusafw . compiler . util . tester . CompilerTester ; import com . asakusafw . runtime . directio . DataFormat ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . vocabulary . directio . DirectFileInputDescription ; import com . asakusafw . vocabulary . directio . DirectFileOutputDescription ; import com . asakusafw . vocabulary . external . ImporterDescription . DataSize ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . Out ; @ RunWith ( Parameterized . class ) public class DirectFileIoProcessorRunTest { @ Rule public CompilerTester tester = new CompilerTester ( ) ; private final Class < ? extends DataFormat < Text > > format ; @ Parameters public static List < Object [ ] > data ( ) { return Arrays . asList ( new Object [ ] [ ] { { LineFormat . class } , { LineFileFormat . class } , } ) ; } public DirectFileIoProcessorRunTest ( Class < ? extends DataFormat < Text > > format ) { this . format = format ; } @ Test public void simple ( ) throws Exception { put ( "" , "1Hello" , "2Hello" , "3Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output" , "output.txt" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < String > list = get ( "" ) ; assertThat ( list . size ( ) , is ( 3 ) ) ; assertThat ( list , hasItem ( "1Hello" ) ) ; assertThat ( list , hasItem ( "2Hello" ) ) ; assertThat ( list , hasItem ( "3Hello" ) ) ; } @ Test public void tiny ( ) throws Exception { put ( "" , "1Hello" , "2Hello" , "3Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( Line1 . class , format , "input" , "*" , DataSize . TINY ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output" , "output.txt" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < String > list = get ( "" ) ; assertThat ( list . size ( ) , is ( 3 ) ) ; assertThat ( list , hasItem ( "1Hello" ) ) ; assertThat ( list , hasItem ( "2Hello" ) ) ; assertThat ( list , hasItem ( "3Hello" ) ) ; } @ Test public void input_multi ( ) throws Exception { put ( "" , "1Hello" ) ; put ( "" , "2Hello" ) ; put ( "" , "3Hello" ) ; put ( "" , "4Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "input-*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output" , "output.txt" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < String > list = get ( "" ) ; assertThat ( list . size ( ) , is ( 3 ) ) ; assertThat ( list , hasItem ( "1Hello" ) ) ; assertThat ( list , hasItem ( "2Hello" ) ) ; assertThat ( list , hasItem ( "3Hello" ) ) ; } @ Test public void order ( ) throws Exception { put ( "" , "1Hello" , "2Hello" , "3Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output" , "output.txt" , "-value" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; assertThat ( get ( "" ) , is ( list ( "3Hello" , "2Hello" , "1Hello" ) ) ) ; } @ Test public void partition ( ) throws Exception { put ( "" , "a1" , "b1" , "b2" , "c1" , "c2" , "c3" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output" , "" , "+value" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; assertThat ( get ( "" ) , is ( list ( "a1" ) ) ) ; assertThat ( get ( "" ) , is ( list ( "b1" , "b2" ) ) ) ; assertThat ( get ( "" ) , is ( list ( "c1" , "c2" , "c3" ) ) ) ; } @ Test public void random ( ) throws Exception { List < String > lines = Lists . create ( ) ; for ( int i = 0 ; i < 1000 ; i ++ ) { lines . add ( String . format ( "%03d" , i ) ) ; } put ( "" , lines . toArray ( new String [ lines . size ( ) ] ) ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output" , "" , "+value" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < String > o1 = get ( "" ) ; List < String > o2 = get ( "" ) ; List < String > o3 = get ( "" ) ; List < String > o4 = get ( "" ) ; assertThat ( o1 . size ( ) , is ( greaterThan ( 0 ) ) ) ; assertThat ( o2 . size ( ) , is ( greaterThan ( 0 ) ) ) ; assertThat ( o3 . size ( ) , is ( greaterThan ( 0 ) ) ) ; assertThat ( o4 . size ( ) , is ( greaterThan ( 0 ) ) ) ; List < String > results = Lists . create ( ) ; results . addAll ( o1 ) ; results . addAll ( o2 ) ; results . addAll ( o3 ) ; results . addAll ( o4 ) ; Collections . sort ( results ) ; assertThat ( results , is ( lines ) ) ; } @ Test public void wildcard ( ) throws Exception { put ( "" , "1Hello" , "2Hello" , "3Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output" , "output-*.txt" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < String > list = get ( "" ) ; assertThat ( list . size ( ) , is ( 3 ) ) ; assertThat ( list , hasItem ( "1Hello" ) ) ; assertThat ( list , hasItem ( "2Hello" ) ) ; assertThat ( list , hasItem ( "3Hello" ) ) ; } @ Test public void variable ( ) throws Exception { put ( "" , "1Hello" ) ; put ( "" , "2Hello" ) ; put ( "" , "3Hello" ) ; put ( "" , "4Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "${input-dir}" , "" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "" , "" ) ) ; tester . variables ( ) . defineVariable ( "input-dir" , "input" ) ; tester . variables ( ) . defineVariable ( "" , "input-*" ) ; tester . variables ( ) . defineVariable ( "output-dir" , "output" ) ; tester . variables ( ) . defineVariable ( "" , "output.txt" ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < String > list = get ( "" ) ; assertThat ( list . size ( ) , is ( 3 ) ) ; assertThat ( list , hasItem ( "1Hello" ) ) ; assertThat ( list , hasItem ( "2Hello" ) ) ; assertThat ( list , hasItem ( "3Hello" ) ) ; } @ Test public void variable_wildcard ( ) throws Exception { put ( "" , "1Hello" ) ; put ( "" , "2Hello" ) ; put ( "" , "3Hello" ) ; put ( "" , "4Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "${input-dir}" , "" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "" , "" ) ) ; tester . variables ( ) . defineVariable ( "input-dir" , "input" ) ; tester . variables ( ) . defineVariable ( "" , "input-*" ) ; tester . variables ( ) . defineVariable ( "output-dir" , "output" ) ; tester . variables ( ) . defineVariable ( "" , "output" ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < String > list = get ( "" ) ; assertThat ( list . size ( ) , is ( 3 ) ) ; assertThat ( list , hasItem ( "1Hello" ) ) ; assertThat ( list , hasItem ( "2Hello" ) ) ; assertThat ( list , hasItem ( "3Hello" ) ) ; } @ Test public void delete ( ) throws Exception { put ( "" , "1Hello" , "2Hello" , "3Hello" ) ; put ( "" , "4Hello" ) ; put ( "" , "5Hello" ) ; put ( "" , "6Hello" ) ; put ( "" , "7Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output" , "output.txt" ) . delete ( "deleted.txt" ) . delete ( "" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < String > list = get ( "output/*.txt" ) ; assertThat ( list . size ( ) , is ( 4 ) ) ; assertThat ( list , hasItem ( "1Hello" ) ) ; assertThat ( list , hasItem ( "2Hello" ) ) ; assertThat ( list , hasItem ( "3Hello" ) ) ; assertThat ( list , hasItem ( "5Hello" ) ) ; } @ Test public void delete_variable ( ) throws Exception { put ( "" , "1Hello" , "2Hello" , "3Hello" ) ; put ( "" , "4Hello" ) ; put ( "" , "5Hello" ) ; put ( "" , "6Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output" , "output.txt" ) . delete ( "" ) ) ; tester . variables ( ) . defineVariable ( "pattern" , "deleted" ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < String > list = get ( "output/*.txt" ) ; assertThat ( list . size ( ) , is ( 4 ) ) ; assertThat ( list , hasItem ( "1Hello" ) ) ; assertThat ( list , hasItem ( "2Hello" ) ) ; assertThat ( list , hasItem ( "3Hello" ) ) ; assertThat ( list , hasItem ( "4Hello" ) ) ; } @ Test public void input_empty ( ) throws Exception { put ( "" ) ; put ( "" ) ; put ( "" ) ; put ( "" , "Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "input-*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output-1" , "output.txt" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < Path > list = find ( "" ) ; assertThat ( list . toString ( ) , list . size ( ) , is ( 0 ) ) ; } @ Test public void input_empty_noreduce ( ) throws Exception { put ( "" ) ; put ( "" ) ; put ( "" ) ; put ( "" , "Hello" ) ; In < Line1 > in = tester . input ( "in1" , new Input ( format , "input" , "input-*" ) ) ; Out < Line1 > out = tester . output ( "out1" , new Output ( format , "output-*" , "output.txt" ) ) ; assertThat ( tester . runFlow ( new IdentityFlow < Line1 > ( in , out ) ) , is ( true ) ) ; List < Path > list = find ( "" ) ; assertThat ( list . toString ( ) , list . size ( ) , is ( 0 ) ) ; } @ Test public void dual_io ( ) throws Exception { put ( "" , "Hello1" ) ; put ( "" , "Hello2" ) ; In < Line1 > in1 = tester . input ( "in1" , new Input ( Line1 . class , format , "input" , "input-1.txt" , DataSize . LARGE ) ) ; In < Line2 > in2 = tester . input ( "in2" , new Input ( Line2 . class , format , "input" , "input-2.txt" , DataSize . TINY ) ) ; Out < Line1 > out1 = tester . output ( "out1" , new Output ( Line1 . class , format , "output-1" , "output.txt" ) ) ; Out < Line2 > out2 = tester . output ( "out2" , new Output ( Line2 . class , format , "output-2" , "output.txt" ) ) ; assertThat ( tester . runFlow ( new DualIdentityFlow < Line1 , Line2 > ( in1 , in2 , out1 , out2 ) ) , is ( true ) ) ; assertThat ( get ( "" ) , is ( list ( "Hello1" ) ) ) ; assertThat ( get ( "" ) , is ( list ( "Hello2" ) ) ) ; } @ Test public void dual_io_noreduce ( ) throws Exception { put ( "" , "Hello1" ) ; put ( "" , "Hello2" ) ; In < Line1 > in1 = tester . input ( "in1" , new Input ( Line1 . class , format , "input" , "input-1.txt" , DataSize . LARGE ) ) ; In < Line2 > in2 = tester