id
int32
0
12.9k
code
sequencelengths
2
264k
10,000
[ "<s>", "package", "com", ".", "datastax", ".", "tutorial", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "Keyspace", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "beans", ".", "Rows", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "factory", ".", "HFactory", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "MultigetSliceQuery", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "QueryResult", ";", "public", "class", "MultigetSliceForNpanxx", "extends", "TutorialCommand", "{", "public", "MultigetSliceForNpanxx", "(", "Keyspace", "keyspace", ")", "{", "super", "(", "keyspace", ")", ";", "}", "@", "Override", "public", "QueryResult", "<", "Rows", "<", "String", ",", "String", ",", "String", ">", ">", "execute", "(", ")", "{", "MultigetSliceQuery", "<", "String", ",", "String", ",", "String", ">", "multigetSlicesQuery", "=", "HFactory", ".", "createMultigetSliceQuery", "(", "keyspace", ",", "stringSerializer", ",", "stringSerializer", ",", "stringSerializer", ")", ";", "multigetSlicesQuery", ".", "setColumnFamily", "(", "\"Npanxx\"", ")", ";", "multigetSlicesQuery", ".", "setColumnNames", "(", "\"city\"", ",", "\"state\"", ",", "\"lat\"", ",", "\"lng\"", ")", ";", "multigetSlicesQuery", ".", "setKeys", "(", "\"512202\"", ",", "\"512203\"", ",", "\"512205\"", ",", "\"512206\"", ")", ";", "QueryResult", "<", "Rows", "<", "String", ",", "String", ",", "String", ">", ">", "results", "=", "multigetSlicesQuery", ".", "execute", "(", ")", ";", "return", "results", ";", "}", "}", "</s>" ]
10,001
[ "<s>", "package", "com", ".", "datastax", ".", "tutorial", ".", "composite", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "com", ".", "datastax", ".", "tutorial", ".", "TutorialBase", ";", "import", "me", ".", "prettyprint", ".", "cassandra", ".", "serializers", ".", "CompositeSerializer", ";", "import", "me", ".", "prettyprint", ".", "cassandra", ".", "serializers", ".", "StringSerializer", ";", "import", "me", ".", "prettyprint", ".", "cassandra", ".", "service", ".", "ColumnSliceIterator", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "beans", ".", "Composite", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "beans", ".", "HColumn", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "factory", ".", "HFactory", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "SliceQuery", ";", "public", "class", "CompositeQuery", "extends", "TutorialBase", "{", "private", "static", "String", "key", "=", "\"ALL\"", ";", "private", "static", "String", "startArg", "=", "\"US\"", ";", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "init", "(", ")", ";", "CompositeQuery", "compositeQuery", "=", "new", "CompositeQuery", "(", ")", ";", "Composite", "start", "=", "compositeFrom", "(", "startArg", ",", "Composite", ".", "ComponentEquality", ".", "EQUAL", ")", ";", "Composite", "end", "=", "compositeFrom", "(", "startArg", ",", "Composite", ".", "ComponentEquality", ".", "GREATER_THAN_EQUAL", ")", ";", "compositeQuery", ".", "printColumnsFor", "(", "start", ",", "end", ")", ";", "}", "public", "void", "printColumnsFor", "(", "Composite", "start", ",", "Composite", "end", ")", "{", "CompositeQueryIterator", "iter", "=", "new", "CompositeQueryIterator", "(", "key", ",", "start", ",", "end", ")", ";", "System", ".", "out", ".", "printf", "(", "\"\"", ",", "startArg", ")", ";", "int", "count", "=", "0", ";", "for", "(", "HColumn", "<", "Composite", ",", "String", ">", "column", ":", "iter", ")", "{", "System", ".", "out", ".", "printf", "(", "\"\"", ",", "column", ".", "getName", "(", ")", ".", "get", "(", "0", ",", "StringSerializer", ".", "get", "(", ")", ")", ",", "column", ".", "getName", "(", ")", ".", "get", "(", "1", ",", "StringSerializer", ".", "get", "(", ")", ")", ",", "column", ".", "getName", "(", ")", ".", "get", "(", "2", ",", "StringSerializer", ".", "get", "(", ")", ")", ",", "column", ".", "getValue", "(", ")", ")", ";", "count", "++", ";", "}", "System", ".", "out", ".", "printf", "(", "\"\"", ",", "count", ")", ";", "}", "public", "static", "Composite", "compositeFrom", "(", "String", "componentName", ",", "Composite", ".", "ComponentEquality", "equalityOp", ")", "{", "Composite", "composite", "=", "new", "Composite", "(", ")", ";", "composite", ".", "addComponent", "(", "0", ",", "componentName", ",", "equalityOp", ")", ";", "return", "composite", ";", "}", "class", "CompositeQueryIterator", "implements", "Iterable", "<", "HColumn", "<", "Composite", ",", "String", ">", ">", "{", "private", "final", "String", "key", ";", "private", "final", "ColumnSliceIterator", "<", "String", ",", "Composite", ",", "String", ">", "sliceIterator", ";", "private", "Composite", "start", ";", "private", "Composite", "end", ";", "CompositeQueryIterator", "(", "String", "key", ",", "Composite", "start", ",", "Composite", "end", ")", "{", "this", ".", "key", "=", "key", ";", "this", ".", "start", "=", "start", ";", "this", ".", "end", "=", "end", ";", "SliceQuery", "<", "String", ",", "Composite", ",", "String", ">", "sliceQuery", "=", "HFactory", ".", "createSliceQuery", "(", "tutorialKeyspace", ",", "StringSerializer", ".", "get", "(", ")", ",", "new", "CompositeSerializer", "(", ")", ",", "StringSerializer", ".", "get", "(", ")", ")", ";", "sliceQuery", ".", "setColumnFamily", "(", "\"\"", ")", ";", "sliceQuery", ".", "setKey", "(", "key", ")", ";", "sliceIterator", "=", "new", "ColumnSliceIterator", "(", "sliceQuery", ",", "start", ",", "end", ",", "false", ")", ";", "}", "public", "Iterator", "<", "HColumn", "<", "Composite", ",", "String", ">", ">", "iterator", "(", ")", "{", "return", "sliceIterator", ";", "}", "}", "}", "</s>" ]
10,002
[ "<s>", "package", "com", ".", "datastax", ".", "tutorial", ".", "composite", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "InputStreamReader", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "concurrent", ".", "Callable", ";", "import", "java", ".", "util", ".", "concurrent", ".", "ExecutorService", ";", "import", "java", ".", "util", ".", "concurrent", ".", "Executors", ";", "import", "java", ".", "util", ".", "concurrent", ".", "Future", ";", "import", "com", ".", "datastax", ".", "tutorial", ".", "TutorialBase", ";", "import", "me", ".", "prettyprint", ".", "cassandra", ".", "serializers", ".", "CompositeSerializer", ";", "import", "me", ".", "prettyprint", ".", "cassandra", ".", "serializers", ".", "StringSerializer", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "beans", ".", "Composite", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "beans", ".", "HColumn", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "factory", ".", "HFactory", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "mutation", ".", "Mutator", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringEscapeUtils", ";", "import", "org", ".", "apache", ".", "commons", ".", "lang", ".", "StringUtils", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "public", "class", "CompositeDataLoader", "extends", "TutorialBase", "{", "private", "static", "Logger", "log", "=", "LoggerFactory", ".", "getLogger", "(", "CompositeDataLoader", ".", "class", ")", ";", "private", "static", "ExecutorService", "exec", ";", "public", "static", "final", "String", "COMPOSITE_KEY", "=", "\"ALL\"", ";", "public", "static", "final", "String", "COUNTRY_STATE_CITY_CF", "=", "\"\"", ";", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "init", "(", ")", ";", "String", "fileLocation", "=", "properties", ".", "getProperty", "(", "\"\"", ",", "\"\"", ")", ";", "BufferedReader", "reader", ";", "exec", "=", "Executors", ".", "newFixedThreadPool", "(", "5", ")", ";", "try", "{", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "new", "FileInputStream", "(", "fileLocation", ")", ")", ")", ";", "List", "<", "String", ">", "lines", "=", "new", "ArrayList", "<", "String", ">", "(", "1000", ")", ";", "String", "line", "=", "reader", ".", "readLine", "(", ")", ";", "List", "<", "Future", "<", "Integer", ">", ">", "sums", "=", "new", "ArrayList", "<", "Future", "<", "Integer", ">", ">", "(", ")", ";", "while", "(", "line", "!=", "null", ")", "{", "lines", ".", "add", "(", "line", ")", ";", "if", "(", "lines", ".", "size", "(", ")", "%", "250", "==", "0", ")", "{", "doParse", "(", "lines", ",", "sums", ")", ";", "}", "line", "=", "reader", ".", "readLine", "(", ")", ";", "}", "doParse", "(", "lines", ",", "sums", ")", ";", "int", "total", "=", "0", ";", "for", "(", "Future", "<", "Integer", ">", "future", ":", "sums", ")", "{", "total", "=", "total", "+", "future", ".", "get", "(", ")", ".", "intValue", "(", ")", ";", "}", "log", ".", "info", "(", "\"\"", ",", "total", ",", "System", ".", "currentTimeMillis", "(", ")", "-", "startTime", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "finally", "{", "exec", ".", "shutdown", "(", ")", ";", "}", "tutorialCluster", ".", "getConnectionManager", "(", ")", ".", "shutdown", "(", ")", ";", "}", "private", "static", "void", "doParse", "(", "List", "<", "String", ">", "lines", ",", "List", "<", "Future", "<", "Integer", ">", ">", "sums", ")", "{", "Future", "<", "Integer", ">", "f", "=", "exec", ".", "submit", "(", "new", "CompositeDataLoader", "(", ")", ".", "new", "LineParser", "(", "new", "ArrayList", "(", "lines", ")", ")", ")", ";", "sums", ".", "add", "(", "f", ")", ";", "lines", ".", "clear", "(", ")", ";", "}", "class", "LineParser", "implements", "Callable", "<", "Integer", ">", "{", "List", "<", "String", ">", "lines", ";", "LineParser", "(", "List", "<", "String", ">", "lines", ")", "{", "this", ".", "lines", "=", "lines", ";", "}", "public", "Integer", "call", "(", ")", "throws", "Exception", "{", "int", "count", "=", "0", ";", "GeoDataLine", "geoDataLine", ";", "Mutator", "<", "String", ">", "mutator", "=", "HFactory", ".", "createMutator", "(", "tutorialKeyspace", ",", "StringSerializer", ".", "get", "(", ")", ")", ";", "for", "(", "String", "row", ":", "lines", ")", "{", "geoDataLine", "=", "new", "GeoDataLine", "(", "row", ")", ";", "mutator", ".", "addInsertion", "(", "COMPOSITE_KEY", ",", "COUNTRY_STATE_CITY_CF", ",", "geoDataLine", ".", "staticColumnFrom", "(", ")", ")", ";", "count", "++", ";", "}", "mutator", ".", "execute", "(", ")", ";", "log", ".", "debug", "(", "\"\"", ",", "count", ")", ";", "return", "Integer", ".", "valueOf", "(", "count", ")", ";", "}", "}", "static", "class", "GeoDataLine", "{", "public", "static", "final", "char", "SEPARATOR_CHAR", "=", "','", ";", "private", "String", "[", "]", "vals", "=", "new", "String", "[", "10", "]", ";", "GeoDataLine", "(", "String", "line", ")", "{", "vals", "=", "StringUtils", ".", "split", "(", "StringEscapeUtils", ".", "unescapeCsv", "(", "line", ")", ",", "SEPARATOR_CHAR", ")", ";", "log", ".", "debug", "(", "\"\"", ",", "vals", ".", "length", ",", "line", ")", ";", "}", "HColumn", "<", "Composite", ",", "String", ">", "staticColumnFrom", "(", ")", "{", "Composite", "composite", "=", "new", "Composite", "(", ")", ";", "composite", ".", "addComponent", "(", "getCountryCode", "(", ")", ",", "StringSerializer", ".", "get", "(", ")", ")", ";", "composite", ".", "addComponent", "(", "getAdmin1Code", "(", ")", ",", "StringSerializer", ".", "get", "(", ")", ")", ";", "composite", ".", "addComponent", "(", "StringEscapeUtils", ".", "unescapeCsv", "(", "getAsciiName", "(", ")", ")", ",", "StringSerializer", ".", "get", "(", ")", ")", ";", "HColumn", "<", "Composite", ",", "String", ">", "col", "=", "HFactory", ".", "createColumn", "(", "composite", ",", "getTimezone", "(", ")", ",", "new", "CompositeSerializer", "(", ")", ",", "StringSerializer", ".", "get", "(", ")", ")", ";", "return", "col", ";", "}", "String", "getCountryCode", "(", ")", "{", "return", "vals", "[", "0", "]", ";", "}", "String", "getAdmin1Code", "(", ")", "{", "return", "vals", "[", "1", "]", ";", "}", "String", "getAsciiName", "(", ")", "{", "return", "vals", "[", "2", "]", ";", "}", "String", "getTimezone", "(", ")", "{", "return", "vals", "[", "3", "]", ";", "}", "}", "}", "</s>" ]
10,003
[ "<s>", "package", "com", ".", "datastax", ".", "tutorial", ";", "import", "me", ".", "prettyprint", ".", "cassandra", ".", "service", ".", "HColumnFamilyImpl", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "HColumnFamily", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "Keyspace", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "ResultStatus", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "SliceQuery", ";", "public", "class", "GetNpanxxHColumnFamily", "extends", "TutorialCommand", "{", "public", "GetNpanxxHColumnFamily", "(", "Keyspace", "keyspace", ")", "{", "super", "(", "keyspace", ")", ";", "}", "@", "Override", "public", "ResultStatus", "execute", "(", ")", "{", "HColumnFamily", "<", "String", ",", "String", ">", "columnFamily", "=", "new", "HColumnFamilyImpl", "<", "String", ",", "String", ">", "(", "keyspace", ",", "\"Npanxx\"", ",", "stringSerializer", ",", "stringSerializer", ")", ";", "columnFamily", ".", "addKey", "(", "\"512202\"", ")", ";", "columnFamily", ".", "addColumnName", "(", "\"city\"", ")", ".", "addColumnName", "(", "\"state\"", ")", ".", "addColumnName", "(", "\"lat\"", ")", ".", "addColumnName", "(", "\"lng\"", ")", ";", "log", ".", "info", "(", "\"\"", ",", "new", "Object", "[", "]", "{", "columnFamily", ".", "getString", "(", "\"city\"", ")", ",", "columnFamily", ".", "getString", "(", "\"state\"", ")", ",", "columnFamily", ".", "getString", "(", "\"lat\"", ")", ",", "columnFamily", ".", "getString", "(", "\"lng\"", ")", "}", ")", ";", "return", "columnFamily", ";", "}", "}", "</s>" ]
10,004
[ "<s>", "package", "com", ".", "datastax", ".", "tutorial", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "Keyspace", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "beans", ".", "ColumnSlice", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "factory", ".", "HFactory", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "QueryResult", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "SliceQuery", ";", "public", "class", "GetSliceForNpanxx", "extends", "TutorialCommand", "{", "public", "GetSliceForNpanxx", "(", "Keyspace", "keyspace", ")", "{", "super", "(", "keyspace", ")", ";", "}", "@", "Override", "public", "QueryResult", "<", "ColumnSlice", "<", "String", ",", "String", ">", ">", "execute", "(", ")", "{", "SliceQuery", "<", "String", ",", "String", ",", "String", ">", "sliceQuery", "=", "HFactory", ".", "createSliceQuery", "(", "keyspace", ",", "stringSerializer", ",", "stringSerializer", ",", "stringSerializer", ")", ";", "sliceQuery", ".", "setColumnFamily", "(", "\"Npanxx\"", ")", ";", "sliceQuery", ".", "setKey", "(", "\"512202\"", ")", ";", "sliceQuery", ".", "setColumnNames", "(", "\"city\"", ",", "\"state\"", ",", "\"lat\"", ",", "\"lng\"", ")", ";", "QueryResult", "<", "ColumnSlice", "<", "String", ",", "String", ">", ">", "result", "=", "sliceQuery", ".", "execute", "(", ")", ";", "return", "result", ";", "}", "}", "</s>" ]
10,005
[ "<s>", "package", "com", ".", "datastax", ".", "tutorial", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "Keyspace", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "factory", ".", "HFactory", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "mutation", ".", "MutationResult", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "mutation", ".", "Mutator", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "QueryResult", ";", "public", "class", "InsertRowsForColumnFamilies", "extends", "TutorialCommand", "{", "public", "InsertRowsForColumnFamilies", "(", "Keyspace", "keyspace", ")", "{", "super", "(", "keyspace", ")", ";", "}", "@", "Override", "public", "QueryResult", "<", "?", ">", "execute", "(", ")", "{", "Mutator", "<", "String", ">", "mutator", "=", "HFactory", ".", "createMutator", "(", "keyspace", ",", "stringSerializer", ")", ";", "mutator", ".", "addInsertion", "(", "\"\"", ",", "\"StateCity\"", ",", "HFactory", ".", "createColumn", "(", "650L", ",", "\"37.57x122.34\"", ",", "longSerializer", ",", "stringSerializer", ")", ")", ";", "mutator", ".", "addInsertion", "(", "\"650\"", ",", "\"AreaCode\"", ",", "HFactory", ".", "createStringColumn", "(", "\"\"", ",", "\"37.57x122.34\"", ")", ")", ";", "mutator", ".", "addInsertion", "(", "\"650222\"", ",", "\"Npanxx\"", ",", "HFactory", ".", "createStringColumn", "(", "\"lat\"", ",", "\"37.57\"", ")", ")", ";", "mutator", ".", "addInsertion", "(", "\"650222\"", ",", "\"Npanxx\"", ",", "HFactory", ".", "createStringColumn", "(", "\"lng\"", ",", "\"122.34\"", ")", ")", ";", "mutator", ".", "addInsertion", "(", "\"650222\"", ",", "\"Npanxx\"", ",", "HFactory", ".", "createStringColumn", "(", "\"city\"", ",", "\"Burlingame\"", ")", ")", ";", "mutator", ".", "addInsertion", "(", "\"650222\"", ",", "\"Npanxx\"", ",", "HFactory", ".", "createStringColumn", "(", "\"state\"", ",", "\"CA\"", ")", ")", ";", "MutationResult", "mr", "=", "mutator", ".", "execute", "(", ")", ";", "return", "null", ";", "}", "}", "</s>" ]
10,006
[ "<s>", "package", "com", ".", "datastax", ".", "tutorial", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "Keyspace", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "beans", ".", "ColumnSlice", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "factory", ".", "HFactory", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "QueryResult", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "SliceQuery", ";", "public", "class", "GetSliceForAreaCodeCity", "extends", "TutorialCommand", "{", "public", "GetSliceForAreaCodeCity", "(", "Keyspace", "keyspace", ")", "{", "super", "(", "keyspace", ")", ";", "}", "@", "Override", "public", "QueryResult", "<", "ColumnSlice", "<", "String", ",", "String", ">", ">", "execute", "(", ")", "{", "SliceQuery", "<", "String", ",", "String", ",", "String", ">", "sliceQuery", "=", "HFactory", ".", "createSliceQuery", "(", "keyspace", ",", "stringSerializer", ",", "stringSerializer", ",", "stringSerializer", ")", ";", "sliceQuery", ".", "setColumnFamily", "(", "\"AreaCode\"", ")", ";", "sliceQuery", ".", "setKey", "(", "\"512\"", ")", ";", "sliceQuery", ".", "setRange", "(", "\"Austin\"", ",", "\"Austin__204\"", ",", "false", ",", "5", ")", ";", "QueryResult", "<", "ColumnSlice", "<", "String", ",", "String", ">", ">", "result", "=", "sliceQuery", ".", "execute", "(", ")", ";", "return", "result", ";", "}", "}", "</s>" ]
10,007
[ "<s>", "package", "com", ".", "datastax", ".", "tutorial", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "Keyspace", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "beans", ".", "ColumnSlice", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "factory", ".", "HFactory", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "QueryResult", ";", "import", "me", ".", "prettyprint", ".", "hector", ".", "api", ".", "query", ".", "SliceQuery", ";", "public", "class", "GetSliceForStateCity", "extends", "TutorialCommand", "{", "public", "GetSliceForStateCity", "(", "Keyspace", "keyspace", ")", "{", "super", "(", "keyspace", ")", ";", "}", "@", "Override", "public", "QueryResult", "<", "ColumnSlice", "<", "Long", ",", "String", ">", ">", "execute", "(", ")", "{", "SliceQuery", "<", "String", ",", "Long", ",", "String", ">", "sliceQuery", "=", "HFactory", ".", "createSliceQuery", "(", "keyspace", ",", "stringSerializer", ",", "longSerializer", ",", "stringSerializer", ")", ";", "sliceQuery", ".", "setColumnFamily", "(", "\"StateCity\"", ")", ";", "sliceQuery", ".", "setKey", "(", "\"TX", "Austin\"", ")", ";", "sliceQuery", ".", "setRange", "(", "202L", ",", "204L", ",", "false", ",", "5", ")", ";", "QueryResult", "<", "ColumnSlice", "<", "Long", ",", "String", ">", ">", "result", "=", "sliceQuery", ".", "execute", "(", ")", ";", "return", "result", ";", "}", "}", "</s>" ]
10,008
[ "<s>", "package", "com", ".", "datastax", ".", "tutorial", ";", "import", "junit", ".", "framework", ".", "Test", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "import", "junit", ".", "framework", ".", "TestSuite", ";", "public", "class", "AppTest", "extends", "TestCase", "{", "public", "AppTest", "(", "String", "testName", ")", "{", "super", "(", "testName", ")", ";", "}", "public", "static", "Test", "suite", "(", ")", "{", "return", "new", "TestSuite", "(", "AppTest", ".", "class", ")", ";", "}", "public", "void", "testApp", "(", ")", "{", "assertTrue", "(", "true", ")", ";", "}", "}", "</s>" ]
10,009
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "util", ";", "import", "com", ".", "lowagie", ".", "text", ".", "pdf", ".", "codec", ".", "Base64", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporterParameter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "ReportFormatResolver", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ".", "ReportExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "@", "Component", "public", "class", "DefaultReportDataURIBuilder", "implements", "ReportDataURIBuilder", "{", "private", "final", "ReportExporter", "exporter", ";", "private", "final", "ReportFormatResolver", "resolver", ";", "public", "DefaultReportDataURIBuilder", "(", "ReportExporter", "exporter", ",", "ReportFormatResolver", "resolver", ")", "{", "this", ".", "exporter", "=", "exporter", ";", "this", ".", "resolver", "=", "resolver", ";", "}", "public", "String", "build", "(", "Report", "report", ",", "ExportFormat", "format", ")", "{", "String", "charset", "=", "extractCharset", "(", "format", ")", ".", "toLowerCase", "(", ")", ";", "byte", "[", "]", "content", "=", "exporter", ".", "export", "(", "report", ")", ".", "to", "(", "format", ")", ";", "StringBuilder", "URI", "=", "new", "StringBuilder", "(", "\"data:\"", ")", ";", "URI", ".", "append", "(", "format", ".", "getContentType", "(", ")", ")", ";", "URI", ".", "append", "(", "\";charset=\"", ")", ".", "append", "(", "charset", ")", ";", "URI", ".", "append", "(", "\";base64,\"", ")", ".", "append", "(", "Base64", ".", "encodeBytes", "(", "content", ")", ")", ";", "return", "URI", ".", "toString", "(", ")", ";", "}", "public", "String", "build", "(", "Report", "report", ")", "{", "return", "build", "(", "report", ",", "resolver", ".", "getExportFormat", "(", ")", ")", ";", "}", "private", "String", "extractCharset", "(", "ExportFormat", "format", ")", "{", "return", "(", "String", ")", "format", ".", "getParameters", "(", ")", ".", "get", "(", "JRExporterParameter", ".", "CHARACTER_ENCODING", ")", ";", "}", "}", "</s>" ]
10,010
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "util", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "public", "interface", "ReportDataURIBuilder", "{", "String", "build", "(", "Report", "report", ",", "ExportFormat", "format", ")", ";", "String", "build", "(", "Report", "report", ")", ";", "}", "</s>" ]
10,011
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JasperReport", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "ApplicationScoped", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "@", "ApplicationScoped", "public", "class", "ReportCache", "{", "private", "Map", "<", "String", ",", "JasperReport", ">", "cache", "=", "new", "HashMap", "<", "String", ",", "JasperReport", ">", "(", ")", ";", "public", "JasperReport", "get", "(", "String", "template", ")", "{", "return", "cache", ".", "get", "(", "template", ")", ";", "}", "public", "void", "put", "(", "String", "template", ",", "JasperReport", "report", ")", "{", "cache", ".", "put", "(", "template", ",", "report", ")", ";", "}", "public", "boolean", "contains", "(", "String", "template", ")", "{", "return", "cache", ".", "containsKey", "(", "template", ")", ";", "}", "}", "</s>" ]
10,012
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "download", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletResponse", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "download", ".", "ByteArrayDownload", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "download", ".", "Download", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ".", "ReportExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "public", "class", "ReportDownload", "implements", "Download", "{", "private", "ReportExporter", "exporter", ";", "private", "final", "Report", "report", ";", "private", "final", "ExportFormat", "format", ";", "private", "final", "boolean", "doDownload", ";", "public", "ReportDownload", "(", "Report", "report", ",", "ExportFormat", "format", ",", "boolean", "doDownload", ")", "{", "this", ".", "report", "=", "report", ";", "this", ".", "format", "=", "format", ";", "this", ".", "doDownload", "=", "doDownload", ";", "}", "public", "ReportDownload", "(", "Report", "report", ",", "ExportFormat", "format", ")", "{", "this", "(", "report", ",", "format", ",", "true", ")", ";", "}", "public", "void", "setExporter", "(", "ReportExporter", "exporter", ")", "{", "this", ".", "exporter", "=", "exporter", ";", "}", "public", "void", "write", "(", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "new", "ByteArrayDownload", "(", "getContent", "(", ")", ",", "getContentType", "(", ")", ",", "getFileName", "(", ")", ",", "doDownload", ")", ".", "write", "(", "response", ")", ";", "}", "private", "byte", "[", "]", "getContent", "(", ")", "{", "return", "exporter", ".", "export", "(", "report", ")", ".", "to", "(", "format", ")", ";", "}", "public", "byte", "[", "]", "getContent", "(", "ReportExporter", "exporter", ")", "{", "return", "exporter", ".", "export", "(", "report", ")", ".", "to", "(", "format", ")", ";", "}", "public", "String", "getContentType", "(", ")", "{", "return", "format", ".", "getContentType", "(", ")", ";", "}", "public", "String", "getFileName", "(", ")", "{", "return", "report", ".", "getFileName", "(", ")", "+", "\".\"", "+", "format", ".", "getExtension", "(", ")", ";", "}", "}", "</s>" ]
10,013
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "download", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ".", "ReportExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "import", "com", ".", "google", ".", "common", ".", "collect", ".", "Lists", ";", "public", "class", "ReportItem", "{", "private", "final", "Collection", "<", "Report", ">", "reports", "=", "Lists", ".", "newArrayList", "(", ")", ";", "private", "final", "ExportFormat", "format", ";", "private", "final", "String", "filename", ";", "public", "ReportItem", "(", "Report", "report", ",", "ExportFormat", "format", ")", "{", "this", ".", "reports", ".", "add", "(", "report", ")", ";", "this", ".", "format", "=", "format", ";", "this", ".", "filename", "=", "report", ".", "getFileName", "(", ")", "+", "\".\"", "+", "format", ".", "getExtension", "(", ")", ";", "}", "public", "ReportItem", "(", "String", "filename", ",", "Collection", "<", "Report", ">", "reports", ",", "ExportFormat", "format", ")", "{", "this", ".", "reports", ".", "addAll", "(", "reports", ")", ";", "this", ".", "format", "=", "format", ";", "this", ".", "filename", "=", "filename", "+", "\".\"", "+", "format", ".", "getExtension", "(", ")", ";", "}", "public", "Collection", "<", "Report", ">", "getReports", "(", ")", "{", "return", "reports", ";", "}", "public", "byte", "[", "]", "getContent", "(", "ReportExporter", "exporter", ")", "{", "return", "exporter", ".", "export", "(", "reports", ")", ".", "to", "(", "format", ")", ";", "}", "public", "ExportFormat", "getFormat", "(", ")", "{", "return", "format", ";", "}", "public", "String", "getFilename", "(", ")", "{", "return", "filename", ";", "}", "public", "String", "getContentType", "(", ")", "{", "return", "format", ".", "getContentType", "(", ")", ";", "}", "}", "</s>" ]
10,014
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "download", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipEntry", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipOutputStream", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ".", "ReportExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "import", "com", ".", "google", ".", "common", ".", "collect", ".", "Lists", ";", "import", "com", ".", "google", ".", "common", ".", "io", ".", "Closeables", ";", "import", "com", ".", "google", ".", "common", ".", "io", ".", "Flushables", ";", "public", "class", "ReportZipFile", "{", "private", "ByteArrayOutputStream", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "private", "ZipOutputStream", "zip", "=", "new", "ZipOutputStream", "(", "output", ")", ";", "private", "List", "<", "ReportItem", ">", "items", "=", "Lists", ".", "newArrayList", "(", ")", ";", "private", "String", "filename", ";", "public", "ReportZipFile", "(", "String", "filename", ")", "{", "this", ".", "filename", "=", "filename", ";", "}", "public", "ReportZipFile", "add", "(", "Report", "report", ",", "ExportFormat", "format", ")", "{", "this", ".", "items", ".", "add", "(", "new", "ReportItem", "(", "report", ",", "format", ")", ")", ";", "return", "this", ";", "}", "public", "ReportZipFile", "add", "(", "String", "filename", ",", "Collection", "<", "Report", ">", "reports", ",", "ExportFormat", "format", ")", "{", "this", ".", "items", ".", "add", "(", "new", "ReportItem", "(", "filename", ",", "reports", ",", "format", ")", ")", ";", "return", "this", ";", "}", "public", "ReportZipFile", "add", "(", "Collection", "<", "Report", ">", "reports", ",", "ExportFormat", "format", ")", "{", "return", "add", "(", "\"reports\"", ",", "reports", ",", "format", ")", ";", "}", "public", "ReportZipFile", "addAll", "(", "Collection", "<", "ReportItem", ">", "entries", ")", "{", "this", ".", "items", ".", "addAll", "(", "entries", ")", ";", "return", "this", ";", "}", "public", "byte", "[", "]", "getContent", "(", "ReportExporter", "exporter", ")", "{", "for", "(", "ReportItem", "item", ":", "items", ")", "{", "write", "(", "item", ".", "getFilename", "(", ")", ",", "item", ".", "getContent", "(", "exporter", ")", ")", ";", "}", "Flushables", ".", "flushQuietly", "(", "zip", ")", ";", "Closeables", ".", "closeQuietly", "(", "zip", ")", ";", "return", "output", ".", "toByteArray", "(", ")", ";", "}", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "filename", ";", "}", "public", "void", "setName", "(", "String", "filename", ")", "{", "this", ".", "filename", "=", "filename", ";", "}", "private", "void", "write", "(", "String", "name", ",", "byte", "[", "]", "content", ")", "{", "try", "{", "ZipEntry", "entry", "=", "new", "ZipEntry", "(", "name", ")", ";", "entry", ".", "setSize", "(", "content", ".", "length", ")", ";", "entry", ".", "setMethod", "(", "ZipEntry", ".", "DEFLATED", ")", ";", "zip", ".", "putNextEntry", "(", "entry", ")", ";", "zip", ".", "write", "(", "content", ")", ";", "zip", ".", "closeEntry", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "}", "</s>" ]
10,015
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "download", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletResponse", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "download", ".", "ByteArrayDownload", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "download", ".", "Download", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ".", "ReportExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "public", "class", "ReportsDownload", "implements", "Download", "{", "private", "ReportExporter", "exporter", ";", "private", "ReportZipFile", "file", ";", "public", "ReportsDownload", "(", ")", "{", "this", "(", "\"reports.zip\"", ")", ";", "}", "public", "ReportsDownload", "(", "String", "filename", ")", "{", "this", ".", "file", "=", "new", "ReportZipFile", "(", "filename", ")", ";", "}", "public", "void", "setExporter", "(", "ReportExporter", "exporter", ")", "{", "this", ".", "exporter", "=", "exporter", ";", "}", "public", "ReportsDownload", "add", "(", "Report", "report", ",", "ExportFormat", "format", ")", "{", "this", ".", "file", ".", "add", "(", "report", ",", "format", ")", ";", "return", "this", ";", "}", "public", "ReportsDownload", "add", "(", "String", "filename", ",", "List", "<", "Report", ">", "reports", ",", "ExportFormat", "format", ")", "{", "this", ".", "file", ".", "add", "(", "filename", ",", "reports", ",", "format", ")", ";", "return", "this", ";", "}", "public", "void", "write", "(", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "new", "ByteArrayDownload", "(", "getContent", "(", ")", ",", "file", ".", "getContentType", "(", ")", ",", "file", ".", "getName", "(", ")", ",", "true", ")", ".", "write", "(", "response", ")", ";", "}", "private", "byte", "[", "]", "getContent", "(", ")", "{", "return", "file", ".", "getContent", "(", "exporter", ")", ";", "}", "public", "byte", "[", "]", "getContent", "(", "ReportExporter", "exporter", ")", "{", "return", "file", ".", "getContent", "(", "exporter", ")", ";", "}", "public", "String", "getContentType", "(", ")", "{", "return", "file", ".", "getContentType", "(", ")", ";", "}", "public", "String", "getFileName", "(", ")", "{", "return", "file", ".", "getName", "(", ")", ";", "}", "}", "</s>" ]
10,016
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "download", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletResponse", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "download", ".", "ByteArrayDownload", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "download", ".", "Download", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ".", "ReportExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "import", "com", ".", "google", ".", "common", ".", "collect", ".", "Lists", ";", "public", "class", "BatchReportsDownload", "implements", "Download", "{", "private", "ReportExporter", "exporter", ";", "private", "List", "<", "Report", ">", "reports", "=", "Lists", ".", "newArrayList", "(", ")", ";", "private", "final", "ExportFormat", "format", ";", "private", "final", "boolean", "doDownload", ";", "private", "String", "filename", ";", "public", "BatchReportsDownload", "(", "ExportFormat", "format", ",", "String", "filename", ",", "boolean", "doDownload", ")", "{", "if", "(", "!", "format", ".", "supportsBatchMode", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "this", ".", "format", "=", "format", ";", "this", ".", "filename", "=", "filename", ";", "this", ".", "doDownload", "=", "doDownload", ";", "}", "public", "BatchReportsDownload", "(", "ExportFormat", "format", ")", "{", "this", "(", "format", ",", "\"reports\"", ",", "true", ")", ";", "}", "public", "void", "setExporter", "(", "ReportExporter", "exporter", ")", "{", "this", ".", "exporter", "=", "exporter", ";", "}", "public", "BatchReportsDownload", "add", "(", "List", "<", "Report", ">", "reports", ")", "{", "reports", ".", "addAll", "(", "reports", ")", ";", "return", "this", ";", "}", "public", "BatchReportsDownload", "add", "(", "Report", "...", "reports", ")", "{", "for", "(", "Report", "report", ":", "reports", ")", "{", "this", ".", "reports", ".", "add", "(", "report", ")", ";", "}", "return", "this", ";", "}", "public", "void", "write", "(", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "new", "ByteArrayDownload", "(", "getContent", "(", ")", ",", "getContentType", "(", ")", ",", "getFileName", "(", ")", ",", "doDownload", ")", ".", "write", "(", "response", ")", ";", "}", "private", "byte", "[", "]", "getContent", "(", ")", "{", "return", "exporter", ".", "export", "(", "reports", ")", ".", "to", "(", "format", ")", ";", "}", "public", "byte", "[", "]", "getContent", "(", "ReportExporter", "exporter", ")", "{", "return", "exporter", ".", "export", "(", "reports", ")", ".", "to", "(", "format", ")", ";", "}", "public", "String", "getContentType", "(", ")", "{", "return", "format", ".", "getContentType", "(", ")", ";", "}", "public", "String", "getFileName", "(", ")", "{", "return", "filename", "+", "\".\"", "+", "format", ".", "getExtension", "(", ")", ";", "}", "}", "</s>" ]
10,017
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "download", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "OutputStream", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletResponse", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "InterceptionException", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "Intercepts", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "Lazy", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "Result", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "core", ".", "InterceptorStack", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "core", ".", "MethodInfo", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "ExecuteMethodInterceptor", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "ForwardToDefaultViewInterceptor", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "Interceptor", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "ReportFormatResolver", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ".", "ReportExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "resource", ".", "ResourceMethod", ";", "@", "Intercepts", "(", "after", "=", "ExecuteMethodInterceptor", ".", "class", ",", "before", "=", "ForwardToDefaultViewInterceptor", ".", "class", ")", "@", "Lazy", "public", "class", "ReportDownloadInterceptor", "implements", "Interceptor", "{", "private", "final", "ReportExporter", "exporter", ";", "private", "final", "HttpServletResponse", "response", ";", "private", "final", "ReportFormatResolver", "resolver", ";", "private", "final", "MethodInfo", "methodInfo", ";", "private", "final", "Result", "result", ";", "private", "final", "Logger", "logger", "=", "LoggerFactory", ".", "getLogger", "(", "getClass", "(", ")", ")", ";", "public", "ReportDownloadInterceptor", "(", "ReportExporter", "exporter", ",", "HttpServletResponse", "response", ",", "ReportFormatResolver", "resolver", ",", "MethodInfo", "methodInfo", ",", "Result", "result", ")", "{", "this", ".", "exporter", "=", "exporter", ";", "this", ".", "response", "=", "response", ";", "this", ".", "resolver", "=", "resolver", ";", "this", ".", "methodInfo", "=", "methodInfo", ";", "this", ".", "result", "=", "result", ";", "}", "public", "boolean", "accepts", "(", "ResourceMethod", "method", ")", "{", "return", "Report", ".", "class", ".", "isAssignableFrom", "(", "method", ".", "getMethod", "(", ")", ".", "getReturnType", "(", ")", ")", ";", "}", "public", "void", "intercept", "(", "InterceptorStack", "stack", ",", "ResourceMethod", "method", ",", "Object", "instance", ")", "throws", "InterceptionException", "{", "Report", "report", "=", "(", "Report", ")", "methodInfo", ".", "getResult", "(", ")", ";", "if", "(", "report", "==", "null", ")", "{", "if", "(", "result", ".", "used", "(", ")", ")", "{", "stack", ".", "next", "(", "method", ",", "instance", ")", ";", "return", ";", "}", "else", "throw", "new", "NullPointerException", "(", "\"\"", ")", ";", "}", "ReportDownload", "download", "=", "new", "ReportDownload", "(", "report", ",", "resolver", ".", "getExportFormat", "(", ")", ",", "resolver", ".", "doDownload", "(", ")", ")", ";", "download", ".", "setExporter", "(", "exporter", ")", ";", "logger", ".", "debug", "(", "\"\"", ",", "exporter", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "download", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "try", "{", "OutputStream", "output", "=", "response", ".", "getOutputStream", "(", ")", ";", "download", ".", "write", "(", "response", ")", ";", "output", ".", "flush", "(", ")", ";", "output", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "InterceptionException", "(", "e", ")", ";", "}", "}", "}", "</s>" ]
10,018
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "interface", "Report", "{", "String", "getTemplate", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "getParameters", "(", ")", ";", "Collection", "getData", "(", ")", ";", "String", "getFileName", "(", ")", ";", "Report", "addParameter", "(", "String", "parameter", ",", "Object", "value", ")", ";", "boolean", "isCacheable", "(", ")", ";", "}", "</s>" ]
10,019
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "InterceptionException", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "Intercepts", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "Lazy", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "core", ".", "InterceptorStack", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "core", ".", "MethodInfo", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "ExecuteMethodInterceptor", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "Interceptor", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "download", ".", "Download", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "interceptor", ".", "download", ".", "DownloadInterceptor", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "download", ".", "BatchReportsDownload", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "download", ".", "ReportDownload", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "download", ".", "ReportsDownload", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "resource", ".", "ResourceMethod", ";", "@", "Intercepts", "(", "after", "=", "ExecuteMethodInterceptor", ".", "class", ",", "before", "=", "DownloadInterceptor", ".", "class", ")", "@", "Lazy", "public", "class", "ExporterInjector", "implements", "Interceptor", "{", "private", "final", "ReportExporter", "exporter", ";", "private", "final", "MethodInfo", "methodInfo", ";", "private", "final", "Logger", "logger", "=", "LoggerFactory", ".", "getLogger", "(", "getClass", "(", ")", ")", ";", "public", "ExporterInjector", "(", "ReportExporter", "exporter", ",", "MethodInfo", "methodInfo", ")", "{", "this", ".", "exporter", "=", "exporter", ";", "this", ".", "methodInfo", "=", "methodInfo", ";", "}", "public", "boolean", "accepts", "(", "ResourceMethod", "method", ")", "{", "Class", "<", "?", ">", "type", "=", "method", ".", "getMethod", "(", ")", ".", "getReturnType", "(", ")", ";", "return", "Download", ".", "class", ".", "isAssignableFrom", "(", "type", ")", "||", "type", "==", "ReportDownload", ".", "class", "||", "type", "==", "ReportsDownload", ".", "class", "||", "type", "==", "BatchReportsDownload", ".", "class", ";", "}", "public", "void", "intercept", "(", "InterceptorStack", "stack", ",", "ResourceMethod", "method", ",", "Object", "instance", ")", "throws", "InterceptionException", "{", "Object", "result", "=", "methodInfo", ".", "getResult", "(", ")", ";", "if", "(", "result", "instanceof", "ReportDownload", ")", "{", "ReportDownload", "download", "=", "(", "ReportDownload", ")", "result", ";", "download", ".", "setExporter", "(", "exporter", ")", ";", "}", "if", "(", "result", "instanceof", "ReportsDownload", ")", "{", "ReportsDownload", "download", "=", "(", "ReportsDownload", ")", "result", ";", "download", ".", "setExporter", "(", "exporter", ")", ";", "}", "if", "(", "result", "instanceof", "BatchReportsDownload", ")", "{", "BatchReportsDownload", "download", "=", "(", "BatchReportsDownload", ")", "result", ";", "download", ".", "setExporter", "(", "exporter", ")", ";", "}", "logger", ".", "debug", "(", "\"\"", ",", "exporter", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "result", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "stack", ".", "next", "(", "method", ",", "instance", ")", ";", "}", "}", "</s>" ]
10,020
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpSession", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRException", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JasperFillManager", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JasperPrint", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JasperReport", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "data", ".", "JRBeanCollectionDataSource", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "j2ee", ".", "servlets", ".", "ImageServlet", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "ReportLoader", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "decorator", ".", "ReportDecorator", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "Html", ";", "import", "com", ".", "google", ".", "common", ".", "collect", ".", "Lists", ";", "import", "com", ".", "google", ".", "common", ".", "collect", ".", "Maps", ";", "@", "Component", "public", "class", "DefaultExporter", "implements", "ReportExporter", "{", "private", "Collection", "<", "Report", ">", "reports", "=", "Lists", ".", "newArrayList", "(", ")", ";", "private", "final", "ReportLoader", "loader", ";", "private", "final", "List", "<", "ReportDecorator", ">", "decorators", ";", "private", "final", "HttpSession", "session", ";", "private", "final", "Logger", "logger", "=", "LoggerFactory", ".", "getLogger", "(", "DefaultExporter", ".", "class", ")", ";", "public", "DefaultExporter", "(", "ReportLoader", "loader", ",", "List", "<", "ReportDecorator", ">", "decorators", ",", "HttpSession", "session", ")", "{", "this", ".", "loader", "=", "loader", ";", "this", ".", "decorators", "=", "decorators", ";", "this", ".", "session", "=", "session", ";", "}", "public", "ReportExporter", "export", "(", "Report", "report", ")", "{", "this", ".", "reports", ".", "add", "(", "report", ")", ";", "return", "this", ";", "}", "public", "ReportExporter", "export", "(", "Collection", "<", "Report", ">", "reports", ")", "{", "this", ".", "reports", "=", "reports", ";", "return", "this", ";", "}", "public", "byte", "[", "]", "to", "(", "ExportFormat", "format", ")", "{", "try", "{", "List", "<", "JasperPrint", ">", "print", "=", "fillAll", "(", "format", ")", ";", "return", "format", ".", "toByteArray", "(", "print", ")", ";", "}", "catch", "(", "JRException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "private", "List", "<", "JasperPrint", ">", "fillAll", "(", "ExportFormat", "format", ")", "throws", "JRException", "{", "List", "<", "JasperPrint", ">", "printList", "=", "new", "ArrayList", "<", "JasperPrint", ">", "(", ")", ";", "for", "(", "Report", "report", ":", "reports", ")", "{", "printList", ".", "add", "(", "fill", "(", "report", ")", ")", ";", "}", "configImageServlet", "(", "format", ",", "printList", ".", "get", "(", "0", ")", ")", ";", "return", "printList", ";", "}", "private", "JasperPrint", "fill", "(", "Report", "report", ")", "throws", "JRException", "{", "for", "(", "ReportDecorator", "decorator", ":", "decorators", ")", "{", "decorator", ".", "decorate", "(", "report", ")", ";", "}", "JasperReport", "jr", "=", "loader", ".", "load", "(", "report", ")", ";", "JRBeanCollectionDataSource", "data", "=", "new", "JRBeanCollectionDataSource", "(", "report", ".", "getData", "(", ")", ",", "false", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "report", ".", "getParameters", "(", ")", ";", "if", "(", "parameters", "==", "null", ")", "{", "parameters", "=", "Maps", ".", "newHashMap", "(", ")", ";", "logger", ".", "warn", "(", "\"\"", ")", ";", "}", "JasperPrint", "print", "=", "JasperFillManager", ".", "fillReport", "(", "jr", ",", "parameters", ",", "data", ")", ";", "return", "print", ";", "}", "private", "void", "configImageServlet", "(", "ExportFormat", "format", ",", "JasperPrint", "print", ")", "{", "if", "(", "format", ".", "getClass", "(", ")", ".", "equals", "(", "Html", ".", "class", ")", "&&", "print", "!=", "null", ")", "session", ".", "setAttribute", "(", "ImageServlet", ".", "DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE", ",", "print", ")", ";", "}", "}", "</s>" ]
10,021
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "exporter", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "public", "interface", "ReportExporter", "{", "ReportExporter", "export", "(", "Report", "report", ")", ";", "ReportExporter", "export", "(", "Collection", "<", "Report", ">", "reports", ")", ";", "byte", "[", "]", "to", "(", "ExportFormat", "format", ")", ";", "}", "</s>" ]
10,022
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "Locale", ";", "import", "javax", ".", "servlet", ".", "ServletContext", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "ApplicationScoped", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "@", "ApplicationScoped", "public", "class", "ReportPathResolver", "{", "private", "final", "ServletContext", "context", ";", "public", "static", "final", "String", "DEFAULT_REPORTS_PATH", "=", "\"\"", ";", "public", "static", "final", "String", "DEFAULT_SUBREPORTS_PATH", "=", "\"\"", ";", "public", "static", "final", "String", "DEFAULT_IMAGES_PATH", "=", "\"\"", ";", "private", "static", "final", "String", "DEFAULT_BUNDLE_NAME", "=", "\"i18n_\"", ";", "private", "static", "final", "String", "SEPARATOR", "=", "File", ".", "separator", ";", "private", "final", "Logger", "logger", "=", "LoggerFactory", ".", "getLogger", "(", "ReportPathResolver", ".", "class", ")", ";", "public", "ReportPathResolver", "(", "ServletContext", "context", ")", "{", "this", ".", "context", "=", "context", ";", "logger", ".", "debug", "(", "\"\"", "+", "getReportsPath", "(", ")", ")", ";", "logger", ".", "debug", "(", "\"\"", "+", "getSubReportsPath", "(", ")", ")", ";", "logger", ".", "debug", "(", "\"\"", "+", "getImagesPath", "(", ")", ")", ";", "}", "public", "String", "getPathFor", "(", "Report", "report", ")", "{", "return", "getReportsPath", "(", ")", "+", "report", ".", "getTemplate", "(", ")", ";", "}", "public", "String", "getReportsPath", "(", ")", "{", "return", "context", ".", "getRealPath", "(", "getRelativeReportsPath", "(", ")", ")", "+", "SEPARATOR", ";", "}", "public", "String", "getSubReportsPath", "(", ")", "{", "return", "context", ".", "getRealPath", "(", "getRelativeSubReportsPath", "(", ")", ")", "+", "SEPARATOR", ";", "}", "public", "String", "getImagesPath", "(", ")", "{", "return", "context", ".", "getRealPath", "(", "getRelativeImagesPath", "(", ")", ")", "+", "SEPARATOR", ";", "}", "public", "String", "getResourceBundleFor", "(", "Locale", "locale", ")", "{", "return", "getReportsPath", "(", ")", "+", "getBundleName", "(", ")", "+", "locale", ".", "toString", "(", ")", "+", "\".properties\"", ";", "}", "private", "String", "getRelativeImagesPath", "(", ")", "{", "String", "param", "=", "context", ".", "getInitParameter", "(", "\"\"", ")", ";", "return", "param", "!=", "null", "?", "param", ".", "trim", "(", ")", ":", "DEFAULT_IMAGES_PATH", ";", "}", "private", "String", "getRelativeSubReportsPath", "(", ")", "{", "String", "param", "=", "context", ".", "getInitParameter", "(", "\"\"", ")", ";", "return", "param", "!=", "null", "?", "param", ".", "trim", "(", ")", ":", "DEFAULT_SUBREPORTS_PATH", ";", "}", "private", "String", "getRelativeReportsPath", "(", ")", "{", "String", "param", "=", "context", ".", "getInitParameter", "(", "\"\"", ")", ";", "return", "param", "!=", "null", "?", "param", ".", "trim", "(", ")", ":", "DEFAULT_REPORTS_PATH", ";", "}", "private", "String", "getBundleName", "(", ")", "{", "String", "param", "=", "context", ".", "getInitParameter", "(", "\"\"", ")", ";", "return", "param", "!=", "null", "?", "param", ".", "trim", "(", ")", ":", "DEFAULT_BUNDLE_NAME", ";", "}", "public", "String", "getImagesURI", "(", ")", "{", "return", "context", ".", "getContextPath", "(", ")", "+", "\"\"", ";", "}", "}", "</s>" ]
10,023
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRException", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JasperCompileManager", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JasperReport", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "util", ".", "JRLoader", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "ApplicationScoped", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "@", "ApplicationScoped", "public", "class", "ReportLoader", "{", "private", "final", "ReportCache", "cache", ";", "private", "final", "ReportPathResolver", "resolver", ";", "public", "ReportLoader", "(", "ReportCache", "cache", ",", "ReportPathResolver", "resolver", ")", "{", "this", ".", "cache", "=", "cache", ";", "this", ".", "resolver", "=", "resolver", ";", "}", "public", "JasperReport", "load", "(", "Report", "report", ")", "throws", "JRException", "{", "if", "(", "report", ".", "isCacheable", "(", ")", ")", "return", "loadFromCache", "(", "report", ")", ";", "else", "return", "loadFromDisk", "(", "report", ")", ";", "}", "private", "JasperReport", "loadFromCache", "(", "Report", "report", ")", "throws", "JRException", "{", "if", "(", "!", "cache", ".", "contains", "(", "report", ".", "getTemplate", "(", ")", ")", ")", "cache", ".", "put", "(", "report", ".", "getTemplate", "(", ")", ",", "loadFromDisk", "(", "report", ")", ")", ";", "return", "cache", ".", "get", "(", "report", ".", "getTemplate", "(", ")", ")", ";", "}", "private", "JasperReport", "loadFromDisk", "(", "Report", "report", ")", "throws", "JRException", "{", "String", "template", "=", "resolver", ".", "getPathFor", "(", "report", ")", ";", "if", "(", "template", ".", "endsWith", "(", "\".jrxml\"", ")", ")", "return", "JasperCompileManager", ".", "compileReport", "(", "template", ")", ";", "else", "return", "(", "JasperReport", ")", "JRLoader", ".", "loadObjectFromFile", "(", "template", ")", ";", "}", "}", "</s>" ]
10,024
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "decorator", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "FileNotFoundException", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "java", ".", "util", ".", "Locale", ";", "import", "java", ".", "util", ".", "MissingResourceException", ";", "import", "java", ".", "util", ".", "PropertyResourceBundle", ";", "import", "java", ".", "util", ".", "ResourceBundle", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "core", ".", "Localization", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "ReportPathResolver", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "util", ".", "EmptyBundle", ";", "@", "Component", "public", "class", "ReportsResourceBundle", "extends", "ResourceBundle", "{", "private", "ResourceBundle", "delegate", ";", "private", "Locale", "locale", ";", "private", "static", "final", "Logger", "logger", "=", "LoggerFactory", ".", "getLogger", "(", "ReportsResourceBundle", ".", "class", ")", ";", "public", "ReportsResourceBundle", "(", "Localization", "localization", ",", "ReportPathResolver", "resolver", ")", "{", "this", ".", "locale", "=", "localization", ".", "getLocale", "(", ")", ";", "buildBundle", "(", "resolver", ".", "getResourceBundleFor", "(", "locale", ")", ")", ";", "}", "public", "Locale", "getLocale", "(", ")", "{", "return", "locale", ";", "}", "private", "void", "buildBundle", "(", "String", "path", ")", "{", "File", "bundle", "=", "new", "File", "(", "path", ")", ";", "try", "{", "this", ".", "delegate", "=", "new", "PropertyResourceBundle", "(", "new", "FileInputStream", "(", "bundle", ")", ")", ";", "logger", ".", "debug", "(", "\"\"", "+", "locale", ")", ";", "logger", ".", "debug", "(", "\"\"", "+", "bundle", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "logger", ".", "debug", "(", "\"\"", "+", "bundle", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ")", ";", "this", ".", "delegate", "=", "new", "EmptyBundle", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "debug", "(", "\"\"", "+", "bundle", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ")", ";", "this", ".", "delegate", "=", "new", "EmptyBundle", "(", ")", ";", "}", "}", "public", "Enumeration", "<", "String", ">", "getKeys", "(", ")", "{", "return", "delegate", ".", "getKeys", "(", ")", ";", "}", "protected", "Object", "handleGetObject", "(", "String", "key", ")", "{", "try", "{", "return", "delegate", ".", "getString", "(", "key", ")", ";", "}", "catch", "(", "MissingResourceException", "e", ")", "{", "return", "\"???\"", "+", "key", "+", "\"???\"", ";", "}", "}", "}", "</s>" ]
10,025
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "decorator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRParameter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "Result", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "ReportPathResolver", ";", "@", "Component", "public", "class", "DefaultDecorator", "implements", "ReportDecorator", "{", "private", "final", "ReportPathResolver", "resolver", ";", "private", "final", "ReportsResourceBundle", "bundle", ";", "private", "final", "Result", "result", ";", "public", "DefaultDecorator", "(", "ReportPathResolver", "resolver", ",", "ReportsResourceBundle", "bundle", ",", "Result", "result", ")", "{", "this", ".", "resolver", "=", "resolver", ";", "this", ".", "bundle", "=", "bundle", ";", "this", ".", "result", "=", "result", ";", "}", "public", "void", "decorate", "(", "Report", "report", ")", "{", "if", "(", "report", ".", "getParameters", "(", ")", "!=", "null", ")", "{", "report", ".", "addParameter", "(", "\"REPORT_DIR\"", ",", "resolver", ".", "getReportsPath", "(", ")", ")", ";", "report", ".", "addParameter", "(", "\"\"", ",", "resolver", ".", "getSubReportsPath", "(", ")", ")", ";", "report", ".", "addParameter", "(", "\"IMAGES_DIR\"", ",", "resolver", ".", "getImagesPath", "(", ")", ")", ";", "report", ".", "addParameter", "(", "JRParameter", ".", "REPORT_LOCALE", ",", "bundle", ".", "getLocale", "(", ")", ")", ";", "report", ".", "addParameter", "(", "JRParameter", ".", "REPORT_RESOURCE_BUNDLE", ",", "bundle", ")", ";", "includeRequestParameters", "(", "report", ")", ";", "}", "}", "private", "void", "includeRequestParameters", "(", "Report", "report", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "result", ".", "included", "(", ")", ".", "entrySet", "(", ")", ")", "{", "report", ".", "addParameter", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "</s>" ]
10,026
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "decorator", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "Report", ";", "public", "interface", "ReportDecorator", "{", "void", "decorate", "(", "Report", "report", ")", ";", "}", "</s>" ]
10,027
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRException", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporterParameter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JasperPrint", ";", "import", "com", ".", "google", ".", "common", ".", "collect", ".", "Maps", ";", "import", "com", ".", "google", ".", "common", ".", "io", ".", "Closeables", ";", "import", "com", ".", "google", ".", "common", ".", "io", ".", "Flushables", ";", "public", "abstract", "class", "AbstractExporter", "implements", "ExportFormat", "{", "protected", "Map", "<", "JRExporterParameter", ",", "Object", ">", "parameters", "=", "Maps", ".", "newHashMap", "(", ")", ";", "public", "AbstractExporter", "(", ")", "{", "defaultParameters", "(", ")", ";", "}", "public", "ExportFormat", "configure", "(", "JRExporterParameter", "parameter", ",", "Object", "value", ")", "{", "parameters", ".", "put", "(", "parameter", ",", "value", ")", ";", "return", "this", ";", "}", "public", "Map", "<", "JRExporterParameter", ",", "Object", ">", "getParameters", "(", ")", "{", "return", "this", ".", "parameters", ";", "}", "protected", "void", "defaultParameters", "(", ")", "{", "configure", "(", "JRExporterParameter", ".", "CHARACTER_ENCODING", ",", "\"UTF-8\"", ")", ";", "}", "protected", "abstract", "JRExporter", "setup", "(", ")", ";", "public", "boolean", "supportsBatchMode", "(", ")", "{", "return", "true", ";", "}", "public", "byte", "[", "]", "toByteArray", "(", "List", "<", "JasperPrint", ">", "print", ")", "{", "ByteArrayOutputStream", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "{", "JRExporter", "exporter", "=", "setup", "(", ")", ";", "exporter", ".", "setParameters", "(", "getParameters", "(", ")", ")", ";", "if", "(", "print", ".", "size", "(", ")", ">", "1", ")", "exporter", ".", "setParameter", "(", "JRExporterParameter", ".", "JASPER_PRINT_LIST", ",", "print", ")", ";", "else", "exporter", ".", "setParameter", "(", "JRExporterParameter", ".", "JASPER_PRINT", ",", "print", ".", "get", "(", "0", ")", ")", ";", "exporter", ".", "setParameter", "(", "JRExporterParameter", ".", "OUTPUT_STREAM", ",", "output", ")", ";", "exporter", ".", "exportReport", "(", ")", ";", "Flushables", ".", "flushQuietly", "(", "output", ")", ";", "return", "output", ".", "toByteArray", "(", ")", ";", "}", "catch", "(", "JRException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "finally", "{", "Closeables", ".", "closeQuietly", "(", "output", ")", ";", "parameters", ".", "clear", "(", ")", ";", "}", "}", "}", "</s>" ]
10,028
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "java", ".", "awt", ".", "image", ".", "BufferedImage", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "imageio", ".", "ImageIO", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRException", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporterParameter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JasperPrint", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRGraphics2DExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRGraphics2DExporterParameter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "import", "com", ".", "google", ".", "common", ".", "io", ".", "Closeables", ";", "@", "Component", "public", "class", "Image", "extends", "AbstractExporter", "{", "private", "Float", "zoom", "=", "1f", ";", "private", "Integer", "page", "=", "0", ";", "private", "String", "format", "=", "\"png\"", ";", "public", "String", "getContentType", "(", ")", "{", "return", "\"image/\"", "+", "format", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "format", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "try", "{", "return", "new", "JRGraphics2DExporter", "(", ")", ";", "}", "catch", "(", "JRException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "public", "Image", "zoom", "(", "Float", "zoom", ")", "{", "this", ".", "zoom", "=", "zoom", ";", "return", "this", ";", "}", "public", "Image", "page", "(", "Integer", "page", ")", "{", "this", ".", "page", "=", "page", ";", "return", "this", ";", "}", "public", "Image", "png", "(", ")", "{", "this", ".", "format", "=", "\"png\"", ";", "return", "this", ";", "}", "public", "Image", "jpeg", "(", ")", "{", "this", ".", "format", "=", "\"jpeg\"", ";", "return", "this", ";", "}", "public", "boolean", "supportsBatchMode", "(", ")", "{", "return", "false", ";", "}", "public", "byte", "[", "]", "toByteArray", "(", "List", "<", "JasperPrint", ">", "print", ")", "{", "ByteArrayOutputStream", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "{", "JRExporter", "exporter", "=", "setup", "(", ")", ";", "exporter", ".", "setParameters", "(", "parameters", ")", ";", "exporter", ".", "setParameter", "(", "JRExporterParameter", ".", "JASPER_PRINT", ",", "print", ".", "get", "(", "0", ")", ")", ";", "BufferedImage", "image", "=", "getPageImage", "(", "print", ".", "get", "(", "0", ")", ")", ";", "exporter", ".", "setParameter", "(", "JRGraphics2DExporterParameter", ".", "GRAPHICS_2D", ",", "image", ".", "getGraphics", "(", ")", ")", ";", "exporter", ".", "setParameter", "(", "JRGraphics2DExporterParameter", ".", "ZOOM_RATIO", ",", "zoom", ")", ";", "exporter", ".", "setParameter", "(", "JRExporterParameter", ".", "PAGE_INDEX", ",", "page", ")", ";", "exporter", ".", "exportReport", "(", ")", ";", "ImageIO", ".", "write", "(", "image", ",", "format", ",", "output", ")", ";", "return", "output", ".", "toByteArray", "(", ")", ";", "}", "catch", "(", "JRException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ",", "e", ")", ";", "}", "finally", "{", "Closeables", ".", "closeQuietly", "(", "output", ")", ";", "parameters", ".", "clear", "(", ")", ";", "}", "}", "private", "BufferedImage", "getPageImage", "(", "JasperPrint", "print", ")", "{", "int", "width", "=", "(", "int", ")", "(", "print", ".", "getPageWidth", "(", ")", "*", "zoom", ")", ";", "int", "height", "=", "(", "int", ")", "(", "print", ".", "getPageHeight", "(", ")", "*", "zoom", ")", ";", "return", "new", "BufferedImage", "(", "width", ",", "height", ",", "BufferedImage", ".", "TYPE_INT_RGB", ")", ";", "}", "}", "</s>" ]
10,029
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRHtmlExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRHtmlExporterParameter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "ReportPathResolver", ";", "@", "Component", "public", "class", "Html", "extends", "AbstractExporter", "{", "private", "final", "ReportPathResolver", "resolver", ";", "public", "Html", "(", "ReportPathResolver", "resolver", ")", "{", "this", ".", "resolver", "=", "resolver", ";", "}", "public", "String", "getContentType", "(", ")", "{", "return", "\"text/html\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"html\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "configure", "(", "JRHtmlExporterParameter", ".", "IS_USING_IMAGES_TO_ALIGN", ",", "Boolean", ".", "FALSE", ")", ";", "configure", "(", "JRHtmlExporterParameter", ".", "IMAGES_DIR_NAME", ",", "resolver", ".", "getImagesPath", "(", ")", ")", ";", "configure", "(", "JRHtmlExporterParameter", ".", "IMAGES_URI", ",", "resolver", ".", "getImagesURI", "(", ")", ")", ";", "return", "new", "JRHtmlExporter", "(", ")", ";", "}", "}", "</s>" ]
10,030
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "oasis", ".", "JROdsExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Ods", "extends", "AbstractExporter", "{", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"ods\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "return", "new", "JROdsExporter", "(", ")", ";", "}", "}", "</s>" ]
10,031
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRXlsExporterParameter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "ooxml", ".", "JRXlsxExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Xlsx", "extends", "AbstractExporter", "{", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"xlsx\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "configure", "(", "JRXlsExporterParameter", ".", "IS_ONE_PAGE_PER_SHEET", ",", "Boolean", ".", "TRUE", ")", ";", "return", "new", "JRXlsxExporter", "(", ")", ";", "}", "}", "</s>" ]
10,032
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRCsvExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Csv", "extends", "AbstractExporter", "{", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"csv\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "return", "new", "JRCsvExporter", "(", ")", ";", "}", "}", "</s>" ]
10,033
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRTextExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRTextExporterParameter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Rtf", "extends", "AbstractExporter", "{", "public", "JRExporter", "setup", "(", ")", "{", "configure", "(", "JRTextExporterParameter", ".", "CHARACTER_WIDTH", ",", "5f", ")", ";", "configure", "(", "JRTextExporterParameter", ".", "CHARACTER_HEIGHT", ",", "20f", ")", ";", "return", "new", "JRTextExporter", "(", ")", ";", "}", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"rtf\"", ";", "}", "}", "</s>" ]
10,034
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRXhtmlExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Xhtml", "extends", "AbstractExporter", "{", "public", "String", "getContentType", "(", ")", "{", "return", "\"text/html\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"xhtml\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "return", "new", "JRXhtmlExporter", "(", ")", ";", "}", "}", "</s>" ]
10,035
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "oasis", ".", "JROdtExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Odt", "extends", "AbstractExporter", "{", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"odt\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "return", "new", "JROdtExporter", "(", ")", ";", "}", "}", "</s>" ]
10,036
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporterParameter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JasperPrint", ";", "public", "interface", "ExportFormat", "{", "String", "getContentType", "(", ")", ";", "String", "getExtension", "(", ")", ";", "ExportFormat", "configure", "(", "JRExporterParameter", "parameter", ",", "Object", "value", ")", ";", "Map", "<", "JRExporterParameter", ",", "Object", ">", "getParameters", "(", ")", ";", "boolean", "supportsBatchMode", "(", ")", ";", "byte", "[", "]", "toByteArray", "(", "List", "<", "JasperPrint", ">", "print", ")", ";", "}", "</s>" ]
10,037
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "ExportFormats", "{", "private", "Map", "<", "String", ",", "ExportFormat", ">", "exporters", "=", "new", "HashMap", "<", "String", ",", "ExportFormat", ">", "(", ")", ";", "public", "ExportFormats", "(", "List", "<", "ExportFormat", ">", "formats", ")", "{", "for", "(", "ExportFormat", "format", ":", "formats", ")", "{", "exporters", ".", "put", "(", "format", ".", "getExtension", "(", ")", ",", "format", ")", ";", "}", "}", "public", "static", "Pdf", "pdf", "(", ")", "{", "return", "new", "Pdf", "(", ")", ";", "}", "public", "static", "Csv", "csv", "(", ")", "{", "return", "new", "Csv", "(", ")", ";", "}", "public", "static", "Xls", "xls", "(", ")", "{", "return", "new", "Xls", "(", ")", ";", "}", "public", "static", "Rtf", "rtf", "(", ")", "{", "return", "new", "Rtf", "(", ")", ";", "}", "public", "static", "Docx", "docx", "(", ")", "{", "return", "new", "Docx", "(", ")", ";", "}", "public", "static", "Odt", "odt", "(", ")", "{", "return", "new", "Odt", "(", ")", ";", "}", "public", "static", "Txt", "txt", "(", ")", "{", "return", "new", "Txt", "(", ")", ";", "}", "public", "Html", "html", "(", ")", "{", "return", "(", "Html", ")", "byExtension", "(", "\"html\"", ")", ";", "}", "public", "static", "Ods", "ods", "(", ")", "{", "return", "new", "Ods", "(", ")", ";", "}", "public", "static", "Pptx", "pptx", "(", ")", "{", "return", "new", "Pptx", "(", ")", ";", "}", "public", "static", "Xhtml", "xhtml", "(", ")", "{", "return", "new", "Xhtml", "(", ")", ";", "}", "public", "static", "Xlsx", "xlsx", "(", ")", "{", "return", "new", "Xlsx", "(", ")", ";", "}", "public", "static", "Image", "png", "(", ")", "{", "return", "new", "Image", "(", ")", ";", "}", "public", "static", "Image", "png", "(", "Integer", "page", ",", "Float", "zoom", ")", "{", "Image", "image", "=", "new", "Image", "(", ")", ";", "image", ".", "page", "(", "page", ")", ";", "image", ".", "zoom", "(", "zoom", ")", ";", "return", "image", ";", "}", "public", "static", "Image", "jpeg", "(", ")", "{", "Image", "image", "=", "new", "Image", "(", ")", ";", "image", ".", "jpeg", "(", ")", ";", "return", "image", ";", "}", "public", "static", "Image", "jpeg", "(", "Integer", "page", ",", "Float", "zoom", ")", "{", "Image", "image", "=", "new", "Image", "(", ")", ";", "image", ".", "jpeg", "(", ")", ";", "image", ".", "page", "(", "page", ")", ";", "image", ".", "zoom", "(", "zoom", ")", ";", "return", "image", ";", "}", "public", "ExportFormat", "byExtension", "(", "String", "extension", ")", "{", "if", "(", "supports", "(", "extension", ")", ")", "return", "exporters", ".", "get", "(", "extension", ".", "toLowerCase", "(", ")", ")", ";", "return", "pdf", "(", ")", ";", "}", "public", "boolean", "supports", "(", "String", "format", ")", "{", "return", "exporters", ".", "containsKey", "(", "format", ".", "toLowerCase", "(", ")", ")", ";", "}", "}", "</s>" ]
10,038
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "ooxml", ".", "JRPptxExporter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Pptx", "extends", "AbstractExporter", "{", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"pptx\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "return", "new", "JRPptxExporter", "(", ")", ";", "}", "}", "</s>" ]
10,039
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "ooxml", ".", "JRDocxExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "ooxml", ".", "JRDocxExporterParameter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Docx", "extends", "AbstractExporter", "{", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"docx\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "configure", "(", "JRDocxExporterParameter", ".", "FLEXIBLE_ROW_HEIGHT", ",", "Boolean", ".", "TRUE", ")", ";", "return", "new", "JRDocxExporter", "(", ")", ";", "}", "}", "</s>" ]
10,040
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRPdfExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRPdfExporterParameter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Pdf", "extends", "AbstractExporter", "{", "private", "Integer", "permissions", "=", "0", ";", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"pdf\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "configure", "(", "JRPdfExporterParameter", ".", "IS_COMPRESSED", ",", "Boolean", ".", "TRUE", ")", ";", "return", "new", "JRPdfExporter", "(", ")", ";", "}", "public", "void", "encrypt", "(", "String", "password", ")", "{", "configure", "(", "JRPdfExporterParameter", ".", "IS_ENCRYPTED", ",", "Boolean", ".", "TRUE", ")", ";", "configure", "(", "JRPdfExporterParameter", ".", "IS_128_BIT_KEY", ",", "Boolean", ".", "TRUE", ")", ";", "configure", "(", "JRPdfExporterParameter", ".", "USER_PASSWORD", ",", "password", ")", ";", "configure", "(", "JRPdfExporterParameter", ".", "OWNER_PASSWORD", ",", "password", ")", ";", "}", "public", "Pdf", "addPermission", "(", "Integer", "permission", ")", "{", "this", ".", "permissions", "|=", "permission", ";", "configure", "(", "JRPdfExporterParameter", ".", "PERMISSIONS", ",", "permissions", ")", ";", "return", "this", ";", "}", "public", "void", "setAuthor", "(", "String", "author", ")", "{", "configure", "(", "JRPdfExporterParameter", ".", "METADATA_AUTHOR", ",", "author", ")", ";", "}", "public", "void", "setTitle", "(", "String", "title", ")", "{", "configure", "(", "JRPdfExporterParameter", ".", "METADATA_TITLE", ",", "title", ")", ";", "}", "public", "void", "setCreator", "(", "String", "creator", ")", "{", "configure", "(", "JRPdfExporterParameter", ".", "METADATA_CREATOR", ",", "creator", ")", ";", "}", "public", "void", "setSubject", "(", "String", "subject", ")", "{", "configure", "(", "JRPdfExporterParameter", ".", "METADATA_SUBJECT", ",", "subject", ")", ";", "}", "public", "void", "setKeywords", "(", "String", "keywords", ")", "{", "configure", "(", "JRPdfExporterParameter", ".", "METADATA_KEYWORDS", ",", "keywords", ")", ";", "}", "}", "</s>" ]
10,041
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRXlsExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRXlsExporterParameter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Xls", "extends", "AbstractExporter", "{", "public", "String", "getContentType", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"xls\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "configure", "(", "JRXlsExporterParameter", ".", "IS_ONE_PAGE_PER_SHEET", ",", "Boolean", ".", "TRUE", ")", ";", "configure", "(", "JRXlsExporterParameter", ".", "IS_WHITE_PAGE_BACKGROUND", ",", "Boolean", ".", "FALSE", ")", ";", "configure", "(", "JRXlsExporterParameter", ".", "IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS", ",", "Boolean", ".", "TRUE", ")", ";", "configure", "(", "JRXlsExporterParameter", ".", "IS_DETECT_CELL_TYPE", ",", "Boolean", ".", "FALSE", ")", ";", "return", "new", "JRXlsExporter", "(", ")", ";", "}", "}", "</s>" ]
10,042
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "JRExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRTextExporter", ";", "import", "net", ".", "sf", ".", "jasperreports", ".", "engine", ".", "export", ".", "JRTextExporterParameter", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "@", "Component", "public", "class", "Txt", "extends", "AbstractExporter", "{", "public", "String", "getContentType", "(", ")", "{", "return", "\"text/plain\"", ";", "}", "public", "String", "getExtension", "(", ")", "{", "return", "\"txt\"", ";", "}", "public", "JRExporter", "setup", "(", ")", "{", "configure", "(", "JRTextExporterParameter", ".", "CHARACTER_WIDTH", ",", "5f", ")", ";", "configure", "(", "JRTextExporterParameter", ".", "CHARACTER_HEIGHT", ",", "20f", ")", ";", "return", "new", "JRTextExporter", "(", ")", ";", "}", "public", "boolean", "supportsBatchMode", "(", ")", "{", "return", "false", ";", "}", "}", "</s>" ]
10,043
[ "<s>", "package", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "http", ".", "FormatResolver", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "ioc", ".", "Component", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormat", ";", "import", "br", ".", "com", ".", "caelum", ".", "vraptor", ".", "jasperreports", ".", "formats", ".", "ExportFormats", ";", "@", "Component", "public", "class", "ReportFormatResolver", "{", "private", "final", "ExportFormats", "formats", ";", "private", "final", "FormatResolver", "formatResolver", ";", "public", "ReportFormatResolver", "(", "ExportFormats", "formats", ",", "FormatResolver", "formatResolver", ")", "{", "this", ".", "formats", "=", "formats", ";", "this", ".", "formatResolver", "=", "formatResolver", ";", "}", "public", "ExportFormat", "getExportFormat", "(", ")", "{", "return", "formats", ".", "byExtension", "(", "formatResolver", ".", "getAcceptFormat", "(", ")", ")", ";", "}", "public", "boolean", "doDownload", "(", ")", "{", "return", "!", "\"html\"", ".", "equals", "(", "formatResolver", ".", "getAcceptFormat", "(", ")", ")", ";", "}", "}", "</s>" ]
10,044
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "component", ".", "session", ".", "SessionBeanComponentDescription", ".", "SessionBeanType", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "Interceptor", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "interceptors", ".", "DispatcherInterceptor", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "interceptors", ".", "InvocationFilterInterceptor", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "interceptors", ".", "InvocationDirectInterceptor", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "interceptors", ".", "TransactionSecurityInterceptor", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "TransactionManager", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "InterfaceCompareHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientImpl", ".", "AEjbStatus", ";", "public", "class", "AcContainer", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "AcContainer", ".", "class", ")", ";", "final", "private", "String", "appName", ";", "final", "private", "String", "aejbName", ";", "final", "private", "String", "moduleName", ";", "final", "private", "String", "beanName", ";", "final", "private", "String", "distinctName", ";", "final", "private", "SessionBeanType", "beanType", ";", "private", "List", "<", "Interceptor", ">", "interceptors", ";", "private", "int", "running", ";", "private", "Set", "<", "String", ">", "originDepndencies", ";", "private", "Set", "<", "String", ">", "runtimeDepndencies", ";", "private", "Map", "<", "String", ",", "TransactionManager", ">", "transactionManagers", ";", "private", "Set", "<", "Class", "<", "?", ">", ">", "localViews", "=", "new", "HashSet", "<", "Class", "<", "?", ">", ">", "(", ")", ";", "private", "Set", "<", "Class", "<", "?", ">", ">", "remoteViews", "=", "new", "HashSet", "<", "Class", "<", "?", ">", ">", "(", ")", ";", "final", "private", "EvolutionStatistics", "evolutionStatistics", "=", "new", "EvolutionStatistics", "(", ")", ";", "public", "AcContainer", "(", "String", "appName", ",", "String", "moduleName", ",", "String", "beanName", ",", "String", "distinctName", ",", "SessionBeanType", "beanType", ")", "{", "this", ".", "appName", "=", "appName", "==", "null", "?", "\"\"", ":", "appName", ";", "this", ".", "moduleName", "=", "moduleName", ";", "this", ".", "beanName", "=", "beanName", ";", "this", ".", "aejbName", "=", "moduleName", "+", "\"/\"", "+", "beanName", ";", "this", ".", "distinctName", "=", "distinctName", ";", "this", ".", "beanType", "=", "beanType", ";", "}", "public", "String", "getAEJBName", "(", ")", "{", "return", "aejbName", ";", "}", "public", "String", "getBeanName", "(", ")", "{", "return", "beanName", ";", "}", "public", "String", "getDistinctName", "(", ")", "{", "return", "distinctName", ";", "}", "public", "SessionBeanType", "getBeanType", "(", ")", "{", "return", "beanType", ";", "}", "public", "String", "getApplicationName", "(", ")", "{", "return", "appName", ";", "}", "public", "String", "getModuleName", "(", ")", "{", "return", "moduleName", ";", "}", "public", "EvolutionStatistics", "getEvolutionStatistics", "(", ")", "{", "return", "evolutionStatistics", ";", "}", "public", "void", "start", "(", ")", "{", "interceptors", "=", "new", "ArrayList", "<", "Interceptor", ">", "(", ")", ";", "interceptors", ".", "add", "(", "new", "TransactionSecurityInterceptor", "(", "this", ")", ")", ";", "interceptors", ".", "add", "(", "new", "InvocationFilterInterceptor", "(", "this", ")", ")", ";", "interceptors", ".", "add", "(", "new", "InvocationDirectInterceptor", "(", "this", ")", ")", ";", "interceptors", ".", "add", "(", "new", "DispatcherInterceptor", "(", ")", ")", ";", "log", ".", "info", "(", "\"\"", "+", "appName", "+", "\"\"", "+", "moduleName", "+", "\"\"", "+", "distinctName", "+", "\"\"", "+", "beanName", "+", "\"\"", "+", "beanType", "+", "\"\"", "+", "aejbName", ")", ";", "}", "public", "void", "stop", "(", ")", "{", "evolutionStatistics", ".", "clear", "(", ")", ";", "interceptors", ".", "clear", "(", ")", ";", "originDepndencies", "=", "null", ";", "runtimeDepndencies", "=", "null", ";", "localViews", ".", "clear", "(", ")", ";", "remoteViews", ".", "clear", "(", ")", ";", "transactionManagers", "=", "null", ";", "log", ".", "info", "(", "\"\"", "+", "aejbName", ")", ";", "}", "public", "List", "<", "Interceptor", ">", "getInterceptors", "(", ")", "{", "return", "interceptors", ";", "}", "public", "void", "addOriginDepndencies", "(", "String", "aejbName", ")", "{", "if", "(", "originDepndencies", "==", "null", ")", "originDepndencies", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "originDepndencies", ".", "add", "(", "aejbName", ")", ";", "}", "public", "void", "changeRuntimeDependencies", "(", "String", "oldD", ",", "String", "newD", ")", "{", "if", "(", "runtimeDepndencies", "==", "null", ")", "runtimeDepndencies", "=", "new", "HashSet", "<", "String", ">", "(", "originDepndencies", ")", ";", "if", "(", "oldD", ".", "equals", "(", "newD", ")", "==", "false", ")", "{", "runtimeDepndencies", ".", "add", "(", "newD", ")", ";", "runtimeDepndencies", ".", "remove", "(", "oldD", ")", ";", "}", "}", "public", "void", "addRunning", "(", ")", "{", "synchronized", "(", "this", ")", "{", "running", "++", ";", "}", "}", "public", "void", "removeRunning", "(", ")", "{", "synchronized", "(", "this", ")", "{", "running", "--", ";", "}", "}", "public", "boolean", "isActive", "(", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "running", "<", "0", ")", "{", "log", ".", "warn", "(", "\"\"", "+", "getAEJBName", "(", ")", "+", "\"\"", "+", "running", ")", ";", "running", "=", "0", ";", "}", "return", "running", "!=", "0", ";", "}", "}", "public", "Set", "<", "String", ">", "getRuntimeDependencies", "(", ")", "{", "if", "(", "runtimeDepndencies", "==", "null", "&&", "originDepndencies", "==", "null", ")", "return", "null", ";", "if", "(", "runtimeDepndencies", "==", "null", ")", "runtimeDepndencies", "=", "new", "HashSet", "<", "String", ">", "(", "originDepndencies", ")", ";", "return", "runtimeDepndencies", ";", "}", "public", "void", "setTransactionManager", "(", "TransactionManager", "tm", ")", "{", "if", "(", "transactionManagers", "==", "null", ")", "transactionManagers", "=", "new", "HashMap", "<", "String", ",", "TransactionManager", ">", "(", ")", ";", "transactionManagers", ".", "put", "(", "tm", ".", "getName", "(", ")", ",", "tm", ")", ";", "}", "public", "TransactionManager", "getTransactionManager", "(", "String", "transactionName", ")", "{", "if", "(", "transactionManagers", "==", "null", ")", "return", "null", ";", "return", "transactionManagers", ".", "get", "(", "transactionName", ")", ";", "}", "public", "Set", "<", "Class", "<", "?", ">", ">", "getLocalView", "(", ")", "{", "return", "localViews", ";", "}", "public", "void", "setLocalView", "(", "Class", "<", "?", ">", "localView", ")", "{", "this", ".", "localViews", ".", "add", "(", "localView", ")", ";", "}", "public", "Set", "<", "Class", "<", "?", ">", ">", "getRemoteView", "(", ")", "{", "return", "remoteViews", ";", "}", "public", "void", "setRemoteView", "(", "Class", "<", "?", ">", "remoteView", ")", "{", "this", ".", "remoteViews", ".", "add", "(", "remoteView", ")", ";", "}", "public", "Class", "<", "?", ">", "getViewByClass", "(", "Class", "<", "?", ">", "viewClass", ")", "{", "if", "(", "viewClass", ".", "isInterface", "(", ")", "==", "false", ")", "return", "null", ";", "for", "(", "Class", "<", "?", ">", "remoteView", ":", "remoteViews", ")", "{", "if", "(", "InterfaceCompareHandler", ".", "equals", "(", "remoteView", ",", "viewClass", ")", ")", "return", "remoteView", ";", "}", "for", "(", "Class", "<", "?", ">", "localView", ":", "localViews", ")", "{", "if", "(", "InterfaceCompareHandler", ".", "equals", "(", "localView", ",", "viewClass", ")", ")", "return", "localView", ";", "}", "return", "null", ";", "}", "public", "class", "EvolutionStatistics", "{", "private", "Map", "<", "String", ",", "AEjbStatus", ">", "aejbStatus", "=", "new", "HashMap", "<", "String", ",", "AEjbStatus", ">", "(", ")", ";", "private", "Set", "<", "Listener", "<", "Map", "<", "String", ",", "AEjbStatus", ">", ">", ">", "aejbStatusListeners", "=", "new", "HashSet", "<", "Listener", "<", "Map", "<", "String", ",", "AEjbStatus", ">", ">", ">", "(", ")", ";", ";", "private", "Map", "<", "String", ",", "AcContainer", ">", "directionalMap", "=", "new", "HashMap", "<", "String", ",", "AcContainer", ">", "(", ")", ";", "private", "Map", "<", "String", ",", "String", ">", "tempMap", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "private", "Map", "<", "String", ",", "String", ">", "protocols", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "public", "void", "clear", "(", ")", "{", "aejbStatus", ".", "clear", "(", ")", ";", "aejbStatusListeners", ".", "clear", "(", ")", ";", "directionalMap", ".", "clear", "(", ")", ";", "protocols", ".", "clear", "(", ")", ";", "}", "public", "void", "setAEjbStatus", "(", "Map", "<", "String", ",", "AEjbStatus", ">", "aejbStatus", ")", "{", "this", ".", "aejbStatus", ".", "putAll", "(", "aejbStatus", ")", ";", "for", "(", "Listener", "<", "Map", "<", "String", ",", "AEjbStatus", ">", ">", "aejbStatusListener", ":", "aejbStatusListeners", ")", "{", "aejbStatusListener", ".", "transition", "(", "aejbStatus", ")", ";", "}", "}", "public", "void", "setAEjbStatus", "(", "String", "name", ",", "AEjbStatus", "aejbStatus", ")", "{", "this", ".", "aejbStatus", ".", "put", "(", "name", ",", "aejbStatus", ")", ";", "for", "(", "Listener", "<", "Map", "<", "String", ",", "AEjbStatus", ">", ">", "aejbStatusListener", ":", "aejbStatusListeners", ")", "{", "aejbStatusListener", ".", "transition", "(", "this", ".", "aejbStatus", ")", ";", "}", "}", "public", "Map", "<", "String", ",", "AEjbStatus", ">", "getAEjbStatus", "(", ")", "{", "return", "aejbStatus", ";", "}", "public", "void", "addStatusListener", "(", "Listener", "<", "Map", "<", "String", ",", "AEjbStatus", ">", ">", "aejbStatusListener", ")", "{", "aejbStatusListeners", ".", "add", "(", "aejbStatusListener", ")", ";", "}", "public", "Map", "<", "String", ",", "AcContainer", ">", "getDirectionalMap", "(", ")", "{", "return", "directionalMap", ";", "}", "public", "void", "addToDirectionalMap", "(", "String", "from", ",", "AcContainer", "toContainer", ")", "{", "if", "(", "(", "originDepndencies", "==", "null", "||", "originDepndencies", ".", "contains", "(", "from", ")", "==", "false", ")", "&&", "tempMap", ".", "containsKey", "(", "from", ")", "==", "false", ")", "return", ";", "if", "(", "originDepndencies", "!=", "null", "&&", "originDepndencies", ".", "contains", "(", "from", ")", ")", "{", "if", "(", "tempMap", ".", "containsValue", "(", "from", ")", "&&", "tempMap", ".", "containsKey", "(", "from", ")", "==", "false", ")", "return", ";", "directionalMap", ".", "put", "(", "from", ",", "toContainer", ")", ";", "tempMap", ".", "put", "(", "toContainer", ".", "getAEJBName", "(", ")", ",", "from", ")", ";", "if", "(", "tempMap", ".", "containsKey", "(", "from", ")", ")", "tempMap", ".", "remove", "(", "from", ")", ";", "}", "else", "if", "(", "tempMap", ".", "containsKey", "(", "from", ")", ")", "{", "String", "dependency", "=", "tempMap", ".", "remove", "(", "from", ")", ";", "directionalMap", ".", "put", "(", "dependency", ",", "toContainer", ")", ";", "tempMap", ".", "put", "(", "toContainer", ".", "getAEJBName", "(", ")", ",", "dependency", ")", ";", "}", "if", "(", "directionalMap", ".", "size", "(", ")", "!=", "tempMap", ".", "size", "(", ")", ")", "log", ".", "info", "(", "\"\"", ")", ";", "}", "public", "Map", "<", "String", ",", "String", ">", "getProtocols", "(", ")", "{", "return", "protocols", ";", "}", "public", "void", "addProtocol", "(", "String", "name", ",", "String", "protocol", ")", "{", "protocols", ".", "put", "(", "name", ",", "protocol", ")", ";", "}", "public", "String", "getProtocolByBeanName", "(", "String", "name", ")", "{", "return", "protocols", ".", "get", "(", "name", ")", ";", "}", "}", "}", "</s>" ]
10,045
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "interceptors", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "Interceptor", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "InterceptorContext", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "TransactionManager", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "DuService", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "protocols", ".", "Protocol", ";", "public", "class", "TransactionSecurityInterceptor", "implements", "Interceptor", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "TransactionSecurityInterceptor", ".", "class", ")", ";", "private", "final", "AcContainer", "container", ";", "public", "TransactionSecurityInterceptor", "(", "AcContainer", "container", ")", "{", "this", ".", "container", "=", "container", ";", "}", "@", "Override", "public", "Object", "processInvocation", "(", "InterceptorContext", "context", ")", "throws", "Exception", "{", "log", ".", "debug", "(", "\"\"", ")", ";", "Object", "[", "]", "params", "=", "context", ".", "getParameters", "(", ")", ";", "if", "(", "params", "==", "null", "||", "!", "(", "params", "[", "0", "]", "instanceof", "String", ")", ")", "{", "return", "context", ".", "proceed", "(", ")", ";", "}", "String", "param0", "=", "(", "String", ")", "params", "[", "0", "]", ";", "String", "[", "]", "splits", "=", "param0", ".", "split", "(", "\"/\"", ")", ";", "if", "(", "splits", ".", "length", "!=", "2", ")", "{", "return", "context", ".", "proceed", "(", ")", ";", "}", "final", "String", "transactionName", "=", "splits", "[", "0", "]", ";", "final", "String", "objectId", "=", "splits", "[", "1", "]", ";", "final", "String", "targetName", "=", "(", "String", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"aejbName\"", ")", ";", "final", "String", "protocol", "=", "container", ".", "getEvolutionStatistics", "(", ")", ".", "getProtocolByBeanName", "(", "targetName", ")", ";", "log", ".", "debug", "(", "\"\"", "+", "transactionName", "+", "\",objectId", "=", "\"", "+", "objectId", "+", "\",protocol", "=", "\"", "+", "protocol", ")", ";", "if", "(", "protocol", "==", "null", "||", "isValidProtocolName", "(", "protocol", ")", "==", "false", ")", "return", "context", ".", "proceed", "(", ")", ";", "boolean", "ts", "=", "checkTransactionSecurity", "(", "targetName", ",", "objectId", ",", "container", ".", "getTransactionManager", "(", "transactionName", ")", ",", "protocol", ")", ";", "log", ".", "debug", "(", "\"\"", "+", "ts", ")", ";", "context", ".", "putPrivateData", "(", "Boolean", ".", "class", ",", "ts", ")", ";", "log", ".", "debug", "(", "\"\"", ")", ";", "return", "context", ".", "proceed", "(", ")", ";", "}", "private", "boolean", "checkTransactionSecurity", "(", "String", "targetName", ",", "String", "objectId", ",", "TransactionManager", "transactionManager", ",", "String", "protocolName", ")", "{", "Protocol", "protocol", "=", "DuService", ".", "getProtocol", "(", "protocolName", ")", ";", "if", "(", "protocol", "!=", "null", ")", "{", "return", "protocol", ".", "checkTransactionSecurity", "(", "targetName", ",", "objectId", ",", "transactionManager", ")", ";", "}", "return", "false", ";", "}", "private", "boolean", "isValidProtocolName", "(", "String", "protocol", ")", "{", "return", "protocol", ".", "equals", "(", "\"tranquility\"", ")", "||", "protocol", ".", "equals", "(", "\"quiescence\"", ")", ";", "}", "}", "</s>" ]
10,046
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "interceptors", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Proxy", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "ejb", ".", "EJBHome", ";", "import", "javax", ".", "ejb", ".", "EJBLocalHome", ";", "import", "org", ".", "jboss", ".", "ejb", ".", "client", ".", "EJBClient", ";", "import", "org", ".", "jboss", ".", "ejb", ".", "client", ".", "EJBHomeLocator", ";", "import", "org", ".", "jboss", ".", "ejb", ".", "client", ".", "EJBLocator", ";", "import", "org", ".", "jboss", ".", "ejb", ".", "client", ".", "StatelessEJBLocator", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "Interceptor", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "InterceptorContext", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "public", "class", "DispatcherInterceptor", "implements", "Interceptor", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "DispatcherInterceptor", ".", "class", ")", ";", "private", "Map", "<", "String", ",", "Object", ">", "contextData", ";", "private", "Map", "<", "String", ",", "Object", ">", "proxyMap", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", ";", "@", "Override", "public", "Object", "processInvocation", "(", "InterceptorContext", "context", ")", "throws", "Exception", "{", "log", ".", "info", "(", "\"\"", ")", ";", "contextData", "=", "context", ".", "getContextData", "(", ")", ";", "String", "appName", "=", "(", "String", ")", "contextData", ".", "get", "(", "\"appName\"", ")", ";", "String", "moduleName", "=", "(", "String", ")", "contextData", ".", "get", "(", "\"moduleName\"", ")", ";", "String", "distinctName", "=", "(", "String", ")", "contextData", ".", "get", "(", "\"distinctName\"", ")", ";", "String", "beanName", "=", "(", "String", ")", "contextData", ".", "get", "(", "\"beanName\"", ")", ";", "Class", "<", "?", ">", "viewClass", "=", "(", "Class", "<", "?", ">", ")", "contextData", ".", "get", "(", "\"viewClass\"", ")", ";", "boolean", "stateful", "=", "(", "Boolean", ")", "contextData", ".", "get", "(", "\"stateful\"", ")", ";", "return", "dispatch", "(", "context", ",", "appName", ",", "moduleName", ",", "distinctName", ",", "beanName", ",", "viewClass", ",", "stateful", ")", ";", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", ",", "\"\"", "}", ")", "private", "Object", "dispatch", "(", "InterceptorContext", "context", ",", "String", "appName", ",", "String", "moduleName", ",", "String", "distinctName", ",", "String", "beanName", ",", "Class", "<", "?", ">", "viewClass", ",", "boolean", "stateful", ")", "{", "EJBLocator", "ejbLocator", "=", "null", ";", "Object", "result", "=", "null", ";", "final", "String", "proxyName", "=", "\"Proxy:\"", "+", "appName", "+", "\"/\"", "+", "moduleName", "+", "\"/\"", "+", "beanName", "+", "\"/\"", "+", "distinctName", "+", "\"/\"", "+", "viewClass", "+", "\"/\"", "+", "stateful", ";", "final", "String", "aejbName", "=", "moduleName", "+", "\"/\"", "+", "beanName", ";", "log", ".", "info", "(", "proxyName", ")", ";", "if", "(", "proxyMap", ".", "containsKey", "(", "proxyName", ")", ")", "{", "final", "Proxy", "proxy", "=", "(", "Proxy", ")", "proxyMap", ".", "get", "(", "proxyName", ")", ";", "try", "{", "AEjbUtilities", ".", "getContainer", "(", "aejbName", ")", ".", "addRunning", "(", ")", ";", "result", "=", "proxy", ".", "getInvocationHandler", "(", "proxy", ")", ".", "invoke", "(", "proxy", ",", "context", ".", "getMethod", "(", ")", ",", "context", ".", "getParameters", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "AEjbUtilities", ".", "getContainer", "(", "aejbName", ")", ".", "removeRunning", "(", ")", ";", "}", "log", ".", "info", "(", "\"\"", ")", ";", "return", "result", ";", "}", "if", "(", "EJBHome", ".", "class", ".", "isAssignableFrom", "(", "viewClass", ")", "||", "EJBLocalHome", ".", "class", ".", "isAssignableFrom", "(", "viewClass", ")", ")", "{", "ejbLocator", "=", "new", "EJBHomeLocator", "(", "viewClass", ",", "appName", ",", "moduleName", ",", "beanName", ",", "distinctName", ")", ";", "}", "else", "if", "(", "stateful", ")", "{", "try", "{", "ejbLocator", "=", "EJBClient", ".", "createSession", "(", "viewClass", ",", "appName", ",", "moduleName", ",", "beanName", ",", "distinctName", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "else", "{", "ejbLocator", "=", "new", "StatelessEJBLocator", "(", "viewClass", ",", "appName", ",", "moduleName", ",", "beanName", ",", "distinctName", ")", ";", "}", "final", "Proxy", "proxy", "=", "(", "Proxy", ")", "EJBClient", ".", "createProxy", "(", "ejbLocator", ")", ";", "try", "{", "AEjbUtilities", ".", "getContainer", "(", "aejbName", ")", ".", "addRunning", "(", ")", ";", "result", "=", "proxy", ".", "getInvocationHandler", "(", "proxy", ")", ".", "invoke", "(", "proxy", ",", "context", ".", "getMethod", "(", ")", ",", "context", ".", "getParameters", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "AEjbUtilities", ".", "getContainer", "(", "aejbName", ")", ".", "removeRunning", "(", ")", ";", "}", "proxyMap", ".", "put", "(", "proxyName", ",", "proxy", ")", ";", "log", ".", "info", "(", "\"\"", ")", ";", "return", "result", ";", "}", "}", "</s>" ]
10,047
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "interceptors", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "component", ".", "session", ".", "SessionBeanComponentDescription", ".", "SessionBeanType", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "Interceptor", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "InterceptorContext", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "public", "class", "InvocationDirectInterceptor", "implements", "Interceptor", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "InvocationDirectInterceptor", ".", "class", ")", ";", "private", "final", "AcContainer", "container", ";", "private", "InvocationContext", "lastInvocation", ";", "public", "InvocationDirectInterceptor", "(", "AcContainer", "container", ")", "{", "this", ".", "container", "=", "container", ";", "}", "@", "Override", "public", "Object", "processInvocation", "(", "InterceptorContext", "context", ")", "throws", "Exception", "{", "log", ".", "info", "(", "\"\"", ")", ";", "Map", "<", "String", ",", "Object", ">", "contextData", "=", "context", ".", "getContextData", "(", ")", ";", "final", "String", "aejbName", "=", "(", "String", ")", "contextData", ".", "get", "(", "\"aejbName\"", ")", ";", "AcContainer", "con", "=", "container", ".", "getEvolutionStatistics", "(", ")", ".", "getDirectionalMap", "(", ")", ".", "get", "(", "aejbName", ")", ";", "if", "(", "lastInvocation", "!=", "null", ")", "{", "contextData", ".", "put", "(", "\"appName\"", ",", "lastInvocation", ".", "appName", "(", ")", ")", ";", "contextData", ".", "put", "(", "\"moduleName\"", ",", "lastInvocation", ".", "moduleName", "(", ")", ")", ";", "contextData", ".", "put", "(", "\"beanName\"", ",", "lastInvocation", ".", "beanName", "(", ")", ")", ";", "contextData", ".", "put", "(", "\"distinctName\"", ",", "lastInvocation", ".", "distinctName", "(", ")", ")", ";", "contextData", ".", "put", "(", "\"viewClass\"", ",", "lastInvocation", ".", "viewClass", "(", ")", ")", ";", "contextData", ".", "put", "(", "\"stateful\"", ",", "lastInvocation", ".", "stateful", "(", ")", ")", ";", "}", "if", "(", "con", "!=", "null", ")", "{", "if", "(", "context", ".", "getPrivateData", "(", "Boolean", ".", "class", ")", "==", "null", "||", "context", ".", "getPrivateData", "(", "Boolean", ".", "class", ")", "==", "false", ")", "return", "context", ".", "proceed", "(", ")", ";", "contextData", ".", "put", "(", "\"appName\"", ",", "con", ".", "getApplicationName", "(", ")", ")", ";", "contextData", ".", "put", "(", "\"moduleName\"", ",", "con", ".", "getModuleName", "(", ")", ")", ";", "contextData", ".", "put", "(", "\"beanName\"", ",", "con", ".", "getBeanName", "(", ")", ")", ";", "contextData", ".", "put", "(", "\"distinctName\"", ",", "con", ".", "getDistinctName", "(", ")", ")", ";", "contextData", ".", "put", "(", "\"viewClass\"", ",", "con", ".", "getViewByClass", "(", "(", "Class", "<", "?", ">", ")", "contextData", ".", "get", "(", "\"viewClass\"", ")", ")", ")", ";", "contextData", ".", "put", "(", "\"stateful\"", ",", "con", ".", "getBeanType", "(", ")", "==", "SessionBeanType", ".", "STATEFUL", ")", ";", "lastInvocation", "=", "new", "InvocationContext", "(", "con", ".", "getApplicationName", "(", ")", ",", "con", ".", "getModuleName", "(", ")", ",", "con", ".", "getBeanName", "(", ")", ",", "con", ".", "getDistinctName", "(", ")", ",", "con", ".", "getViewByClass", "(", "(", "Class", "<", "?", ">", ")", "contextData", ".", "get", "(", "\"viewClass\"", ")", ")", ",", "con", ".", "getBeanType", "(", ")", "==", "SessionBeanType", ".", "STATEFUL", ")", ";", "}", "log", ".", "info", "(", "\"\"", ")", ";", "return", "context", ".", "proceed", "(", ")", ";", "}", "private", "class", "InvocationContext", "{", "private", "String", "$appName", ";", "private", "String", "$moduleName", ";", "private", "String", "$beanName", ";", "private", "String", "$distinctName", ";", "private", "Class", "<", "?", ">", "$viewClass", ";", "private", "boolean", "$stateful", ";", "public", "InvocationContext", "(", "String", "$appName", ",", "String", "$moduleName", ",", "String", "$beanName", ",", "String", "$distinctName", ",", "Class", "<", "?", ">", "$viewClass", ",", "boolean", "$stateful", ")", "{", "this", ".", "$appName", "=", "$appName", ";", "this", ".", "$moduleName", "=", "$moduleName", ";", "this", ".", "$beanName", "=", "$beanName", ";", "this", ".", "$distinctName", "=", "$distinctName", ";", "this", ".", "$viewClass", "=", "$viewClass", ";", "this", ".", "$stateful", "=", "$stateful", ";", "}", "String", "appName", "(", ")", "{", "return", "$appName", ";", "}", "String", "moduleName", "(", ")", "{", "return", "$moduleName", ";", "}", "String", "beanName", "(", ")", "{", "return", "$beanName", ";", "}", "String", "distinctName", "(", ")", "{", "return", "$distinctName", ";", "}", "Class", "<", "?", ">", "viewClass", "(", ")", "{", "return", "$viewClass", ";", "}", "boolean", "stateful", "(", ")", "{", "return", "$stateful", ";", "}", "}", "}", "</s>" ]
10,048
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "interceptors", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "Interceptor", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "InterceptorContext", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbStatusListener", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientImpl", ".", "AEjbStatus", ";", "public", "class", "InvocationFilterInterceptor", "implements", "Interceptor", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "InvocationFilterInterceptor", ".", "class", ")", ";", "private", "final", "AcContainer", "container", ";", "private", "final", "InvocationManager", "manager", ";", "public", "InvocationFilterInterceptor", "(", "AcContainer", "container", ")", "{", "this", ".", "container", "=", "container", ";", "manager", "=", "new", "InvocationManager", "(", ")", ";", "this", ".", "container", ".", "getEvolutionStatistics", "(", ")", ".", "addStatusListener", "(", "new", "AEjbStatusListener", "(", "manager", ")", ")", ";", "}", "@", "Override", "public", "Object", "processInvocation", "(", "InterceptorContext", "context", ")", "throws", "Exception", "{", "log", ".", "info", "(", "\"\"", ")", ";", "final", "String", "targetAEjbName", "=", "(", "String", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"aejbName\"", ")", ";", "final", "Map", "<", "String", ",", "AEjbStatus", ">", "status", "=", "container", ".", "getEvolutionStatistics", "(", ")", ".", "getAEjbStatus", "(", ")", ";", "if", "(", "status", "!=", "null", "&&", "AEjbStatus", ".", "BLOCKING", "==", "status", ".", "get", "(", "targetAEjbName", ")", ")", "{", "manager", ".", "blockInvocation", "(", "context", ",", "targetAEjbName", ")", ";", "}", "log", ".", "info", "(", "\"\"", ")", ";", "return", "context", ".", "proceed", "(", ")", ";", "}", "public", "class", "InvocationManager", "{", "private", "InterceptorContext", "context", ";", "private", "String", "targetName", ";", "public", "void", "resumeInvocation", "(", ")", "{", "if", "(", "context", "!=", "null", ")", "{", "synchronized", "(", "context", ")", "{", "context", ".", "notify", "(", ")", ";", "}", "this", ".", "context", "=", "null", ";", "}", "}", "public", "void", "blockInvocation", "(", "InterceptorContext", "context", ",", "String", "targetName", ")", "{", "this", ".", "context", "=", "context", ";", "this", ".", "targetName", "=", "targetName", ";", "synchronized", "(", "this", ".", "context", ")", "{", "try", "{", "this", ".", "context", ".", "wait", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "public", "String", "getTargetName", "(", ")", "{", "return", "targetName", ";", "}", "}", "}", "</s>" ]
10,049
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "interceptors", ".", "InvocationFilterInterceptor", ".", "InvocationManager", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientImpl", ".", "AEjbStatus", ";", "public", "class", "AEjbStatusListener", "implements", "Listener", "<", "Map", "<", "String", ",", "AEjbStatus", ">", ">", "{", "private", "final", "InvocationManager", "invocationManager", ";", "public", "AEjbStatusListener", "(", "InvocationManager", "invocationManager", ")", "{", "this", ".", "invocationManager", "=", "invocationManager", ";", "}", "@", "Override", "public", "void", "transition", "(", "Map", "<", "String", ",", "AEjbStatus", ">", "context", ")", "{", "if", "(", "invocationManager", "!=", "null", "&&", "context", "!=", "null", "&&", "!", "context", ".", "isEmpty", "(", ")", ")", "{", "final", "String", "targetName", "=", "invocationManager", ".", "getTargetName", "(", ")", ";", "if", "(", "targetName", "!=", "null", "&&", "AEjbStatus", ".", "RESUMING", "==", "context", ".", "get", "(", "targetName", ")", ")", "{", "invocationManager", ".", "resumeInvocation", "(", ")", ";", "}", "}", "}", "}", "</s>" ]
10,050
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Map", ".", "Entry", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "Service", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceName", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StartContext", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StartException", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StopContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientImpl", ".", "AEjbStatus", ";", "public", "class", "AEjbUtilities", "implements", "Service", "<", "AEjbUtilities", ">", "{", "public", "static", "final", "ServiceName", "SERVICE_NAME", "=", "ServiceName", ".", "JBOSS", ".", "append", "(", "\"aejb\"", ",", "\"utilities\"", ")", ";", "static", "Map", "<", "String", ",", "Map", "<", "String", ",", "AcContainer", ">", ">", "DeploymentUnits", "=", "new", "HashMap", "<", "String", ",", "Map", "<", "String", ",", "AcContainer", ">", ">", "(", ")", ";", "public", "static", "boolean", "registerAEJB", "(", "String", "unitName", ",", "AcContainer", "container", ")", "{", "if", "(", "DeploymentUnits", ".", "containsKey", "(", "unitName", ")", ")", "{", "AcContainer", "accon", "=", "DeploymentUnits", ".", "get", "(", "unitName", ")", ".", "put", "(", "container", ".", "getAEJBName", "(", ")", ",", "container", ")", ";", "if", "(", "accon", "!=", "null", ")", "return", "false", ";", "}", "else", "{", "Map", "<", "String", ",", "AcContainer", ">", "aejbs", "=", "new", "HashMap", "<", "String", ",", "AcContainer", ">", "(", ")", ";", "aejbs", ".", "put", "(", "container", ".", "getAEJBName", "(", ")", ",", "container", ")", ";", "DeploymentUnits", ".", "put", "(", "unitName", ",", "aejbs", ")", ";", "}", "container", ".", "start", "(", ")", ";", "return", "true", ";", "}", "public", "static", "void", "removeDeploymentUnit", "(", "String", "unitName", ")", "{", "if", "(", "DeploymentUnits", ".", "containsKey", "(", "unitName", ")", ")", "{", "Map", "<", "String", ",", "AcContainer", ">", "aejbs", "=", "DeploymentUnits", ".", "get", "(", "unitName", ")", ";", "Iterator", "<", "Entry", "<", "String", ",", "AcContainer", ">", ">", "iterator", "=", "aejbs", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "iterator", ".", "next", "(", ")", ".", "getValue", "(", ")", ".", "stop", "(", ")", ";", "}", "aejbs", "=", "null", ";", "DeploymentUnits", ".", "remove", "(", "unitName", ")", ";", "}", "}", "public", "static", "Map", "<", "String", ",", "Map", "<", "String", ",", "AcContainer", ">", ">", "getAllAEjbsInfo", "(", ")", "{", "return", "DeploymentUnits", ";", "}", "public", "void", "setAEjbStatus", "(", "Map", "<", "String", ",", "AEjbStatus", ">", "aejbStatus", ")", "{", "for", "(", "Entry", "<", "String", ",", "Map", "<", "String", ",", "AcContainer", ">", ">", "entry", ":", "DeploymentUnits", ".", "entrySet", "(", ")", ")", "{", "Map", "<", "String", ",", "AcContainer", ">", "mapValue", "=", "entry", ".", "getValue", "(", ")", ";", "for", "(", "Entry", "<", "String", ",", "AcContainer", ">", "en", ":", "mapValue", ".", "entrySet", "(", ")", ")", "{", "Map", "<", "String", ",", "AEjbStatus", ">", "status", "=", "new", "HashMap", "<", "String", ",", "AEjbStatus", ">", "(", "aejbStatus", ")", ";", "en", ".", "getValue", "(", ")", ".", "getEvolutionStatistics", "(", ")", ".", "setAEjbStatus", "(", "status", ")", ";", "}", "}", "}", "public", "static", "AcContainer", "getContainer", "(", "String", "aejbName", ")", "{", "for", "(", "Entry", "<", "String", ",", "Map", "<", "String", ",", "AcContainer", ">", ">", "entry", ":", "DeploymentUnits", ".", "entrySet", "(", ")", ")", "{", "Map", "<", "String", ",", "AcContainer", ">", "mapValue", "=", "entry", ".", "getValue", "(", ")", ";", "for", "(", "Entry", "<", "String", ",", "AcContainer", ">", "en", ":", "mapValue", ".", "entrySet", "(", ")", ")", "{", "if", "(", "aejbName", ".", "equals", "(", "en", ".", "getValue", "(", ")", ".", "getAEJBName", "(", ")", ")", ")", "return", "en", ".", "getValue", "(", ")", ";", "}", "}", "return", "null", ";", "}", "public", "List", "<", "AcContainer", ">", "getAllContainers", "(", ")", "{", "List", "<", "AcContainer", ">", "containers", "=", "new", "ArrayList", "<", "AcContainer", ">", "(", ")", ";", "for", "(", "Entry", "<", "String", ",", "Map", "<", "String", ",", "AcContainer", ">", ">", "entry", ":", "DeploymentUnits", ".", "entrySet", "(", ")", ")", "{", "Map", "<", "String", ",", "AcContainer", ">", "mapValue", "=", "entry", ".", "getValue", "(", ")", ";", "for", "(", "Entry", "<", "String", ",", "AcContainer", ">", "en", ":", "mapValue", ".", "entrySet", "(", ")", ")", "{", "containers", ".", "add", "(", "en", ".", "getValue", "(", ")", ")", ";", "}", "}", "return", "containers", ";", "}", "@", "Override", "public", "AEjbUtilities", "getValue", "(", ")", "throws", "IllegalStateException", ",", "IllegalArgumentException", "{", "return", "this", ";", "}", "@", "Override", "public", "void", "start", "(", "StartContext", "context", ")", "throws", "StartException", "{", "}", "@", "Override", "public", "void", "stop", "(", "StopContext", "context", ")", "{", "}", "}", "</s>" ]
10,051
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ";", "public", "interface", "Listener", "<", "T", ">", "{", "void", "transition", "(", "T", "transitionContext", ")", ";", "}", "</s>" ]
10,052
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Constructor", ";", "import", "java", ".", "lang", ".", "reflect", ".", "InvocationHandler", ";", "import", "java", ".", "lang", ".", "reflect", ".", "InvocationTargetException", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Proxy", ";", "import", "java", ".", "security", ".", "AccessController", ";", "import", "java", ".", "security", ".", "PrivilegedAction", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ManagedReference", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ManagedReferenceFactory", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ValueManagedReference", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "msc", ".", "value", ".", "ImmediateValue", ";", "import", "org", ".", "jboss", ".", "msc", ".", "value", ".", "Value", ";", "public", "class", "ContainerManagedReferenceFactory", "implements", "ManagedReferenceFactory", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "ContainerManagedReferenceFactory", ".", "class", ")", ";", "private", "final", "String", "appName", ";", "private", "final", "String", "moduleName", ";", "private", "final", "String", "distinctName", ";", "private", "final", "String", "beanName", ";", "private", "final", "String", "viewClass", ";", "private", "final", "boolean", "stateful", ";", "private", "final", "Value", "<", "ClassLoader", ">", "viewClassLoader", ";", "private", "final", "AcContainer", "container", ";", "public", "ContainerManagedReferenceFactory", "(", "final", "String", "appName", ",", "final", "String", "moduleName", ",", "final", "String", "distinctName", ",", "final", "String", "beanName", ",", "final", "String", "viewClass", ",", "boolean", "stateful", ",", "AcContainer", "container", ")", "{", "this", "(", "appName", ",", "moduleName", ",", "distinctName", ",", "beanName", ",", "viewClass", ",", "null", ",", "stateful", ",", "container", ")", ";", "}", "public", "ContainerManagedReferenceFactory", "(", "final", "String", "appName", ",", "final", "String", "moduleName", ",", "final", "String", "distinctName", ",", "final", "String", "beanName", ",", "final", "String", "viewClass", ",", "final", "Value", "<", "ClassLoader", ">", "viewClassLoader", ",", "boolean", "stateful", ",", "AcContainer", "container", ")", "{", "this", ".", "appName", "=", "appName", "==", "null", "?", "\"\"", ":", "appName", ";", "this", ".", "moduleName", "=", "moduleName", ";", "this", ".", "distinctName", "=", "distinctName", ";", "this", ".", "beanName", "=", "beanName", ";", "this", ".", "viewClass", "=", "viewClass", ";", "this", ".", "viewClassLoader", "=", "viewClassLoader", ";", "this", ".", "stateful", "=", "stateful", ";", "this", ".", "container", "=", "container", ";", "this", ".", "container", ".", "addOriginDepndencies", "(", "moduleName", "+", "'/'", "+", "beanName", ")", ";", "}", "@", "Override", "public", "ManagedReference", "getReference", "(", ")", "{", "Class", "<", "?", ">", "viewClass", ";", "try", "{", "viewClass", "=", "Class", ".", "forName", "(", "this", ".", "viewClass", ",", "false", ",", "getContextClassLoader", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "if", "(", "viewClassLoader", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", "+", "beanName", ")", ";", "}", "try", "{", "viewClass", "=", "Class", ".", "forName", "(", "this", ".", "viewClass", ",", "false", ",", "viewClassLoader", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ce", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", "+", "beanName", ")", ";", "}", "}", "Class", "<", "?", ">", "proxyClass", "=", "Proxy", ".", "getProxyClass", "(", "viewClass", ".", "getClassLoader", "(", ")", ",", "viewClass", ")", ".", "asSubclass", "(", "viewClass", ")", ";", "Constructor", "<", "?", ">", "proxyConstructor", "=", "null", ";", "Object", "proxy", "=", "null", ";", "try", "{", "proxyConstructor", "=", "proxyClass", ".", "getConstructor", "(", "InvocationHandler", ".", "class", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "NoSuchMethodError", "(", "\"\"", ")", ";", "}", "try", "{", "proxy", "=", "proxyConstructor", ".", "newInstance", "(", "new", "ContainerInvocationHandler", "(", "appName", ",", "moduleName", ",", "distinctName", ",", "beanName", ",", "viewClass", ",", "stateful", ",", "container", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "new", "ValueManagedReference", "(", "new", "ImmediateValue", "<", "Object", ">", "(", "proxy", ")", ")", ";", "}", "public", "static", "ClassLoader", "getContextClassLoader", "(", ")", "{", "if", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "{", "return", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "}", "else", "{", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "ClassLoader", ">", "(", ")", "{", "public", "ClassLoader", "run", "(", ")", "{", "return", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "}", "}", ")", ";", "}", "}", "}", "</s>" ]
10,053
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ";", "import", "java", ".", "lang", ".", "reflect", ".", "InvocationHandler", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "Interceptor", ";", "import", "org", ".", "jboss", ".", "invocation", ".", "InterceptorContext", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "public", "class", "ContainerInvocationHandler", "implements", "InvocationHandler", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "ContainerInvocationHandler", ".", "class", ")", ";", "private", "final", "Map", "<", "String", ",", "Object", ">", "contextData", ";", "private", "final", "List", "<", "Interceptor", ">", "interceptors", ";", "public", "ContainerInvocationHandler", "(", "final", "String", "appName", ",", "final", "String", "moduleName", ",", "final", "String", "distinctName", ",", "final", "String", "beanName", ",", "final", "Class", "<", "?", ">", "viewClass", ",", "boolean", "stateful", ",", "AcContainer", "container", ")", "{", "final", "String", "aejbName", "=", "moduleName", "+", "\"/\"", "+", "beanName", ";", "contextData", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "contextData", ".", "put", "(", "\"appName\"", ",", "appName", ")", ";", "contextData", ".", "put", "(", "\"moduleName\"", ",", "moduleName", ")", ";", "contextData", ".", "put", "(", "\"distinctName\"", ",", "distinctName", ")", ";", "contextData", ".", "put", "(", "\"beanName\"", ",", "beanName", ")", ";", "contextData", ".", "put", "(", "\"viewClass\"", ",", "viewClass", ")", ";", "contextData", ".", "put", "(", "\"stateful\"", ",", "stateful", ")", ";", "contextData", ".", "put", "(", "\"aejbName\"", ",", "aejbName", ")", ";", "this", ".", "interceptors", "=", "container", ".", "getInterceptors", "(", ")", ";", "}", "@", "Override", "public", "Object", "invoke", "(", "Object", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "final", "InterceptorContext", "context", "=", "new", "InterceptorContext", "(", ")", ";", "context", ".", "setInterceptors", "(", "interceptors", ")", ";", "context", ".", "putPrivateData", "(", "Object", ".", "class", ",", "proxy", ")", ";", "context", ".", "setParameters", "(", "args", ")", ";", "context", ".", "setMethod", "(", "method", ")", ";", "context", ".", "setContextData", "(", "contextData", ")", ";", "return", "context", ".", "proceed", "(", ")", ";", "}", "}", "</s>" ]
10,054
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "subsystem", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "AbstractBoottimeAddStepHandler", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "OperationContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "OperationFailedException", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "ServiceVerificationHandler", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "AbstractDeploymentChainStep", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "DeploymentProcessorTarget", ";", "import", "org", ".", "jboss", ".", "dmr", ".", "ModelNode", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceController", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceController", ".", "Mode", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceName", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "AEjbLogger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "AEjbInjectionAnnotationProcessor", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "AnnotatedAEJBComponentDescriptionProcessor", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "BusinessViewProcessor", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "SubsystemDeploymentProcessor", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "TransactionAnnotationProcessor", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "DuService", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientImpl", ";", "public", "class", "AEJBSubsystemAdd", "extends", "AbstractBoottimeAddStepHandler", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "AEJBSubsystemAdd", ".", "class", ")", ";", "static", "final", "AEJBSubsystemAdd", "INSTANCE", "=", "new", "AEJBSubsystemAdd", "(", ")", ";", "static", "final", "String", "JAR_FILE_EXTENSION", "=", "\"jar\"", ";", "private", "AEJBSubsystemAdd", "(", ")", "{", "}", "@", "Override", "protected", "void", "performBoottime", "(", "OperationContext", "context", ",", "ModelNode", "operation", ",", "ModelNode", "model", ",", "ServiceVerificationHandler", "verificationHandler", ",", "List", "<", "ServiceController", "<", "?", ">", ">", "newControllers", ")", "throws", "OperationFailedException", "{", "AEjbLogger", ".", "ROOT_LOGGER", ".", "activatingAEjbSubsystem", "(", ")", ";", "context", ".", "addStep", "(", "new", "AbstractDeploymentChainStep", "(", ")", "{", "public", "void", "execute", "(", "DeploymentProcessorTarget", "processorTarget", ")", "{", "processorTarget", ".", "addDeploymentProcessor", "(", "SubsystemDeploymentProcessor", ".", "PHASE", ",", "SubsystemDeploymentProcessor", ".", "PRIORITY", ",", "new", "SubsystemDeploymentProcessor", "(", ")", ")", ";", "processorTarget", ".", "addDeploymentProcessor", "(", "AnnotatedAEJBComponentDescriptionProcessor", ".", "PHASE", ",", "AnnotatedAEJBComponentDescriptionProcessor", ".", "PRIORITY", ",", "new", "AnnotatedAEJBComponentDescriptionProcessor", "(", ")", ")", ";", "processorTarget", ".", "addDeploymentProcessor", "(", "AEjbInjectionAnnotationProcessor", ".", "PHASE", ",", "AEjbInjectionAnnotationProcessor", ".", "PRIORITY", ",", "new", "AEjbInjectionAnnotationProcessor", "(", ")", ")", ";", "processorTarget", ".", "addDeploymentProcessor", "(", "TransactionAnnotationProcessor", ".", "PHASE", ",", "TransactionAnnotationProcessor", ".", "PRIORITY", ",", "new", "TransactionAnnotationProcessor", "(", ")", ")", ";", "processorTarget", ".", "addDeploymentProcessor", "(", "BusinessViewProcessor", ".", "POST_MODULE", ",", "BusinessViewProcessor", ".", "PRIORITY", ",", "new", "BusinessViewProcessor", "(", ")", ")", ";", "}", "}", ",", "OperationContext", ".", "Stage", ".", "RUNTIME", ")", ";", "TrackerService", "service", "=", "new", "TrackerService", "(", "JAR_FILE_EXTENSION", ",", "180000", ")", ";", "ServiceName", "name", "=", "TrackerService", ".", "createServiceName", "(", "JAR_FILE_EXTENSION", ")", ";", "ServiceController", "<", "TrackerService", ">", "controller", "=", "context", ".", "getServiceTarget", "(", ")", ".", "addService", "(", "name", ",", "service", ")", ".", "addListener", "(", "verificationHandler", ")", ".", "setInitialMode", "(", "Mode", ".", "ACTIVE", ")", ".", "install", "(", ")", ";", "newControllers", ".", "add", "(", "controller", ")", ";", "final", "AEjbUtilities", "aejbUtilities", "=", "new", "AEjbUtilities", "(", ")", ";", "newControllers", ".", "add", "(", "context", ".", "getServiceTarget", "(", ")", ".", "addService", "(", "AEjbUtilities", ".", "SERVICE_NAME", ",", "aejbUtilities", ")", ".", "setInitialMode", "(", "ServiceController", ".", "Mode", ".", "ACTIVE", ")", ".", "addListener", "(", "verificationHandler", ")", ".", "install", "(", ")", ")", ";", "final", "DuService", "duService", "=", "new", "DuService", "(", ")", ";", "newControllers", ".", "add", "(", "context", ".", "getServiceTarget", "(", ")", ".", "addService", "(", "DuService", ".", "SERVICE_NAME", ",", "duService", ")", ".", "addInjection", "(", "duService", ".", "getAejbClientValue", "(", ")", ",", "AEjbClientImpl", ".", "INSTANCE", ")", ".", "addDependency", "(", "AEjbUtilities", ".", "SERVICE_NAME", ",", "AEjbUtilities", ".", "class", ",", "duService", ".", "getAejbUtilitiesValue", "(", ")", ")", ".", "setInitialMode", "(", "ServiceController", ".", "Mode", ".", "PASSIVE", ")", ".", "addListener", "(", "verificationHandler", ")", ".", "install", "(", ")", ")", ";", "}", "@", "Override", "protected", "void", "populateModel", "(", "ModelNode", "operation", ",", "ModelNode", "model", ")", "throws", "OperationFailedException", "{", "model", ".", "get", "(", "\"jndi-name\"", ")", ".", "setEmptyObject", "(", ")", ";", "}", "}", "</s>" ]
10,055
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "subsystem", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "concurrent", ".", "atomic", ".", "AtomicLong", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "Service", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceName", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StartContext", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StartException", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StopContext", ";", "public", "class", "TrackerService", "implements", "Service", "<", "TrackerService", ">", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "TrackerService", ".", "class", ")", ";", "private", "AtomicLong", "tick", "=", "new", "AtomicLong", "(", "10000", ")", ";", "private", "Set", "<", "String", ">", "deployments", "=", "Collections", ".", "synchronizedSet", "(", "new", "HashSet", "<", "String", ">", "(", ")", ")", ";", "private", "Set", "<", "String", ">", "coolDeployments", "=", "Collections", ".", "synchronizedSet", "(", "new", "HashSet", "<", "String", ">", "(", ")", ")", ";", "private", "final", "String", "suffix", ";", "private", "Thread", "OUTPUT", "=", "new", "Thread", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "while", "(", "true", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "tick", ".", "get", "(", ")", ")", ";", "log", ".", "info", "(", "\"\"", "+", "suffix", "+", "\"\"", "+", "deployments", "+", "\"nCool:", "\"", "+", "coolDeployments", ".", "size", "(", ")", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "interrupted", "(", ")", ";", "break", ";", "}", "}", "}", "}", ";", "public", "TrackerService", "(", "String", "suffix", ",", "long", "tick", ")", "{", "this", ".", "suffix", "=", "suffix", ";", "this", ".", "tick", ".", "set", "(", "tick", ")", ";", "}", "@", "Override", "public", "TrackerService", "getValue", "(", ")", "throws", "IllegalStateException", ",", "IllegalArgumentException", "{", "return", "this", ";", "}", "@", "Override", "public", "void", "start", "(", "StartContext", "context", ")", "throws", "StartException", "{", "OUTPUT", ".", "start", "(", ")", ";", "}", "@", "Override", "public", "void", "stop", "(", "StopContext", "context", ")", "{", "OUTPUT", ".", "interrupt", "(", ")", ";", "}", "public", "static", "ServiceName", "createServiceName", "(", "String", "suffix", ")", "{", "return", "ServiceName", ".", "JBOSS", ".", "append", "(", "\"tracker\"", ",", "suffix", ")", ";", "}", "public", "void", "addDeployment", "(", "String", "name", ")", "{", "deployments", ".", "add", "(", "name", ")", ";", "}", "public", "void", "addCoolDeployment", "(", "String", "name", ")", "{", "coolDeployments", ".", "add", "(", "name", ")", ";", "}", "public", "void", "removeDeployment", "(", "String", "name", ")", "{", "deployments", ".", "remove", "(", "name", ")", ";", "coolDeployments", ".", "remove", "(", "name", ")", ";", "}", "void", "setTick", "(", "long", "tick", ")", "{", "this", ".", "tick", ".", "set", "(", "tick", ")", ";", "}", "public", "long", "getTick", "(", ")", "{", "return", "this", ".", "tick", ".", "get", "(", ")", ";", "}", "}", "</s>" ]
10,056
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "subsystem", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "CHILDREN", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "DESCRIPTION", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "HEAD_COMMENT_ALLOWED", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "MODEL_DESCRIPTION", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "NAMESPACE", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "TAIL_COMMENT_ALLOWED", ";", "import", "java", ".", "util", ".", "Locale", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "DescriptionProvider", ";", "import", "org", ".", "jboss", ".", "dmr", ".", "ModelNode", ";", "class", "AEJBSubsystemProviders", "{", "public", "static", "DescriptionProvider", "SUBSYSTEM", "=", "new", "DescriptionProvider", "(", ")", "{", "public", "ModelNode", "getModelDescription", "(", "Locale", "locale", ")", "{", "final", "ModelNode", "subsystem", "=", "new", "ModelNode", "(", ")", ";", "subsystem", ".", "get", "(", "DESCRIPTION", ")", ".", "set", "(", "\"\"", ")", ";", "subsystem", ".", "get", "(", "HEAD_COMMENT_ALLOWED", ")", ".", "set", "(", "true", ")", ";", "subsystem", ".", "get", "(", "TAIL_COMMENT_ALLOWED", ")", ".", "set", "(", "true", ")", ";", "subsystem", ".", "get", "(", "NAMESPACE", ")", ".", "set", "(", "AEJBSubsystemExtension", ".", "NAMESPACE", ")", ";", "subsystem", ".", "get", "(", "CHILDREN", ",", "\"jndi-name\"", ",", "DESCRIPTION", ")", ".", "set", "(", "\"\"", ")", ";", "subsystem", ".", "get", "(", "CHILDREN", ",", "\"jndi-name\"", ",", "MODEL_DESCRIPTION", ")", ";", "return", "subsystem", ";", "}", "}", ";", "public", "static", "DescriptionProvider", "SUBSYSTEM_ADD", "=", "new", "DescriptionProvider", "(", ")", "{", "public", "ModelNode", "getModelDescription", "(", "Locale", "locale", ")", "{", "final", "ModelNode", "subsystem", "=", "new", "ModelNode", "(", ")", ";", "subsystem", ".", "get", "(", "DESCRIPTION", ")", ".", "set", "(", "\"\"", ")", ";", "return", "subsystem", ";", "}", "}", ";", "public", "static", "DescriptionProvider", "JNDI_CHILD", "=", "new", "DescriptionProvider", "(", ")", "{", "@", "Override", "public", "ModelNode", "getModelDescription", "(", "Locale", "locale", ")", "{", "ModelNode", "node", "=", "new", "ModelNode", "(", ")", ";", "node", ".", "get", "(", "DESCRIPTION", ")", ".", "set", "(", "\"\"", ")", ";", "return", "node", ";", "}", "}", ";", "}", "</s>" ]
10,057
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "subsystem", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "DESCRIPTION", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Locale", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "AbstractAddStepHandler", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "OperationContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "OperationFailedException", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "PathAddress", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "ServiceVerificationHandler", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "DescriptionProvider", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ManagedReference", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ManagedReferenceFactory", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ServiceBasedNamingStore", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ValueManagedReference", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "deployment", ".", "ContextNames", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "service", ".", "BinderService", ";", "import", "org", ".", "jboss", ".", "dmr", ".", "ModelNode", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "AbstractServiceListener", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceBuilder", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceController", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceName", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceTarget", ";", "import", "org", ".", "jboss", ".", "msc", ".", "value", ".", "ImmediateValue", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "AEjbLogger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientService", ";", "class", "ClientJndiBindingHandler", "extends", "AbstractAddStepHandler", "implements", "DescriptionProvider", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "ClientJndiBindingHandler", ".", "class", ")", ";", "public", "static", "final", "ServiceName", "SERVICE_NAME_BASE", "=", "ServiceName", ".", "JBOSS", ".", "append", "(", "\"aejb-client\"", ")", ";", "public", "static", "final", "ClientJndiBindingHandler", "INSTANCE", "=", "new", "ClientJndiBindingHandler", "(", ")", ";", "private", "ClientJndiBindingHandler", "(", ")", "{", "}", "@", "Override", "public", "ModelNode", "getModelDescription", "(", "Locale", "locale", ")", "{", "ModelNode", "node", "=", "new", "ModelNode", "(", ")", ";", "node", ".", "get", "(", "DESCRIPTION", ")", ".", "set", "(", "\"\"", ")", ";", "return", "node", ";", "}", "@", "Override", "protected", "void", "populateModel", "(", "ModelNode", "operation", ",", "ModelNode", "model", ")", "throws", "OperationFailedException", "{", "}", "@", "Override", "protected", "void", "performRuntime", "(", "OperationContext", "context", ",", "ModelNode", "operation", ",", "ModelNode", "model", ",", "ServiceVerificationHandler", "verificationHandler", ",", "List", "<", "ServiceController", "<", "?", ">", ">", "newControllers", ")", "throws", "OperationFailedException", "{", "final", "ServiceTarget", "serviceTarget", "=", "context", ".", "getServiceTarget", "(", ")", ";", "final", "String", "jndiName", "=", "PathAddress", ".", "pathAddress", "(", "operation", ".", "get", "(", "ModelDescriptionConstants", ".", "ADDRESS", ")", ")", ".", "getLastElement", "(", ")", ".", "getValue", "(", ")", ";", "final", "AEjbClientService", "service", "=", "new", "AEjbClientService", "(", ")", ";", "final", "ServiceName", "serviceName", "=", "SERVICE_NAME_BASE", ".", "append", "(", "jndiName", ")", ";", "final", "ServiceBuilder", "<", "?", ">", "aejbClientBuilder", "=", "serviceTarget", ".", "addService", "(", "serviceName", ",", "service", ")", ";", "final", "ManagedReferenceFactory", "valueManagedReferenceFactory", "=", "new", "ManagedReferenceFactory", "(", ")", "{", "@", "Override", "public", "ManagedReference", "getReference", "(", ")", "{", "return", "new", "ValueManagedReference", "(", "new", "ImmediateValue", "<", "Object", ">", "(", "service", ".", "getValue", "(", ")", ")", ")", ";", "}", "}", ";", "final", "ContextNames", ".", "BindInfo", "bindInfo", "=", "ContextNames", ".", "bindInfoFor", "(", "jndiName", ")", ";", "final", "BinderService", "binderService", "=", "new", "BinderService", "(", "bindInfo", ".", "getBindName", "(", ")", ")", ";", "final", "ServiceBuilder", "<", "?", ">", "binderBuilder", "=", "serviceTarget", ".", "addService", "(", "bindInfo", ".", "getBinderServiceName", "(", ")", ",", "binderService", ")", ".", "addInjection", "(", "binderService", ".", "getManagedObjectInjector", "(", ")", ",", "valueManagedReferenceFactory", ")", ".", "addDependency", "(", "bindInfo", ".", "getParentContextServiceName", "(", ")", ",", "ServiceBasedNamingStore", ".", "class", ",", "binderService", ".", "getNamingStoreInjector", "(", ")", ")", ".", "addListener", "(", "new", "AbstractServiceListener", "<", "Object", ">", "(", ")", "{", "public", "void", "transition", "(", "final", "ServiceController", "<", "?", "extends", "Object", ">", "controller", ",", "final", "ServiceController", ".", "Transition", "transition", ")", "{", "switch", "(", "transition", ")", "{", "case", "STARTING_to_UP", ":", "{", "AEjbLogger", ".", "ROOT_LOGGER", ".", "boundClientService", "(", "jndiName", ")", ";", "break", ";", "}", "case", "START_REQUESTED_to_DOWN", ":", "{", "AEjbLogger", ".", "ROOT_LOGGER", ".", "unboundClientService", "(", "jndiName", ")", ";", "break", ";", "}", "case", "REMOVING_to_REMOVED", ":", "{", "AEjbLogger", ".", "ROOT_LOGGER", ".", "removeClientService", "(", "jndiName", ")", ";", "break", ";", "}", "}", "}", "}", ")", ";", "aejbClientBuilder", ".", "setInitialMode", "(", "ServiceController", ".", "Mode", ".", "ACTIVE", ")", ".", "addListener", "(", "verificationHandler", ")", ";", "binderBuilder", ".", "setInitialMode", "(", "ServiceController", ".", "Mode", ".", "ACTIVE", ")", ".", "addListener", "(", "verificationHandler", ")", ";", "newControllers", ".", "add", "(", "aejbClientBuilder", ".", "install", "(", ")", ")", ";", "newControllers", ".", "add", "(", "binderBuilder", ".", "install", "(", ")", ")", ";", "}", "}", "</s>" ]
10,058
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "subsystem", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "ADD", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "DESCRIBE", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "OP", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "OP_ADDR", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ".", "SUBSYSTEM", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Locale", ";", "import", "javax", ".", "xml", ".", "stream", ".", "XMLStreamConstants", ";", "import", "javax", ".", "xml", ".", "stream", ".", "XMLStreamException", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "Extension", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "ExtensionContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "OperationContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "OperationFailedException", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "OperationStepHandler", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "PathAddress", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "PathElement", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "SubsystemRegistration", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "DescriptionProvider", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "ModelDescriptionConstants", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "descriptions", ".", "common", ".", "CommonDescriptions", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "parsing", ".", "ExtensionParsingContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "parsing", ".", "ParseUtils", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "persistence", ".", "SubsystemMarshallingContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "registry", ".", "ManagementResourceRegistration", ";", "import", "org", ".", "jboss", ".", "as", ".", "controller", ".", "registry", ".", "OperationEntry", ";", "import", "org", ".", "jboss", ".", "dmr", ".", "ModelNode", ";", "import", "org", ".", "jboss", ".", "dmr", ".", "Property", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "staxmapper", ".", "XMLElementReader", ";", "import", "org", ".", "jboss", ".", "staxmapper", ".", "XMLElementWriter", ";", "import", "org", ".", "jboss", ".", "staxmapper", ".", "XMLExtendedStreamReader", ";", "import", "org", ".", "jboss", ".", "staxmapper", ".", "XMLExtendedStreamWriter", ";", "public", "class", "AEJBSubsystemExtension", "implements", "Extension", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "AEJBSubsystemExtension", ".", "class", ")", ";", "public", "static", "final", "String", "NAMESPACE", "=", "\"\"", ";", "public", "static", "final", "String", "SUBSYSTEM_NAME", "=", "\"aejb\"", ";", "private", "final", "AEJBSubsystemParser", "parser", "=", "new", "AEJBSubsystemParser", "(", ")", ";", "public", "void", "initialize", "(", "ExtensionContext", "context", ")", "{", "final", "SubsystemRegistration", "subsystem", "=", "context", ".", "registerSubsystem", "(", "SUBSYSTEM_NAME", ")", ";", "final", "ManagementResourceRegistration", "registration", "=", "subsystem", ".", "registerSubsystemModel", "(", "AEJBSubsystemProviders", ".", "SUBSYSTEM", ")", ";", "registration", ".", "registerOperationHandler", "(", "ADD", ",", "AEJBSubsystemAdd", ".", "INSTANCE", ",", "AEJBSubsystemProviders", ".", "SUBSYSTEM_ADD", ",", "false", ")", ";", "registration", ".", "registerOperationHandler", "(", "DESCRIBE", ",", "AEJBSubsystemDescribeHandler", ".", "INSTANCE", ",", "AEJBSubsystemDescribeHandler", ".", "INSTANCE", ",", "false", ",", "OperationEntry", ".", "EntryType", ".", "PRIVATE", ")", ";", "ManagementResourceRegistration", "jndiChild", "=", "registration", ".", "registerSubModel", "(", "PathElement", ".", "pathElement", "(", "\"jndi-name\"", ")", ",", "AEJBSubsystemProviders", ".", "JNDI_CHILD", ")", ";", "jndiChild", ".", "registerOperationHandler", "(", "ModelDescriptionConstants", ".", "ADD", ",", "ClientJndiBindingHandler", ".", "INSTANCE", ",", "ClientJndiBindingHandler", ".", "INSTANCE", ")", ";", "subsystem", ".", "registerXMLElementWriter", "(", "parser", ")", ";", "}", "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "void", "initializeParsers", "(", "ExtensionParsingContext", "context", ")", "{", "context", ".", "setSubsystemXmlMapping", "(", "NAMESPACE", ",", "parser", ")", ";", "}", "private", "static", "ModelNode", "createAEJBSubsystemOperation", "(", ")", "{", "final", "ModelNode", "subsystem", "=", "new", "ModelNode", "(", ")", ";", "subsystem", ".", "get", "(", "OP", ")", ".", "set", "(", "ADD", ")", ";", "subsystem", ".", "get", "(", "OP_ADDR", ")", ".", "add", "(", "SUBSYSTEM", ",", "SUBSYSTEM_NAME", ")", ";", "return", "subsystem", ";", "}", "private", "static", "class", "AEJBSubsystemParser", "implements", "XMLStreamConstants", ",", "XMLElementReader", "<", "List", "<", "ModelNode", ">", ">", ",", "XMLElementWriter", "<", "SubsystemMarshallingContext", ">", "{", "@", "Override", "public", "void", "readElement", "(", "XMLExtendedStreamReader", "reader", ",", "List", "<", "ModelNode", ">", "list", ")", "throws", "XMLStreamException", "{", "ParseUtils", ".", "requireNoAttributes", "(", "reader", ")", ";", "list", ".", "add", "(", "createAEJBSubsystemOperation", "(", ")", ")", ";", "while", "(", "reader", ".", "hasNext", "(", ")", "&&", "reader", ".", "nextTag", "(", ")", "!=", "END_ELEMENT", ")", "{", "if", "(", "!", "reader", ".", "getLocalName", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "throw", "ParseUtils", ".", "unexpectedElement", "(", "reader", ")", ";", "}", "if", "(", "reader", ".", "getLocalName", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "readClientService", "(", "reader", ",", "list", ")", ";", "while", "(", "reader", ".", "hasNext", "(", ")", "&&", "reader", ".", "nextTag", "(", ")", "!=", "END_ELEMENT", ")", "{", "}", "}", "}", "private", "void", "readClientService", "(", "XMLExtendedStreamReader", "reader", ",", "List", "<", "ModelNode", ">", "list", ")", "throws", "XMLStreamException", "{", "String", "jndiName", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "reader", ".", "getAttributeCount", "(", ")", ";", "i", "++", ")", "{", "String", "attr", "=", "reader", ".", "getAttributeLocalName", "(", "i", ")", ";", "if", "(", "attr", ".", "equals", "(", "\"jndi-name\"", ")", ")", "{", "jndiName", "=", "reader", ".", "getAttributeValue", "(", "i", ")", ";", "}", "else", "{", "throw", "ParseUtils", ".", "unexpectedAttribute", "(", "reader", ",", "i", ")", ";", "}", "}", "ParseUtils", ".", "requireNoContent", "(", "reader", ")", ";", "if", "(", "jndiName", "==", "null", ")", "{", "throw", "ParseUtils", ".", "missingRequiredElement", "(", "reader", ",", "Collections", ".", "singleton", "(", "\"jndi-name\"", ")", ")", ";", "}", "ModelNode", "addType", "=", "new", "ModelNode", "(", ")", ";", "addType", ".", "get", "(", "OP", ")", ".", "set", "(", "ModelDescriptionConstants", ".", "ADD", ")", ";", "PathAddress", "addr", "=", "PathAddress", ".", "pathAddress", "(", "PathElement", ".", "pathElement", "(", "SUBSYSTEM", ",", "SUBSYSTEM_NAME", ")", ",", "PathElement", ".", "pathElement", "(", "\"jndi-name\"", ",", "jndiName", ")", ")", ";", "addType", ".", "get", "(", "OP_ADDR", ")", ".", "set", "(", "addr", ".", "toModelNode", "(", ")", ")", ";", "list", ".", "add", "(", "addType", ")", ";", "}", "@", "Override", "public", "void", "writeContent", "(", "final", "XMLExtendedStreamWriter", "writer", ",", "final", "SubsystemMarshallingContext", "context", ")", "throws", "XMLStreamException", "{", "context", ".", "startSubsystemElement", "(", "AEJBSubsystemExtension", ".", "NAMESPACE", ",", "false", ")", ";", "writer", ".", "writeStartElement", "(", "\"\"", ")", ";", "ModelNode", "node", "=", "context", ".", "getModelNode", "(", ")", ";", "ModelNode", "jndiName", "=", "node", ".", "get", "(", "\"jndi-name\"", ")", ";", "for", "(", "Property", "property", ":", "jndiName", ".", "asPropertyList", "(", ")", ")", "{", "writer", ".", "writeAttribute", "(", "\"jndi-name\"", ",", "property", ".", "getName", "(", ")", ")", ";", "}", "writer", ".", "writeEndElement", "(", ")", ";", "writer", ".", "writeEndElement", "(", ")", ";", "}", "}", "private", "static", "class", "AEJBSubsystemDescribeHandler", "implements", "OperationStepHandler", ",", "DescriptionProvider", "{", "static", "final", "AEJBSubsystemDescribeHandler", "INSTANCE", "=", "new", "AEJBSubsystemDescribeHandler", "(", ")", ";", "public", "void", "execute", "(", "OperationContext", "context", ",", "ModelNode", "operation", ")", "throws", "OperationFailedException", "{", "context", ".", "getResult", "(", ")", ".", "add", "(", "createAEJBSubsystemOperation", "(", ")", ")", ";", "ModelNode", "node", "=", "context", ".", "readModel", "(", "PathAddress", ".", "EMPTY_ADDRESS", ")", ";", "for", "(", "Property", "property", ":", "node", ".", "get", "(", "\"jndi-name\"", ")", ".", "asPropertyList", "(", ")", ")", "{", "ModelNode", "addType", "=", "new", "ModelNode", "(", ")", ";", "addType", ".", "get", "(", "OP", ")", ".", "set", "(", "ModelDescriptionConstants", ".", "ADD", ")", ";", "PathAddress", "addr", "=", "PathAddress", ".", "pathAddress", "(", "PathElement", ".", "pathElement", "(", "SUBSYSTEM", ",", "SUBSYSTEM_NAME", ")", ",", "PathElement", ".", "pathElement", "(", "\"jndi-name\"", ",", "property", ".", "getName", "(", ")", ")", ")", ";", "addType", ".", "get", "(", "OP_ADDR", ")", ".", "set", "(", "addr", ".", "toModelNode", "(", ")", ")", ";", "context", ".", "getResult", "(", ")", ".", "add", "(", "addType", ")", ";", "}", "context", ".", "completeStep", "(", ")", ";", "}", "@", "Override", "public", "ModelNode", "getModelDescription", "(", "Locale", "locale", ")", "{", "return", "CommonDescriptions", ".", "getSubsystemDescribeOperation", "(", "locale", ")", ";", "}", "}", "}", "</s>" ]
10,059
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "aejb", ".", "Transaction", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "Attachments", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "BindingConfiguration", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "EEModuleClassDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "EEModuleDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "InjectionSource", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ManagedReference", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ManagedReferenceFactory", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ValueManagedReference", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentPhaseContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnit", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessingException", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessor", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Phase", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "annotation", ".", "CompositeIndex", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "AnnotationInstance", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "AnnotationTarget", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "AnnotationValue", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "ClassInfo", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "DotName", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "MethodInfo", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "msc", ".", "inject", ".", "Injector", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceBuilder", ";", "import", "org", ".", "jboss", ".", "msc", ".", "value", ".", "ImmediateValue", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "AEjbLogger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "transaction", ".", "TransactionState", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "transaction", ".", "TransactionManagerImpl", ";", "public", "class", "TransactionAnnotationProcessor", "implements", "DeploymentUnitProcessor", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "TransactionAnnotationProcessor", ".", "class", ")", ";", "private", "static", "final", "DotName", "TRANSACTION_ANNOTATION", "=", "DotName", ".", "createSimple", "(", "Transaction", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "static", "final", "Phase", "PHASE", "=", "Phase", ".", "PARSE", ";", "public", "static", "final", "int", "PRIORITY", "=", "0x3900", ";", "private", "AcContainer", "container", ";", "@", "Override", "public", "void", "deploy", "(", "DeploymentPhaseContext", "phaseContext", ")", "throws", "DeploymentUnitProcessingException", "{", "log", ".", "debug", "(", "\"\"", ")", ";", "final", "DeploymentUnit", "deploymentUnit", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ";", "final", "Map", "<", "String", ",", "AcContainer", ">", "aejbInfo", "=", "deploymentUnit", ".", "getAttachment", "(", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "Attachments", ".", "AEJB_INFO", ")", ";", "final", "CompositeIndex", "index", "=", "deploymentUnit", ".", "getAttachment", "(", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Attachments", ".", "COMPOSITE_ANNOTATION_INDEX", ")", ";", "final", "EEModuleDescription", "moduleDescription", "=", "deploymentUnit", ".", "getAttachment", "(", "Attachments", ".", "EE_MODULE_DESCRIPTION", ")", ";", "final", "List", "<", "AnnotationInstance", ">", "aejbAnnotations", "=", "index", ".", "getAnnotations", "(", "TRANSACTION_ANNOTATION", ")", ";", "for", "(", "final", "AnnotationInstance", "aejbAnnotation", ":", "aejbAnnotations", ")", "{", "final", "AnnotationTarget", "target", "=", "aejbAnnotation", ".", "target", "(", ")", ";", "if", "(", "!", "(", "target", "instanceof", "MethodInfo", ")", ")", "{", "log", ".", "warn", "(", "aejbAnnotation", ".", "name", "(", ")", "+", "\"\"", "+", "target", "+", "\"\"", ")", ";", "continue", ";", "}", "String", "beanName", "=", "(", "(", "MethodInfo", ")", "target", ")", ".", "declaringClass", "(", ")", ".", "name", "(", ")", ".", "local", "(", ")", ";", "if", "(", "!", "aejbInfo", ".", "containsKey", "(", "beanName", ")", ")", "{", "log", ".", "warn", "(", "aejbAnnotation", ".", "name", "(", ")", "+", "\"\"", "+", "beanName", "+", "\"\"", ")", ";", "continue", ";", "}", "container", "=", "aejbInfo", ".", "get", "(", "beanName", ")", ";", "final", "TransactionResourceWrapper", "annotationWrapper", "=", "new", "TransactionResourceWrapper", "(", "aejbAnnotation", ")", ";", "if", "(", "annotationWrapper", ".", "states", "(", ")", "==", "null", ")", "{", "log", ".", "warn", "(", "aejbAnnotation", ".", "name", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "try", "{", "processTransaction", "(", "annotationWrapper", ",", "(", "MethodInfo", ")", "target", ",", "moduleDescription", ")", ";", "}", "catch", "(", "TransactionProcessFailedException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", ";", "}", "}", "}", "private", "void", "processTransaction", "(", "TransactionResourceWrapper", "annotationWrapper", ",", "MethodInfo", "method", ",", "final", "EEModuleDescription", "eeModuleDescription", ")", "throws", "TransactionProcessFailedException", "{", "int", "states_count", "=", "annotationWrapper", ".", "states", "(", ")", ".", "length", ";", "if", "(", "states_count", "==", "1", ")", "{", "log", ".", "warn", "(", "annotationWrapper", ".", "name", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "else", "if", "(", "states_count", "!=", "annotationWrapper", ".", "next", "(", ")", ".", "length", "+", "1", ")", "throw", "new", "TransactionProcessFailedException", "(", "\"\"", ")", ";", "TransactionState", "[", "]", "states", "=", "new", "TransactionState", "[", "states_count", "]", ";", "Map", "[", "]", "nextStates", "=", "new", "HashMap", "[", "states_count", "-", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "states_count", "-", "1", ";", "i", "++", ")", "nextStates", "[", "i", "]", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "List", "<", "String", ">", "portNames", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "states_count", ";", "i", "++", ")", "{", "String", "[", "]", "passedPorts", "=", "null", ",", "futurePorts", "=", "null", ";", "String", "[", "]", "portz", "=", "annotationWrapper", ".", "states", "(", ")", "[", "i", "]", ".", "split", "(", "\";\"", ")", ";", "int", "pLength", "=", "portz", ".", "length", ";", "if", "(", "pLength", ">", "2", ")", "{", "throw", "new", "TransactionProcessFailedException", "(", "\"\"", ")", ";", "}", "for", "(", "int", "index", "=", "0", ";", "index", "<", "pLength", ";", "index", "++", ")", "{", "String", "[", "]", "ports", "=", "portz", "[", "index", "]", ".", "split", "(", "\",\"", ")", ";", "if", "(", "index", "==", "0", ")", "passedPorts", "=", "ports", ";", "else", "futurePorts", "=", "ports", ";", "}", "for", "(", "String", "port", ":", "passedPorts", ")", "{", "if", "(", "!", "portNames", ".", "contains", "(", "port", ")", ")", "portNames", ".", "add", "(", "port", ")", ";", "}", "TransactionState", "s", "=", "new", "TransactionState", "(", "passedPorts", ",", "futurePorts", ")", ";", "states", "[", "i", "]", "=", "s", ";", "if", "(", "i", "==", "states_count", "-", "1", ")", "continue", ";", "String", "[", "]", "nexts", "=", "annotationWrapper", ".", "next", "(", ")", "[", "i", "]", ".", "split", "(", "\",\"", ")", ";", "for", "(", "String", "next", ":", "nexts", ")", "{", "if", "(", "next", "!=", "null", "&&", "!", "next", ".", "equals", "(", "\"\"", ")", ")", "{", "String", "[", "]", "n", "=", "next", ".", "split", "(", "\"-\"", ")", ";", "if", "(", "n", ".", "length", "!=", "2", ")", "throw", "new", "TransactionProcessFailedException", "(", "\"\"", ")", ";", "nextStates", "[", "i", "]", ".", "put", "(", "n", "[", "0", "]", ",", "n", "[", "1", "]", ")", ";", "}", "}", "}", "final", "int", "size", "=", "portNames", ".", "size", "(", ")", ";", "TransactionManager", "tm", "=", "new", "TransactionManagerImpl", "(", "annotationWrapper", ".", "name", "(", ")", ",", "method", ".", "name", "(", ")", ",", "portNames", ".", "toArray", "(", "new", "String", "[", "size", "]", ")", ",", "states", ",", "nextStates", ")", ";", "container", ".", "setTransactionManager", "(", "tm", ")", ";", "bindTransactionManager", "(", "tm", ",", "method", ".", "declaringClass", "(", ")", ",", "eeModuleDescription", ")", ";", "}", "private", "void", "bindTransactionManager", "(", "final", "TransactionManager", "tm", ",", "final", "ClassInfo", "classInfo", ",", "final", "EEModuleDescription", "eeModuleDescription", ")", "{", "final", "EEModuleClassDescription", "classDescription", "=", "eeModuleDescription", ".", "addOrGetLocalClassDescription", "(", "classInfo", ".", "name", "(", ")", ".", "toString", "(", ")", ")", ";", "final", "ManagedReferenceFactory", "valueManagedReferenceFactory", "=", "new", "ManagedReferenceFactory", "(", ")", "{", "@", "Override", "public", "ManagedReference", "getReference", "(", ")", "{", "return", "new", "ValueManagedReference", "(", "new", "ImmediateValue", "<", "Object", ">", "(", "tm", ")", ")", ";", "}", "}", ";", "final", "String", "jndiName", "=", "\"\"", "+", "tm", ".", "getName", "(", ")", ";", "final", "BindingConfiguration", "bindingConfiguration", "=", "new", "BindingConfiguration", "(", "jndiName", ",", "new", "InjectionSource", "(", ")", "{", "@", "Override", "public", "void", "getResourceValue", "(", "ResolutionContext", "arg0", ",", "ServiceBuilder", "<", "?", ">", "builder", ",", "DeploymentPhaseContext", "arg2", ",", "Injector", "<", "ManagedReferenceFactory", ">", "injector", ")", "throws", "DeploymentUnitProcessingException", "{", "injector", ".", "inject", "(", "valueManagedReferenceFactory", ")", ";", "AEjbLogger", ".", "ROOT_LOGGER", ".", "boundTransactionManager", "(", "jndiName", ")", ";", "}", "}", ")", ";", "classDescription", ".", "getBindingConfigurations", "(", ")", ".", "add", "(", "bindingConfiguration", ")", ";", "}", "@", "Override", "public", "void", "undeploy", "(", "DeploymentUnit", "arg0", ")", "{", "}", "private", "class", "TransactionResourceWrapper", "{", "private", "final", "String", "name", ";", "private", "final", "String", "[", "]", "states", ";", "private", "final", "String", "[", "]", "next", ";", "private", "TransactionResourceWrapper", "(", "final", "AnnotationInstance", "annotation", ")", "{", "name", "=", "stringValueOrNull", "(", "annotation", ",", "\"name\"", ")", ";", "states", "=", "arrayValueOrNull", "(", "annotation", ",", "\"states\"", ")", ";", "next", "=", "arrayValueOrNull", "(", "annotation", ",", "\"next\"", ")", ";", "}", "private", "String", "name", "(", ")", "{", "return", "name", ";", "}", "private", "String", "[", "]", "states", "(", ")", "{", "return", "states", ";", "}", "private", "String", "[", "]", "next", "(", ")", "{", "return", "next", ";", "}", "private", "String", "stringValueOrNull", "(", "final", "AnnotationInstance", "annotation", ",", "final", "String", "attribute", ")", "{", "final", "AnnotationValue", "value", "=", "annotation", ".", "value", "(", "attribute", ")", ";", "return", "value", "!=", "null", "?", "value", ".", "asString", "(", ")", ":", "null", ";", "}", "private", "String", "[", "]", "arrayValueOrNull", "(", "final", "AnnotationInstance", "annotation", ",", "final", "String", "attribute", ")", "{", "final", "AnnotationValue", "value", "=", "annotation", ".", "value", "(", "attribute", ")", ";", "return", "value", "!=", "null", "?", "value", ".", "asStringArray", "(", ")", ":", "null", ";", "}", "}", "}", "</s>" ]
10,060
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "aejb", ".", "TransactionTrigger", ";", "public", "interface", "TransactionManager", "extends", "TransactionTrigger", "{", "String", "toString", "(", ")", ";", "int", "getRunNumber", "(", ")", ";", "String", "getName", "(", ")", ";", "boolean", "isActive", "(", ")", ";", "boolean", "isActive", "(", "String", "objectId", ")", ";", "List", "<", "String", ">", "getAffectedPorts", "(", ")", ";", "List", "<", "String", ">", "getAffectedPorts", "(", "String", "objectId", ")", ";", "String", "[", "]", "getInvolvedPorts", "(", ")", ";", "String", "getTransactionMethodName", "(", ")", ";", "void", "createTransaction", "(", "String", "objectId", ")", ";", "void", "destroyTransaction", "(", "String", "objectId", ")", ";", "List", "<", "String", ">", "getPassedPorts", "(", "String", "objectId", ")", ";", "List", "<", "String", ">", "getFuturePorts", "(", "String", "objectId", ")", ";", "}", "</s>" ]
10,061
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "Attachments", ".", "EE_MODULE_DESCRIPTION", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "ejb", ".", "Local", ";", "import", "javax", ".", "ejb", ".", "Remote", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "ComponentDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "EEModuleDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "ViewDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "component", ".", "EJBViewDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "component", ".", "MethodIntf", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "component", ".", "session", ".", "SessionBeanComponentDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentPhaseContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnit", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessingException", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessor", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Phase", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "modules", ".", "Module", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "public", "class", "BusinessViewProcessor", "implements", "DeploymentUnitProcessor", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "BusinessViewProcessor", ".", "class", ")", ";", "public", "static", "final", "Phase", "POST_MODULE", "=", "Phase", ".", "POST_MODULE", ";", "public", "static", "final", "int", "PRIORITY", "=", "0x0440", ";", "@", "Override", "public", "void", "deploy", "(", "DeploymentPhaseContext", "phaseContext", ")", "throws", "DeploymentUnitProcessingException", "{", "logger", ".", "info", "(", "\"\"", ")", ";", "final", "DeploymentUnit", "deploymentUnit", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ";", "final", "EEModuleDescription", "eeModuleDescription", "=", "deploymentUnit", ".", "getAttachment", "(", "EE_MODULE_DESCRIPTION", ")", ";", "final", "Map", "<", "String", ",", "AcContainer", ">", "aejbInfo", "=", "deploymentUnit", ".", "getAttachment", "(", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "Attachments", ".", "AEJB_INFO", ")", ";", "final", "Collection", "<", "ComponentDescription", ">", "componentDescriptions", "=", "eeModuleDescription", ".", "getComponentDescriptions", "(", ")", ";", "final", "Module", "module", "=", "deploymentUnit", ".", "getAttachment", "(", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Attachments", ".", "MODULE", ")", ";", "if", "(", "aejbInfo", "==", "null", "||", "module", "==", "null", ")", "{", "return", ";", "}", "final", "ClassLoader", "moduleClassLoader", "=", "module", ".", "getClassLoader", "(", ")", ";", "if", "(", "componentDescriptions", "!=", "null", ")", "{", "for", "(", "ComponentDescription", "componentDescription", ":", "componentDescriptions", ")", "{", "if", "(", "componentDescription", "instanceof", "SessionBeanComponentDescription", "==", "false", "||", "aejbInfo", ".", "containsKey", "(", "componentDescription", ".", "getComponentName", "(", ")", ")", "==", "false", ")", "{", "continue", ";", "}", "for", "(", "ViewDescription", "view", ":", "componentDescription", ".", "getViews", "(", ")", ")", "{", "if", "(", "view", "instanceof", "EJBViewDescription", "==", "false", ")", "continue", ";", "final", "Class", "<", "?", ">", "viewClass", ";", "try", "{", "viewClass", "=", "moduleClassLoader", ".", "loadClass", "(", "view", ".", "getViewClassName", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "DeploymentUnitProcessingException", "(", "\"View", "Class:", "\"", "+", "view", ".", "getViewClassName", "(", ")", "+", "\"", "Not", "Found.\"", ",", "e", ")", ";", "}", "logger", ".", "info", "(", "\"view", "=", "\"", "+", "view", ".", "getViewClassName", "(", ")", ")", ";", "final", "MethodIntf", "intf", "=", "(", "(", "EJBViewDescription", ")", "view", ")", ".", "getMethodIntf", "(", ")", ";", "final", "AcContainer", "container", "=", "aejbInfo", ".", "get", "(", "componentDescription", ".", "getComponentName", "(", ")", ")", ";", "if", "(", "intf", "==", "MethodIntf", ".", "LOCAL", ")", "{", "container", ".", "setLocalView", "(", "viewClass", ")", ";", "}", "else", "if", "(", "intf", "==", "MethodIntf", ".", "REMOTE", ")", "{", "container", ".", "setRemoteView", "(", "viewClass", ")", ";", "}", "}", "}", "}", "logger", ".", "info", "(", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "undeploy", "(", "DeploymentUnit", "context", ")", "{", "}", "}", "</s>" ]
10,062
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ";", "import", "org", ".", "jboss", ".", "dmr", ".", "ModelNode", ";", "public", "class", "TransactionProcessFailedException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "6370943552523006525L", ";", "private", "final", "ModelNode", "failureDescription", ";", "public", "TransactionProcessFailedException", "(", "final", "String", "msg", ",", "final", "ModelNode", "description", ")", "{", "super", "(", "msg", ")", ";", "failureDescription", "=", "description", ";", "}", "public", "TransactionProcessFailedException", "(", "final", "String", "message", ")", "{", "this", "(", "message", ",", "new", "ModelNode", "(", "message", ")", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "super", ".", "toString", "(", ")", "+", "\"", "[", "\"", "+", "failureDescription", "+", "\"", "]\"", ";", "}", "}", "</s>" ]
10,063
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "aejb", ".", "AEjb", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "Attachments", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "BindingConfiguration", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "EEModuleClassDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "EEModuleDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "FieldInjectionTarget", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "InjectionTarget", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "ResourceInjectionConfiguration", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentPhaseContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnit", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessingException", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessor", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Phase", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "annotation", ".", "CompositeIndex", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "AnnotationInstance", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "AnnotationTarget", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "AnnotationValue", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "ClassInfo", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "DotName", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "FieldInfo", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "public", "class", "AEjbInjectionAnnotationProcessor", "implements", "DeploymentUnitProcessor", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "AEjbInjectionAnnotationProcessor", ".", "class", ")", ";", "private", "static", "final", "DotName", "AEJB_ANNOTATION", "=", "DotName", ".", "createSimple", "(", "AEjb", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "static", "final", "Phase", "PHASE", "=", "Phase", ".", "PARSE", ";", "public", "static", "final", "int", "PRIORITY", "=", "0x3800", ";", "private", "AcContainer", "container", ";", "@", "Override", "public", "void", "deploy", "(", "DeploymentPhaseContext", "phaseContext", ")", "throws", "DeploymentUnitProcessingException", "{", "log", ".", "debug", "(", "\"\"", ")", ";", "final", "DeploymentUnit", "deploymentUnit", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ";", "final", "Map", "<", "String", ",", "AcContainer", ">", "aejbInfo", "=", "deploymentUnit", ".", "getAttachment", "(", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "Attachments", ".", "AEJB_INFO", ")", ";", "final", "CompositeIndex", "index", "=", "deploymentUnit", ".", "getAttachment", "(", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Attachments", ".", "COMPOSITE_ANNOTATION_INDEX", ")", ";", "final", "EEModuleDescription", "moduleDescription", "=", "deploymentUnit", ".", "getAttachment", "(", "Attachments", ".", "EE_MODULE_DESCRIPTION", ")", ";", "final", "List", "<", "AnnotationInstance", ">", "aejbAnnotations", "=", "index", ".", "getAnnotations", "(", "AEJB_ANNOTATION", ")", ";", "for", "(", "final", "AnnotationInstance", "aejbAnnotation", ":", "aejbAnnotations", ")", "{", "final", "AnnotationTarget", "target", "=", "aejbAnnotation", ".", "target", "(", ")", ";", "if", "(", "!", "(", "target", "instanceof", "FieldInfo", ")", ")", "{", "log", ".", "warn", "(", "aejbAnnotation", ".", "name", "(", ")", "+", "\"\"", "+", "target", "+", "\"\"", ")", ";", "continue", ";", "}", "String", "beanName", "=", "(", "(", "FieldInfo", ")", "target", ")", ".", "declaringClass", "(", ")", ".", "name", "(", ")", ".", "local", "(", ")", ";", "if", "(", "!", "aejbInfo", ".", "containsKey", "(", "beanName", ")", ")", "{", "log", ".", "warn", "(", "aejbAnnotation", ".", "name", "(", ")", "+", "\"\"", "+", "beanName", "+", "\"\"", ")", ";", "continue", ";", "}", "container", "=", "aejbInfo", ".", "get", "(", "beanName", ")", ";", "final", "AEJBResourceWrapper", "annotationWrapper", "=", "new", "AEJBResourceWrapper", "(", "aejbAnnotation", ")", ";", "processField", "(", "deploymentUnit", ",", "annotationWrapper", ",", "(", "FieldInfo", ")", "target", ",", "moduleDescription", ")", ";", "}", "}", "private", "void", "processField", "(", "final", "DeploymentUnit", "deploymentUnit", ",", "final", "AEJBResourceWrapper", "annotation", ",", "final", "FieldInfo", "fieldInfo", ",", "final", "EEModuleDescription", "eeModuleDescription", ")", "{", "final", "String", "fieldName", "=", "fieldInfo", ".", "name", "(", ")", ";", "final", "String", "fieldType", "=", "fieldInfo", ".", "type", "(", ")", ".", "name", "(", ")", ".", "toString", "(", ")", ";", "final", "InjectionTarget", "targetDescription", "=", "new", "FieldInjectionTarget", "(", "fieldInfo", ".", "declaringClass", "(", ")", ".", "name", "(", ")", ".", "toString", "(", ")", ",", "fieldName", ",", "fieldType", ")", ";", "final", "String", "localContextName", "=", "isEmpty", "(", "annotation", ".", "name", "(", ")", ")", "?", "fieldInfo", ".", "declaringClass", "(", ")", ".", "name", "(", ")", ".", "toString", "(", ")", "+", "\"/\"", "+", "fieldInfo", ".", "name", "(", ")", ":", "annotation", ".", "name", "(", ")", ";", "final", "String", "beanInterfaceType", "=", "isEmpty", "(", "annotation", ".", "beanInterface", "(", ")", ")", "||", "annotation", ".", "beanInterface", "(", ")", ".", "equals", "(", "Object", ".", "class", ".", "getName", "(", ")", ")", "?", "fieldType", ":", "annotation", ".", "beanInterface", "(", ")", ";", "process", "(", "deploymentUnit", ",", "beanInterfaceType", ",", "annotation", ".", "beanName", "(", ")", ",", "annotation", ".", "lookup", "(", ")", ",", "fieldInfo", ".", "declaringClass", "(", ")", ",", "targetDescription", ",", "localContextName", ",", "eeModuleDescription", ")", ";", "}", "private", "void", "process", "(", "final", "DeploymentUnit", "deploymentUnit", ",", "final", "String", "beanInterface", ",", "final", "String", "beanName", ",", "final", "String", "lookup", ",", "final", "ClassInfo", "classInfo", ",", "final", "InjectionTarget", "targetDescription", ",", "final", "String", "localContextName", ",", "final", "EEModuleDescription", "eeModuleDescription", ")", "{", "if", "(", "!", "isEmpty", "(", "lookup", ")", "&&", "!", "isEmpty", "(", "beanName", ")", ")", "{", "log", ".", "debug", "(", "\"\"", "+", "beanName", "+", "\"\"", "+", "lookup", "+", "\"\"", "+", "\"\"", "+", "classInfo", ".", "name", "(", ")", ")", ";", "}", "final", "EEModuleClassDescription", "classDescription", "=", "eeModuleDescription", ".", "addOrGetLocalClassDescription", "(", "classInfo", ".", "name", "(", ")", ".", "toString", "(", ")", ")", ";", "final", "AejbInjectionSource", "aejbInjectionSource", ";", "if", "(", "!", "isEmpty", "(", "lookup", ")", ")", "{", "if", "(", "!", "isEmpty", "(", "beanName", ")", ")", "{", "aejbInjectionSource", "=", "new", "AejbInjectionSource", "(", "lookup", ",", "beanName", ",", "beanInterface", ",", "localContextName", ",", "deploymentUnit", ",", "container", ")", ";", "}", "else", "{", "aejbInjectionSource", "=", "new", "AejbInjectionSource", "(", "lookup", ",", "null", ",", "beanInterface", ",", "localContextName", ",", "deploymentUnit", ",", "container", ")", ";", "}", "}", "else", "{", "if", "(", "!", "isEmpty", "(", "beanName", ")", ")", "{", "aejbInjectionSource", "=", "new", "AejbInjectionSource", "(", "beanName", ",", "beanInterface", ",", "localContextName", ",", "deploymentUnit", ",", "container", ")", ";", "}", "else", "{", "aejbInjectionSource", "=", "new", "AejbInjectionSource", "(", "null", ",", "beanInterface", ",", "localContextName", ",", "deploymentUnit", ",", "container", ")", ";", "}", "}", "final", "ResourceInjectionConfiguration", "injectionConfiguration", "=", "targetDescription", "!=", "null", "?", "new", "ResourceInjectionConfiguration", "(", "targetDescription", ",", "aejbInjectionSource", ")", ":", "null", ";", "final", "BindingConfiguration", "bindingConfiguration", "=", "new", "BindingConfiguration", "(", "localContextName", ",", "aejbInjectionSource", ")", ";", "classDescription", ".", "getBindingConfigurations", "(", ")", ".", "add", "(", "bindingConfiguration", ")", ";", "if", "(", "injectionConfiguration", "!=", "null", ")", "{", "classDescription", ".", "addResourceInjection", "(", "injectionConfiguration", ")", ";", "}", "}", "@", "Override", "public", "void", "undeploy", "(", "DeploymentUnit", "context", ")", "{", "}", "private", "boolean", "isEmpty", "(", "final", "String", "string", ")", "{", "return", "string", "==", "null", "||", "string", ".", "isEmpty", "(", ")", ";", "}", "private", "class", "AEJBResourceWrapper", "{", "private", "final", "String", "name", ";", "private", "final", "String", "beanInterface", ";", "private", "final", "String", "beanName", ";", "private", "final", "String", "lookup", ";", "private", "final", "String", "description", ";", "private", "AEJBResourceWrapper", "(", "final", "AnnotationInstance", "annotation", ")", "{", "name", "=", "stringValueOrNull", "(", "annotation", ",", "\"name\"", ")", ";", "beanInterface", "=", "classValueOrNull", "(", "annotation", ",", "\"\"", ")", ";", "beanName", "=", "stringValueOrNull", "(", "annotation", ",", "\"beanName\"", ")", ";", "String", "lookupValue", "=", "stringValueOrNull", "(", "annotation", ",", "\"lookup\"", ")", ";", "if", "(", "isEmpty", "(", "lookupValue", ")", ")", "{", "lookupValue", "=", "stringValueOrNull", "(", "annotation", ",", "\"mappedName\"", ")", ";", "}", "this", ".", "lookup", "=", "lookupValue", ";", "description", "=", "stringValueOrNull", "(", "annotation", ",", "\"description\"", ")", ";", "}", "private", "String", "name", "(", ")", "{", "return", "name", ";", "}", "private", "String", "beanInterface", "(", ")", "{", "return", "beanInterface", ";", "}", "private", "String", "beanName", "(", ")", "{", "return", "beanName", ";", "}", "private", "String", "lookup", "(", ")", "{", "return", "lookup", ";", "}", "private", "String", "description", "(", ")", "{", "return", "description", ";", "}", "private", "String", "stringValueOrNull", "(", "final", "AnnotationInstance", "annotation", ",", "final", "String", "attribute", ")", "{", "final", "AnnotationValue", "value", "=", "annotation", ".", "value", "(", "attribute", ")", ";", "return", "value", "!=", "null", "?", "value", ".", "asString", "(", ")", ":", "null", ";", "}", "private", "String", "classValueOrNull", "(", "final", "AnnotationInstance", "annotation", ",", "final", "String", "attribute", ")", "{", "final", "AnnotationValue", "value", "=", "annotation", ".", "value", "(", "attribute", ")", ";", "return", "value", "!=", "null", "?", "value", ".", "asClass", "(", ")", ".", "name", "(", ")", ".", "toString", "(", ")", ":", "null", ";", "}", "}", "}", "</s>" ]
10,064
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "javax", ".", "aejb", ".", "Adaptive", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "ComponentDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "EEModuleDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "component", ".", "session", ".", "SessionBeanComponentDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "component", ".", "session", ".", "SessionBeanComponentDescription", ".", "SessionBeanType", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "deployment", ".", "EjbDeploymentMarker", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Attachments", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentPhaseContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnit", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessingException", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessor", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Phase", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "annotation", ".", "CompositeIndex", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "AnnotationInstance", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "AnnotationTarget", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "ClassInfo", ";", "import", "org", ".", "jboss", ".", "jandex", ".", "DotName", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "public", "class", "AnnotatedAEJBComponentDescriptionProcessor", "implements", "DeploymentUnitProcessor", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "AnnotatedAEJBComponentDescriptionProcessor", ".", "class", ")", ";", "private", "static", "final", "DotName", "ADAPTIVE_ANNOTATION", "=", "DotName", ".", "createSimple", "(", "Adaptive", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "static", "final", "Phase", "PHASE", "=", "Phase", ".", "PARSE", ";", "public", "static", "final", "int", "PRIORITY", "=", "0x1210", ";", "public", "String", "unitName", ";", "@", "Override", "public", "void", "deploy", "(", "DeploymentPhaseContext", "phaseContext", ")", "throws", "DeploymentUnitProcessingException", "{", "log", ".", "debug", "(", "\"\"", ")", ";", "final", "DeploymentUnit", "deploymentUnit", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ";", "if", "(", "!", "EjbDeploymentMarker", ".", "isEjbDeployment", "(", "deploymentUnit", ")", ")", "return", ";", "final", "CompositeIndex", "compositeIndex", "=", "deploymentUnit", ".", "getAttachment", "(", "Attachments", ".", "COMPOSITE_ANNOTATION_INDEX", ")", ";", "if", "(", "compositeIndex", "==", "null", ")", "return", ";", "final", "List", "<", "AnnotationInstance", ">", "adpAnnotations", "=", "compositeIndex", ".", "getAnnotations", "(", "ADAPTIVE_ANNOTATION", ")", ";", "if", "(", "adpAnnotations", ".", "isEmpty", "(", ")", ")", "return", ";", "final", "Set", "<", "String", ">", "aejbClassInfo", "=", "getAEJBClassInfo", "(", "adpAnnotations", ")", ";", "Map", "<", "String", ",", "AcContainer", ">", "aejbInfo", "=", "new", "HashMap", "<", "String", ",", "AcContainer", ">", "(", ")", ";", "this", ".", "unitName", "=", "deploymentUnit", ".", "getName", "(", ")", ";", "final", "EEModuleDescription", "moduleDescription", "=", "deploymentUnit", ".", "getAttachment", "(", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "Attachments", ".", "EE_MODULE_DESCRIPTION", ")", ";", "for", "(", "ComponentDescription", "beanDescription", ":", "moduleDescription", ".", "getComponentDescriptions", "(", ")", ")", "{", "if", "(", "!", "(", "beanDescription", "instanceof", "SessionBeanComponentDescription", ")", ")", "continue", ";", "String", "beanClass", "=", "beanDescription", ".", "getComponentName", "(", ")", ";", "if", "(", "!", "aejbClassInfo", ".", "contains", "(", "beanClass", ")", ")", "continue", ";", "SessionBeanComponentDescription", "sessionBeanDescription", "=", "(", "SessionBeanComponentDescription", ")", "beanDescription", ";", "String", "appName", "=", "moduleDescription", ".", "getEarApplicationName", "(", ")", ";", "String", "moduleName", "=", "sessionBeanDescription", ".", "getModuleName", "(", ")", ";", "String", "beanName", "=", "sessionBeanDescription", ".", "getEJBName", "(", ")", ";", "String", "distinctName", "=", "moduleDescription", ".", "getDistinctName", "(", ")", ";", "SessionBeanType", "beanType", "=", "sessionBeanDescription", ".", "getSessionBeanType", "(", ")", ";", "AcContainer", "accon", "=", "new", "AcContainer", "(", "appName", ",", "moduleName", ",", "beanName", ",", "distinctName", ",", "beanType", ")", ";", "AEjbUtilities", ".", "registerAEJB", "(", "unitName", ",", "accon", ")", ";", "aejbInfo", ".", "put", "(", "beanClass", ",", "accon", ")", ";", "}", "deploymentUnit", ".", "putAttachment", "(", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "Attachments", ".", "AEJB_INFO", ",", "aejbInfo", ")", ";", "}", "@", "Override", "public", "void", "undeploy", "(", "DeploymentUnit", "deploymentUnit", ")", "{", "AEjbUtilities", ".", "removeDeploymentUnit", "(", "deploymentUnit", ".", "getName", "(", ")", ")", ";", "}", "private", "Set", "<", "String", ">", "getAEJBClassInfo", "(", "List", "<", "AnnotationInstance", ">", "adpAnnotations", ")", "{", "Set", "<", "String", ">", "aejbClassInfo", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "final", "AnnotationInstance", "adpAnnotation", ":", "adpAnnotations", ")", "{", "final", "AnnotationTarget", "target", "=", "adpAnnotation", ".", "target", "(", ")", ";", "if", "(", "!", "(", "target", "instanceof", "ClassInfo", ")", ")", "{", "log", ".", "warn", "(", "adpAnnotation", ".", "name", "(", ")", "+", "\"\"", "+", "target", "+", "\"\"", ")", ";", "continue", ";", "}", "aejbClassInfo", ".", "add", "(", "(", "(", "ClassInfo", ")", "target", ")", ".", "name", "(", ")", ".", "local", "(", ")", ")", ";", "}", "return", "aejbClassInfo", ";", "}", "}", "</s>" ]
10,065
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ";", "import", "static", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "Attachments", ".", "EE_APPLICATION_DESCRIPTION", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "EEApplicationDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "EEModuleDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "InjectionSource", ";", "import", "org", ".", "jboss", ".", "as", ".", "ee", ".", "component", ".", "ViewDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "EjbMessages", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "component", ".", "EJBComponentDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "ejb3", ".", "component", ".", "EJBViewDescription", ";", "import", "org", ".", "jboss", ".", "as", ".", "naming", ".", "ManagedReferenceFactory", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Attachments", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentPhaseContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnit", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessingException", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "module", ".", "ResourceRoot", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "msc", ".", "inject", ".", "Injector", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceBuilder", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceName", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "ContainerManagedReferenceFactory", ";", "public", "class", "AejbInjectionSource", "extends", "InjectionSource", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "AejbInjectionSource", ".", "class", ")", ";", "private", "final", "String", "lookup", ";", "private", "final", "String", "beanName", ";", "private", "final", "String", "typeName", ";", "private", "final", "String", "bindingName", ";", "private", "final", "DeploymentUnit", "deploymentUnit", ";", "private", "final", "AcContainer", "container", ";", "private", "volatile", "String", "error", "=", "null", ";", "private", "volatile", "ServiceName", "resolvedViewName", ";", "ContainerManagedReferenceFactory", "containerFactory", ";", "private", "volatile", "boolean", "resolved", "=", "false", ";", "public", "AejbInjectionSource", "(", "final", "String", "lookup", ",", "final", "String", "beanName", ",", "final", "String", "typeName", ",", "final", "String", "bindingName", ",", "final", "DeploymentUnit", "deploymentUnit", ",", "AcContainer", "container", ")", "{", "this", ".", "beanName", "=", "beanName", ";", "this", ".", "typeName", "=", "typeName", ";", "this", ".", "bindingName", "=", "bindingName", ";", "this", ".", "deploymentUnit", "=", "deploymentUnit", ";", "this", ".", "lookup", "=", "lookup", ";", "this", ".", "container", "=", "container", ";", "}", "public", "AejbInjectionSource", "(", "final", "String", "beanName", ",", "final", "String", "typeName", ",", "final", "String", "bindingName", ",", "final", "DeploymentUnit", "deploymentUnit", ",", "AcContainer", "container", ")", "{", "this", ".", "bindingName", "=", "bindingName", ";", "this", ".", "deploymentUnit", "=", "deploymentUnit", ";", "this", ".", "beanName", "=", "beanName", ";", "this", ".", "typeName", "=", "typeName", ";", "this", ".", "lookup", "=", "null", ";", "this", ".", "container", "=", "container", ";", "}", "@", "Override", "public", "void", "getResourceValue", "(", "ResolutionContext", "resolutionContext", ",", "ServiceBuilder", "<", "?", ">", "serviceBuilder", ",", "DeploymentPhaseContext", "phaseContext", ",", "Injector", "<", "ManagedReferenceFactory", ">", "injector", ")", "throws", "DeploymentUnitProcessingException", "{", "resolve", "(", ")", ";", "if", "(", "error", "!=", "null", ")", "{", "throw", "new", "DeploymentUnitProcessingException", "(", "error", ")", ";", "}", "if", "(", "containerFactory", "!=", "null", ")", "{", "injector", ".", "inject", "(", "containerFactory", ")", ";", "}", "}", "private", "void", "resolve", "(", ")", "{", "if", "(", "!", "resolved", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "!", "resolved", ")", "{", "final", "Set", "<", "ViewDescription", ">", "views", "=", "getViews", "(", ")", ";", "final", "Set", "<", "EJBViewDescription", ">", "ejbsForViewName", "=", "new", "HashSet", "<", "EJBViewDescription", ">", "(", ")", ";", "for", "(", "final", "ViewDescription", "view", ":", "views", ")", "{", "if", "(", "view", "instanceof", "EJBViewDescription", ")", "{", "ejbsForViewName", ".", "add", "(", "(", "EJBViewDescription", ")", "view", ")", ";", "}", "}", "if", "(", "ejbsForViewName", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "beanName", "==", "null", ")", "{", "error", "=", "EjbMessages", ".", "MESSAGES", ".", "ejbNotFound", "(", "typeName", ",", "bindingName", ")", ";", "}", "else", "{", "error", "=", "EjbMessages", ".", "MESSAGES", ".", "ejbNotFound", "(", "typeName", ",", "beanName", ",", "bindingName", ")", ";", "}", "}", "else", "if", "(", "ejbsForViewName", ".", "size", "(", ")", ">", "1", ")", "{", "if", "(", "beanName", "==", "null", ")", "{", "error", "=", "EjbMessages", ".", "MESSAGES", ".", "moreThanOneEjbFound", "(", "typeName", ",", "bindingName", ",", "ejbsForViewName", ")", ";", "}", "else", "{", "error", "=", "EjbMessages", ".", "MESSAGES", ".", "moreThanOneEjbFound", "(", "typeName", ",", "beanName", ",", "bindingName", ",", "ejbsForViewName", ")", ";", "}", "error", "=", "\"\"", "+", "typeName", "+", "\"\"", "+", "beanName", "+", "\"\"", "+", "bindingName", ";", "}", "else", "{", "final", "EJBViewDescription", "description", "=", "ejbsForViewName", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "log", ".", "debug", "(", "\"\"", ")", ";", "final", "EJBComponentDescription", "componentDescription", "=", "(", "EJBComponentDescription", ")", "description", ".", "getComponentDescription", "(", ")", ";", "final", "EEModuleDescription", "moduleDescription", "=", "componentDescription", ".", "getModuleDescription", "(", ")", ";", "final", "String", "earApplicationName", "=", "moduleDescription", ".", "getEarApplicationName", "(", ")", ";", "containerFactory", "=", "new", "ContainerManagedReferenceFactory", "(", "earApplicationName", ",", "moduleDescription", ".", "getModuleName", "(", ")", ",", "moduleDescription", ".", "getDistinctName", "(", ")", ",", "componentDescription", ".", "getComponentName", "(", ")", ",", "description", ".", "getViewClassName", "(", ")", ",", "componentDescription", ".", "isStateful", "(", ")", ",", "container", ")", ";", "final", "ServiceName", "serviceName", "=", "description", ".", "getServiceName", "(", ")", ";", "resolvedViewName", "=", "serviceName", ";", "}", "resolved", "=", "true", ";", "}", "}", "}", "}", "private", "Set", "<", "ViewDescription", ">", "getViews", "(", ")", "{", "final", "EEApplicationDescription", "applicationDescription", "=", "deploymentUnit", ".", "getAttachment", "(", "EE_APPLICATION_DESCRIPTION", ")", ";", "final", "ResourceRoot", "deploymentRoot", "=", "deploymentUnit", ".", "getAttachment", "(", "Attachments", ".", "DEPLOYMENT_ROOT", ")", ";", "final", "Set", "<", "ViewDescription", ">", "componentsForViewName", ";", "if", "(", "beanName", "!=", "null", ")", "{", "componentsForViewName", "=", "applicationDescription", ".", "getComponents", "(", "beanName", ",", "typeName", ",", "deploymentRoot", ".", "getRoot", "(", ")", ")", ";", "}", "else", "{", "componentsForViewName", "=", "applicationDescription", ".", "getComponentsForViewName", "(", "typeName", ",", "deploymentRoot", ".", "getRoot", "(", ")", ")", ";", "}", "return", "componentsForViewName", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "this", "==", "o", ")", "return", "true", ";", "if", "(", "!", "(", "o", "instanceof", "AejbInjectionSource", ")", ")", "return", "false", ";", "resolve", "(", ")", ";", "if", "(", "error", "!=", "null", ")", "{", "return", "false", ";", "}", "final", "AejbInjectionSource", "other", "=", "(", "AejbInjectionSource", ")", "o", ";", "return", "eq", "(", "typeName", ",", "other", ".", "typeName", ")", "&&", "eq", "(", "resolvedViewName", ",", "other", ".", "resolvedViewName", ")", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "typeName", ".", "hashCode", "(", ")", ";", "}", "private", "static", "boolean", "eq", "(", "Object", "a", ",", "Object", "b", ")", "{", "return", "a", "==", "b", "||", "(", "a", "!=", "null", "&&", "a", ".", "equals", "(", "b", ")", ")", ";", "}", "}", "</s>" ]
10,066
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "AbstractDeploymentChainStep", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Attachments", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentPhaseContext", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnit", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessingException", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "DeploymentUnitProcessor", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "Phase", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "module", ".", "ResourceRoot", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceController", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceRegistry", ";", "import", "org", ".", "jboss", ".", "vfs", ".", "VirtualFile", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "subsystem", ".", "TrackerService", ";", "public", "class", "SubsystemDeploymentProcessor", "implements", "DeploymentUnitProcessor", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "SubsystemDeploymentProcessor", ".", "class", ")", ";", "public", "static", "final", "Phase", "PHASE", "=", "Phase", ".", "DEPENDENCIES", ";", "public", "static", "final", "int", "PRIORITY", "=", "0x4000", ";", "@", "Override", "public", "void", "deploy", "(", "DeploymentPhaseContext", "phaseContext", ")", "throws", "DeploymentUnitProcessingException", "{", "String", "name", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ".", "getName", "(", ")", ";", "ResourceRoot", "root", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ".", "getAttachment", "(", "Attachments", ".", "DEPLOYMENT_ROOT", ")", ";", "TrackerService", "service", "=", "getTrackerService", "(", "phaseContext", ".", "getServiceRegistry", "(", ")", ",", "name", ")", ";", "if", "(", "service", "!=", "null", ")", "{", "VirtualFile", "cool", "=", "root", ".", "getRoot", "(", ")", ".", "getChild", "(", "\"\"", ")", ";", "service", ".", "addDeployment", "(", "name", ")", ";", "if", "(", "cool", ".", "exists", "(", ")", ")", "{", "service", ".", "addCoolDeployment", "(", "name", ")", ";", "}", "}", "}", "@", "Override", "public", "void", "undeploy", "(", "DeploymentUnit", "context", ")", "{", "context", ".", "getServiceRegistry", "(", ")", ";", "String", "name", "=", "context", ".", "getName", "(", ")", ";", "TrackerService", "service", "=", "getTrackerService", "(", "context", ".", "getServiceRegistry", "(", ")", ",", "name", ")", ";", "if", "(", "service", "!=", "null", ")", "{", "service", ".", "removeDeployment", "(", "name", ")", ";", "}", "}", "private", "TrackerService", "getTrackerService", "(", "ServiceRegistry", "registry", ",", "String", "name", ")", "{", "int", "last", "=", "name", ".", "lastIndexOf", "(", "\".\"", ")", ";", "String", "suffix", "=", "name", ".", "substring", "(", "last", "+", "1", ")", ";", "ServiceController", "<", "?", ">", "container", "=", "registry", ".", "getService", "(", "TrackerService", ".", "createServiceName", "(", "suffix", ")", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "TrackerService", "service", "=", "(", "TrackerService", ")", "container", ".", "getValue", "(", ")", ";", "return", "service", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
10,067
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "transaction", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Hashtable", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "TransactionState", "{", "private", "Map", "<", "String", ",", "TransactionState", ">", "$nextStates", "=", "new", "Hashtable", "<", "String", ",", "TransactionState", ">", "(", ")", ";", "private", "List", "<", "String", ">", "$passedPorts", ";", "private", "List", "<", "String", ">", "$futurePorts", ";", "public", "TransactionState", "(", "String", "[", "]", "passedPorts", ",", "String", "[", "]", "futurePorts", ")", "{", "if", "(", "passedPorts", "!=", "null", ")", "{", "$passedPorts", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "passed", ":", "passedPorts", ")", "$passedPorts", ".", "add", "(", "passed", ")", ";", "}", "if", "(", "futurePorts", "!=", "null", ")", "{", "$futurePorts", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "future", ":", "futurePorts", ")", "$futurePorts", ".", "add", "(", "future", ")", ";", "}", "}", "public", "void", "setNextState", "(", "String", "eventName", ",", "TransactionState", "next", ")", "{", "$nextStates", ".", "put", "(", "eventName", ",", "next", ")", ";", "}", "public", "TransactionState", "getStateAfterEvent", "(", "String", "eventName", ")", "{", "TransactionState", "s", "=", "(", "TransactionState", ")", "$nextStates", ".", "get", "(", "eventName", ")", ";", "return", "s", ";", "}", "public", "List", "<", "String", ">", "getAffectedPorts", "(", ")", "{", "List", "<", "String", ">", "affectedPorts", "=", "null", ";", "if", "(", "$passedPorts", "!=", "null", "&&", "$futurePorts", "!=", "null", ")", "{", "affectedPorts", "=", "new", "ArrayList", "<", "String", ">", "(", "$passedPorts", ")", ";", "affectedPorts", ".", "retainAll", "(", "$futurePorts", ")", ";", "}", "return", "affectedPorts", ";", "}", "public", "List", "<", "String", ">", "getPassedPorts", "(", ")", "{", "return", "$passedPorts", ";", "}", "public", "List", "<", "String", ">", "getFuturePorts", "(", ")", "{", "return", "$futurePorts", ";", "}", "}", "</s>" ]
10,068
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "transaction", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "Transaction", "{", "private", "TransactionState", "$currentState", ";", "public", "void", "init", "(", "TransactionState", "initialState", ")", "{", "$currentState", "=", "initialState", ";", "}", "public", "TransactionState", "getCurrentState", "(", ")", "{", "return", "$currentState", ";", "}", "public", "void", "trigger", "(", "String", "eventName", ")", "{", "if", "(", "$currentState", "!=", "null", ")", "{", "TransactionState", "next", "=", "$currentState", ".", "getStateAfterEvent", "(", "eventName", ")", ";", "if", "(", "next", "!=", "null", ")", "{", "$currentState", "=", "next", ";", "}", "}", "}", "public", "List", "<", "String", ">", "getAffectedPorts", "(", ")", "{", "return", "$currentState", ".", "getAffectedPorts", "(", ")", ";", "}", "public", "List", "<", "String", ">", "getPassedPorts", "(", ")", "{", "return", "$currentState", ".", "getPassedPorts", "(", ")", ";", "}", "public", "List", "<", "String", ">", "getFuturePorts", "(", ")", "{", "return", "$currentState", ".", "getFuturePorts", "(", ")", ";", "}", "}", "</s>" ]
10,069
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "transaction", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Map", ".", "Entry", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "TransactionManager", ";", "public", "class", "TransactionManagerImpl", "implements", "TransactionManager", "{", "private", "TransactionState", "[", "]", "$states", ";", "private", "String", "$name", ";", "private", "int", "$runNumber", ";", "private", "Map", "<", "String", ",", "Transaction", ">", "$transactions", ";", "private", "String", "[", "]", "$portNames", ";", "private", "String", "$transactionmethod", ";", "public", "String", "getTransactionMethodName", "(", ")", "{", "return", "$transactionmethod", ";", "}", "public", "TransactionManagerImpl", "(", "String", "name", ",", "String", "method", ",", "String", "[", "]", "portNames", ",", "TransactionState", "[", "]", "states", ",", "Map", "<", "String", ",", "String", ">", "[", "]", "nextStates", ")", "{", "$name", "=", "name", ";", "$states", "=", "states", ";", "$transactionmethod", "=", "method", ";", "$transactions", "=", "new", "HashMap", "<", "String", ",", "Transaction", ">", "(", ")", ";", "$portNames", "=", "portNames", ";", "final", "int", "index", "=", "$states", ".", "length", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "index", ";", "i", "++", ")", "{", "Map", "<", "String", ",", "String", ">", "table", "=", "nextStates", "[", "i", "]", ";", "Iterator", "<", "Entry", "<", "String", ",", "String", ">", ">", "itrator", "=", "table", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "itrator", ".", "hasNext", "(", ")", ")", "{", "Entry", "<", "String", ",", "String", ">", "entry", "=", "itrator", ".", "next", "(", ")", ";", "String", "eventName", "=", "entry", ".", "getKey", "(", ")", ";", "String", "next", "=", "entry", ".", "getValue", "(", ")", ";", "int", "n", "=", "Integer", ".", "parseInt", "(", "next", ".", "substring", "(", "1", ")", ")", ";", "$states", "[", "i", "]", ".", "setNextState", "(", "eventName", ",", "$states", "[", "n", "]", ")", ";", "}", "}", "}", "public", "String", "getName", "(", ")", "{", "return", "$name", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "$name", "+", "\"_\"", "+", "getRunNumber", "(", ")", ";", "}", "public", "int", "getRunNumber", "(", ")", "{", "return", "$runNumber", ";", "}", "public", "boolean", "isActive", "(", ")", "{", "return", "getRunNumber", "(", ")", "!=", "0", ";", "}", "public", "boolean", "isActive", "(", "String", "objectId", ")", "{", "return", "$transactions", ".", "containsKey", "(", "objectId", ")", ";", "}", "public", "void", "trigger", "(", "String", "objectId", ",", "String", "eventName", ")", "{", "synchronized", "(", "$transactions", ")", "{", "if", "(", "!", "$transactions", ".", "containsKey", "(", "objectId", ")", ")", "createTransaction", "(", "objectId", ")", ";", "Transaction", "tran", "=", "$transactions", ".", "get", "(", "objectId", ")", ";", "tran", ".", "trigger", "(", "eventName", ")", ";", "}", "}", "public", "List", "<", "String", ">", "getAffectedPorts", "(", ")", "{", "List", "<", "String", ">", "affectedports", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "Transaction", "tran", ":", "$transactions", ".", "values", "(", ")", ")", "{", "affectedports", ".", "addAll", "(", "tran", ".", "getAffectedPorts", "(", ")", ")", ";", "}", "return", "affectedports", ";", "}", "public", "String", "[", "]", "getInvolvedPorts", "(", ")", "{", "return", "$portNames", ";", "}", "public", "void", "createTransaction", "(", "String", "objectId", ")", "{", "Transaction", "transaction", "=", "new", "Transaction", "(", ")", ";", "transaction", ".", "init", "(", "$states", "[", "0", "]", ")", ";", "$runNumber", "++", ";", "$transactions", ".", "put", "(", "objectId", ",", "transaction", ")", ";", "}", "public", "void", "destroyTransaction", "(", "String", "objectId", ")", "{", "$transactions", ".", "remove", "(", "objectId", ")", ";", "$runNumber", "--", ";", "}", "@", "Override", "public", "List", "<", "String", ">", "getAffectedPorts", "(", "String", "objectId", ")", "{", "if", "(", "$transactions", ".", "containsKey", "(", "objectId", ")", ")", "{", "Transaction", "transaction", "=", "$transactions", ".", "get", "(", "objectId", ")", ";", "return", "transaction", ".", "getAffectedPorts", "(", ")", ";", "}", "return", "null", ";", "}", "@", "Override", "public", "List", "<", "String", ">", "getPassedPorts", "(", "String", "objectId", ")", "{", "if", "(", "$transactions", ".", "containsKey", "(", "objectId", ")", ")", "{", "Transaction", "transaction", "=", "$transactions", ".", "get", "(", "objectId", ")", ";", "return", "transaction", ".", "getPassedPorts", "(", ")", ";", "}", "return", "null", ";", "}", "@", "Override", "public", "List", "<", "String", ">", "getFuturePorts", "(", "String", "objectId", ")", "{", "if", "(", "$transactions", ".", "containsKey", "(", "objectId", ")", ")", "{", "Transaction", "transaction", "=", "$transactions", ".", "get", "(", "objectId", ")", ";", "return", "transaction", ".", "getFuturePorts", "(", ")", ";", "}", "return", "null", ";", "}", "@", "Override", "public", "void", "trigger", "(", "String", "objectId", ")", "{", "synchronized", "(", "$transactions", ")", "{", "if", "(", "!", "$transactions", ".", "containsKey", "(", "objectId", ")", ")", "return", ";", "destroyTransaction", "(", "objectId", ")", ";", "}", "}", "}", "</s>" ]
10,070
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "jboss", ".", "as", ".", "server", ".", "deployment", ".", "AttachmentKey", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "public", "class", "Attachments", "{", "public", "static", "final", "AttachmentKey", "<", "Map", "<", "String", ",", "AcContainer", ">", ">", "AEJB_INFO", "=", "AttachmentKey", ".", "create", "(", "Map", ".", "class", ")", ";", "}", "</s>" ]
10,071
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ";", "import", "org", ".", "jboss", ".", "dmr", ".", "ModelNode", ";", "public", "class", "OperationFailedException", "extends", "Exception", "{", "private", "final", "ModelNode", "failureDescription", ";", "private", "static", "final", "long", "serialVersionUID", "=", "-", "7739982937774202930L", ";", "public", "OperationFailedException", "(", "final", "String", "msg", ",", "final", "ModelNode", "description", ")", "{", "super", "(", "msg", ")", ";", "failureDescription", "=", "description", ";", "}", "public", "OperationFailedException", "(", "final", "String", "message", ")", "{", "this", "(", "message", ",", "new", "ModelNode", "(", "message", ")", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "super", ".", "toString", "(", ")", "+", "\"", "[", "\"", "+", "failureDescription", "+", "\"", "]\"", ";", "}", "}", "</s>" ]
10,072
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "behaviors", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "OperationStepHandler", ";", "public", "abstract", "class", "EvolutionBehavior", "implements", "OperationStepHandler", "{", "List", "<", "OperationStepHandler", ">", "handlers", "=", "new", "ArrayList", "<", "OperationStepHandler", ">", "(", ")", ";", "abstract", "protected", "void", "initializeStepHandlers", "(", ")", ";", "protected", "void", "perform", "(", ")", "throws", "OperationFailedException", "{", "OperationContext", "context", "=", "generateOperationContext", "(", ")", ";", "initializeStepHandlers", "(", ")", ";", "for", "(", "Iterator", "<", "OperationStepHandler", ">", "iterator", "=", "handlers", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "OperationStepHandler", "handler", "=", "iterator", ".", "next", "(", ")", ";", "if", "(", "handler", ".", "execute", "(", "context", ")", "==", "OperationResult", ".", "UnExpected", ")", "rollBackWhenUnExpectedResult", "(", "handler", ")", ";", "}", "}", "abstract", "protected", "OperationContext", "generateOperationContext", "(", ")", ";", "abstract", "void", "rollBackWhenUnExpectedResult", "(", "OperationStepHandler", "handler", ")", "throws", "OperationFailedException", ";", "}", "</s>" ]
10,073
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "behaviors", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "DependencyComputeHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "OperationStepHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "StatusShiftHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientImpl", ".", "AEjbStatus", ";", "public", "class", "ComponentLocker", "extends", "EvolutionBehavior", "{", "private", "static", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "static", "final", "String", "LOCK", "=", "\"lock\"", ";", "static", "final", "String", "UNLOCK", "=", "\"unlock\"", ";", "private", "String", "aejbName", ";", "private", "AEjbUtilities", "utilities", ";", "private", "AEjbStatus", "status", ";", "private", "void", "lock", "(", "String", "aejbName", ")", "throws", "OperationFailedException", "{", "this", ".", "aejbName", "=", "aejbName", ";", "this", ".", "status", "=", "AEjbStatus", ".", "BLOCKING", ";", "perform", "(", ")", ";", "}", "private", "void", "unlock", "(", "String", "aejbName", ")", "throws", "OperationFailedException", "{", "this", ".", "aejbName", "=", "aejbName", ";", "this", ".", "status", "=", "AEjbStatus", ".", "RESUMING", ";", "perform", "(", ")", ";", "}", "@", "Override", "protected", "OperationContext", "generateOperationContext", "(", ")", "{", "OperationContext", "context", "=", "new", "OperationContext", "(", "null", ",", "aejbName", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "AEjbUtilities", ".", "class", ",", "utilities", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "AEjbStatus", ".", "class", ",", "status", ")", ";", "return", "context", ";", "}", "@", "Override", "protected", "void", "initializeStepHandlers", "(", ")", "{", "handlers", ".", "add", "(", "new", "DependencyComputeHandler", "(", ")", ")", ";", "handlers", ".", "add", "(", "new", "StatusShiftHandler", "(", ")", ")", ";", "}", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "String", "operationName", "=", "context", ".", "getOperationName", "(", ")", ";", "utilities", "=", "(", "AEjbUtilities", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "AEjbUtilities", ".", "class", ")", ";", "if", "(", "LOCK", ".", "equals", "(", "operationName", ")", ")", "{", "lock", "(", "context", ".", "getTargetName", "(", ")", ")", ";", "}", "else", "if", "(", "UNLOCK", ".", "equals", "(", "operationName", ")", ")", "{", "unlock", "(", "context", ".", "getTargetName", "(", ")", ")", ";", "}", "else", "throw", "new", "OperationFailedException", "(", "\"\"", "+", "operationName", "+", "\"\"", ")", ";", "return", "OperationResult", ".", "Expected", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "@", "Override", "void", "rollBackWhenUnExpectedResult", "(", "OperationStepHandler", "handler", ")", "{", "}", "}", "</s>" ]
10,074
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "behaviors", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "ComponentInstanceDirectHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "ComponentSecurityHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "DependencyChangeHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "InterfaceCompareHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "OperationAlterHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "OperationStepHandler", ";", "public", "class", "ComponentReplacer", "extends", "EvolutionBehavior", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "ComponentReplacer", ".", "class", ")", ";", "private", "static", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "private", "final", "String", "fromName", ";", "private", "final", "String", "toName", ";", "private", "final", "String", "protocol", ";", "private", "AEjbUtilities", "utilities", ";", "public", "ComponentReplacer", "(", "String", "fromName", ",", "String", "toName", ",", "String", "protocol", ")", "{", "this", ".", "fromName", "=", "fromName", ";", "this", ".", "toName", "=", "toName", ";", "this", ".", "protocol", "=", "protocol", ";", "}", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "utilities", "=", "(", "AEjbUtilities", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "AEjbUtilities", ".", "class", ")", ";", "perform", "(", ")", ";", "return", "OperationResult", ".", "Expected", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "@", "Override", "protected", "void", "initializeStepHandlers", "(", ")", "{", "handlers", ".", "add", "(", "new", "InterfaceCompareHandler", "(", ")", ")", ";", "handlers", ".", "add", "(", "new", "OperationAlterHandler", "(", "ComponentLocker", ".", "LOCK", ")", ")", ";", "handlers", ".", "add", "(", "new", "ComponentLocker", "(", ")", ")", ";", "handlers", ".", "add", "(", "new", "ComponentSecurityHandler", "(", ")", ")", ";", "handlers", ".", "add", "(", "new", "ComponentInstanceDirectHandler", "(", ")", ")", ";", "handlers", ".", "add", "(", "new", "OperationAlterHandler", "(", "ComponentLocker", ".", "UNLOCK", ")", ")", ";", "handlers", ".", "add", "(", "new", "ComponentLocker", "(", ")", ")", ";", "handlers", ".", "add", "(", "new", "DependencyChangeHandler", "(", ")", ")", ";", "}", "@", "Override", "protected", "OperationContext", "generateOperationContext", "(", ")", "{", "OperationContext", "context", "=", "new", "OperationContext", "(", "null", ",", "fromName", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "AEjbUtilities", ".", "class", ",", "utilities", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "\"toName\"", ",", "toName", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "\"protocol\"", ",", "protocol", ")", ";", "return", "context", ";", "}", "@", "Override", "void", "rollBackWhenUnExpectedResult", "(", "OperationStepHandler", "handler", ")", "throws", "OperationFailedException", "{", "}", "}", "</s>" ]
10,075
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "behaviors", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "DependencyChangeHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "DependencyComputeHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "ComponentInstanceDirectHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "InterfaceCompareHandler", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ".", "OperationStepHandler", ";", "public", "class", "ComponentSwitcher", "extends", "EvolutionBehavior", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "ComponentSwitcher", ".", "class", ")", ";", "private", "static", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "private", "final", "String", "fromName", ";", "private", "final", "String", "toName", ";", "private", "final", "String", "protocol", ";", "private", "AEjbUtilities", "utilities", ";", "public", "ComponentSwitcher", "(", "String", "fromName", ",", "String", "toName", ",", "String", "protocol", ")", "{", "this", ".", "fromName", "=", "fromName", ";", "this", ".", "toName", "=", "toName", ";", "this", ".", "protocol", "=", "protocol", ";", "}", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "utilities", "=", "(", "AEjbUtilities", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "AEjbUtilities", ".", "class", ")", ";", "perform", "(", ")", ";", "return", "OperationResult", ".", "Expected", ";", "}", "@", "Override", "protected", "void", "initializeStepHandlers", "(", ")", "{", "handlers", ".", "add", "(", "new", "InterfaceCompareHandler", "(", ")", ")", ";", "handlers", ".", "add", "(", "new", "DependencyComputeHandler", "(", ")", ")", ";", "handlers", ".", "add", "(", "new", "ComponentInstanceDirectHandler", "(", ")", ")", ";", "handlers", ".", "add", "(", "new", "DependencyChangeHandler", "(", ")", ")", ";", "}", "@", "Override", "protected", "OperationContext", "generateOperationContext", "(", ")", "{", "OperationContext", "context", "=", "new", "OperationContext", "(", "null", ",", "fromName", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "AEjbUtilities", ".", "class", ",", "utilities", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "\"toName\"", ",", "toName", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "\"protocol\"", ",", "protocol", ")", ";", "return", "context", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "@", "Override", "void", "rollBackWhenUnExpectedResult", "(", "OperationStepHandler", "handler", ")", "throws", "OperationFailedException", "{", "throw", "new", "OperationFailedException", "(", "handler", ".", "getHandlerName", "(", ")", "+", "\"\"", ")", ";", "}", "}", "</s>" ]
10,076
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "OperationContext", "{", "private", "String", "operationName", ";", "private", "String", "targetName", ";", "private", "Map", "<", "Object", ",", "Object", ">", "contextData", "=", "new", "HashMap", "<", "Object", ",", "Object", ">", "(", ")", ";", "public", "OperationContext", "(", "String", "operationName", ",", "String", "targetName", ")", "{", "this", ".", "operationName", "=", "operationName", ";", "this", ".", "targetName", "=", "targetName", ";", "}", "public", "Map", "<", "Object", ",", "Object", ">", "getContextData", "(", ")", "{", "return", "contextData", ";", "}", "public", "String", "getOperationName", "(", ")", "{", "return", "operationName", ";", "}", "public", "void", "setOperationName", "(", "String", "operationName", ")", "{", "this", ".", "operationName", "=", "operationName", ";", "}", "public", "String", "getTargetName", "(", ")", "{", "return", "targetName", ";", "}", "public", "void", "setTargetName", "(", "String", "targetName", ")", "{", "this", ".", "targetName", "=", "targetName", ";", "}", "}", "</s>" ]
10,077
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Map", ".", "Entry", ";", "import", "java", ".", "util", ".", "concurrent", ".", "atomic", ".", "AtomicLong", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "Service", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceName", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StartContext", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StartException", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StopContext", ";", "import", "org", ".", "jboss", ".", "msc", ".", "value", ".", "InjectedValue", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "behaviors", ".", "ComponentSwitcher", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "protocols", ".", "Protocol", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "protocols", ".", "QuiescenceProtocol", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "protocols", ".", "TranquilityProtocol", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClient", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientImpl", ".", "AEjbStatus", ";", "public", "class", "DuService", "implements", "Service", "<", "DuService", ">", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "DuService", ".", "class", ")", ";", "public", "static", "final", "ServiceName", "SERVICE_NAME", "=", "ServiceName", ".", "JBOSS", ".", "append", "(", "\"aejb\"", ",", "\"duservice\"", ")", ";", "private", "final", "InjectedValue", "<", "AEjbClient", ">", "aejbClientValue", "=", "new", "InjectedValue", "<", "AEjbClient", ">", "(", ")", ";", "private", "final", "InjectedValue", "<", "AEjbUtilities", ">", "aejbUtilitiesValue", "=", "new", "InjectedValue", "<", "AEjbUtilities", ">", "(", ")", ";", "private", "final", "AtomicLong", "tick", "=", "new", "AtomicLong", "(", "2500", ")", ";", "@", "Override", "public", "DuService", "getValue", "(", ")", "throws", "IllegalStateException", ",", "IllegalArgumentException", "{", "return", "this", ";", "}", "AEjbClient", "getAEjbClient", "(", ")", "{", "return", "aejbClientValue", ".", "getValue", "(", ")", ";", "}", "AEjbUtilities", "getAEjbUtilities", "(", ")", "{", "return", "aejbUtilitiesValue", ".", "getValue", "(", ")", ";", "}", "private", "Thread", "CLIENT_MONITOR", "=", "new", "Thread", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "while", "(", "true", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "tick", ".", "get", "(", ")", ")", ";", "Map", "<", "String", ",", "AEjbStatus", ">", "aejbStatus", "=", "getAEjbClient", "(", ")", ".", "getAEjbStatus", "(", ")", ";", "if", "(", "!", "aejbStatus", ".", "isEmpty", "(", ")", ")", "{", "manageAEjbState", "(", "aejbStatus", ")", ";", "getAEjbClient", "(", ")", ".", "clearAEjbStatus", "(", ")", ";", "}", "Map", "<", "String", ",", "String", ">", "switchMap", "=", "getAEjbClient", "(", ")", ".", "getSwitchMap", "(", ")", ";", "if", "(", "!", "switchMap", ".", "isEmpty", "(", ")", ")", "{", "manageAEjbSwitch", "(", "switchMap", ")", ";", "getAEjbClient", "(", ")", ".", "clearSwitchMap", "(", ")", ";", "}", "}", "catch", "(", "InterruptedException", "e", ")", "{", "interrupted", "(", ")", ";", "break", ";", "}", "}", "}", "}", ";", "@", "Override", "public", "void", "start", "(", "StartContext", "context", ")", "throws", "StartException", "{", "CLIENT_MONITOR", ".", "start", "(", ")", ";", "}", "private", "void", "manageAEjbState", "(", "Map", "<", "String", ",", "AEjbStatus", ">", "aejbStatus", ")", "{", "getAEjbUtilities", "(", ")", ".", "setAEjbStatus", "(", "aejbStatus", ")", ";", "}", "private", "void", "manageAEjbSwitch", "(", "Map", "<", "String", ",", "String", ">", "switchMap", ")", "{", "Iterator", "<", "Entry", "<", "String", ",", "String", ">", ">", "iterator", "=", "switchMap", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "Entry", "<", "String", ",", "String", ">", "entry", "=", "iterator", ".", "next", "(", ")", ";", "String", "fromName", "=", "entry", ".", "getKey", "(", ")", ";", "String", "toName", "=", "entry", ".", "getValue", "(", ")", ";", "OperationContext", "context", "=", "new", "OperationContext", "(", "null", ",", "fromName", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "AEjbUtilities", ".", "class", ",", "getAEjbUtilities", "(", ")", ")", ";", "try", "{", "new", "ComponentSwitcher", "(", "fromName", ",", "toName", ",", "getAEjbClient", "(", ")", ".", "getProtocol", "(", "fromName", ")", ")", ".", "execute", "(", "context", ")", ";", "}", "catch", "(", "OperationFailedException", "e", ")", "{", "log", ".", "warn", "(", "e", ".", "getMessage", "(", ")", ")", ";", "log", ".", "info", "(", "\"#Evolution:", "\"", "+", "fromName", "+", "\"", "switch", "to", "\"", "+", "toName", "+", "\"", "failed.\"", ")", ";", "}", "}", "}", "@", "Override", "public", "void", "stop", "(", "StopContext", "context", ")", "{", "CLIENT_MONITOR", ".", "interrupt", "(", ")", ";", "}", "public", "InjectedValue", "<", "AEjbClient", ">", "getAejbClientValue", "(", ")", "{", "return", "aejbClientValue", ";", "}", "public", "InjectedValue", "<", "AEjbUtilities", ">", "getAejbUtilitiesValue", "(", ")", "{", "return", "aejbUtilitiesValue", ";", "}", "public", "static", "Protocol", "getProtocol", "(", "String", "protocolName", ")", "{", "if", "(", "\"quiescence\"", ".", "equals", "(", "protocolName", ")", ")", "{", "return", "new", "QuiescenceProtocol", "(", ")", ";", "}", "else", "if", "(", "\"tranquility\"", ".", "equals", "(", "protocolName", ")", ")", "{", "return", "new", "TranquilityProtocol", "(", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
10,078
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "aejb", ".", "AEjb", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "public", "class", "DependencyComputeHandler", "implements", "OperationStepHandler", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "DependencyComputeHandler", ".", "class", ")", ";", "private", "static", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "log", ".", "info", "(", "\"\"", ")", ";", "final", "AEjbUtilities", "utilities", "=", "(", "AEjbUtilities", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "AEjbUtilities", ".", "class", ")", ";", "final", "String", "targetName", "=", "context", ".", "getTargetName", "(", ")", ";", "if", "(", "utilities", "==", "null", "||", "targetName", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "\"\"", ")", ";", "List", "<", "String", ">", "neighbors", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "AcContainer", "container", ":", "utilities", ".", "getAllContainers", "(", ")", ")", "{", "Set", "<", "String", ">", "dependencies", "=", "container", ".", "getRuntimeDependencies", "(", ")", ";", "log", ".", "info", "(", "\"container", "=", "\"", "+", "container", ".", "getAEJBName", "(", ")", "+", "\"\"", "+", "dependencies", ")", ";", "if", "(", "dependencies", "!=", "null", "&&", "dependencies", ".", "contains", "(", "targetName", ")", ")", "{", "neighbors", ".", "add", "(", "container", ".", "getAEJBName", "(", ")", ")", ";", "}", "}", "log", ".", "info", "(", "targetName", "+", "\"\"", "+", "neighbors", ")", ";", "context", ".", "getContextData", "(", ")", ".", "put", "(", "\"neighbors\"", ",", "neighbors", ")", ";", "log", ".", "info", "(", "\"\"", ")", ";", "return", "OperationResult", ".", "Expected", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "}", "</s>" ]
10,079
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "public", "class", "ComponentInstanceDirectHandler", "implements", "OperationStepHandler", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "ComponentInstanceDirectHandler", ".", "class", ")", ";", "private", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "log", ".", "debug", "(", "\"\"", ")", ";", "final", "List", "<", "String", ">", "neighbors", "=", "(", "List", "<", "String", ">", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"neighbors\"", ")", ";", "final", "String", "targetName", "=", "context", ".", "getTargetName", "(", ")", ";", "final", "String", "toName", "=", "(", "String", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"toName\"", ")", ";", "final", "String", "protocol", "=", "(", "String", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"protocol\"", ")", ";", "final", "AcContainer", "toCon", "=", "AEjbUtilities", ".", "getContainer", "(", "toName", ")", ";", "if", "(", "neighbors", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "\"\"", ")", ";", "if", "(", "toCon", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "\"\"", "+", "toName", "+", "\".\"", ")", ";", "for", "(", "String", "aejbName", ":", "neighbors", ")", "{", "AcContainer", "con", "=", "AEjbUtilities", ".", "getContainer", "(", "aejbName", ")", ";", "if", "(", "con", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "\"\"", "+", "aejbName", "+", "\".\"", ")", ";", "con", ".", "getEvolutionStatistics", "(", ")", ".", "addToDirectionalMap", "(", "targetName", ",", "toCon", ")", ";", "con", ".", "getEvolutionStatistics", "(", ")", ".", "addProtocol", "(", "targetName", ",", "protocol", ")", ";", "}", "log", ".", "debug", "(", "\"\"", ")", ";", "return", "OperationResult", ".", "Expected", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "}", "</s>" ]
10,080
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "public", "interface", "OperationStepHandler", "{", "enum", "OperationResult", "{", "Expected", ",", "UnExpected", ",", "}", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", ";", "String", "getHandlerName", "(", ")", ";", "}", "</s>" ]
10,081
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientImpl", ".", "AEjbStatus", ";", "public", "class", "StatusShiftHandler", "implements", "OperationStepHandler", "{", "private", "static", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "final", "List", "<", "String", ">", "neighbors", "=", "(", "List", "<", "String", ">", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"neighbors\"", ")", ";", "final", "String", "targetName", "=", "context", ".", "getTargetName", "(", ")", ";", "final", "AEjbStatus", "status", "=", "(", "AEjbStatus", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "AEjbStatus", ".", "class", ")", ";", "if", "(", "neighbors", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "\"\"", ")", ";", "for", "(", "String", "aejbName", ":", "neighbors", ")", "{", "AcContainer", "con", "=", "AEjbUtilities", ".", "getContainer", "(", "aejbName", ")", ";", "if", "(", "con", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "\"\"", "+", "aejbName", "+", "\".\"", ")", ";", "con", ".", "getEvolutionStatistics", "(", ")", ".", "setAEjbStatus", "(", "targetName", ",", "status", ")", ";", "}", "return", "OperationResult", ".", "Expected", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "}", "</s>" ]
10,082
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "public", "class", "OperationAlterHandler", "implements", "OperationStepHandler", "{", "private", "static", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "private", "final", "String", "operationName", ";", "public", "OperationAlterHandler", "(", "String", "operationName", ")", "{", "this", ".", "operationName", "=", "operationName", ";", "}", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "context", ".", "setOperationName", "(", "operationName", ")", ";", "return", "OperationResult", ".", "Expected", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "}", "</s>" ]
10,083
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "public", "class", "DependencyChangeHandler", "implements", "OperationStepHandler", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "DependencyChangeHandler", ".", "class", ")", ";", "private", "static", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "log", ".", "info", "(", "\"\"", ")", ";", "if", "(", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"\"", ")", "==", "null", "||", "(", "Boolean", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"\"", ")", ")", "{", "final", "List", "<", "String", ">", "neighbors", "=", "(", "List", "<", "String", ">", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"neighbors\"", ")", ";", "final", "String", "targetName", "=", "context", ".", "getTargetName", "(", ")", ";", "final", "String", "toName", "=", "(", "String", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"toName\"", ")", ";", "if", "(", "neighbors", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "\"\"", ")", ";", "for", "(", "String", "aejbName", ":", "neighbors", ")", "{", "AcContainer", "con", "=", "AEjbUtilities", ".", "getContainer", "(", "aejbName", ")", ";", "if", "(", "con", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "\"\"", "+", "aejbName", "+", "\".\"", ")", ";", "con", ".", "changeRuntimeDependencies", "(", "targetName", ",", "toName", ")", ";", "log", ".", "info", "(", "aejbName", "+", "\"\"", "+", "targetName", "+", "\"", "to", "\"", "+", "toName", ")", ";", "}", "}", "log", ".", "info", "(", "\"\"", ")", ";", "return", "OperationResult", ".", "Expected", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "}", "</s>" ]
10,084
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "public", "class", "InterfaceCompareHandler", "implements", "OperationStepHandler", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "InterfaceCompareHandler", ".", "class", ")", ";", "private", "static", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "log", ".", "info", "(", "\"\"", ")", ";", "final", "String", "fromName", "=", "context", ".", "getTargetName", "(", ")", ";", "final", "String", "toName", "=", "(", "String", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"toName\"", ")", ";", "final", "AEjbUtilities", "utilities", "=", "(", "AEjbUtilities", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "AEjbUtilities", ".", "class", ")", ";", "if", "(", "utilities", "==", "null", "||", "fromName", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "\"\"", ")", ";", "if", "(", "toName", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "fromName", "+", "\"\"", ")", ";", "log", ".", "info", "(", "\"fromName", "=", "\"", "+", "fromName", "+", "\";toName", "=", "\"", "+", "toName", ")", ";", "AcContainer", "fromContainer", "=", "AEjbUtilities", ".", "getContainer", "(", "fromName", ")", ";", "AcContainer", "toContainer", "=", "AEjbUtilities", ".", "getContainer", "(", "toName", ")", ";", "if", "(", "fromContainer", "==", "null", "||", "toContainer", "==", "null", ")", "throw", "new", "OperationFailedException", "(", "fromName", "+", "\"", "or", "\"", "+", "toName", "+", "\"\"", ")", ";", "if", "(", "fromContainer", ".", "getLocalView", "(", ")", ".", "size", "(", ")", "!=", "toContainer", ".", "getLocalView", "(", ")", ".", "size", "(", ")", "||", "fromContainer", ".", "getRemoteView", "(", ")", ".", "size", "(", ")", "!=", "toContainer", ".", "getRemoteView", "(", ")", ".", "size", "(", ")", ")", "throw", "new", "OperationFailedException", "(", "fromName", "+", "\"", "and", "\"", "+", "toName", "+", "\"\"", ")", ";", "boolean", "locale", "=", "equalSet", "(", "fromContainer", ".", "getLocalView", "(", ")", ",", "toContainer", ".", "getLocalView", "(", ")", ")", ";", "boolean", "remote", "=", "equalSet", "(", "fromContainer", ".", "getRemoteView", "(", ")", ",", "toContainer", ".", "getRemoteView", "(", ")", ")", ";", "log", ".", "info", "(", "\"\"", ")", ";", "return", "(", "locale", "&&", "remote", ")", "?", "OperationResult", ".", "Expected", ":", "OperationResult", ".", "UnExpected", ";", "}", "private", "boolean", "equalSet", "(", "Set", "<", "Class", "<", "?", ">", ">", "sets1", ",", "Set", "<", "Class", "<", "?", ">", ">", "sets2", ")", "{", "int", "sum", "=", "sets1", ".", "size", "(", ")", ";", "int", "num", "=", "0", ";", "for", "(", "Class", "<", "?", ">", "class1", ":", "sets1", ")", "{", "for", "(", "Class", "<", "?", ">", "class2", ":", "sets2", ")", "{", "if", "(", "equals", "(", "class1", ",", "class2", ")", ")", "{", "num", "++", ";", "break", ";", "}", "}", "}", "return", "sum", "==", "num", ";", "}", "public", "static", "boolean", "equals", "(", "Class", "<", "?", ">", "c1", ",", "Class", "<", "?", ">", "c2", ")", "{", "if", "(", "c1", "==", "null", "&&", "c2", "==", "null", ")", "return", "true", ";", "if", "(", "c1", "!=", "null", "&&", "c2", "!=", "null", ")", "{", "Method", "[", "]", "methods1", "=", "c1", ".", "getMethods", "(", ")", ";", "Method", "[", "]", "methods2", "=", "c2", ".", "getMethods", "(", ")", ";", "if", "(", "methods1", "==", "null", "||", "methods2", "==", "null", "||", "methods1", ".", "length", "!=", "methods2", ".", "length", ")", "return", "false", ";", "int", "methodsSum", "=", "methods1", ".", "length", ";", "int", "methodsNum", "=", "0", ";", "for", "(", "Method", "method1", ":", "methods1", ")", "{", "for", "(", "Method", "method2", ":", "methods2", ")", "{", "if", "(", "method1", ".", "getName", "(", ")", "==", "method2", ".", "getName", "(", ")", ")", "{", "if", "(", "!", "method1", ".", "getReturnType", "(", ")", ".", "equals", "(", "method2", ".", "getReturnType", "(", ")", ")", ")", "continue", ";", "Class", "<", "?", ">", "[", "]", "params1", "=", "method1", ".", "getParameterTypes", "(", ")", ";", "Class", "<", "?", ">", "[", "]", "params2", "=", "method2", ".", "getParameterTypes", "(", ")", ";", "if", "(", "params1", ".", "length", "==", "params2", ".", "length", ")", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "params1", ".", "length", ";", "i", "++", ")", "{", "if", "(", "params1", "[", "i", "]", "!=", "params2", "[", "i", "]", ")", "break", ";", "}", "if", "(", "i", "==", "params1", ".", "length", ")", "methodsNum", "++", ";", "}", "}", "}", "}", "if", "(", "methodsNum", "==", "methodsSum", ")", "return", "true", ";", "}", "return", "false", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "}", "</s>" ]
10,085
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AEjbUtilities", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "DuService", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "protocols", ".", "Protocol", ";", "public", "class", "ComponentSecurityHandler", "implements", "OperationStepHandler", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "ComponentSecurityHandler", ".", "class", ")", ";", "private", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "final", "String", "protocolName", "=", "(", "String", ")", "context", ".", "getContextData", "(", ")", ".", "get", "(", "\"protocol\"", ")", ";", "final", "String", "aejbName", "=", "context", ".", "getTargetName", "(", ")", ";", "Protocol", "protocol", "=", "DuService", ".", "getProtocol", "(", "protocolName", ")", ";", "if", "(", "protocol", "!=", "null", ")", "{", "boolean", "res", "=", "protocol", ".", "setToSafePoint", "(", "AEjbUtilities", ".", "getContainer", "(", "aejbName", ")", ")", ";", "if", "(", "res", ")", "return", "OperationResult", ".", "Expected", ";", "}", "return", "OperationResult", ".", "UnExpected", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "}", "</s>" ]
10,086
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "handlers", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationContext", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "OperationFailedException", ";", "public", "class", "SingletonAEjbHandler", "implements", "OperationStepHandler", "{", "private", "static", "final", "String", "HANDLER_NAME", "=", "\"\"", ";", "@", "Override", "public", "OperationResult", "execute", "(", "OperationContext", "context", ")", "throws", "OperationFailedException", "{", "return", "null", ";", "}", "@", "Override", "public", "String", "getHandlerName", "(", ")", "{", "return", "HANDLER_NAME", ";", "}", "}", "</s>" ]
10,087
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "protocols", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "TransactionManager", ";", "public", "class", "QuiescenceProtocol", "implements", "Protocol", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "QuiescenceProtocol", ".", "class", ")", ";", "@", "Override", "public", "boolean", "checkTransactionSecurity", "(", "String", "targetName", ",", "String", "objectId", ",", "TransactionManager", "transactionManager", ")", "{", "log", ".", "debug", "(", "\"Using", "\\\"\"", "+", "getName", "(", ")", "+", "\"\"", ")", ";", "String", "[", "]", "ports", "=", "transactionManager", ".", "getInvolvedPorts", "(", ")", ";", "if", "(", "ports", "!=", "null", "&&", "transactionManager", ".", "isActive", "(", "objectId", ")", ")", "{", "if", "(", "transactionManager", ".", "getPassedPorts", "(", "objectId", ")", ".", "contains", "(", "targetName", ")", "||", "transactionManager", ".", "getFuturePorts", "(", "objectId", ")", ".", "contains", "(", "targetName", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "@", "Override", "public", "String", "getName", "(", ")", "{", "return", "\"QUIESCENCE\"", ";", "}", "@", "Override", "public", "boolean", "setToSafePoint", "(", "AcContainer", "container", ")", "{", "return", "false", ";", "}", "}", "</s>" ]
10,088
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "protocols", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "TransactionManager", ";", "public", "class", "TranquilityProtocol", "implements", "Protocol", "{", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "TranquilityProtocol", ".", "class", ")", ";", "@", "Override", "public", "boolean", "checkTransactionSecurity", "(", "String", "targetName", ",", "String", "objectId", ",", "TransactionManager", "transactionManager", ")", "{", "log", ".", "debug", "(", "\"Using", "\\\"\"", "+", "getName", "(", ")", "+", "\"\"", ")", ";", "List", "<", "String", ">", "ports", "=", "transactionManager", ".", "getAffectedPorts", "(", "objectId", ")", ";", "if", "(", "ports", "!=", "null", "&&", "ports", ".", "contains", "(", "targetName", ")", ")", "return", "false", ";", "return", "true", ";", "}", "@", "Override", "public", "String", "getName", "(", ")", "{", "return", "\"TRANQUILITY\"", ";", "}", "@", "Override", "public", "boolean", "setToSafePoint", "(", "AcContainer", "container", ")", "{", "return", "false", ";", "}", "}", "</s>" ]
10,089
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "evolution", ".", "protocols", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "component", ".", "AcContainer", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "deployment", ".", "processors", ".", "TransactionManager", ";", "public", "interface", "Protocol", "{", "boolean", "checkTransactionSecurity", "(", "String", "targetName", ",", "String", "objectId", ",", "TransactionManager", "transactionManager", ")", ";", "String", "getName", "(", ")", ";", "boolean", "setToSafePoint", "(", "AcContainer", "container", ")", ";", "}", "</s>" ]
10,090
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ";", "import", "org", ".", "jboss", ".", "logging", ".", "BasicLogger", ";", "import", "org", ".", "jboss", ".", "logging", ".", "LogMessage", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ".", "Level", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Message", ";", "import", "org", ".", "jboss", ".", "logging", ".", "MessageLogger", ";", "@", "MessageLogger", "(", "projectCode", "=", "\"JBAS\"", ")", "public", "interface", "AEjbLogger", "extends", "BasicLogger", "{", "AEjbLogger", "ROOT_LOGGER", "=", "Logger", ".", "getMessageLogger", "(", "AEjbLogger", ".", "class", ",", "AEjbLogger", ".", "class", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ")", ";", "@", "LogMessage", "(", "level", "=", "Level", ".", "INFO", ")", "@", "Message", "(", "id", "=", "20000", ",", "value", "=", "\"\"", ")", "void", "activatingAEjbSubsystem", "(", ")", ";", "@", "LogMessage", "(", "level", "=", "Level", ".", "INFO", ")", "@", "Message", "(", "id", "=", "20001", ",", "value", "=", "\"\"", ")", "void", "boundClientService", "(", "String", "jndi", ")", ";", "@", "LogMessage", "(", "level", "=", "Level", ".", "INFO", ")", "@", "Message", "(", "id", "=", "20002", ",", "value", "=", "\"\"", ")", "void", "unboundClientService", "(", "String", "jndi", ")", ";", "@", "LogMessage", "(", "level", "=", "Level", ".", "INFO", ")", "@", "Message", "(", "id", "=", "20003", ",", "value", "=", "\"\"", ")", "void", "removeClientService", "(", "String", "jndi", ")", ";", "@", "LogMessage", "(", "level", "=", "Level", ".", "INFO", ")", "@", "Message", "(", "id", "=", "20004", ",", "value", "=", "\"\"", ")", "void", "boundTransactionManager", "(", "String", "jndi", ")", ";", "}", "</s>" ]
10,091
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "cli", ";", "import", "java", ".", "security", ".", "PrivilegedAction", ";", "class", "PropertyWriteAction", "implements", "PrivilegedAction", "<", "String", ">", "{", "private", "final", "String", "key", ";", "private", "final", "String", "value", ";", "PropertyWriteAction", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "this", ".", "key", "=", "key", ";", "this", ".", "value", "=", "value", ";", "}", "@", "Override", "public", "String", "run", "(", ")", "{", "return", "System", ".", "setProperty", "(", "key", ",", "value", ")", ";", "}", "}", "</s>" ]
10,092
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "cli", ";", "import", "java", ".", "io", ".", "File", ";", "public", "abstract", "class", "FilenameTabCompleter", "{", "public", "String", "translatePath", "(", "String", "path", ")", "{", "final", "String", "translated", ";", "if", "(", "path", ".", "startsWith", "(", "\"~\"", "+", "File", ".", "separator", ")", ")", "{", "translated", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", "+", "path", ".", "substring", "(", "1", ")", ";", "}", "else", "if", "(", "path", ".", "startsWith", "(", "\"~\"", ")", ")", "{", "translated", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"user.home\"", ")", ")", ".", "getParentFile", "(", ")", ".", "getAbsolutePath", "(", ")", ";", "}", "else", "if", "(", "!", "startsWithRoot", "(", "path", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "ManagementMessages", ".", "FilePathNotCorrect", "+", "\":", "\"", "+", "path", ")", ";", "}", "else", "{", "translated", "=", "path", ";", "}", "return", "translated", ";", "}", "protected", "abstract", "boolean", "startsWithRoot", "(", "String", "path", ")", ";", "public", "File", "getFile", "(", "String", "buffer", ")", "{", "if", "(", "buffer", ".", "length", "(", ")", ">=", "2", "&&", "buffer", ".", "charAt", "(", "0", ")", "==", "'\"'", ")", "{", "int", "lastQuote", "=", "buffer", ".", "lastIndexOf", "(", "'\"'", ")", ";", "if", "(", "lastQuote", ">=", "0", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "buffer", ".", "substring", "(", "1", ",", "lastQuote", ")", ")", ";", "if", "(", "lastQuote", "!=", "buffer", ".", "length", "(", ")", "-", "1", ")", "{", "buf", ".", "append", "(", "buffer", ".", "substring", "(", "lastQuote", "+", "1", ")", ")", ";", "}", "buffer", "=", "buf", ".", "toString", "(", ")", ";", "}", "}", "final", "String", "path", ";", "if", "(", "buffer", ".", "length", "(", ")", "==", "0", ")", "{", "path", "=", "null", ";", "}", "else", "{", "path", "=", "translatePath", "(", "buffer", ")", ";", "}", "if", "(", "path", "==", "null", ")", "return", "null", ";", "File", "file", "=", "new", "File", "(", "path", ")", ";", "if", "(", "file", ".", "exists", "(", ")", ")", "return", "file", ";", "else", "{", "return", "null", ";", "}", "}", "}", "</s>" ]
10,093
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "cli", ";", "import", "java", ".", "security", ".", "AccessController", ";", "import", "java", ".", "security", ".", "PrivilegedAction", ";", "class", "SecurityActions", "{", "private", "interface", "TCLAction", "{", "class", "UTIL", "{", "static", "TCLAction", "getTCLAction", "(", ")", "{", "return", "System", ".", "getSecurityManager", "(", ")", "==", "null", "?", "NON_PRIVILEGED", ":", "PRIVILEGED", ";", "}", "static", "String", "getSystemProperty", "(", "String", "name", ")", "{", "return", "getTCLAction", "(", ")", ".", "getSystemProperty", "(", "name", ")", ";", "}", "static", "ClassLoader", "getContextClassLoader", "(", ")", "{", "return", "getTCLAction", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "}", "}", "TCLAction", "NON_PRIVILEGED", "=", "new", "TCLAction", "(", ")", "{", "@", "Override", "public", "String", "getSystemProperty", "(", "String", "name", ")", "{", "return", "System", ".", "getProperty", "(", "name", ")", ";", "}", "@", "Override", "public", "ClassLoader", "getContextClassLoader", "(", ")", "{", "return", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "}", "}", ";", "TCLAction", "PRIVILEGED", "=", "new", "TCLAction", "(", ")", "{", "@", "Override", "public", "String", "getSystemProperty", "(", "final", "String", "name", ")", "{", "return", "(", "String", ")", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "Object", ">", "(", ")", "{", "public", "Object", "run", "(", ")", "{", "return", "System", ".", "getProperty", "(", "name", ")", ";", "}", "}", ")", ";", "}", "@", "Override", "public", "ClassLoader", "getContextClassLoader", "(", ")", "{", "return", "(", "ClassLoader", ")", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "Object", ">", "(", ")", "{", "public", "Object", "run", "(", ")", "{", "return", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "}", "}", ")", ";", "}", "}", ";", "String", "getSystemProperty", "(", "String", "name", ")", ";", "ClassLoader", "getContextClassLoader", "(", ")", ";", "}", "protected", "static", "String", "getSystemProperty", "(", "String", "name", ")", "{", "return", "TCLAction", ".", "UTIL", ".", "getSystemProperty", "(", "name", ")", ";", "}", "protected", "static", "ClassLoader", "getContextClassLoader", "(", ")", "{", "return", "TCLAction", ".", "UTIL", ".", "getContextClassLoader", "(", ")", ";", "}", "}", "</s>" ]
10,094
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "cli", ";", "public", "class", "WindowsFilenameTabCompleter", "extends", "FilenameTabCompleter", "{", "@", "Override", "protected", "boolean", "startsWithRoot", "(", "String", "path", ")", "{", "return", "path", ".", "contains", "(", "\":\\\\\"", ")", ";", "}", "}", "</s>" ]
10,095
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "cli", ";", "public", "interface", "ManagementMessages", "{", "String", "FunctionPrompt", "=", "\"\"", ";", "String", "JbossHomeNotSet", "=", "\"\"", ";", "String", "InputFilePathPrompt", "=", "\"\"", ";", "String", "InputFileNamePrompt", "=", "\"\"", ";", "String", "FilePathNotCorrect", "=", "\"\"", ";", "String", "FilePathNotExist", "=", "\"\"", ";", "String", "DisplayDeployments", "=", "\"\"", ";", "String", "NotConnectServer", "=", "\"\"", ";", "String", "EmptyDeployments", "=", "\"\"", ";", "String", "AEjbNamePrompt", "=", "\"\"", ";", "String", "AEjbNotExist", "=", "\"\"", ";", "String", "WaitingPrompt", "=", "\"Waiting.\"", ";", "String", "ThreadExceptionPrompt", "=", "\"\"", ";", "String", "OperationFailed", "=", "\"\"", ";", "String", "OperationTimeOutFailed", "=", "\"\"", ";", "String", "OperationSuccess", "=", "\"\"", ";", "String", "ConnectPrompt", "=", "\"\"", ";", "String", "ProtocolPrompt", "=", "\"\"", ";", "String", "UnexpectedCommandPrompt", "=", "\"\"", ";", "String", "UnexpectedSameName", "=", "\"\"", ";", "}", "</s>" ]
10,096
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "cli", ";", "import", "java", ".", "io", ".", "Console", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "security", ".", "AccessController", ";", "import", "java", ".", "util", ".", "Hashtable", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Map", ".", "Entry", ";", "import", "java", ".", "util", ".", "concurrent", ".", "atomic", ".", "AtomicLong", ";", "import", "javax", ".", "naming", ".", "Context", ";", "import", "javax", ".", "naming", ".", "InitialContext", ";", "import", "javax", ".", "naming", ".", "NamingException", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClient", ";", "import", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ".", "AEjbClientImpl", ".", "AEjbStatus", ";", "public", "class", "CommandLineMain", "{", "private", "static", "final", "String", "NEW_LINE", "=", "\"n\"", ";", "private", "static", "final", "String", "SPACE", "=", "\"", "\"", ";", "private", "static", "final", "String", "TAB", "=", "\";", "\"", ";", "private", "static", "final", "String", "POINT", "=", "\".\"", ";", "private", "static", "final", "AtomicLong", "TICK", "=", "new", "AtomicLong", "(", "1500", ")", ";", "private", "static", "final", "int", "MAXCONNECTTIMES", "=", "20", ";", "private", "static", "String", "classpath", "=", "null", ";", "private", "static", "final", "Console", "theConsole", "=", "System", ".", "console", "(", ")", ";", "private", "State", "nextState", ";", "FilenameTabCompleter", "pathCompleter", ";", "static", "final", "String", "CLIENT_EJB_JNDI", "=", "\"ejb:\"", "+", "\"/\"", "+", "\"aejb-client\"", "+", "\"/\"", "+", "\"/\"", "+", "\"\"", "+", "\"!\"", "+", "\"\"", ";", "static", "AEjbClient", "client", ";", "static", "Context", "context", ";", "static", "{", "final", "Hashtable", "jndiProperties", "=", "new", "Hashtable", "(", ")", ";", "jndiProperties", ".", "put", "(", "Context", ".", "URL_PKG_PREFIXES", ",", "\"\"", ")", ";", "try", "{", "context", "=", "new", "InitialContext", "(", "jndiProperties", ")", ";", "}", "catch", "(", "NamingException", "e", ")", "{", "}", "}", "private", "CommandLineMain", "(", ")", "{", "if", "(", "theConsole", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"\"", ")", ";", "}", "pathCompleter", "=", "isWindows", "(", ")", "?", "new", "WindowsFilenameTabCompleter", "(", ")", ":", "new", "DefaultFilenameTabCompleter", "(", ")", ";", "nextState", "=", "new", "ConnectState", "(", ")", ";", "}", "private", "void", "run", "(", ")", "{", "while", "(", "(", "nextState", "=", "nextState", ".", "execute", "(", ")", ")", "!=", "null", ")", "{", "}", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "final", "int", "argsLen", "=", "args", ".", "length", ";", "if", "(", "argsLen", ">=", "1", ")", "{", "for", "(", "int", "i", "=", "0", ",", "argsLength", "=", "argsLen", ";", "i", "<", "argsLength", ";", "i", "++", ")", "{", "final", "String", "arg", "=", "args", "[", "i", "]", ";", "if", "(", "arg", ".", "charAt", "(", "0", ")", "==", "'-'", ")", "{", "if", "(", "\"-cp\"", ".", "equals", "(", "arg", ")", "||", "\"-classpath\"", ".", "equals", "(", "arg", ")", ")", "{", "classpath", "=", "args", "[", "++", "i", "]", ";", "AccessController", ".", "doPrivileged", "(", "new", "PropertyWriteAction", "(", "\"\"", ",", "classpath", ")", ")", ";", "}", "}", "}", "}", "new", "CommandLineMain", "(", ")", ".", "run", "(", ")", ";", "}", "private", "class", "FunctionPrompt", "implements", "State", "{", "@", "Override", "public", "State", "execute", "(", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "FunctionPrompt", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "while", "(", "true", ")", "{", "String", "temp", "=", "theConsole", ".", "readLine", "(", "\"[choose", "/]:", "\"", ")", ";", "if", "(", "temp", "==", "null", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "null", ";", "}", "if", "(", "temp", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "temp", ".", "length", "(", ")", "==", "1", ")", "{", "switch", "(", "temp", ".", "charAt", "(", "0", ")", ")", "{", "case", "'a'", ":", "case", "'A'", ":", "return", "new", "DeploymentsDisplayer", "(", ")", ";", "case", "'b'", ":", "case", "'B'", ":", "return", "new", "DeploymentFilePathInput", "(", ")", ";", "case", "'c'", ":", "case", "'C'", ":", "return", "new", "DeploymentFileNameInput", "(", ")", ";", "case", "'d'", ":", "case", "'D'", ":", "return", "new", "AEjbBlocker", "(", "new", "AEjbNameInput", "(", ")", ")", ";", "case", "'e'", ":", "case", "'E'", ":", "return", "new", "AEjbRecorver", "(", "new", "AEjbNameInput", "(", ")", ")", ";", "case", "'g'", ":", "case", "'G'", ":", "return", "new", "AEjbSwitcher", "(", "new", "AEjbNameInput", "(", ")", ")", ";", "}", "}", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "UnexpectedCommandPrompt", "+", "SPACE", "+", "\"'\"", "+", "temp", "+", "\"'.\"", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "}", "}", "}", "}", "private", "class", "DeploymentFilePathInput", "implements", "State", "{", "private", "DeploymentFilePathInput", "(", ")", "{", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "InputFilePathPrompt", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "while", "(", "true", ")", "{", "String", "temp", "=", "theConsole", ".", "readLine", "(", "\"\"", ")", ";", "if", "(", "temp", "==", "null", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "null", ";", "}", "if", "(", "temp", ".", "length", "(", ")", ">", "0", ")", "{", "return", "new", "DeploymentFileFinder", "(", "temp", ")", ";", "}", "}", "}", "}", "private", "class", "DeploymentFileNameInput", "implements", "State", "{", "private", "DeploymentFileNameInput", "(", ")", "{", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "InputFileNamePrompt", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "while", "(", "true", ")", "{", "String", "temp", "=", "theConsole", ".", "readLine", "(", "\"\"", ")", ";", "if", "(", "temp", "==", "null", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "null", ";", "}", "if", "(", "temp", ".", "length", "(", ")", ">", "0", ")", "{", "return", "new", "DeploymentFileFinder", "(", "temp", ",", "true", ")", ";", "}", "}", "}", "}", "private", "class", "AEjbNameInput", "implements", "State", "{", "private", "String", "aejbName", ";", "private", "String", "prompt", ";", "public", "String", "getAEjbName", "(", ")", "{", "return", "aejbName", ";", "}", "public", "void", "setPrompt", "(", "String", "prompt", ")", "{", "this", ".", "prompt", "=", "prompt", ";", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "AEjbNamePrompt", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "while", "(", "true", ")", "{", "String", "temp", ";", "if", "(", "prompt", "==", "null", ")", "temp", "=", "theConsole", ".", "readLine", "(", "\"\"", ")", ";", "else", "temp", "=", "theConsole", ".", "readLine", "(", "\"[\"", "+", "prompt", "+", "\"", "/]:", "\"", ")", ";", "if", "(", "temp", "==", "null", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "null", ";", "}", "if", "(", "temp", ".", "length", "(", ")", ">", "0", ")", "{", "aejbName", "=", "temp", ";", "return", "null", ";", "}", "}", "}", "}", "private", "class", "ProtocolNameInput", "implements", "State", "{", "private", "String", "protocol", ";", "public", "String", "getProtocol", "(", ")", "{", "return", "protocol", ";", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "ProtocolPrompt", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "while", "(", "true", ")", "{", "String", "temp", "=", "theConsole", ".", "readLine", "(", "\"[choose", "/]:", "\"", ")", ";", "if", "(", "temp", "==", "null", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "null", ";", "}", "if", "(", "temp", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "temp", ".", "length", "(", ")", "==", "1", ")", "{", "switch", "(", "temp", ".", "charAt", "(", "0", ")", ")", "{", "case", "'a'", ":", "case", "'A'", ":", "protocol", "=", "\"quiescence\"", ";", "return", "null", ";", "case", "'b'", ":", "case", "'B'", ":", "protocol", "=", "\"tranquility\"", ";", "return", "null", ";", "}", "}", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "UnexpectedCommandPrompt", "+", "SPACE", "+", "\"'\"", "+", "temp", "+", "\"'.\"", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "}", "}", "}", "}", "private", "class", "AEjbBlocker", "implements", "State", "{", "final", "AEjbNameInput", "input", ";", "private", "AEjbBlocker", "(", "AEjbNameInput", "input", ")", "{", "this", ".", "input", "=", "input", ";", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "input", ".", "execute", "(", ")", ";", "final", "String", "aejbName", "=", "input", ".", "getAEjbName", "(", ")", ";", "boolean", "exsit", "=", "false", ";", "try", "{", "exsit", "=", "blockAEjb", "(", "aejbName", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "\"##", "\"", ")", ";", "theConsole", ".", "printf", "(", "e", ".", "getMessage", "(", ")", ")", ";", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "NotConnectServer", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "}", "if", "(", "exsit", "==", "false", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "AEjbNotExist", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "new", "FunctionPrompt", "(", ")", ";", "}", "return", "new", "AEjbResponseWaiting", "(", "aejbName", ")", ";", "}", "}", "private", "class", "AEjbRecorver", "implements", "State", "{", "final", "AEjbNameInput", "input", ";", "private", "AEjbRecorver", "(", "AEjbNameInput", "input", ")", "{", "this", ".", "input", "=", "input", ";", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "input", ".", "execute", "(", ")", ";", "final", "String", "aejbName", "=", "input", ".", "getAEjbName", "(", ")", ";", "boolean", "exsit", "=", "false", ";", "try", "{", "exsit", "=", "recorverAEjb", "(", "aejbName", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "\"##", "\"", ")", ";", "theConsole", ".", "printf", "(", "e", ".", "getMessage", "(", ")", ")", ";", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "NotConnectServer", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "}", "if", "(", "exsit", "==", "false", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "AEjbNotExist", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "new", "FunctionPrompt", "(", ")", ";", "}", "return", "new", "AEjbResponseWaiting", "(", "aejbName", ")", ";", "}", "}", "private", "class", "AEjbSwitcher", "implements", "State", "{", "final", "AEjbNameInput", "input", ";", "private", "AEjbSwitcher", "(", "AEjbNameInput", "input", ")", "{", "this", ".", "input", "=", "input", ";", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "input", ".", "setPrompt", "(", "\"\"", ")", ";", "input", ".", "execute", "(", ")", ";", "final", "String", "fromName", "=", "input", ".", "getAEjbName", "(", ")", ";", "input", ".", "setPrompt", "(", "\"\"", ")", ";", "input", ".", "execute", "(", ")", ";", "final", "String", "toName", "=", "input", ".", "getAEjbName", "(", ")", ";", "if", "(", "fromName", ".", "equals", "(", "toName", ")", ")", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "UnexpectedSameName", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "ProtocolNameInput", "protocolInput", "=", "new", "ProtocolNameInput", "(", ")", ";", "protocolInput", ".", "execute", "(", ")", ";", "final", "String", "protocol", "=", "protocolInput", ".", "getProtocol", "(", ")", ";", "boolean", "exsit", "=", "false", ";", "try", "{", "exsit", "=", "switchAEjb", "(", "fromName", ",", "toName", ",", "protocol", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "\"##", "\"", ")", ";", "theConsole", ".", "printf", "(", "e", ".", "getMessage", "(", ")", ")", ";", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "NotConnectServer", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "}", "if", "(", "exsit", "==", "false", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "AEjbNotExist", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "new", "FunctionPrompt", "(", ")", ";", "}", "return", "new", "SuccessState", "(", "ManagementMessages", ".", "OperationSuccess", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "}", "}", "private", "class", "AEjbResponseWaiting", "implements", "State", "{", "String", "aejbName", ";", "private", "AEjbResponseWaiting", "(", "String", "aejbName", ")", "{", "this", ".", "aejbName", "=", "aejbName", ";", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "WaitingPrompt", ")", ";", "AEjbStatus", "status", "=", "AEjbStatus", ".", "BLOCKING", ";", "int", "times", "=", "0", ";", "do", "{", "try", "{", "Thread", ".", "sleep", "(", "TICK", ".", "get", "(", ")", ")", ";", "status", "=", "getAEjbStatus", "(", "aejbName", ")", ";", "times", "++", ";", "theConsole", ".", "printf", "(", "POINT", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "ThreadExceptionPrompt", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "break", ";", "}", "catch", "(", "Exception", "e", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "\"##", "\"", ")", ";", "theConsole", ".", "printf", "(", "e", ".", "getMessage", "(", ")", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "break", ";", "}", "}", "while", "(", "status", "!=", "null", "&&", "times", "<", "MAXCONNECTTIMES", ")", ";", "if", "(", "status", "!=", "null", "&&", "times", "==", "MAXCONNECTTIMES", ")", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "OperationTimeOutFailed", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "if", "(", "status", "!=", "null", ")", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "OperationFailed", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "return", "new", "SuccessState", "(", "ManagementMessages", ".", "OperationSuccess", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "}", "}", "private", "class", "DeploymentFileFinder", "implements", "State", "{", "String", "buffer", ";", "boolean", "file", ";", "private", "DeploymentFileFinder", "(", "String", "buffer", ")", "{", "this", ".", "buffer", "=", "buffer", ";", "this", ".", "file", "=", "false", ";", "}", "private", "DeploymentFileFinder", "(", "String", "buffer", ",", "boolean", "file", ")", "{", "this", ".", "buffer", "=", "buffer", ";", "this", ".", "file", "=", "file", ";", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "String", "jbossHome", "=", "System", ".", "getenv", "(", "\"JBOSS_HOME\"", ")", ";", "if", "(", "jbossHome", "==", "null", ")", "{", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "JbossHomeNotSet", ",", "null", ")", ";", "}", "File", "deployment", "=", "null", ";", "if", "(", "file", ")", "{", "buffer", "=", "jbossHome", "+", "\"\"", "+", "buffer", ";", "}", "try", "{", "deployment", "=", "pathCompleter", ".", "getFile", "(", "buffer", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "return", "new", "ErrorState", "(", "e", ".", "getMessage", "(", ")", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "}", "if", "(", "deployment", "==", "null", ")", "{", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "FilePathNotExist", "+", "\":", "\"", "+", "buffer", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "}", "if", "(", "file", ")", "{", "deployment", ".", "delete", "(", ")", ";", "}", "else", "{", "FileOperations", ".", "copyFile", "(", "deployment", ",", "jbossHome", "+", "\"\"", "+", "deployment", ".", "getName", "(", ")", ")", ";", "}", "return", "new", "SuccessState", "(", "ManagementMessages", ".", "OperationSuccess", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "}", "}", "private", "class", "DeploymentsDisplayer", "implements", "State", "{", "private", "DeploymentsDisplayer", "(", ")", "{", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "Map", "<", "String", ",", "String", "[", "]", ">", "info", ";", "try", "{", "info", "=", "getAllDeploymentsInfo", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "\"##", "\"", ")", ";", "theConsole", ".", "printf", "(", "e", ".", "getMessage", "(", ")", ")", ";", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "NotConnectServer", ",", "new", "FunctionPrompt", "(", ")", ")", ";", "}", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "SPACE", ")", ";", "theConsole", ".", "printf", "(", "\"##", "\"", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "DisplayDeployments", ")", ";", "theConsole", ".", "printf", "(", "SPACE", ")", ";", "theConsole", ".", "printf", "(", "\"##", "\"", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "if", "(", "info", ".", "isEmpty", "(", ")", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "EmptyDeployments", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "new", "FunctionPrompt", "(", ")", ";", "}", "Iterator", "<", "Entry", "<", "String", ",", "String", "[", "]", ">", ">", "itrator", "=", "info", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "itrator", ".", "hasNext", "(", ")", ")", "{", "Entry", "<", "String", ",", "String", "[", "]", ">", "entry", "=", "itrator", ".", "next", "(", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "\"\"", ")", ";", "theConsole", ".", "printf", "(", "entry", ".", "getKey", "(", ")", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "\"aejbs:", "\"", ")", ";", "for", "(", "String", "aejbName", ":", "entry", ".", "getValue", "(", ")", ")", "{", "theConsole", ".", "printf", "(", "aejbName", ")", ";", "theConsole", ".", "printf", "(", "TAB", ")", ";", "}", "}", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "new", "FunctionPrompt", "(", ")", ";", "}", "}", "private", "class", "ErrorState", "implements", "State", "{", "private", "final", "State", "nextState", ";", "private", "final", "String", "errorMessage", ";", "private", "ErrorState", "(", "String", "errorMessage", ")", "{", "this", "(", "errorMessage", ",", "null", ")", ";", "}", "private", "ErrorState", "(", "String", "errorMessage", ",", "State", "nextState", ")", "{", "this", ".", "errorMessage", "=", "errorMessage", ";", "this", ".", "nextState", "=", "nextState", ";", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "\"", "*", "Error", "*", "\"", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "errorMessage", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "nextState", ";", "}", "}", "private", "class", "SuccessState", "implements", "State", "{", "private", "final", "State", "nextState", ";", "private", "final", "String", "sMessage", ";", "private", "SuccessState", "(", "String", "sMessage", ")", "{", "this", "(", "sMessage", ",", "null", ")", ";", "}", "private", "SuccessState", "(", "String", "sMessage", ",", "State", "nextState", ")", "{", "this", ".", "sMessage", "=", "sMessage", ";", "this", ".", "nextState", "=", "nextState", ";", "}", "@", "Override", "public", "State", "execute", "(", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "\"\"", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "theConsole", ".", "printf", "(", "sMessage", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "try", "{", "Thread", ".", "sleep", "(", "2500", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "nextState", ";", "}", "}", "private", "class", "ConnectState", "implements", "State", "{", "@", "Override", "public", "State", "execute", "(", ")", "{", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "ConnectPrompt", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "while", "(", "true", ")", "{", "String", "temp", "=", "theConsole", ".", "readLine", "(", "\"\"", ")", ";", "if", "(", "temp", "==", "null", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "null", ";", "}", "if", "(", "temp", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "temp", ".", "equals", "(", "\"connect\"", ")", ")", "break", ";", "else", "{", "theConsole", ".", "printf", "(", "ManagementMessages", ".", "UnexpectedCommandPrompt", "+", "SPACE", "+", "\"'\"", "+", "temp", "+", "\"'.\"", ")", ";", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "}", "}", "}", "try", "{", "getAndInvokeClientEjb", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "theConsole", ".", "printf", "(", "NEW_LINE", ")", ";", "return", "new", "ErrorState", "(", "ManagementMessages", ".", "NotConnectServer", ",", "new", "ConnectState", "(", ")", ")", ";", "}", "return", "new", "FunctionPrompt", "(", ")", ";", "}", "}", "private", "static", "boolean", "switchAEjb", "(", "String", "fromName", ",", "String", "toName", ",", "String", "protocol", ")", "throws", "Exception", "{", "return", "getAndManageClientEjb", "(", "fromName", ",", "toName", ",", "\"switchAEjb\"", ",", "protocol", ")", ";", "}", "private", "static", "boolean", "blockAEjb", "(", "String", "aejbName", ")", "throws", "Exception", "{", "return", "getAndManageClientEjb", "(", "aejbName", ",", "\"blockAEjb\"", ")", ";", "}", "private", "static", "boolean", "recorverAEjb", "(", "String", "aejbName", ")", "throws", "Exception", "{", "return", "getAndManageClientEjb", "(", "aejbName", ",", "\"resumeAEjb\"", ")", ";", "}", "private", "static", "AEjbStatus", "getAEjbStatus", "(", "String", "aejbName", ")", "throws", "Exception", "{", "getAndInvokeClientEjb", "(", ")", ";", "return", "client", ".", "getAEjbStatus", "(", "aejbName", ")", ";", "}", "private", "static", "Map", "<", "String", ",", "String", "[", "]", ">", "getAllDeploymentsInfo", "(", ")", "throws", "Exception", "{", "getAndInvokeClientEjb", "(", ")", ";", "return", "client", ".", "listAEjbs", "(", ")", ";", "}", "private", "static", "void", "getAndInvokeClientEjb", "(", ")", "throws", "Exception", "{", "Object", "remoteClient", "=", "context", ".", "lookup", "(", "CLIENT_EJB_JNDI", ")", ";", "Method", "method", "=", "getClientMethod", "(", "remoteClient", ",", "\"\"", ")", ";", "client", "=", "(", "AEjbClient", ")", "method", ".", "invoke", "(", "remoteClient", ")", ";", "}", "private", "static", "boolean", "getAndManageClientEjb", "(", "String", "aejbName", ",", "String", "methodName", ")", "throws", "Exception", "{", "Object", "remoteClient", "=", "context", ".", "lookup", "(", "CLIENT_EJB_JNDI", ")", ";", "Method", "method", "=", "getClientMethod", "(", "remoteClient", ",", "methodName", ")", ";", "return", "(", "Boolean", ")", "method", ".", "invoke", "(", "remoteClient", ",", "aejbName", ")", ";", "}", "private", "static", "boolean", "getAndManageClientEjb", "(", "String", "fromName", ",", "String", "toName", ",", "String", "methodName", ",", "String", "protocol", ")", "throws", "Exception", "{", "Object", "remoteClient", "=", "context", ".", "lookup", "(", "CLIENT_EJB_JNDI", ")", ";", "Method", "method", "=", "getClientMethod", "(", "remoteClient", ",", "methodName", ")", ";", "return", "(", "Boolean", ")", "method", ".", "invoke", "(", "remoteClient", ",", "fromName", ",", "toName", ",", "protocol", ")", ";", "}", "private", "static", "Method", "getClientMethod", "(", "Object", "remoteClient", ",", "String", "methodName", ")", "{", "for", "(", "Method", "me", ":", "remoteClient", ".", "getClass", "(", ")", ".", "getMethods", "(", ")", ")", "{", "if", "(", "me", ".", "getName", "(", ")", ".", "contains", "(", "methodName", ")", ")", "{", "return", "me", ";", "}", "}", "return", "null", ";", "}", "private", "interface", "State", "{", "State", "execute", "(", ")", ";", "}", "public", "static", "boolean", "isWindows", "(", ")", "{", "return", "SecurityActions", ".", "getSystemProperty", "(", "\"os.name\"", ")", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "\"windows\"", ")", ">=", "0", ";", "}", "}", "</s>" ]
10,097
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "cli", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "public", "class", "FileOperations", "{", "public", "FileOperations", "(", ")", "{", "}", "public", "static", "void", "newFolder", "(", "String", "folderPath", ")", "{", "try", "{", "String", "filePath", "=", "folderPath", ";", "filePath", "=", "filePath", ".", "toString", "(", ")", ";", "java", ".", "io", ".", "File", "myFilePath", "=", "new", "java", ".", "io", ".", "File", "(", "filePath", ")", ";", "if", "(", "!", "myFilePath", ".", "exists", "(", ")", ")", "{", "myFilePath", ".", "mkdir", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"-UNK-\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "static", "void", "newFile", "(", "String", "filePathAndName", ",", "String", "fileContent", ")", "{", "try", "{", "String", "filePath", "=", "filePathAndName", ";", "filePath", "=", "filePath", ".", "toString", "(", ")", ";", "File", "myFilePath", "=", "new", "File", "(", "filePath", ")", ";", "if", "(", "!", "myFilePath", ".", "exists", "(", ")", ")", "{", "myFilePath", ".", "createNewFile", "(", ")", ";", "}", "FileWriter", "resultFile", "=", "new", "FileWriter", "(", "myFilePath", ")", ";", "PrintWriter", "myFile", "=", "new", "PrintWriter", "(", "resultFile", ")", ";", "String", "strContent", "=", "fileContent", ";", "myFile", ".", "println", "(", "strContent", ")", ";", "resultFile", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"-UNK-\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "static", "void", "delFile", "(", "String", "filePathAndName", ")", "{", "try", "{", "String", "filePath", "=", "filePathAndName", ";", "java", ".", "io", ".", "File", "myDelFile", "=", "new", "java", ".", "io", ".", "File", "(", "filePath", ")", ";", "myDelFile", ".", "delete", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"-UNK-\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "static", "void", "delFolder", "(", "String", "folderPath", ")", "{", "try", "{", "delAllFile", "(", "folderPath", ")", ";", "String", "filePath", "=", "folderPath", ";", "filePath", "=", "filePath", ".", "toString", "(", ")", ";", "java", ".", "io", ".", "File", "myFilePath", "=", "new", "java", ".", "io", ".", "File", "(", "filePath", ")", ";", "myFilePath", ".", "delete", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"-UNK-\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "static", "void", "delAllFile", "(", "String", "path", ")", "{", "File", "file", "=", "new", "File", "(", "path", ")", ";", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "file", ".", "isDirectory", "(", ")", ")", "{", "return", ";", "}", "String", "[", "]", "tempList", "=", "file", ".", "list", "(", ")", ";", "File", "temp", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tempList", ".", "length", ";", "i", "++", ")", "{", "if", "(", "path", ".", "endsWith", "(", "File", ".", "separator", ")", ")", "{", "temp", "=", "new", "File", "(", "path", "+", "tempList", "[", "i", "]", ")", ";", "}", "else", "{", "temp", "=", "new", "File", "(", "path", "+", "File", ".", "separator", "+", "tempList", "[", "i", "]", ")", ";", "}", "if", "(", "temp", ".", "isFile", "(", ")", ")", "{", "temp", ".", "delete", "(", ")", ";", "}", "if", "(", "temp", ".", "isDirectory", "(", ")", ")", "{", "delAllFile", "(", "path", "+", "\"/\"", "+", "tempList", "[", "i", "]", ")", ";", "delFolder", "(", "path", "+", "\"/\"", "+", "tempList", "[", "i", "]", ")", ";", "}", "}", "}", "public", "static", "void", "copyFile", "(", "File", "oldfile", ",", "String", "newPath", ")", "{", "try", "{", "int", "byteread", "=", "0", ";", "delFile", "(", "newPath", ")", ";", "Thread", ".", "sleep", "(", "500", ")", ";", "if", "(", "oldfile", ".", "exists", "(", ")", ")", "{", "InputStream", "inStream", "=", "new", "FileInputStream", "(", "oldfile", ")", ";", "FileOutputStream", "fs", "=", "new", "FileOutputStream", "(", "newPath", ")", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "1444", "]", ";", "while", "(", "(", "byteread", "=", "inStream", ".", "read", "(", "buffer", ")", ")", "!=", "-", "1", ")", "{", "fs", ".", "write", "(", "buffer", ",", "0", ",", "byteread", ")", ";", "}", "inStream", ".", "close", "(", ")", ";", "fs", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"-UNK-\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "static", "void", "copyFolder", "(", "String", "oldPath", ",", "String", "newPath", ")", "{", "try", "{", "(", "new", "File", "(", "newPath", ")", ")", ".", "mkdirs", "(", ")", ";", "File", "a", "=", "new", "File", "(", "oldPath", ")", ";", "String", "[", "]", "file", "=", "a", ".", "list", "(", ")", ";", "File", "temp", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "file", ".", "length", ";", "i", "++", ")", "{", "if", "(", "oldPath", ".", "endsWith", "(", "File", ".", "separator", ")", ")", "{", "temp", "=", "new", "File", "(", "oldPath", "+", "file", "[", "i", "]", ")", ";", "}", "else", "{", "temp", "=", "new", "File", "(", "oldPath", "+", "File", ".", "separator", "+", "file", "[", "i", "]", ")", ";", "}", "if", "(", "temp", ".", "isFile", "(", ")", ")", "{", "FileInputStream", "input", "=", "new", "FileInputStream", "(", "temp", ")", ";", "FileOutputStream", "output", "=", "new", "FileOutputStream", "(", "newPath", "+", "\"/\"", "+", "(", "temp", ".", "getName", "(", ")", ")", ".", "toString", "(", ")", ")", ";", "byte", "[", "]", "b", "=", "new", "byte", "[", "1024", "*", "5", "]", ";", "int", "len", ";", "while", "(", "(", "len", "=", "input", ".", "read", "(", "b", ")", ")", "!=", "-", "1", ")", "{", "output", ".", "write", "(", "b", ",", "0", ",", "len", ")", ";", "}", "output", ".", "flush", "(", ")", ";", "output", ".", "close", "(", ")", ";", "input", ".", "close", "(", ")", ";", "}", "if", "(", "temp", ".", "isDirectory", "(", ")", ")", "{", "copyFolder", "(", "oldPath", "+", "\"/\"", "+", "file", "[", "i", "]", ",", "newPath", "+", "\"/\"", "+", "file", "[", "i", "]", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"-UNK-\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "static", "void", "moveFile", "(", "String", "oldPath", ",", "String", "newPath", ")", "{", "File", "oldfile", "=", "new", "File", "(", "oldPath", ")", ";", "copyFile", "(", "oldfile", ",", "newPath", ")", ";", "delFile", "(", "oldPath", ")", ";", "}", "public", "static", "void", "moveFolder", "(", "String", "oldPath", ",", "String", "newPath", ")", "{", "copyFolder", "(", "oldPath", ",", "newPath", ")", ";", "delFolder", "(", "oldPath", ")", ";", "}", "}", "</s>" ]
10,098
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "cli", ";", "import", "java", ".", "io", ".", "File", ";", "public", "class", "DefaultFilenameTabCompleter", "extends", "FilenameTabCompleter", "{", "@", "Override", "protected", "boolean", "startsWithRoot", "(", "String", "path", ")", "{", "return", "path", ".", "startsWith", "(", "File", ".", "separator", ")", ";", "}", "}", "</s>" ]
10,099
[ "<s>", "package", "org", ".", "nju", ".", "artemis", ".", "aejb", ".", "management", ".", "client", ";", "import", "org", ".", "jboss", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "Service", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StartContext", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StartException", ";", "import", "org", ".", "jboss", ".", "msc", ".", "service", ".", "StopContext", ";", "public", "class", "AEjbClientService", "implements", "Service", "<", "AEjbClient", ">", "{", "private", "static", "final", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "AEjbClientService", ".", "class", ")", ";", "public", "AEjbClientService", "(", ")", "{", "}", "@", "Override", "public", "AEjbClient", "getValue", "(", ")", "throws", "IllegalStateException", ",", "IllegalArgumentException", "{", "AEjbClientImpl", ".", "INSTANCE", ".", "refreshAEjbsInfo", "(", ")", ";", "return", "AEjbClientImpl", ".", "INSTANCE", ";", "}", "@", "Override", "public", "void", "start", "(", "StartContext", "context", ")", "throws", "StartException", "{", "log", ".", "info", "(", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "stop", "(", "StopContext", "context", ")", "{", "log", ".", "info", "(", "\"\"", ")", ";", "}", "}", "</s>" ]