repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/statements/StatementList.java | StatementList.tryToEliminateTheScope | private void tryToEliminateTheScope()
{
for( int i = 0; i < _statements.length; i++ )
{
Statement statement = _statements[i];
if( statement instanceof VarStatement ||
(!(statement instanceof StatementList) &&
statement.getContainedParsedElementsByType( EvalExpression.class, nu... | java | private void tryToEliminateTheScope()
{
for( int i = 0; i < _statements.length; i++ )
{
Statement statement = _statements[i];
if( statement instanceof VarStatement ||
(!(statement instanceof StatementList) &&
statement.getContainedParsedElementsByType( EvalExpression.class, nu... | [
"private",
"void",
"tryToEliminateTheScope",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_statements",
".",
"length",
";",
"i",
"++",
")",
"{",
"Statement",
"statement",
"=",
"_statements",
"[",
"i",
"]",
";",
"if",
"(",
"stateme... | A statement-list needs to push a new scope on the symbol table to provide
a for local variable scoping. Since this is a relatively expensive
operation we avoid pushing the scope if we know none of the statements
declare variables. | [
"A",
"statement",
"-",
"list",
"needs",
"to",
"push",
"a",
"new",
"scope",
"on",
"the",
"symbol",
"table",
"to",
"provide",
"a",
"for",
"local",
"variable",
"scoping",
".",
"Since",
"this",
"is",
"a",
"relatively",
"expensive",
"operation",
"we",
"avoid",
... | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/statements/StatementList.java#L107-L120 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/util/HTMLEscapeUtil.java | HTMLEscapeUtil.escapeAttribute | public static String escapeAttribute( String string )
{
if( string == null || string.length() == 0 )
{
return string;
}
StringBuilder resultBuffer = null;
for( int i = 0, length = string.length(); i < length; i++ )
{
String entity = null;
char ch = string.charAt( i );
s... | java | public static String escapeAttribute( String string )
{
if( string == null || string.length() == 0 )
{
return string;
}
StringBuilder resultBuffer = null;
for( int i = 0, length = string.length(); i < length; i++ )
{
String entity = null;
char ch = string.charAt( i );
s... | [
"public",
"static",
"String",
"escapeAttribute",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"string",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"string",
";",
"}",
"StringBuilder",
"resultBuffer",
"=",
"null... | Escape a string for use as an HTML attribute by replacing all double
quotes and '&'. | [
"Escape",
"a",
"string",
"for",
"use",
"as",
"an",
"HTML",
"attribute",
"by",
"replacing",
"all",
"double",
"quotes",
"and",
"&",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/HTMLEscapeUtil.java#L124-L161 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/settings/Settings.java | Settings.makeDefaultSettings | public static Map<String, ISettings> makeDefaultSettings( Experiment experiment )
{
Map<String, ISettings> settings = new TreeMap<>();
CompilerSettings compilerSettings = new CompilerSettings();
compilerSettings.resetToDefaultSettings( experiment );
settings.put( compilerSettings.getPath(), compilerS... | java | public static Map<String, ISettings> makeDefaultSettings( Experiment experiment )
{
Map<String, ISettings> settings = new TreeMap<>();
CompilerSettings compilerSettings = new CompilerSettings();
compilerSettings.resetToDefaultSettings( experiment );
settings.put( compilerSettings.getPath(), compilerS... | [
"public",
"static",
"Map",
"<",
"String",
",",
"ISettings",
">",
"makeDefaultSettings",
"(",
"Experiment",
"experiment",
")",
"{",
"Map",
"<",
"String",
",",
"ISettings",
">",
"settings",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"CompilerSettings",
"compi... | Reset Experiment-specific settings to defaults. | [
"Reset",
"Experiment",
"-",
"specific",
"settings",
"to",
"defaults",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/settings/Settings.java#L14-L23 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/settings/Settings.java | Settings.makeDefaultSettings | public static Map<String, ISettings> makeDefaultSettings()
{
Map<String, ISettings> settings = new TreeMap<>();
AppearanceSettings appearanceSettings = new AppearanceSettings();
appearanceSettings.resetToDefaultSettings( null );
settings.put( appearanceSettings.getPath(), appearanceSettings );
r... | java | public static Map<String, ISettings> makeDefaultSettings()
{
Map<String, ISettings> settings = new TreeMap<>();
AppearanceSettings appearanceSettings = new AppearanceSettings();
appearanceSettings.resetToDefaultSettings( null );
settings.put( appearanceSettings.getPath(), appearanceSettings );
r... | [
"public",
"static",
"Map",
"<",
"String",
",",
"ISettings",
">",
"makeDefaultSettings",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"ISettings",
">",
"settings",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"AppearanceSettings",
"appearanceSettings",
"=",
"new"... | Reset Gosu Lab application-level settings to defaults. | [
"Reset",
"Gosu",
"Lab",
"application",
"-",
"level",
"settings",
"to",
"defaults",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/settings/Settings.java#L28-L37 | train |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/settings/Settings.java | Settings.mergeSettings | public static Map<String, ISettings> mergeSettings( Map<String, ISettings> old, Experiment experiment )
{
Map<String, ISettings> defaultSettings = makeDefaultSettings( experiment );
old.keySet().forEach( key -> defaultSettings.put( key, old.get( key ) ) );
return defaultSettings;
} | java | public static Map<String, ISettings> mergeSettings( Map<String, ISettings> old, Experiment experiment )
{
Map<String, ISettings> defaultSettings = makeDefaultSettings( experiment );
old.keySet().forEach( key -> defaultSettings.put( key, old.get( key ) ) );
return defaultSettings;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"ISettings",
">",
"mergeSettings",
"(",
"Map",
"<",
"String",
",",
"ISettings",
">",
"old",
",",
"Experiment",
"experiment",
")",
"{",
"Map",
"<",
"String",
",",
"ISettings",
">",
"defaultSettings",
"=",
"make... | Assumes settings map is ordered top-down in tree order | [
"Assumes",
"settings",
"map",
"is",
"ordered",
"top",
"-",
"down",
"in",
"tree",
"order"
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/settings/Settings.java#L42-L47 | train |
gosu-lang/gosu-lang | gosu-ant-tools/src/main/java/gosu/tools/ant/Gosuc.java | Gosuc.setSrcdir | public void setSrcdir(Path srcDir) {
if (_src == null) {
_src = srcDir;
} else {
_src.append(srcDir);
}
} | java | public void setSrcdir(Path srcDir) {
if (_src == null) {
_src = srcDir;
} else {
_src.append(srcDir);
}
} | [
"public",
"void",
"setSrcdir",
"(",
"Path",
"srcDir",
")",
"{",
"if",
"(",
"_src",
"==",
"null",
")",
"{",
"_src",
"=",
"srcDir",
";",
"}",
"else",
"{",
"_src",
".",
"append",
"(",
"srcDir",
")",
";",
"}",
"}"
] | Set the source directories to find the source Gosu files.
@param srcDir the source directories as a path | [
"Set",
"the",
"source",
"directories",
"to",
"find",
"the",
"source",
"Gosu",
"files",
"."
] | d6e9261b137ce66fef3726cabe7826d4a1f946b7 | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-ant-tools/src/main/java/gosu/tools/ant/Gosuc.java#L76-L82 | train |
signalapp/curve25519-java | common/src/main/java/org/whispersystems/curve25519/Curve25519.java | Curve25519.generateKeyPair | public Curve25519KeyPair generateKeyPair() {
byte[] privateKey = provider.generatePrivateKey();
byte[] publicKey = provider.generatePublicKey(privateKey);
return new Curve25519KeyPair(publicKey, privateKey);
} | java | public Curve25519KeyPair generateKeyPair() {
byte[] privateKey = provider.generatePrivateKey();
byte[] publicKey = provider.generatePublicKey(privateKey);
return new Curve25519KeyPair(publicKey, privateKey);
} | [
"public",
"Curve25519KeyPair",
"generateKeyPair",
"(",
")",
"{",
"byte",
"[",
"]",
"privateKey",
"=",
"provider",
".",
"generatePrivateKey",
"(",
")",
";",
"byte",
"[",
"]",
"publicKey",
"=",
"provider",
".",
"generatePublicKey",
"(",
"privateKey",
")",
";",
... | Generates a Curve25519 keypair.
@return A randomly generated Curve25519 keypair. | [
"Generates",
"a",
"Curve25519",
"keypair",
"."
] | 70fae57d6dccff7e78a46203c534314b07dfdd98 | https://github.com/signalapp/curve25519-java/blob/70fae57d6dccff7e78a46203c534314b07dfdd98/common/src/main/java/org/whispersystems/curve25519/Curve25519.java#L58-L63 | train |
signalapp/curve25519-java | common/src/main/java/org/whispersystems/curve25519/Curve25519.java | Curve25519.calculateAgreement | public byte[] calculateAgreement(byte[] publicKey, byte[] privateKey) {
if (publicKey == null || privateKey == null) {
throw new IllegalArgumentException("Keys must not be null!");
}
if (publicKey.length != 32 || privateKey.length != 32) {
throw new IllegalArgumentException("Keys must be 32 byt... | java | public byte[] calculateAgreement(byte[] publicKey, byte[] privateKey) {
if (publicKey == null || privateKey == null) {
throw new IllegalArgumentException("Keys must not be null!");
}
if (publicKey.length != 32 || privateKey.length != 32) {
throw new IllegalArgumentException("Keys must be 32 byt... | [
"public",
"byte",
"[",
"]",
"calculateAgreement",
"(",
"byte",
"[",
"]",
"publicKey",
",",
"byte",
"[",
"]",
"privateKey",
")",
"{",
"if",
"(",
"publicKey",
"==",
"null",
"||",
"privateKey",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException... | Calculates an ECDH agreement.
@param publicKey The Curve25519 (typically remote party's) public key.
@param privateKey The Curve25519 (typically yours) private key.
@return A 32-byte shared secret. | [
"Calculates",
"an",
"ECDH",
"agreement",
"."
] | 70fae57d6dccff7e78a46203c534314b07dfdd98 | https://github.com/signalapp/curve25519-java/blob/70fae57d6dccff7e78a46203c534314b07dfdd98/common/src/main/java/org/whispersystems/curve25519/Curve25519.java#L72-L82 | train |
signalapp/curve25519-java | common/src/main/java/org/whispersystems/curve25519/Curve25519.java | Curve25519.verifySignature | public boolean verifySignature(byte[] publicKey, byte[] message, byte[] signature) {
if (publicKey == null || publicKey.length != 32) {
throw new IllegalArgumentException("Invalid public key!");
}
if (message == null || signature == null || signature.length != 64) {
return false;
}
ret... | java | public boolean verifySignature(byte[] publicKey, byte[] message, byte[] signature) {
if (publicKey == null || publicKey.length != 32) {
throw new IllegalArgumentException("Invalid public key!");
}
if (message == null || signature == null || signature.length != 64) {
return false;
}
ret... | [
"public",
"boolean",
"verifySignature",
"(",
"byte",
"[",
"]",
"publicKey",
",",
"byte",
"[",
"]",
"message",
",",
"byte",
"[",
"]",
"signature",
")",
"{",
"if",
"(",
"publicKey",
"==",
"null",
"||",
"publicKey",
".",
"length",
"!=",
"32",
")",
"{",
... | Verify a Curve25519 signature.
@param publicKey The Curve25519 public key the signature belongs to.
@param message The message that was signed.
@param signature The signature to verify.
@return true if valid, false if not. | [
"Verify",
"a",
"Curve25519",
"signature",
"."
] | 70fae57d6dccff7e78a46203c534314b07dfdd98 | https://github.com/signalapp/curve25519-java/blob/70fae57d6dccff7e78a46203c534314b07dfdd98/common/src/main/java/org/whispersystems/curve25519/Curve25519.java#L108-L118 | train |
signalapp/curve25519-java | common/src/main/java/org/whispersystems/curve25519/Curve25519.java | Curve25519.calculateVrfSignature | public byte[] calculateVrfSignature(byte[] privateKey, byte[] message) {
if (privateKey == null || privateKey.length != 32) {
throw new IllegalArgumentException("Invalid private key!");
}
byte[] random = provider.getRandom(64);
return provider.calculateVrfSignature(random, privateKey, message);
... | java | public byte[] calculateVrfSignature(byte[] privateKey, byte[] message) {
if (privateKey == null || privateKey.length != 32) {
throw new IllegalArgumentException("Invalid private key!");
}
byte[] random = provider.getRandom(64);
return provider.calculateVrfSignature(random, privateKey, message);
... | [
"public",
"byte",
"[",
"]",
"calculateVrfSignature",
"(",
"byte",
"[",
"]",
"privateKey",
",",
"byte",
"[",
"]",
"message",
")",
"{",
"if",
"(",
"privateKey",
"==",
"null",
"||",
"privateKey",
".",
"length",
"!=",
"32",
")",
"{",
"throw",
"new",
"Illeg... | Calculates a Unique Curve25519 signature.
@param privateKey The private Curve25519 key to create the signature with.
@param message The message to sign.
@return A 96-byte signature. | [
"Calculates",
"a",
"Unique",
"Curve25519",
"signature",
"."
] | 70fae57d6dccff7e78a46203c534314b07dfdd98 | https://github.com/signalapp/curve25519-java/blob/70fae57d6dccff7e78a46203c534314b07dfdd98/common/src/main/java/org/whispersystems/curve25519/Curve25519.java#L127-L134 | train |
signalapp/curve25519-java | common/src/main/java/org/whispersystems/curve25519/Curve25519.java | Curve25519.verifyVrfSignature | public byte[] verifyVrfSignature(byte[] publicKey, byte[] message, byte[] signature)
throws VrfSignatureVerificationFailedException
{
if (publicKey == null || publicKey.length != 32) {
throw new IllegalArgumentException("Invalid public key!");
}
if (message == null || signature == null || sig... | java | public byte[] verifyVrfSignature(byte[] publicKey, byte[] message, byte[] signature)
throws VrfSignatureVerificationFailedException
{
if (publicKey == null || publicKey.length != 32) {
throw new IllegalArgumentException("Invalid public key!");
}
if (message == null || signature == null || sig... | [
"public",
"byte",
"[",
"]",
"verifyVrfSignature",
"(",
"byte",
"[",
"]",
"publicKey",
",",
"byte",
"[",
"]",
"message",
",",
"byte",
"[",
"]",
"signature",
")",
"throws",
"VrfSignatureVerificationFailedException",
"{",
"if",
"(",
"publicKey",
"==",
"null",
"... | Verify a Unique Curve25519 signature.
@param publicKey The Curve25519 public key the unique signature belongs to.
@param message The message that was signed.
@param signature The unique signature to verify.
@return The vrf for this signature. | [
"Verify",
"a",
"Unique",
"Curve25519",
"signature",
"."
] | 70fae57d6dccff7e78a46203c534314b07dfdd98 | https://github.com/signalapp/curve25519-java/blob/70fae57d6dccff7e78a46203c534314b07dfdd98/common/src/main/java/org/whispersystems/curve25519/Curve25519.java#L145-L157 | train |
jklingsporn/vertx-jooq | vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/internal/AbstractVertxDAO.java | AbstractVertxDAO.setDefault | private Record setDefault(Record record) {
int size = record.size();
for (int i = 0; i < size; i++)
if (record.get(i) == null) {
@SuppressWarnings("unchecked")
Field<Object> field = (Field<Object>) record.field(i);
if (!field.getDataType().null... | java | private Record setDefault(Record record) {
int size = record.size();
for (int i = 0; i < size; i++)
if (record.get(i) == null) {
@SuppressWarnings("unchecked")
Field<Object> field = (Field<Object>) record.field(i);
if (!field.getDataType().null... | [
"private",
"Record",
"setDefault",
"(",
"Record",
"record",
")",
"{",
"int",
"size",
"=",
"record",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"if",
"(",
"record",
".",
"get",
"(",
... | Defaults fields that have a default value and are nullable.
@param record the record
@return the record | [
"Defaults",
"fields",
"that",
"have",
"a",
"default",
"value",
"and",
"are",
"nullable",
"."
] | 0db00b5e040639c309691dfbc125034fa3346d88 | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/internal/AbstractVertxDAO.java#L238-L248 | train |
jklingsporn/vertx-jooq | vertx-jooq-shared-async/src/main/java/io/github/jklingsporn/vertx/jooq/shared/async/AbstractAsyncQueryExecutor.java | AbstractAsyncQueryExecutor.convertToAsyncDriverTypes | protected Object convertToAsyncDriverTypes(Object object){
if(object instanceof Enum){
return ((Enum)object).name();
}else if(object instanceof LocalDateTime){
LocalDateTime convert = (LocalDateTime) object;
return new org.joda.time.LocalDateTime(convert.getYear(),con... | java | protected Object convertToAsyncDriverTypes(Object object){
if(object instanceof Enum){
return ((Enum)object).name();
}else if(object instanceof LocalDateTime){
LocalDateTime convert = (LocalDateTime) object;
return new org.joda.time.LocalDateTime(convert.getYear(),con... | [
"protected",
"Object",
"convertToAsyncDriverTypes",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Enum",
")",
"{",
"return",
"(",
"(",
"Enum",
")",
"object",
")",
".",
"name",
"(",
")",
";",
"}",
"else",
"if",
"(",
"object",
"i... | Async-driver uses joda-time instead of java-time, so we need to convert it.
@param object the object to convert
@return a joda-time representation of the object or the object itself
@see <a href="https://github.com/jklingsporn/vertx-jooq/issues/31">#31</a>
@see <a href="https://github.com/vert-x3/vertx-mysql-postgresql... | [
"Async",
"-",
"driver",
"uses",
"joda",
"-",
"time",
"instead",
"of",
"java",
"-",
"time",
"so",
"we",
"need",
"to",
"convert",
"it",
"."
] | 0db00b5e040639c309691dfbc125034fa3346d88 | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-shared-async/src/main/java/io/github/jklingsporn/vertx/jooq/shared/async/AbstractAsyncQueryExecutor.java#L94-L126 | train |
jklingsporn/vertx-jooq | vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonArrayBinding.java | ObjectToJsonArrayBinding.sql | @Override
public void sql(BindingSQLContext<JsonArray> ctx) {
// Depending on how you generate your SQL, you may need to explicitly distinguish
// between jOOQ generating bind variables or inlined literals. If so, use this check:
// ctx.render().paramType() == INLINED
RenderContext c... | java | @Override
public void sql(BindingSQLContext<JsonArray> ctx) {
// Depending on how you generate your SQL, you may need to explicitly distinguish
// between jOOQ generating bind variables or inlined literals. If so, use this check:
// ctx.render().paramType() == INLINED
RenderContext c... | [
"@",
"Override",
"public",
"void",
"sql",
"(",
"BindingSQLContext",
"<",
"JsonArray",
">",
"ctx",
")",
"{",
"// Depending on how you generate your SQL, you may need to explicitly distinguish",
"// between jOOQ generating bind variables or inlined literals. If so, use this check:",
"// ... | Rending a bind variable for the binding context's value and casting it to the json type | [
"Rending",
"a",
"bind",
"variable",
"for",
"the",
"binding",
"context",
"s",
"value",
"and",
"casting",
"it",
"to",
"the",
"json",
"type"
] | 0db00b5e040639c309691dfbc125034fa3346d88 | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonArrayBinding.java#L46-L56 | train |
jklingsporn/vertx-jooq | vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonArrayBinding.java | ObjectToJsonArrayBinding.register | @Override
public void register(BindingRegisterContext<JsonArray> ctx) throws SQLException {
ctx.statement().registerOutParameter(ctx.index(), Types.VARCHAR);
} | java | @Override
public void register(BindingRegisterContext<JsonArray> ctx) throws SQLException {
ctx.statement().registerOutParameter(ctx.index(), Types.VARCHAR);
} | [
"@",
"Override",
"public",
"void",
"register",
"(",
"BindingRegisterContext",
"<",
"JsonArray",
">",
"ctx",
")",
"throws",
"SQLException",
"{",
"ctx",
".",
"statement",
"(",
")",
".",
"registerOutParameter",
"(",
"ctx",
".",
"index",
"(",
")",
",",
"Types",
... | Registering VARCHAR types for JDBC CallableStatement OUT parameters | [
"Registering",
"VARCHAR",
"types",
"for",
"JDBC",
"CallableStatement",
"OUT",
"parameters"
] | 0db00b5e040639c309691dfbc125034fa3346d88 | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonArrayBinding.java#L59-L62 | train |
jklingsporn/vertx-jooq | vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonArrayBinding.java | ObjectToJsonArrayBinding.set | @Override
public void set(BindingSetStatementContext<JsonArray> ctx) throws SQLException {
ctx.statement().setString(ctx.index(), Objects.toString(ctx.convert(converter()).value(), null));
} | java | @Override
public void set(BindingSetStatementContext<JsonArray> ctx) throws SQLException {
ctx.statement().setString(ctx.index(), Objects.toString(ctx.convert(converter()).value(), null));
} | [
"@",
"Override",
"public",
"void",
"set",
"(",
"BindingSetStatementContext",
"<",
"JsonArray",
">",
"ctx",
")",
"throws",
"SQLException",
"{",
"ctx",
".",
"statement",
"(",
")",
".",
"setString",
"(",
"ctx",
".",
"index",
"(",
")",
",",
"Objects",
".",
"... | Converting the JsonArray to a String value and setting that on a JDBC PreparedStatement | [
"Converting",
"the",
"JsonArray",
"to",
"a",
"String",
"value",
"and",
"setting",
"that",
"on",
"a",
"JDBC",
"PreparedStatement"
] | 0db00b5e040639c309691dfbc125034fa3346d88 | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonArrayBinding.java#L65-L68 | train |
jklingsporn/vertx-jooq | vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonArrayBinding.java | ObjectToJsonArrayBinding.get | @Override
public void get(BindingGetResultSetContext<JsonArray> ctx) throws SQLException {
ctx.convert(converter()).value(ctx.resultSet().getString(ctx.index()));
} | java | @Override
public void get(BindingGetResultSetContext<JsonArray> ctx) throws SQLException {
ctx.convert(converter()).value(ctx.resultSet().getString(ctx.index()));
} | [
"@",
"Override",
"public",
"void",
"get",
"(",
"BindingGetResultSetContext",
"<",
"JsonArray",
">",
"ctx",
")",
"throws",
"SQLException",
"{",
"ctx",
".",
"convert",
"(",
"converter",
"(",
")",
")",
".",
"value",
"(",
"ctx",
".",
"resultSet",
"(",
")",
"... | Getting a String value from a JDBC ResultSet and converting that to a JsonArray | [
"Getting",
"a",
"String",
"value",
"from",
"a",
"JDBC",
"ResultSet",
"and",
"converting",
"that",
"to",
"a",
"JsonArray"
] | 0db00b5e040639c309691dfbc125034fa3346d88 | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonArrayBinding.java#L71-L74 | train |
jklingsporn/vertx-jooq | vertx-jooq-generate/src/main/java/io/github/jklingsporn/vertx/jooq/generate/VertxGenerator.java | VertxGenerator.writeExtraData | protected Collection<JavaWriter> writeExtraData(SchemaDefinition definition, Function<File,JavaWriter> writerGenerator){
return Collections.emptyList();
} | java | protected Collection<JavaWriter> writeExtraData(SchemaDefinition definition, Function<File,JavaWriter> writerGenerator){
return Collections.emptyList();
} | [
"protected",
"Collection",
"<",
"JavaWriter",
">",
"writeExtraData",
"(",
"SchemaDefinition",
"definition",
",",
"Function",
"<",
"File",
",",
"JavaWriter",
">",
"writerGenerator",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}"
] | Write some extra data during code generation
@param definition the schema
@param writerGenerator a Function that returns a new JavaWriter based on a File.
@return a Collection of JavaWriters with data init. | [
"Write",
"some",
"extra",
"data",
"during",
"code",
"generation"
] | 0db00b5e040639c309691dfbc125034fa3346d88 | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-generate/src/main/java/io/github/jklingsporn/vertx/jooq/generate/VertxGenerator.java#L181-L183 | train |
jklingsporn/vertx-jooq | vertx-jooq-generate/src/main/java/io/github/jklingsporn/vertx/jooq/generate/VertxGenerator.java | VertxGenerator.generateDao | @Override
protected void generateDao(TableDefinition table, JavaWriter out1) {
UniqueKeyDefinition key = table.getPrimaryKey();
if (key == null) {
logger.info("Skipping DAO generation", out1.file().getName());
return;
}
VertxJavaWriter out = (VertxJavaWriter) ... | java | @Override
protected void generateDao(TableDefinition table, JavaWriter out1) {
UniqueKeyDefinition key = table.getPrimaryKey();
if (key == null) {
logger.info("Skipping DAO generation", out1.file().getName());
return;
}
VertxJavaWriter out = (VertxJavaWriter) ... | [
"@",
"Override",
"protected",
"void",
"generateDao",
"(",
"TableDefinition",
"table",
",",
"JavaWriter",
"out1",
")",
"{",
"UniqueKeyDefinition",
"key",
"=",
"table",
".",
"getPrimaryKey",
"(",
")",
";",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"logger",
... | copied from jOOQ's JavaGenerator
@param table
@param out1 | [
"copied",
"from",
"jOOQ",
"s",
"JavaGenerator"
] | 0db00b5e040639c309691dfbc125034fa3346d88 | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-generate/src/main/java/io/github/jklingsporn/vertx/jooq/generate/VertxGenerator.java#L493-L502 | train |
jklingsporn/vertx-jooq | vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonObjectBinding.java | ObjectToJsonObjectBinding.get | @Override
public void get(BindingGetStatementContext<JsonObject> ctx) throws SQLException {
ctx.convert(converter()).value(ctx.statement().getString(ctx.index()));
} | java | @Override
public void get(BindingGetStatementContext<JsonObject> ctx) throws SQLException {
ctx.convert(converter()).value(ctx.statement().getString(ctx.index()));
} | [
"@",
"Override",
"public",
"void",
"get",
"(",
"BindingGetStatementContext",
"<",
"JsonObject",
">",
"ctx",
")",
"throws",
"SQLException",
"{",
"ctx",
".",
"convert",
"(",
"converter",
"(",
")",
")",
".",
"value",
"(",
"ctx",
".",
"statement",
"(",
")",
... | Getting a String value from a JDBC CallableStatement and converting that to a JsonObject | [
"Getting",
"a",
"String",
"value",
"from",
"a",
"JDBC",
"CallableStatement",
"and",
"converting",
"that",
"to",
"a",
"JsonObject"
] | 0db00b5e040639c309691dfbc125034fa3346d88 | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-shared/src/main/java/io/github/jklingsporn/vertx/jooq/shared/ObjectToJsonObjectBinding.java#L77-L80 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/SearchableString.java | SearchableString.startsWith | boolean startsWith(final Literal literal) {
// Check whether the answer is already in the cache
final int index = literal.getIndex();
final Boolean cached = myPrefixCache.get(index);
if (cached != null) {
return cached.booleanValue();
}
// Get the answer and... | java | boolean startsWith(final Literal literal) {
// Check whether the answer is already in the cache
final int index = literal.getIndex();
final Boolean cached = myPrefixCache.get(index);
if (cached != null) {
return cached.booleanValue();
}
// Get the answer and... | [
"boolean",
"startsWith",
"(",
"final",
"Literal",
"literal",
")",
"{",
"// Check whether the answer is already in the cache",
"final",
"int",
"index",
"=",
"literal",
".",
"getIndex",
"(",
")",
";",
"final",
"Boolean",
"cached",
"=",
"myPrefixCache",
".",
"get",
"... | Indicates whether this instance starts with the specified prefix.
@param literal The prefix that should be tested
@return <code>true</code> if the argument represents the prefix of this instance, <code>false</code> otherwise. | [
"Indicates",
"whether",
"this",
"instance",
"starts",
"with",
"the",
"specified",
"prefix",
"."
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/SearchableString.java#L47-L60 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/SearchableString.java | SearchableString.endsWith | boolean endsWith(final Literal literal) {
// Check whether the answer is already in the cache
final int index = literal.getIndex();
final Boolean cached = myPostfixCache.get(index);
if (cached != null) {
return cached.booleanValue();
}
// Get the answer and ... | java | boolean endsWith(final Literal literal) {
// Check whether the answer is already in the cache
final int index = literal.getIndex();
final Boolean cached = myPostfixCache.get(index);
if (cached != null) {
return cached.booleanValue();
}
// Get the answer and ... | [
"boolean",
"endsWith",
"(",
"final",
"Literal",
"literal",
")",
"{",
"// Check whether the answer is already in the cache",
"final",
"int",
"index",
"=",
"literal",
".",
"getIndex",
"(",
")",
";",
"final",
"Boolean",
"cached",
"=",
"myPostfixCache",
".",
"get",
"(... | Indicates whether this instance ends with the specified postfix.
@param literal The postfix that should be tested
@return <code>true</code> if the argument represents the postfix of this instance, <code>false</code> otherwise. | [
"Indicates",
"whether",
"this",
"instance",
"ends",
"with",
"the",
"specified",
"postfix",
"."
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/SearchableString.java#L67-L80 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/SearchableString.java | SearchableString.getIndices | int[] getIndices(final Literal literal) {
// Check whether the answer is already in the cache
final int index = literal.getIndex();
final int[] cached = myIndices[index];
if (cached != null) {
return cached;
}
// Find all indices
final int[] values =... | java | int[] getIndices(final Literal literal) {
// Check whether the answer is already in the cache
final int index = literal.getIndex();
final int[] cached = myIndices[index];
if (cached != null) {
return cached;
}
// Find all indices
final int[] values =... | [
"int",
"[",
"]",
"getIndices",
"(",
"final",
"Literal",
"literal",
")",
"{",
"// Check whether the answer is already in the cache",
"final",
"int",
"index",
"=",
"literal",
".",
"getIndex",
"(",
")",
";",
"final",
"int",
"[",
"]",
"cached",
"=",
"myIndices",
"... | Returns all indices where the literal argument can be found in this String. Results are cached for better
performance.
@param literal The string that should be found
@return all indices where the literal argument can be found in this String. | [
"Returns",
"all",
"indices",
"where",
"the",
"literal",
"argument",
"can",
"be",
"found",
"in",
"this",
"String",
".",
"Results",
"are",
"cached",
"for",
"better",
"performance",
"."
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/SearchableString.java#L88-L101 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/SearchableString.java | SearchableString.findIndices | private int[] findIndices(final Literal literal) {
int count = 0;
final char s = literal.getFirstChar();
for (int i = 0; i < myChars.length; i++) {
// Check the first char for better performance and check the complete string
if ((myChars[i] == s || s == '?') && literal.... | java | private int[] findIndices(final Literal literal) {
int count = 0;
final char s = literal.getFirstChar();
for (int i = 0; i < myChars.length; i++) {
// Check the first char for better performance and check the complete string
if ((myChars[i] == s || s == '?') && literal.... | [
"private",
"int",
"[",
"]",
"findIndices",
"(",
"final",
"Literal",
"literal",
")",
"{",
"int",
"count",
"=",
"0",
";",
"final",
"char",
"s",
"=",
"literal",
".",
"getFirstChar",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"my... | Returns all indices where the literal argument can be found in this String.
@param literal The string that should be found
@return all indices where the literal argument can be found in this String. | [
"Returns",
"all",
"indices",
"where",
"the",
"literal",
"argument",
"can",
"be",
"found",
"in",
"this",
"String",
"."
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/SearchableString.java#L108-L140 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/SearchableString.java | Literal.matches | boolean matches(final char[] value, final int from) {
// Check the bounds
final int len = myCharacters.length;
if (len + from > value.length || from < 0) {
return false;
}
// Bounds are ok, check all characters.
// Allow question marks to match any character... | java | boolean matches(final char[] value, final int from) {
// Check the bounds
final int len = myCharacters.length;
if (len + from > value.length || from < 0) {
return false;
}
// Bounds are ok, check all characters.
// Allow question marks to match any character... | [
"boolean",
"matches",
"(",
"final",
"char",
"[",
"]",
"value",
",",
"final",
"int",
"from",
")",
"{",
"// Check the bounds",
"final",
"int",
"len",
"=",
"myCharacters",
".",
"length",
";",
"if",
"(",
"len",
"+",
"from",
">",
"value",
".",
"length",
"||... | Checks whether the value represents a complete substring from the from index.
@param from The start index of the potential substring
@return <code>true</code> If the arguments represent a valid substring, <code>false</code> otherwise. | [
"Checks",
"whether",
"the",
"value",
"represents",
"a",
"complete",
"substring",
"from",
"the",
"from",
"index",
"."
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/SearchableString.java#L248-L266 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/Rule.java | Rule.requires | boolean requires(final String value) {
if (requires(myPrefix, value) || requires(myPostfix, value)) {
return true;
}
if (mySuffixes == null) {
return false;
}
for (final Literal suffix : mySuffixes) {
if (requires(suffix, value)) {
... | java | boolean requires(final String value) {
if (requires(myPrefix, value) || requires(myPostfix, value)) {
return true;
}
if (mySuffixes == null) {
return false;
}
for (final Literal suffix : mySuffixes) {
if (requires(suffix, value)) {
... | [
"boolean",
"requires",
"(",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"requires",
"(",
"myPrefix",
",",
"value",
")",
"||",
"requires",
"(",
"myPostfix",
",",
"value",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"mySuffixes",
"==",
"... | Tests whether this rule needs a specific string in the useragent to match.
@return <code>true</code> if this rule can't match without the specific substring, false otherwise. | [
"Tests",
"whether",
"this",
"rule",
"needs",
"a",
"specific",
"string",
"in",
"the",
"useragent",
"to",
"match",
"."
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/Rule.java#L68-L82 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/Rule.java | Rule.checkWildCard | private static int checkWildCard(final SearchableString value, final Literal suffix, final int start) {
for (final int index : value.getIndices(suffix)) {
if (index >= start) {
return index;
}
}
return -1;
} | java | private static int checkWildCard(final SearchableString value, final Literal suffix, final int start) {
for (final int index : value.getIndices(suffix)) {
if (index >= start) {
return index;
}
}
return -1;
} | [
"private",
"static",
"int",
"checkWildCard",
"(",
"final",
"SearchableString",
"value",
",",
"final",
"Literal",
"suffix",
",",
"final",
"int",
"start",
")",
"{",
"for",
"(",
"final",
"int",
"index",
":",
"value",
".",
"getIndices",
"(",
"suffix",
")",
")"... | Return found index or -1 | [
"Return",
"found",
"index",
"or",
"-",
"1"
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/Rule.java#L153-L160 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/Rule.java | Rule.getPattern | String getPattern() {
final StringBuilder result = new StringBuilder();
if (myPrefix != null) {
result.append(myPrefix);
}
if (mySuffixes != null) {
result.append("*");
for (final Literal sub : mySuffixes) {
result.append(sub);
... | java | String getPattern() {
final StringBuilder result = new StringBuilder();
if (myPrefix != null) {
result.append(myPrefix);
}
if (mySuffixes != null) {
result.append("*");
for (final Literal sub : mySuffixes) {
result.append(sub);
... | [
"String",
"getPattern",
"(",
")",
"{",
"final",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"myPrefix",
"!=",
"null",
")",
"{",
"result",
".",
"append",
"(",
"myPrefix",
")",
";",
"}",
"if",
"(",
"mySuffixes",
"!="... | Returns the reconstructed original pattern.
@return the reconstructed original pattern | [
"Returns",
"the",
"reconstructed",
"original",
"pattern",
"."
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/Rule.java#L166-L183 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/UserAgentParserImpl.java | UserAgentParserImpl.getOrderedRules | static Rule[] getOrderedRules(final Rule[] rules) {
final Comparator<Rule> c = Comparator.comparing(Rule::getSize).reversed().thenComparing(Rule::getPattern);
final Rule[] result = Arrays.copyOf(rules, rules.length);
parallelSort(result, c);
return result;
} | java | static Rule[] getOrderedRules(final Rule[] rules) {
final Comparator<Rule> c = Comparator.comparing(Rule::getSize).reversed().thenComparing(Rule::getPattern);
final Rule[] result = Arrays.copyOf(rules, rules.length);
parallelSort(result, c);
return result;
} | [
"static",
"Rule",
"[",
"]",
"getOrderedRules",
"(",
"final",
"Rule",
"[",
"]",
"rules",
")",
"{",
"final",
"Comparator",
"<",
"Rule",
">",
"c",
"=",
"Comparator",
".",
"comparing",
"(",
"Rule",
"::",
"getSize",
")",
".",
"reversed",
"(",
")",
".",
"t... | Sort by size and alphabet, so the first match can be returned immediately | [
"Sort",
"by",
"size",
"and",
"alphabet",
"so",
"the",
"first",
"match",
"can",
"be",
"returned",
"immediately"
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/UserAgentParserImpl.java#L90-L97 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/impl/UserAgentFileParser.java | UserAgentFileParser.parse | public static UserAgentParser parse(final Reader input, final Collection<BrowsCapField> fields)
throws IOException, ParseException {
return new UserAgentFileParser(fields).parse(input);
} | java | public static UserAgentParser parse(final Reader input, final Collection<BrowsCapField> fields)
throws IOException, ParseException {
return new UserAgentFileParser(fields).parse(input);
} | [
"public",
"static",
"UserAgentParser",
"parse",
"(",
"final",
"Reader",
"input",
",",
"final",
"Collection",
"<",
"BrowsCapField",
">",
"fields",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"return",
"new",
"UserAgentFileParser",
"(",
"fields",
")",
... | Parses a csv stream of rules.
@param input The input stream
@param fields The fields that should be stored during parsing
@return a UserAgentParser based on the read rules
@throws IOException If reading the stream failed.
@throws ParseException | [
"Parses",
"a",
"csv",
"stream",
"of",
"rules",
"."
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/impl/UserAgentFileParser.java#L56-L59 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/UserAgentService.java | UserAgentService.loadParser | public UserAgentParser loadParser() throws IOException, ParseException {
// Use all default fields
final Set<BrowsCapField> defaultFields =
Stream.of(BrowsCapField.values()).filter(BrowsCapField::isDefault).collect(toSet());
return createParserWithFields(defaultFields);
} | java | public UserAgentParser loadParser() throws IOException, ParseException {
// Use all default fields
final Set<BrowsCapField> defaultFields =
Stream.of(BrowsCapField.values()).filter(BrowsCapField::isDefault).collect(toSet());
return createParserWithFields(defaultFields);
} | [
"public",
"UserAgentParser",
"loadParser",
"(",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"// Use all default fields",
"final",
"Set",
"<",
"BrowsCapField",
">",
"defaultFields",
"=",
"Stream",
".",
"of",
"(",
"BrowsCapField",
".",
"values",
"(",
"... | Returns a parser based on the bundled BrowsCap version
@return the user agent parser | [
"Returns",
"a",
"parser",
"based",
"on",
"the",
"bundled",
"BrowsCap",
"version"
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/UserAgentService.java#L55-L62 | train |
blueconic/browscap-java | src/main/java/com/blueconic/browscap/UserAgentService.java | UserAgentService.getCsvFileStream | private InputStream getCsvFileStream() throws FileNotFoundException {
if (myZipFileStream == null) {
if (myZipFilePath == null) {
final String csvFileName = getBundledCsvFileName();
return getClass().getClassLoader().getResourceAsStream(csvFileName);
} els... | java | private InputStream getCsvFileStream() throws FileNotFoundException {
if (myZipFileStream == null) {
if (myZipFilePath == null) {
final String csvFileName = getBundledCsvFileName();
return getClass().getClassLoader().getResourceAsStream(csvFileName);
} els... | [
"private",
"InputStream",
"getCsvFileStream",
"(",
")",
"throws",
"FileNotFoundException",
"{",
"if",
"(",
"myZipFileStream",
"==",
"null",
")",
"{",
"if",
"(",
"myZipFilePath",
"==",
"null",
")",
"{",
"final",
"String",
"csvFileName",
"=",
"getBundledCsvFileName"... | Returns the InputStream to the CSV file. This is either the bundled ZIP file or the one passed in the
constructor.
@return
@throws FileNotFoundException | [
"Returns",
"the",
"InputStream",
"to",
"the",
"CSV",
"file",
".",
"This",
"is",
"either",
"the",
"bundled",
"ZIP",
"file",
"or",
"the",
"one",
"passed",
"in",
"the",
"constructor",
"."
] | c0dbd1741d32628c560dcf6eb995bdeba0725cd9 | https://github.com/blueconic/browscap-java/blob/c0dbd1741d32628c560dcf6eb995bdeba0725cd9/src/main/java/com/blueconic/browscap/UserAgentService.java#L105-L116 | train |
jbellis/jamm | src/org/github/jamm/MemoryLayoutSpecification.java | MemoryLayoutSpecification.sizeOfInstance | public static long sizeOfInstance(Class<?> type) {
long size = SPEC.getObjectHeaderSize() + sizeOfDeclaredFields(type);
while ((type = type.getSuperclass()) != Object.class && type != null)
size += roundTo(sizeOfDeclaredFields(type), SPEC.getSuperclassFieldPadding());
return roundTo(... | java | public static long sizeOfInstance(Class<?> type) {
long size = SPEC.getObjectHeaderSize() + sizeOfDeclaredFields(type);
while ((type = type.getSuperclass()) != Object.class && type != null)
size += roundTo(sizeOfDeclaredFields(type), SPEC.getSuperclassFieldPadding());
return roundTo(... | [
"public",
"static",
"long",
"sizeOfInstance",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"long",
"size",
"=",
"SPEC",
".",
"getObjectHeaderSize",
"(",
")",
"+",
"sizeOfDeclaredFields",
"(",
"type",
")",
";",
"while",
"(",
"(",
"type",
"=",
"type",
... | sizeOfInstanceWithUnsafe is safe against this miscounting | [
"sizeOfInstanceWithUnsafe",
"is",
"safe",
"against",
"this",
"miscounting"
] | b397a48705ff579028df258e08e28b9c97d8472b | https://github.com/jbellis/jamm/blob/b397a48705ff579028df258e08e28b9c97d8472b/src/org/github/jamm/MemoryLayoutSpecification.java#L95-L100 | train |
jbellis/jamm | src/org/github/jamm/MemoryLayoutSpecification.java | MemoryLayoutSpecification.sizeOfInstanceWithUnsafe | public static long sizeOfInstanceWithUnsafe(Class<?> type) {
while (type != null)
{
long size = 0;
for (Field f : declaredFieldsOf(type))
size = Math.max(size, unsafe.objectFieldOffset(f) + sizeOf(f));
if (size > 0)
return roundTo(size,... | java | public static long sizeOfInstanceWithUnsafe(Class<?> type) {
while (type != null)
{
long size = 0;
for (Field f : declaredFieldsOf(type))
size = Math.max(size, unsafe.objectFieldOffset(f) + sizeOf(f));
if (size > 0)
return roundTo(size,... | [
"public",
"static",
"long",
"sizeOfInstanceWithUnsafe",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"while",
"(",
"type",
"!=",
"null",
")",
"{",
"long",
"size",
"=",
"0",
";",
"for",
"(",
"Field",
"f",
":",
"declaredFieldsOf",
"(",
"type",
")",
"... | attemps to use sun.misc.Unsafe to find the maximum object offset, this work around helps deal with long alignment | [
"attemps",
"to",
"use",
"sun",
".",
"misc",
".",
"Unsafe",
"to",
"find",
"the",
"maximum",
"object",
"offset",
"this",
"work",
"around",
"helps",
"deal",
"with",
"long",
"alignment"
] | b397a48705ff579028df258e08e28b9c97d8472b | https://github.com/jbellis/jamm/blob/b397a48705ff579028df258e08e28b9c97d8472b/src/org/github/jamm/MemoryLayoutSpecification.java#L103-L114 | train |
jbellis/jamm | src/org/github/jamm/MemoryLayoutSpecification.java | MemoryLayoutSpecification.sizeOfArray | public static long sizeOfArray(int length, long elementSize) {
return roundTo(SPEC.getArrayHeaderSize() + length * elementSize, SPEC.getObjectPadding());
} | java | public static long sizeOfArray(int length, long elementSize) {
return roundTo(SPEC.getArrayHeaderSize() + length * elementSize, SPEC.getObjectPadding());
} | [
"public",
"static",
"long",
"sizeOfArray",
"(",
"int",
"length",
",",
"long",
"elementSize",
")",
"{",
"return",
"roundTo",
"(",
"SPEC",
".",
"getArrayHeaderSize",
"(",
")",
"+",
"length",
"*",
"elementSize",
",",
"SPEC",
".",
"getObjectPadding",
"(",
")",
... | Memory an array will consume
@param length Number of elements in the array
@param elementSize In-memory size of each element's primitive stored
@return In-memory size of the array | [
"Memory",
"an",
"array",
"will",
"consume"
] | b397a48705ff579028df258e08e28b9c97d8472b | https://github.com/jbellis/jamm/blob/b397a48705ff579028df258e08e28b9c97d8472b/src/org/github/jamm/MemoryLayoutSpecification.java#L136-L138 | train |
jbellis/jamm | src/org/github/jamm/MemoryLayoutSpecification.java | MemoryLayoutSpecification.getAlignment | private static int getAlignment() {
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
for (String arg : runtimeMxBean.getInputArguments()) {
if (arg.startsWith("-XX:ObjectAlignmentInBytes=")) {
try {
return Integer.parseInt(arg.substring(... | java | private static int getAlignment() {
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
for (String arg : runtimeMxBean.getInputArguments()) {
if (arg.startsWith("-XX:ObjectAlignmentInBytes=")) {
try {
return Integer.parseInt(arg.substring(... | [
"private",
"static",
"int",
"getAlignment",
"(",
")",
"{",
"RuntimeMXBean",
"runtimeMxBean",
"=",
"ManagementFactory",
".",
"getRuntimeMXBean",
"(",
")",
";",
"for",
"(",
"String",
"arg",
":",
"runtimeMxBean",
".",
"getInputArguments",
"(",
")",
")",
"{",
"if"... | check if we have a non-standard object alignment we need to round to | [
"check",
"if",
"we",
"have",
"a",
"non",
"-",
"standard",
"object",
"alignment",
"we",
"need",
"to",
"round",
"to"
] | b397a48705ff579028df258e08e28b9c97d8472b | https://github.com/jbellis/jamm/blob/b397a48705ff579028df258e08e28b9c97d8472b/src/org/github/jamm/MemoryLayoutSpecification.java#L273-L283 | train |
ops4j/org.ops4j.pax.web | pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/DOMJettyWebXmlParser.java | DOMJettyWebXmlParser.configure | public void configure(Object obj, Element cfg, int startIdx)
throws Exception {
String id = getAttribute(cfg, "id");
if (id != null) {
_idMap.put(id, obj);
}
Element[] children = getChildren(cfg);
for (int i = startIdx; i < children.length; i++) {
Element node = children[i];
//CHECKSTYLE:OFF
... | java | public void configure(Object obj, Element cfg, int startIdx)
throws Exception {
String id = getAttribute(cfg, "id");
if (id != null) {
_idMap.put(id, obj);
}
Element[] children = getChildren(cfg);
for (int i = startIdx; i < children.length; i++) {
Element node = children[i];
//CHECKSTYLE:OFF
... | [
"public",
"void",
"configure",
"(",
"Object",
"obj",
",",
"Element",
"cfg",
",",
"int",
"startIdx",
")",
"throws",
"Exception",
"{",
"String",
"id",
"=",
"getAttribute",
"(",
"cfg",
",",
"\"id\"",
")",
";",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"_... | Recursive configuration step. This method applies the remaining Set, Put
and Call elements to the current object.
@param obj
@param cfg
@param startIdx the child element index to start with
@throws Exception | [
"Recursive",
"configuration",
"step",
".",
"This",
"method",
"applies",
"the",
"remaining",
"Set",
"Put",
"and",
"Call",
"elements",
"to",
"the",
"current",
"object",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/DOMJettyWebXmlParser.java#L98-L138 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/TldScanner.java | TldScanner.scanJspConfig | protected void scanJspConfig() throws IOException, SAXException {
JspConfigDescriptor jspConfigDescriptor = context.getJspConfigDescriptor();
if (jspConfigDescriptor == null) {
return;
}
Collection<TaglibDescriptor> descriptors = jspConfigDescriptor.getTaglibs();
for... | java | protected void scanJspConfig() throws IOException, SAXException {
JspConfigDescriptor jspConfigDescriptor = context.getJspConfigDescriptor();
if (jspConfigDescriptor == null) {
return;
}
Collection<TaglibDescriptor> descriptors = jspConfigDescriptor.getTaglibs();
for... | [
"protected",
"void",
"scanJspConfig",
"(",
")",
"throws",
"IOException",
",",
"SAXException",
"{",
"JspConfigDescriptor",
"jspConfigDescriptor",
"=",
"context",
".",
"getJspConfigDescriptor",
"(",
")",
";",
"if",
"(",
"jspConfigDescriptor",
"==",
"null",
")",
"{",
... | Scan for TLDs defined in <jsp-config>. | [
"Scan",
"for",
"TLDs",
"defined",
"in",
"<",
";",
"jsp",
"-",
"config>",
";",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/TldScanner.java#L138-L190 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/TldScanner.java | TldScanner.scanResourcePaths | protected void scanResourcePaths(String startPath) throws IOException, SAXException {
Set<String> dirList = context.getResourcePaths(startPath);
if (dirList != null) {
for (String path : dirList) {
if (path.startsWith("/WEB-INF/classes/")) {
// Skip: JSP.... | java | protected void scanResourcePaths(String startPath) throws IOException, SAXException {
Set<String> dirList = context.getResourcePaths(startPath);
if (dirList != null) {
for (String path : dirList) {
if (path.startsWith("/WEB-INF/classes/")) {
// Skip: JSP.... | [
"protected",
"void",
"scanResourcePaths",
"(",
"String",
"startPath",
")",
"throws",
"IOException",
",",
"SAXException",
"{",
"Set",
"<",
"String",
">",
"dirList",
"=",
"context",
".",
"getResourcePaths",
"(",
"startPath",
")",
";",
"if",
"(",
"dirList",
"!=",... | Scan web application resources for TLDs, recursively.
@param startPath
the directory resource to scan
@throws IOException
if there was a problem scanning for or loading a TLD
@throws SAXException
if there was a problem parsing a TLD | [
"Scan",
"web",
"application",
"resources",
"for",
"TLDs",
"recursively",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/TldScanner.java#L202-L223 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java | Activator.trackHttpContexts | private void trackHttpContexts(final BundleContext bundleContext, ExtendedHttpServiceRuntime httpServiceRuntime) {
final ServiceTracker<HttpContext, HttpContextElement> httpContextTracker = HttpContextTracker
.createTracker(extenderContext, bundleContext, httpServiceRuntime);
httpContextTracker.open();
... | java | private void trackHttpContexts(final BundleContext bundleContext, ExtendedHttpServiceRuntime httpServiceRuntime) {
final ServiceTracker<HttpContext, HttpContextElement> httpContextTracker = HttpContextTracker
.createTracker(extenderContext, bundleContext, httpServiceRuntime);
httpContextTracker.open();
... | [
"private",
"void",
"trackHttpContexts",
"(",
"final",
"BundleContext",
"bundleContext",
",",
"ExtendedHttpServiceRuntime",
"httpServiceRuntime",
")",
"{",
"final",
"ServiceTracker",
"<",
"HttpContext",
",",
"HttpContextElement",
">",
"httpContextTracker",
"=",
"HttpContextT... | Track http contexts.
@param bundleContext the BundleContext associated with this bundle
@param httpServiceRuntime | [
"Track",
"http",
"contexts",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java#L143-L155 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java | Activator.trackResources | private void trackResources(final BundleContext bundleContext) {
ServiceTracker<Object, ResourceWebElement> resourceTracker = ResourceTracker.createTracker(extenderContext, bundleContext);
resourceTracker.open();
trackers.add(0, resourceTracker);
final ServiceTracker<ResourceMapping, ResourceMappingWebE... | java | private void trackResources(final BundleContext bundleContext) {
ServiceTracker<Object, ResourceWebElement> resourceTracker = ResourceTracker.createTracker(extenderContext, bundleContext);
resourceTracker.open();
trackers.add(0, resourceTracker);
final ServiceTracker<ResourceMapping, ResourceMappingWebE... | [
"private",
"void",
"trackResources",
"(",
"final",
"BundleContext",
"bundleContext",
")",
"{",
"ServiceTracker",
"<",
"Object",
",",
"ResourceWebElement",
">",
"resourceTracker",
"=",
"ResourceTracker",
".",
"createTracker",
"(",
"extenderContext",
",",
"bundleContext",... | Track resources.
@param bundleContext the BundleContext associated with this bundle | [
"Track",
"resources",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java#L196-L207 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java | Activator.trackFilters | private void trackFilters(final BundleContext bundleContext) {
final ServiceTracker<Filter, FilterWebElement> filterTracker = FilterTracker
.createTracker(extenderContext, bundleContext);
filterTracker.open();
trackers.add(0, filterTracker);
// FIXME needed?
final ServiceTracker<FilterMapping, F... | java | private void trackFilters(final BundleContext bundleContext) {
final ServiceTracker<Filter, FilterWebElement> filterTracker = FilterTracker
.createTracker(extenderContext, bundleContext);
filterTracker.open();
trackers.add(0, filterTracker);
// FIXME needed?
final ServiceTracker<FilterMapping, F... | [
"private",
"void",
"trackFilters",
"(",
"final",
"BundleContext",
"bundleContext",
")",
"{",
"final",
"ServiceTracker",
"<",
"Filter",
",",
"FilterWebElement",
">",
"filterTracker",
"=",
"FilterTracker",
".",
"createTracker",
"(",
"extenderContext",
",",
"bundleContex... | Track filters.
@param bundleContext the BundleContext associated with this bundle | [
"Track",
"filters",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java#L214-L227 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java | Activator.trackListeners | private void trackListeners(final BundleContext bundleContext) {
final ServiceTracker<EventListener, ListenerWebElement> listenerTracker = ListenerTracker
.createTracker(extenderContext, bundleContext);
listenerTracker.open();
trackers.add(0, listenerTracker);
// FIXME needed?
final ServiceTrack... | java | private void trackListeners(final BundleContext bundleContext) {
final ServiceTracker<EventListener, ListenerWebElement> listenerTracker = ListenerTracker
.createTracker(extenderContext, bundleContext);
listenerTracker.open();
trackers.add(0, listenerTracker);
// FIXME needed?
final ServiceTrack... | [
"private",
"void",
"trackListeners",
"(",
"final",
"BundleContext",
"bundleContext",
")",
"{",
"final",
"ServiceTracker",
"<",
"EventListener",
",",
"ListenerWebElement",
">",
"listenerTracker",
"=",
"ListenerTracker",
".",
"createTracker",
"(",
"extenderContext",
",",
... | Track listeners.
@param bundleContext the BundleContext associated with this bundle | [
"Track",
"listeners",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java#L234-L247 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java | Activator.trackJspMappings | private void trackJspMappings(final BundleContext bundleContext) {
final ServiceTracker<JspMapping, JspWebElement> jspMappingTracker = JspMappingTracker
.createTracker(extenderContext, bundleContext);
jspMappingTracker.open();
trackers.add(0, jspMappingTracker);
} | java | private void trackJspMappings(final BundleContext bundleContext) {
final ServiceTracker<JspMapping, JspWebElement> jspMappingTracker = JspMappingTracker
.createTracker(extenderContext, bundleContext);
jspMappingTracker.open();
trackers.add(0, jspMappingTracker);
} | [
"private",
"void",
"trackJspMappings",
"(",
"final",
"BundleContext",
"bundleContext",
")",
"{",
"final",
"ServiceTracker",
"<",
"JspMapping",
",",
"JspWebElement",
">",
"jspMappingTracker",
"=",
"JspMappingTracker",
".",
"createTracker",
"(",
"extenderContext",
",",
... | Track JSPs.
@param bundleContext the BundleContext associated with this bundle | [
"Track",
"JSPs",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java#L254-L260 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java | Activator.trackWelcomeFiles | private void trackWelcomeFiles(final BundleContext bundleContext) {
final ServiceTracker<WelcomeFileMapping, WelcomeFileWebElement> welcomeFileTracker = WelcomeFileMappingTracker
.createTracker(extenderContext, bundleContext);
welcomeFileTracker.open();
trackers.add(0, welcomeFileTracker);
} | java | private void trackWelcomeFiles(final BundleContext bundleContext) {
final ServiceTracker<WelcomeFileMapping, WelcomeFileWebElement> welcomeFileTracker = WelcomeFileMappingTracker
.createTracker(extenderContext, bundleContext);
welcomeFileTracker.open();
trackers.add(0, welcomeFileTracker);
} | [
"private",
"void",
"trackWelcomeFiles",
"(",
"final",
"BundleContext",
"bundleContext",
")",
"{",
"final",
"ServiceTracker",
"<",
"WelcomeFileMapping",
",",
"WelcomeFileWebElement",
">",
"welcomeFileTracker",
"=",
"WelcomeFileMappingTracker",
".",
"createTracker",
"(",
"e... | Track welcome files
@param bundleContext the BundleContext associated with this bundle | [
"Track",
"welcome",
"files"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java#L267-L273 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java | Activator.trackErrorPages | private void trackErrorPages(final BundleContext bundleContext) {
final ServiceTracker<ErrorPageMapping, ErrorPageWebElement> errorPagesTracker = ErrorPageMappingTracker
.createTracker(extenderContext, bundleContext);
errorPagesTracker.open();
trackers.add(0, errorPagesTracker);
} | java | private void trackErrorPages(final BundleContext bundleContext) {
final ServiceTracker<ErrorPageMapping, ErrorPageWebElement> errorPagesTracker = ErrorPageMappingTracker
.createTracker(extenderContext, bundleContext);
errorPagesTracker.open();
trackers.add(0, errorPagesTracker);
} | [
"private",
"void",
"trackErrorPages",
"(",
"final",
"BundleContext",
"bundleContext",
")",
"{",
"final",
"ServiceTracker",
"<",
"ErrorPageMapping",
",",
"ErrorPageWebElement",
">",
"errorPagesTracker",
"=",
"ErrorPageMappingTracker",
".",
"createTracker",
"(",
"extenderCo... | Track error pages
@param bundleContext the BundleContext associated with this bundle | [
"Track",
"error",
"pages"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java#L280-L285 | train |
ops4j/org.ops4j.pax.web | samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/HelloWorldSessionListener.java | HelloWorldSessionListener.sessionCreated | public void sessionCreated(final HttpSessionEvent event) {
counter++;
final HttpSession session = event.getSession();
final String id = session.getId();
SESSIONS.put(id, session);
} | java | public void sessionCreated(final HttpSessionEvent event) {
counter++;
final HttpSession session = event.getSession();
final String id = session.getId();
SESSIONS.put(id, session);
} | [
"public",
"void",
"sessionCreated",
"(",
"final",
"HttpSessionEvent",
"event",
")",
"{",
"counter",
"++",
";",
"final",
"HttpSession",
"session",
"=",
"event",
".",
"getSession",
"(",
")",
";",
"final",
"String",
"id",
"=",
"session",
".",
"getId",
"(",
")... | Fires whenever a new session is created. | [
"Fires",
"whenever",
"a",
"new",
"session",
"is",
"created",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/HelloWorldSessionListener.java#L48-L53 | train |
ops4j/org.ops4j.pax.web | samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/HelloWorldSessionListener.java | HelloWorldSessionListener.sessionDestroyed | public void sessionDestroyed(final HttpSessionEvent event) {
final HttpSession session = event.getSession();
final String id = session.getId();
SESSIONS.remove(id);
counter--;
} | java | public void sessionDestroyed(final HttpSessionEvent event) {
final HttpSession session = event.getSession();
final String id = session.getId();
SESSIONS.remove(id);
counter--;
} | [
"public",
"void",
"sessionDestroyed",
"(",
"final",
"HttpSessionEvent",
"event",
")",
"{",
"final",
"HttpSession",
"session",
"=",
"event",
".",
"getSession",
"(",
")",
";",
"final",
"String",
"id",
"=",
"session",
".",
"getId",
"(",
")",
";",
"SESSIONS",
... | Fires whenever a session is destroyed. | [
"Fires",
"whenever",
"a",
"session",
"is",
"destroyed",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/HelloWorldSessionListener.java#L58-L63 | train |
ops4j/org.ops4j.pax.web | samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/HelloWorldSessionListener.java | HelloWorldSessionListener.getAttributes | public static synchronized List<Object> getAttributes(final String name) {
final List<Object> data = new ArrayList<>();
for (final String id : SESSIONS.keySet()) {
final HttpSession session = SESSIONS.get(id);
try {
final Object o = session.getAttribute(name);
data.add(o);
//CHECKSTYLE:OFF
} c... | java | public static synchronized List<Object> getAttributes(final String name) {
final List<Object> data = new ArrayList<>();
for (final String id : SESSIONS.keySet()) {
final HttpSession session = SESSIONS.get(id);
try {
final Object o = session.getAttribute(name);
data.add(o);
//CHECKSTYLE:OFF
} c... | [
"public",
"static",
"synchronized",
"List",
"<",
"Object",
">",
"getAttributes",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"List",
"<",
"Object",
">",
"data",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"String",
"id",
"... | Return a list with all session values for a given attribute name.
@return a list with all session values for a given attribute name. | [
"Return",
"a",
"list",
"with",
"all",
"session",
"values",
"for",
"a",
"given",
"attribute",
"name",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/HelloWorldSessionListener.java#L70-L86 | train |
ops4j/org.ops4j.pax.web | samples/authentication/src/main/java/org/ops4j/pax/web/samples/authentication/internal/Activator.java | Activator.start | public void start(BundleContext bc) throws Exception {
httpServiceRef = bc.getServiceReference(HttpService.class);
if (httpServiceRef != null) {
httpService = (HttpService) bc.getService(httpServiceRef);
httpService.registerServlet("/status", new StatusServlet(), null,
null);
httpService.registerServl... | java | public void start(BundleContext bc) throws Exception {
httpServiceRef = bc.getServiceReference(HttpService.class);
if (httpServiceRef != null) {
httpService = (HttpService) bc.getService(httpServiceRef);
httpService.registerServlet("/status", new StatusServlet(), null,
null);
httpService.registerServl... | [
"public",
"void",
"start",
"(",
"BundleContext",
"bc",
")",
"throws",
"Exception",
"{",
"httpServiceRef",
"=",
"bc",
".",
"getServiceReference",
"(",
"HttpService",
".",
"class",
")",
";",
"if",
"(",
"httpServiceRef",
"!=",
"null",
")",
"{",
"httpService",
"... | Called whenever the OSGi framework starts our bundle | [
"Called",
"whenever",
"the",
"OSGi",
"framework",
"starts",
"our",
"bundle"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/samples/authentication/src/main/java/org/ops4j/pax/web/samples/authentication/internal/Activator.java#L36-L45 | train |
ops4j/org.ops4j.pax.web | samples/authentication/src/main/java/org/ops4j/pax/web/samples/authentication/internal/Activator.java | Activator.stop | public void stop(BundleContext bc) throws Exception {
if (httpService != null) {
bc.ungetService(httpServiceRef);
httpServiceRef = null;
httpService = null;
}
} | java | public void stop(BundleContext bc) throws Exception {
if (httpService != null) {
bc.ungetService(httpServiceRef);
httpServiceRef = null;
httpService = null;
}
} | [
"public",
"void",
"stop",
"(",
"BundleContext",
"bc",
")",
"throws",
"Exception",
"{",
"if",
"(",
"httpService",
"!=",
"null",
")",
"{",
"bc",
".",
"ungetService",
"(",
"httpServiceRef",
")",
";",
"httpServiceRef",
"=",
"null",
";",
"httpService",
"=",
"nu... | Called whenever the OSGi framework stops our bundle | [
"Called",
"whenever",
"the",
"OSGi",
"framework",
"stops",
"our",
"bundle"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/samples/authentication/src/main/java/org/ops4j/pax/web/samples/authentication/internal/Activator.java#L50-L56 | train |
ops4j/org.ops4j.pax.web | pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceRequestWrapper.java | HttpServiceRequestWrapper.setAttribute | @Override
public void setAttribute(final String name, Object value) {
if (HttpContext.AUTHENTICATION_TYPE.equals(name)) {
handleAuthenticationType(value);
} else if (HttpContext.REMOTE_USER.equals(name)) {
handleRemoteUser(value);
}
super.setAttribute(name, value);
} | java | @Override
public void setAttribute(final String name, Object value) {
if (HttpContext.AUTHENTICATION_TYPE.equals(name)) {
handleAuthenticationType(value);
} else if (HttpContext.REMOTE_USER.equals(name)) {
handleRemoteUser(value);
}
super.setAttribute(name, value);
} | [
"@",
"Override",
"public",
"void",
"setAttribute",
"(",
"final",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"HttpContext",
".",
"AUTHENTICATION_TYPE",
".",
"equals",
"(",
"name",
")",
")",
"{",
"handleAuthenticationType",
"(",
"value",
")... | Filter the setting of authentication related attributes. If one of
HttpContext.AUTHENTICATION_TYPE or HTTPContext.REMOTE_USER set the
corresponding values in original request.
@see javax.servlet.http.HttpServletRequest#setAttribute(String, Object) | [
"Filter",
"the",
"setting",
"of",
"authentication",
"related",
"attributes",
".",
"If",
"one",
"of",
"HttpContext",
".",
"AUTHENTICATION_TYPE",
"or",
"HTTPContext",
".",
"REMOTE_USER",
"set",
"the",
"corresponding",
"values",
"in",
"original",
"request",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceRequestWrapper.java#L98-L106 | train |
ops4j/org.ops4j.pax.web | pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceRequestWrapper.java | HttpServiceRequestWrapper.handleAuthenticationType | private void handleAuthenticationType(final Object authenticationType) {
if (request != null) {
if (authenticationType != null) {
// be defensive
if (!(authenticationType instanceof String)) {
final String message = "Attribute "
+ HttpContext.AUTHENTICATION_TYPE
+ " expected to be... | java | private void handleAuthenticationType(final Object authenticationType) {
if (request != null) {
if (authenticationType != null) {
// be defensive
if (!(authenticationType instanceof String)) {
final String message = "Attribute "
+ HttpContext.AUTHENTICATION_TYPE
+ " expected to be... | [
"private",
"void",
"handleAuthenticationType",
"(",
"final",
"Object",
"authenticationType",
")",
"{",
"if",
"(",
"request",
"!=",
"null",
")",
"{",
"if",
"(",
"authenticationType",
"!=",
"null",
")",
"{",
"// be defensive\r",
"if",
"(",
"!",
"(",
"authenticat... | Handles setting of authentication type attribute.
@param authenticationType new authentication type | [
"Handles",
"setting",
"of",
"authentication",
"type",
"attribute",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceRequestWrapper.java#L113-L135 | train |
ops4j/org.ops4j.pax.web | pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceRequestWrapper.java | HttpServiceRequestWrapper.handleRemoteUser | private void handleRemoteUser(final Object remoteUser) {
if (request != null) {
Principal userPrincipal = null;
if (remoteUser != null) {
// be defensive
if (!(remoteUser instanceof String)) {
final String message = "Attribute "
+ HttpContext.REMOTE_USER
+ " expected to be a S... | java | private void handleRemoteUser(final Object remoteUser) {
if (request != null) {
Principal userPrincipal = null;
if (remoteUser != null) {
// be defensive
if (!(remoteUser instanceof String)) {
final String message = "Attribute "
+ HttpContext.REMOTE_USER
+ " expected to be a S... | [
"private",
"void",
"handleRemoteUser",
"(",
"final",
"Object",
"remoteUser",
")",
"{",
"if",
"(",
"request",
"!=",
"null",
")",
"{",
"Principal",
"userPrincipal",
"=",
"null",
";",
"if",
"(",
"remoteUser",
"!=",
"null",
")",
"{",
"// be defensive\r",
"if",
... | Handles setting of remote user attribute.
@param remoteUser new remote user name | [
"Handles",
"setting",
"of",
"remote",
"user",
"attribute",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceRequestWrapper.java#L142-L166 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/apache/jasper/JspCompilationContext.java | JspCompilationContext.createCompiler | public Compiler createCompiler() {
if (jspCompiler != null ) {
return jspCompiler;
}
jspCompiler = null;
if (options.getCompilerClassName() != null) {
jspCompiler = createCompiler(options.getCompilerClassName());
} else {
if (options.ge... | java | public Compiler createCompiler() {
if (jspCompiler != null ) {
return jspCompiler;
}
jspCompiler = null;
if (options.getCompilerClassName() != null) {
jspCompiler = createCompiler(options.getCompilerClassName());
} else {
if (options.ge... | [
"public",
"Compiler",
"createCompiler",
"(",
")",
"{",
"if",
"(",
"jspCompiler",
"!=",
"null",
")",
"{",
"return",
"jspCompiler",
";",
"}",
"jspCompiler",
"=",
"null",
";",
"if",
"(",
"options",
".",
"getCompilerClassName",
"(",
")",
"!=",
"null",
")",
"... | Create a "Compiler" object based on some init param data. This
is not done yet. Right now we're just hardcoding the actual
compilers that are created.
@return the Java compiler wrapper | [
"Create",
"a",
"Compiler",
"object",
"based",
"on",
"some",
"init",
"param",
"data",
".",
"This",
"is",
"not",
"done",
"yet",
".",
"Right",
"now",
"we",
"re",
"just",
"hardcoding",
"the",
"actual",
"compilers",
"that",
"are",
"created",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/apache/jasper/JspCompilationContext.java#L225-L251 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/apache/jasper/JspCompilationContext.java | JspCompilationContext.resolveRelativeUri | public String resolveRelativeUri(String uri) {
// sometimes we get uri's massaged from File(String), so check for
// a root directory separator char
if (uri.startsWith("/") || uri.startsWith(File.separator)) {
return uri;
} else {
return baseURI + uri;
... | java | public String resolveRelativeUri(String uri) {
// sometimes we get uri's massaged from File(String), so check for
// a root directory separator char
if (uri.startsWith("/") || uri.startsWith(File.separator)) {
return uri;
} else {
return baseURI + uri;
... | [
"public",
"String",
"resolveRelativeUri",
"(",
"String",
"uri",
")",
"{",
"// sometimes we get uri's massaged from File(String), so check for\r",
"// a root directory separator char\r",
"if",
"(",
"uri",
".",
"startsWith",
"(",
"\"/\"",
")",
"||",
"uri",
".",
"startsWith",
... | Get the full value of a URI relative to this compilations context
uses current file as the base.
@param uri The relative URI
@return absolute URI | [
"Get",
"the",
"full",
"value",
"of",
"a",
"URI",
"relative",
"to",
"this",
"compilations",
"context",
"uses",
"current",
"file",
"as",
"the",
"base",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/apache/jasper/JspCompilationContext.java#L279-L287 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/apache/jasper/JspCompilationContext.java | JspCompilationContext.getRealPath | public String getRealPath(String path) {
if (context != null) {
return context.getRealPath(path);
}
return path;
} | java | public String getRealPath(String path) {
if (context != null) {
return context.getRealPath(path);
}
return path;
} | [
"public",
"String",
"getRealPath",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"context",
"!=",
"null",
")",
"{",
"return",
"context",
".",
"getRealPath",
"(",
"path",
")",
";",
"}",
"return",
"path",
";",
"}"
] | Gets the actual path of a URI relative to the context of
the compilation.
@param path The webapp path
@return the corresponding path in the filesystem | [
"Gets",
"the",
"actual",
"path",
"of",
"a",
"URI",
"relative",
"to",
"the",
"context",
"of",
"the",
"compilation",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/apache/jasper/JspCompilationContext.java#L316-L321 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/apache/jasper/JspCompilationContext.java | JspCompilationContext.getServletPackageName | public String getServletPackageName() {
if (isTagFile()) {
String className = tagInfo.getTagClassName();
int lastIndex = className.lastIndexOf('.');
String pkgName = "";
if (lastIndex != -1) {
pkgName = className.substring(0, lastIndex);
... | java | public String getServletPackageName() {
if (isTagFile()) {
String className = tagInfo.getTagClassName();
int lastIndex = className.lastIndexOf('.');
String pkgName = "";
if (lastIndex != -1) {
pkgName = className.substring(0, lastIndex);
... | [
"public",
"String",
"getServletPackageName",
"(",
")",
"{",
"if",
"(",
"isTagFile",
"(",
")",
")",
"{",
"String",
"className",
"=",
"tagInfo",
".",
"getTagClassName",
"(",
")",
";",
"int",
"lastIndex",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
... | Package name for the generated class is make up of the base package
name, which is user settable, and the derived package name. The
derived package name directly mirrors the file hierarchy of the JSP page.
@return the package name | [
"Package",
"name",
"for",
"the",
"generated",
"class",
"is",
"make",
"up",
"of",
"the",
"base",
"package",
"name",
"which",
"is",
"user",
"settable",
"and",
"the",
"derived",
"package",
"name",
".",
"The",
"derived",
"package",
"name",
"directly",
"mirrors",... | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/apache/jasper/JspCompilationContext.java#L464-L480 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorWC.java | RegisterWebAppVisitorWC.visit | public void visit(final WebAppServlet webAppServlet) {
NullArgumentException.validateNotNull(webAppServlet, "Web app servlet");
final String[] urlPatterns = webAppServlet.getAliases();
if (urlPatterns == null || urlPatterns.length == 0) {
LOG.warn("Servlet [" + webAppServlet
+ "] does not have any ma... | java | public void visit(final WebAppServlet webAppServlet) {
NullArgumentException.validateNotNull(webAppServlet, "Web app servlet");
final String[] urlPatterns = webAppServlet.getAliases();
if (urlPatterns == null || urlPatterns.length == 0) {
LOG.warn("Servlet [" + webAppServlet
+ "] does not have any ma... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppServlet",
"webAppServlet",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppServlet",
",",
"\"Web app servlet\"",
")",
";",
"final",
"String",
"[",
"]",
"urlPatterns",
"=",
"webAppServlet",
".",
... | Registers servlets with web container.
@throws NullArgumentException if servlet is null
@see WebAppVisitor#visit(org.ops4j.pax.web.extender.war.internal.model.WebAppServlet) | [
"Registers",
"servlets",
"with",
"web",
"container",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorWC.java#L246-L273 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorWC.java | RegisterWebAppVisitorWC.visit | public void visit(final WebAppFilter webAppFilter) {
NullArgumentException.validateNotNull(webAppFilter, "Web app filter");
LOG.debug("registering filter: {}", webAppFilter);
final String[] urlPatterns = webAppFilter.getUrlPatterns();
final String[] servletNames = webAppFilter.getServletNames();
if ((url... | java | public void visit(final WebAppFilter webAppFilter) {
NullArgumentException.validateNotNull(webAppFilter, "Web app filter");
LOG.debug("registering filter: {}", webAppFilter);
final String[] urlPatterns = webAppFilter.getUrlPatterns();
final String[] servletNames = webAppFilter.getServletNames();
if ((url... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppFilter",
"webAppFilter",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppFilter",
",",
"\"Web app filter\"",
")",
";",
"LOG",
".",
"debug",
"(",
"\"registering filter: {}\"",
",",
"webAppFilter",
... | Registers filters with web container.
@throws NullArgumentException if filter is null
@see WebAppVisitor#visit(org.ops4j.pax.web.extender.war.internal.model.WebAppFilter) | [
"Registers",
"filters",
"with",
"web",
"container",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorWC.java#L281-L326 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorWC.java | RegisterWebAppVisitorWC.visit | public void visit(final WebAppListener webAppListener) {
NullArgumentException.validateNotNull(webAppListener,
"Web app listener");
try {
final EventListener listener = RegisterWebAppVisitorHS.newInstance(
EventListener.class, bundleClassLoader,
webAppListener.getListenerClass());
webAppL... | java | public void visit(final WebAppListener webAppListener) {
NullArgumentException.validateNotNull(webAppListener,
"Web app listener");
try {
final EventListener listener = RegisterWebAppVisitorHS.newInstance(
EventListener.class, bundleClassLoader,
webAppListener.getListenerClass());
webAppL... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppListener",
"webAppListener",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppListener",
",",
"\"Web app listener\"",
")",
";",
"try",
"{",
"final",
"EventListener",
"listener",
"=",
"RegisterWebApp... | Registers listeners with web container.
@throws NullArgumentException if listener is null
@see WebAppVisitor#visit(org.ops4j.pax.web.extender.war.internal.model.WebAppListener) | [
"Registers",
"listeners",
"with",
"web",
"container",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorWC.java#L334-L348 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorWC.java | RegisterWebAppVisitorWC.visit | public void visit(final WebAppErrorPage webAppErrorPage) {
NullArgumentException.validateNotNull(webAppErrorPage,
"Web app error page");
try {
webContainer.registerErrorPage(webAppErrorPage.getError(),
webAppErrorPage.getLocation(), httpContext);
//CHECKSTYLE:OFF
} catch (Exception ignore) {... | java | public void visit(final WebAppErrorPage webAppErrorPage) {
NullArgumentException.validateNotNull(webAppErrorPage,
"Web app error page");
try {
webContainer.registerErrorPage(webAppErrorPage.getError(),
webAppErrorPage.getLocation(), httpContext);
//CHECKSTYLE:OFF
} catch (Exception ignore) {... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppErrorPage",
"webAppErrorPage",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppErrorPage",
",",
"\"Web app error page\"",
")",
";",
"try",
"{",
"webContainer",
".",
"registerErrorPage",
"(",
"webAp... | Registers error pages with web container.
@throws NullArgumentException if listener is null
@see WebAppVisitor#visit(org.ops4j.pax.web.extender.war.internal.model.WebAppListener) | [
"Registers",
"error",
"pages",
"with",
"web",
"container",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorWC.java#L356-L367 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java | WebAppParser.parseContextParams | private static void parseContextParams(final ParamValueType contextParam, final WebApp webApp) {
final WebAppInitParam initParam = new WebAppInitParam();
initParam.setParamName(contextParam.getParamName().getValue());
initParam.setParamValue(contextParam.getParamValue().getValue());
webApp.addContextParam(i... | java | private static void parseContextParams(final ParamValueType contextParam, final WebApp webApp) {
final WebAppInitParam initParam = new WebAppInitParam();
initParam.setParamName(contextParam.getParamName().getValue());
initParam.setParamValue(contextParam.getParamValue().getValue());
webApp.addContextParam(i... | [
"private",
"static",
"void",
"parseContextParams",
"(",
"final",
"ParamValueType",
"contextParam",
",",
"final",
"WebApp",
"webApp",
")",
"{",
"final",
"WebAppInitParam",
"initParam",
"=",
"new",
"WebAppInitParam",
"(",
")",
";",
"initParam",
".",
"setParamName",
... | Parses context params out of web.xml.
@param contextParam contextParam element from web.xml
@param webApp model for web.xml | [
"Parses",
"context",
"params",
"out",
"of",
"web",
".",
"xml",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L526-L531 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java | WebAppParser.parseSessionConfig | private static void parseSessionConfig(final SessionConfigType sessionConfigType, final WebApp webApp) {
// Fix for PAXWEB-201
if (sessionConfigType.getSessionTimeout() != null) {
webApp.setSessionTimeout(sessionConfigType.getSessionTimeout().getValue().toString());
}
if (sessionConfigType.getCookieConf... | java | private static void parseSessionConfig(final SessionConfigType sessionConfigType, final WebApp webApp) {
// Fix for PAXWEB-201
if (sessionConfigType.getSessionTimeout() != null) {
webApp.setSessionTimeout(sessionConfigType.getSessionTimeout().getValue().toString());
}
if (sessionConfigType.getCookieConf... | [
"private",
"static",
"void",
"parseSessionConfig",
"(",
"final",
"SessionConfigType",
"sessionConfigType",
",",
"final",
"WebApp",
"webApp",
")",
"{",
"// Fix for PAXWEB-201\r",
"if",
"(",
"sessionConfigType",
".",
"getSessionTimeout",
"(",
")",
"!=",
"null",
")",
"... | Parses session config out of web.xml.
@param sessionConfigType session-configType element from web.xml
@param webApp model for web.xml | [
"Parses",
"session",
"config",
"out",
"of",
"web",
".",
"xml",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L539-L575 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java | WebAppParser.parseServlets | private static void parseServlets(final ServletType servletType, final WebApp webApp) {
final WebAppServlet servlet = new WebAppServlet();
servlet.setServletName(servletType.getServletName().getValue());
if (servletType.getServletClass() != null) {
servlet.setServletClassName(servletType.getServletClass().... | java | private static void parseServlets(final ServletType servletType, final WebApp webApp) {
final WebAppServlet servlet = new WebAppServlet();
servlet.setServletName(servletType.getServletName().getValue());
if (servletType.getServletClass() != null) {
servlet.setServletClassName(servletType.getServletClass().... | [
"private",
"static",
"void",
"parseServlets",
"(",
"final",
"ServletType",
"servletType",
",",
"final",
"WebApp",
"webApp",
")",
"{",
"final",
"WebAppServlet",
"servlet",
"=",
"new",
"WebAppServlet",
"(",
")",
";",
"servlet",
".",
"setServletName",
"(",
"servlet... | Parses servlets and servlet mappings out of web.xml.
@param servletType servletType element from web.xml
@param webApp model for web.xml | [
"Parses",
"servlets",
"and",
"servlet",
"mappings",
"out",
"of",
"web",
".",
"xml",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L583-L642 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java | WebAppParser.parseFilters | private static void parseFilters(final FilterType filterType, final WebApp webApp) {
final WebAppFilter filter = new WebAppFilter();
if (filterType.getFilterName() != null) {
filter.setFilterName(filterType.getFilterName().getValue());
}
if (filterType.getFilterClass() != null) {
filter.setFilterCla... | java | private static void parseFilters(final FilterType filterType, final WebApp webApp) {
final WebAppFilter filter = new WebAppFilter();
if (filterType.getFilterName() != null) {
filter.setFilterName(filterType.getFilterName().getValue());
}
if (filterType.getFilterClass() != null) {
filter.setFilterCla... | [
"private",
"static",
"void",
"parseFilters",
"(",
"final",
"FilterType",
"filterType",
",",
"final",
"WebApp",
"webApp",
")",
"{",
"final",
"WebAppFilter",
"filter",
"=",
"new",
"WebAppFilter",
"(",
")",
";",
"if",
"(",
"filterType",
".",
"getFilterName",
"(",... | Parses filters and filter mappings out of web.xml.
@param filterType filterType element from web.xml
@param webApp model for web.xml | [
"Parses",
"filters",
"and",
"filter",
"mappings",
"out",
"of",
"web",
".",
"xml",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L663-L691 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java | WebAppParser.parseErrorPages | private static void parseErrorPages(final ErrorPageType errorPageType, final WebApp webApp) {
final WebAppErrorPage errorPage = new WebAppErrorPage();
if (errorPageType.getErrorCode() != null) {
errorPage.setErrorCode(errorPageType.getErrorCode().getValue().toString());
}
if (errorPageType.getExceptionT... | java | private static void parseErrorPages(final ErrorPageType errorPageType, final WebApp webApp) {
final WebAppErrorPage errorPage = new WebAppErrorPage();
if (errorPageType.getErrorCode() != null) {
errorPage.setErrorCode(errorPageType.getErrorCode().getValue().toString());
}
if (errorPageType.getExceptionT... | [
"private",
"static",
"void",
"parseErrorPages",
"(",
"final",
"ErrorPageType",
"errorPageType",
",",
"final",
"WebApp",
"webApp",
")",
"{",
"final",
"WebAppErrorPage",
"errorPage",
"=",
"new",
"WebAppErrorPage",
"(",
")",
";",
"if",
"(",
"errorPageType",
".",
"g... | Parses error pages out of web.xml.
@param errorPageType errorPageType element from web.xml
@param webApp model for web.xml | [
"Parses",
"error",
"pages",
"out",
"of",
"web",
".",
"xml",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L755-L770 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java | WebAppParser.parseWelcomeFiles | private static void parseWelcomeFiles(final WelcomeFileListType welcomeFileList, final WebApp webApp) {
if (welcomeFileList != null && welcomeFileList.getWelcomeFile() != null
&& !welcomeFileList.getWelcomeFile().isEmpty()) {
welcomeFileList.getWelcomeFile().forEach(webApp::addWelcomeFile);
}
} | java | private static void parseWelcomeFiles(final WelcomeFileListType welcomeFileList, final WebApp webApp) {
if (welcomeFileList != null && welcomeFileList.getWelcomeFile() != null
&& !welcomeFileList.getWelcomeFile().isEmpty()) {
welcomeFileList.getWelcomeFile().forEach(webApp::addWelcomeFile);
}
} | [
"private",
"static",
"void",
"parseWelcomeFiles",
"(",
"final",
"WelcomeFileListType",
"welcomeFileList",
",",
"final",
"WebApp",
"webApp",
")",
"{",
"if",
"(",
"welcomeFileList",
"!=",
"null",
"&&",
"welcomeFileList",
".",
"getWelcomeFile",
"(",
")",
"!=",
"null"... | Parses welcome files out of web.xml.
@param welcomeFileList welcomeFileList element from web.xml
@param webApp model for web.xml | [
"Parses",
"welcome",
"files",
"out",
"of",
"web",
".",
"xml",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L778-L783 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java | WebAppParser.parseMimeMappings | private static void parseMimeMappings(final MimeMappingType mimeMappingType, final WebApp webApp) {
final WebAppMimeMapping mimeMapping = new WebAppMimeMapping();
mimeMapping.setExtension(mimeMappingType.getExtension().getValue());
mimeMapping.setMimeType(mimeMappingType.getMimeType().getValue());
webApp.ad... | java | private static void parseMimeMappings(final MimeMappingType mimeMappingType, final WebApp webApp) {
final WebAppMimeMapping mimeMapping = new WebAppMimeMapping();
mimeMapping.setExtension(mimeMappingType.getExtension().getValue());
mimeMapping.setMimeType(mimeMappingType.getMimeType().getValue());
webApp.ad... | [
"private",
"static",
"void",
"parseMimeMappings",
"(",
"final",
"MimeMappingType",
"mimeMappingType",
",",
"final",
"WebApp",
"webApp",
")",
"{",
"final",
"WebAppMimeMapping",
"mimeMapping",
"=",
"new",
"WebAppMimeMapping",
"(",
")",
";",
"mimeMapping",
".",
"setExt... | Parses mime mappings out of web.xml.
@param mimeMappingType mimeMappingType element from web.xml
@param webApp model for web.xml | [
"Parses",
"mime",
"mappings",
"out",
"of",
"web",
".",
"xml",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L791-L796 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java | WebAppParser.getTextContent | private static String getTextContent(final Element element) {
if (element != null) {
String content = element.getTextContent();
if (content != null) {
content = content.trim();
}
return content;
}
return null;
} | java | private static String getTextContent(final Element element) {
if (element != null) {
String content = element.getTextContent();
if (content != null) {
content = content.trim();
}
return content;
}
return null;
} | [
"private",
"static",
"String",
"getTextContent",
"(",
"final",
"Element",
"element",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"String",
"content",
"=",
"element",
".",
"getTextContent",
"(",
")",
";",
"if",
"(",
"content",
"!=",
"null",
")... | Returns the text content of an element or null if the element is null.
@param element the same element form which the context should be retrieved
@return text content of element | [
"Returns",
"the",
"text",
"content",
"of",
"an",
"element",
"or",
"null",
"if",
"the",
"element",
"is",
"null",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L856-L865 | train |
ops4j/org.ops4j.pax.web | pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/TypeUtil.java | TypeUtil.parseInt | public static int parseInt(byte[] b, int offset, int length, int base) {
int value = 0;
//CHECKSTYLE:OFF
if (length < 0) {
length = b.length - offset;
}
//CHECKSTYLE:ON
for (int i = 0; i < length; i++) {
char c = (char) (_0XFF & b[offset + i]);
int digit = c - '0';
if (digit < 0 || digit >= b... | java | public static int parseInt(byte[] b, int offset, int length, int base) {
int value = 0;
//CHECKSTYLE:OFF
if (length < 0) {
length = b.length - offset;
}
//CHECKSTYLE:ON
for (int i = 0; i < length; i++) {
char c = (char) (_0XFF & b[offset + i]);
int digit = c - '0';
if (digit < 0 || digit >= b... | [
"public",
"static",
"int",
"parseInt",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"offset",
",",
"int",
"length",
",",
"int",
"base",
")",
"{",
"int",
"value",
"=",
"0",
";",
"//CHECKSTYLE:OFF",
"if",
"(",
"length",
"<",
"0",
")",
"{",
"length",
"=",
... | Parse an int from a byte array of ascii characters. Negative numbers are
not handled.
@param b byte array
@param offset Offset within string
@param length Length of integer or -1 for remainder of string
@param base base of the integer
@return the parsed integer
@throws NumberFormatException if the array cannot ... | [
"Parse",
"an",
"int",
"from",
"a",
"byte",
"array",
"of",
"ascii",
"characters",
".",
"Negative",
"numbers",
"are",
"not",
"handled",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/TypeUtil.java#L322-L347 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/HttpServiceTracker.java | HttpServiceTracker.addingService | @Override
public HttpService addingService(
final ServiceReference<HttpService> serviceReference) {
LOG.debug("HttpService available {}", serviceReference);
lock.lock();
HttpService addedHttpService = null;
try {
if (httpService != null) {
return super.addingService(serviceReference);
}
... | java | @Override
public HttpService addingService(
final ServiceReference<HttpService> serviceReference) {
LOG.debug("HttpService available {}", serviceReference);
lock.lock();
HttpService addedHttpService = null;
try {
if (httpService != null) {
return super.addingService(serviceReference);
}
... | [
"@",
"Override",
"public",
"HttpService",
"addingService",
"(",
"final",
"ServiceReference",
"<",
"HttpService",
">",
"serviceReference",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"HttpService available {}\"",
",",
"serviceReference",
")",
";",
"lock",
".",
"lock",
"(... | Gets the service if one is not already available and notify listeners.
@see org.osgi.util.tracker.ServiceTracker#addingService(org.osgi.framework.ServiceReference) | [
"Gets",
"the",
"service",
"if",
"one",
"is",
"not",
"already",
"available",
"and",
"notify",
"listeners",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/HttpServiceTracker.java#L88-L109 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/HttpServiceTracker.java | HttpServiceTracker.removedService | @Override
public void removedService(
final ServiceReference<HttpService> serviceReference,
final HttpService service) {
LOG.debug("HttpService removed {}", serviceReference);
lock.lock();
HttpService removedHttpService = null;
try {
if (context != null) {
super.removedService(serviceRefe... | java | @Override
public void removedService(
final ServiceReference<HttpService> serviceReference,
final HttpService service) {
LOG.debug("HttpService removed {}", serviceReference);
lock.lock();
HttpService removedHttpService = null;
try {
if (context != null) {
super.removedService(serviceRefe... | [
"@",
"Override",
"public",
"void",
"removedService",
"(",
"final",
"ServiceReference",
"<",
"HttpService",
">",
"serviceReference",
",",
"final",
"HttpService",
"service",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"HttpService removed {}\"",
",",
"serviceReference",
")"... | Notify listeners that the http service became unavailable. Then looks for
another one and if available notifies listeners.
@see org.osgi.util.tracker.ServiceTracker#removedService(org.osgi.framework.ServiceReference, Object) | [
"Notify",
"listeners",
"that",
"the",
"http",
"service",
"became",
"unavailable",
".",
"Then",
"looks",
"for",
"another",
"one",
"and",
"if",
"available",
"notifies",
"listeners",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/HttpServiceTracker.java#L117-L137 | train |
ops4j/org.ops4j.pax.web | samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/Activator.java | Activator.start | public void start(BundleContext bc) throws Exception {
/*
* The pax-web-war service can take a little longer to start, we can't
* say how much it will take, so we do need to sit down a while and wait
* it's availability in order to use it's reference.
*
* This is a MUST, it's really important - mostly ... | java | public void start(BundleContext bc) throws Exception {
/*
* The pax-web-war service can take a little longer to start, we can't
* say how much it will take, so we do need to sit down a while and wait
* it's availability in order to use it's reference.
*
* This is a MUST, it's really important - mostly ... | [
"public",
"void",
"start",
"(",
"BundleContext",
"bc",
")",
"throws",
"Exception",
"{",
"/*\n\t\t * The pax-web-war service can take a little longer to start, we can't\n\t\t * say how much it will take, so we do need to sit down a while and wait\n\t\t * it's availability in order to use it's ref... | Called when the OSGi framework starts our bundle. | [
"Called",
"when",
"the",
"OSGi",
"framework",
"starts",
"our",
"bundle",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/Activator.java#L51-L182 | train |
ops4j/org.ops4j.pax.web | samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/HelloWorldErrorServlet.java | HelloWorldErrorServlet.printAttribute | private static void printAttribute(final PrintWriter writer,
final HttpServletRequest request, final String attribute) {
writer.println("<tr><td>"
+ attribute
+ "</td><td>"
+ (request.getAttribute(attribute) != null ? request
.getAttribute(attribute) : "") + "</td></tr>");
} | java | private static void printAttribute(final PrintWriter writer,
final HttpServletRequest request, final String attribute) {
writer.println("<tr><td>"
+ attribute
+ "</td><td>"
+ (request.getAttribute(attribute) != null ? request
.getAttribute(attribute) : "") + "</td></tr>");
} | [
"private",
"static",
"void",
"printAttribute",
"(",
"final",
"PrintWriter",
"writer",
",",
"final",
"HttpServletRequest",
"request",
",",
"final",
"String",
"attribute",
")",
"{",
"writer",
".",
"println",
"(",
"\"<tr><td>\"",
"+",
"attribute",
"+",
"\"</td><td>\"... | Prints an error request attribute.
@param writer print writer to write to
@param request servlet request
@param attribute attribute name | [
"Prints",
"an",
"error",
"request",
"attribute",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/samples/helloworld-wc/src/main/java/org/ops4j/pax/web/samples/helloworld/wc/internal/HelloWorldErrorServlet.java#L69-L76 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/JasperClassLoader.java | JasperClassLoader.getResources | @Override
public Enumeration<URL> getResources(String name) throws IOException {
return bundleClassLoader.getResources(name);
} | java | @Override
public Enumeration<URL> getResources(String name) throws IOException {
return bundleClassLoader.getResources(name);
} | [
"@",
"Override",
"public",
"Enumeration",
"<",
"URL",
">",
"getResources",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"return",
"bundleClassLoader",
".",
"getResources",
"(",
"name",
")",
";",
"}"
] | Delegate to bundle class loader.
@see BundleClassLoader#getResources(String) | [
"Delegate",
"to",
"bundle",
"class",
"loader",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/JasperClassLoader.java#L87-L90 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/JasperClassLoader.java | JasperClassLoader.scanBundlesInClassSpace | public List<URL> scanBundlesInClassSpace(String directory,
String filePattern, boolean recursive) {
Set<Bundle> bundlesInClassSpace = ClassPathUtil.getBundlesInClassSpace(
bundleClassLoader.getBundle(), new HashSet<>());
List<URL> matching = new ArrayList<>();
for (Bundle bundle : bundlesInClassS... | java | public List<URL> scanBundlesInClassSpace(String directory,
String filePattern, boolean recursive) {
Set<Bundle> bundlesInClassSpace = ClassPathUtil.getBundlesInClassSpace(
bundleClassLoader.getBundle(), new HashSet<>());
List<URL> matching = new ArrayList<>();
for (Bundle bundle : bundlesInClassS... | [
"public",
"List",
"<",
"URL",
">",
"scanBundlesInClassSpace",
"(",
"String",
"directory",
",",
"String",
"filePattern",
",",
"boolean",
"recursive",
")",
"{",
"Set",
"<",
"Bundle",
">",
"bundlesInClassSpace",
"=",
"ClassPathUtil",
".",
"getBundlesInClassSpace",
"(... | Scans the imported and required bundles for matching resources. Can be
used to obtain references to TLD files, XML definition files, etc.
@param directory the directory within the imported/required bundle where to
perform the lookup (e.g. "META-INF/")
@param filePattern the file pattern to lookup (e.g. "*.tld")
@par... | [
"Scans",
"the",
"imported",
"and",
"required",
"bundles",
"for",
"matching",
"resources",
".",
"Can",
"be",
"used",
"to",
"obtain",
"references",
"to",
"TLD",
"files",
"XML",
"definition",
"files",
"etc",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/JasperClassLoader.java#L235-L255 | train |
ops4j/org.ops4j.pax.web | pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/configuration/model/UndertowConfiguration.java | UndertowConfiguration.bindingInfo | public BindingInfo bindingInfo(String socketBindingName) {
SocketBinding sb = socketBinding(socketBindingName);
if (sb == null) {
throw new IllegalArgumentException("Can't find socket binding with name \"" + socketBindingName + "\"");
}
Interface iface = interfaceRef(sb.getInterfaceRef());
if (iface == nul... | java | public BindingInfo bindingInfo(String socketBindingName) {
SocketBinding sb = socketBinding(socketBindingName);
if (sb == null) {
throw new IllegalArgumentException("Can't find socket binding with name \"" + socketBindingName + "\"");
}
Interface iface = interfaceRef(sb.getInterfaceRef());
if (iface == nul... | [
"public",
"BindingInfo",
"bindingInfo",
"(",
"String",
"socketBindingName",
")",
"{",
"SocketBinding",
"sb",
"=",
"socketBinding",
"(",
"socketBindingName",
")",
";",
"if",
"(",
"sb",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Ca... | Returns valid information about interfaces+port to listen on
@param socketBindingName
@return | [
"Returns",
"valid",
"information",
"about",
"interfaces",
"+",
"port",
"to",
"listen",
"on"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/configuration/model/UndertowConfiguration.java#L153-L168 | train |
ops4j/org.ops4j.pax.web | pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/ResourceServlet.java | ResourceServlet.configureWelcomeFiles | public void configureWelcomeFiles(List<String> welcomePages) {
this.welcomePages = welcomePages;
((ResourceHandler) handler).setWelcomeFiles();
((ResourceHandler) handler).addWelcomeFiles(welcomePages.toArray(new String[welcomePages.size()]));
} | java | public void configureWelcomeFiles(List<String> welcomePages) {
this.welcomePages = welcomePages;
((ResourceHandler) handler).setWelcomeFiles();
((ResourceHandler) handler).addWelcomeFiles(welcomePages.toArray(new String[welcomePages.size()]));
} | [
"public",
"void",
"configureWelcomeFiles",
"(",
"List",
"<",
"String",
">",
"welcomePages",
")",
"{",
"this",
".",
"welcomePages",
"=",
"welcomePages",
";",
"(",
"(",
"ResourceHandler",
")",
"handler",
")",
".",
"setWelcomeFiles",
"(",
")",
";",
"(",
"(",
... | Reconfigures default welcome pages with ones provided externally
@param welcomePages | [
"Reconfigures",
"default",
"welcome",
"pages",
"with",
"ones",
"provided",
"externally"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/ResourceServlet.java#L127-L131 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java | ServicePropertiesUtils.getStringProperty | public static String getStringProperty(
final ServiceReference<?> serviceReference, final String key) {
NullArgumentException.validateNotNull(serviceReference, "Service reference");
NullArgumentException.validateNotEmpty(key, true, "Property key");
Object value = serviceReference.getProperty(key);
if ... | java | public static String getStringProperty(
final ServiceReference<?> serviceReference, final String key) {
NullArgumentException.validateNotNull(serviceReference, "Service reference");
NullArgumentException.validateNotEmpty(key, true, "Property key");
Object value = serviceReference.getProperty(key);
if ... | [
"public",
"static",
"String",
"getStringProperty",
"(",
"final",
"ServiceReference",
"<",
"?",
">",
"serviceReference",
",",
"final",
"String",
"key",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"serviceReference",
",",
"\"Service reference\"",
")"... | Returns a property as String.
@param serviceReference service reference; cannot be null
@param key property key; cannot be null
@return property value; null if property is not set or property value is
not a String
@throws NullArgumentException - If service reference is null - If key is null | [
"Returns",
"a",
"property",
"as",
"String",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java#L65-L76 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java | ServicePropertiesUtils.getIntegerProperty | public static Integer getIntegerProperty(final ServiceReference<?> serviceReference, final String key) {
NullArgumentException.validateNotNull(serviceReference, "Service reference");
NullArgumentException.validateNotEmpty(key, true, "Property key");
final Object value = serviceReference.getProperty(key);
if... | java | public static Integer getIntegerProperty(final ServiceReference<?> serviceReference, final String key) {
NullArgumentException.validateNotNull(serviceReference, "Service reference");
NullArgumentException.validateNotEmpty(key, true, "Property key");
final Object value = serviceReference.getProperty(key);
if... | [
"public",
"static",
"Integer",
"getIntegerProperty",
"(",
"final",
"ServiceReference",
"<",
"?",
">",
"serviceReference",
",",
"final",
"String",
"key",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"serviceReference",
",",
"\"Service reference\"",
"... | Returns a property as Integer.
@param serviceReference service reference; cannot be null
@param key property key; cannot be null
@return property value; null if property is not set or property value is
not an Integer
@throws NullArgumentException - If service reference is null - If key is null | [
"Returns",
"a",
"property",
"as",
"Integer",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java#L93-L110 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java | ServicePropertiesUtils.getSubsetStartingWith | public static Map<String, Object> getSubsetStartingWith(
final ServiceReference<?> serviceReference, final String prefix) {
final Map<String, Object> subset = new HashMap<>();
for (String key : serviceReference.getPropertyKeys()) {
if (key != null && key.startsWith(prefix)
&& key.trim().length() > p... | java | public static Map<String, Object> getSubsetStartingWith(
final ServiceReference<?> serviceReference, final String prefix) {
final Map<String, Object> subset = new HashMap<>();
for (String key : serviceReference.getPropertyKeys()) {
if (key != null && key.startsWith(prefix)
&& key.trim().length() > p... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"getSubsetStartingWith",
"(",
"final",
"ServiceReference",
"<",
"?",
">",
"serviceReference",
",",
"final",
"String",
"prefix",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"subset... | Returns the subset of properties that start with the prefix. The returned
dictionary will have as keys the original key without the prefix.
@param serviceReference service reference; cannot be null
@param prefix property keys prefix; cannot be null
@return subset of properties or null if there is no property... | [
"Returns",
"the",
"subset",
"of",
"properties",
"that",
"start",
"with",
"the",
"prefix",
".",
"The",
"returned",
"dictionary",
"will",
"have",
"as",
"keys",
"the",
"original",
"key",
"without",
"the",
"prefix",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java#L146-L160 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java | ServicePropertiesUtils.extractHttpContextId | public static String extractHttpContextId(final ServiceReference<?> serviceReference) {
String httpContextId = getStringProperty(serviceReference, ExtenderConstants.PROPERTY_HTTP_CONTEXT_ID);
//TODO: Make sure the current HttpContextSelect works together with R6
if (httpContextId == null) {
String httpCo... | java | public static String extractHttpContextId(final ServiceReference<?> serviceReference) {
String httpContextId = getStringProperty(serviceReference, ExtenderConstants.PROPERTY_HTTP_CONTEXT_ID);
//TODO: Make sure the current HttpContextSelect works together with R6
if (httpContextId == null) {
String httpCo... | [
"public",
"static",
"String",
"extractHttpContextId",
"(",
"final",
"ServiceReference",
"<",
"?",
">",
"serviceReference",
")",
"{",
"String",
"httpContextId",
"=",
"getStringProperty",
"(",
"serviceReference",
",",
"ExtenderConstants",
".",
"PROPERTY_HTTP_CONTEXT_ID",
... | Utility method to extract the httpContextID from the service reference.
This can either be included with the "old" Pax-Web style or the new OSGi R6 Whiteboard style.
@param serviceReference - service reference where the httpContextID needs to be extracted from.
@return the http context id | [
"Utility",
"method",
"to",
"extract",
"the",
"httpContextID",
"from",
"the",
"service",
"reference",
".",
"This",
"can",
"either",
"be",
"included",
"with",
"the",
"old",
"Pax",
"-",
"Web",
"style",
"or",
"the",
"new",
"OSGi",
"R6",
"Whiteboard",
"style",
... | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java#L182-L195 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java | ServicePropertiesUtils.extractSharedHttpContext | public static Boolean extractSharedHttpContext(final ServiceReference<?> serviceReference) {
Boolean sharedHttpContext = Boolean
.parseBoolean((String) serviceReference
.getProperty(ExtenderConstants.PROPERTY_HTTP_CONTEXT_SHARED));
if (serviceReference.getProperty(HttpWhiteboardConstants.HTTP_WHITEB... | java | public static Boolean extractSharedHttpContext(final ServiceReference<?> serviceReference) {
Boolean sharedHttpContext = Boolean
.parseBoolean((String) serviceReference
.getProperty(ExtenderConstants.PROPERTY_HTTP_CONTEXT_SHARED));
if (serviceReference.getProperty(HttpWhiteboardConstants.HTTP_WHITEB... | [
"public",
"static",
"Boolean",
"extractSharedHttpContext",
"(",
"final",
"ServiceReference",
"<",
"?",
">",
"serviceReference",
")",
"{",
"Boolean",
"sharedHttpContext",
"=",
"Boolean",
".",
"parseBoolean",
"(",
"(",
"String",
")",
"serviceReference",
".",
"getPrope... | Utility method to extract the shared state of the HttpContext
@param serviceReference
@return whether the context is shared | [
"Utility",
"method",
"to",
"extract",
"the",
"shared",
"state",
"of",
"the",
"HttpContext"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/util/ServicePropertiesUtils.java#L203-L212 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebAppServlet.java | WebAppServlet.addInitParam | public void addInitParam(final WebAppInitParam param) {
NullArgumentException.validateNotNull(param, "Init param");
NullArgumentException.validateNotNull(param.getParamName(),
"Init param name");
NullArgumentException.validateNotNull(param.getParamValue(),
"Init param value");
initParams.add(param);
} | java | public void addInitParam(final WebAppInitParam param) {
NullArgumentException.validateNotNull(param, "Init param");
NullArgumentException.validateNotNull(param.getParamName(),
"Init param name");
NullArgumentException.validateNotNull(param.getParamValue(),
"Init param value");
initParams.add(param);
} | [
"public",
"void",
"addInitParam",
"(",
"final",
"WebAppInitParam",
"param",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"param",
",",
"\"Init param\"",
")",
";",
"NullArgumentException",
".",
"validateNotNull",
"(",
"param",
".",
"getParamName",
... | Add a init param for filter.
@param param to be added
@throws NullArgumentException if param, param name, param value is null | [
"Add",
"a",
"init",
"param",
"for",
"filter",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebAppServlet.java#L166-L173 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebObserver.java | WebObserver.createExtension | public Extension createExtension(final Bundle bundle) {
NullArgumentException.validateNotNull(bundle, "Bundle");
if (bundle.getState() != Bundle.ACTIVE) {
LOG.debug("Bundle is not in ACTIVE state, ignore it!");
return null;
}
// Check compatibility
Boolean canSeeServletClass = canSeeClass(bundle, Servl... | java | public Extension createExtension(final Bundle bundle) {
NullArgumentException.validateNotNull(bundle, "Bundle");
if (bundle.getState() != Bundle.ACTIVE) {
LOG.debug("Bundle is not in ACTIVE state, ignore it!");
return null;
}
// Check compatibility
Boolean canSeeServletClass = canSeeClass(bundle, Servl... | [
"public",
"Extension",
"createExtension",
"(",
"final",
"Bundle",
"bundle",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"bundle",
",",
"\"Bundle\"",
")",
";",
"if",
"(",
"bundle",
".",
"getState",
"(",
")",
"!=",
"Bundle",
".",
"ACTIVE",
... | Parse the web app and create the extension that will be managed by the
extender. | [
"Parse",
"the",
"web",
"app",
"and",
"create",
"the",
"extension",
"that",
"will",
"be",
"managed",
"by",
"the",
"extender",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebObserver.java#L119-L207 | train |
ops4j/org.ops4j.pax.web | pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/Path.java | Path.normalizeResourcePath | public static String normalizeResourcePath(final String path) {
if (path == null) {
return null;
}
String normalizedPath = replaceSlashes(path.trim());
if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) {
normalizedPath = normalizedPath.substring(1);
}
return normalizedPath;
} | java | public static String normalizeResourcePath(final String path) {
if (path == null) {
return null;
}
String normalizedPath = replaceSlashes(path.trim());
if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) {
normalizedPath = normalizedPath.substring(1);
}
return normalizedPath;
} | [
"public",
"static",
"String",
"normalizeResourcePath",
"(",
"final",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"normalizedPath",
"=",
"replaceSlashes",
"(",
"path",
".",
"trim",
"(",
")",
... | Normalize the path for accesing a resource, meaning that will replace
consecutive slashes and will remove a leading slash if present.
@param path path to normalize
@return normalized path or the original path if there is nothing to be
replaced. | [
"Normalize",
"the",
"path",
"for",
"accesing",
"a",
"resource",
"meaning",
"that",
"will",
"replace",
"consecutive",
"slashes",
"and",
"will",
"remove",
"a",
"leading",
"slash",
"if",
"present",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/Path.java#L43-L52 | train |
ops4j/org.ops4j.pax.web | pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/Path.java | Path.normalizePatterns | public static String[] normalizePatterns(final String[] urlPatterns) {
String[] normalized = null;
if (urlPatterns != null) {
normalized = new String[urlPatterns.length];
for (int i = 0; i < urlPatterns.length; i++) {
normalized[i] = normalizePattern(urlPatterns[i]);
}
}
return normalized;
} | java | public static String[] normalizePatterns(final String[] urlPatterns) {
String[] normalized = null;
if (urlPatterns != null) {
normalized = new String[urlPatterns.length];
for (int i = 0; i < urlPatterns.length; i++) {
normalized[i] = normalizePattern(urlPatterns[i]);
}
}
return normalized;
} | [
"public",
"static",
"String",
"[",
"]",
"normalizePatterns",
"(",
"final",
"String",
"[",
"]",
"urlPatterns",
")",
"{",
"String",
"[",
"]",
"normalized",
"=",
"null",
";",
"if",
"(",
"urlPatterns",
"!=",
"null",
")",
"{",
"normalized",
"=",
"new",
"Strin... | Normalize an array of patterns.
@param urlPatterns to mormalize
@return array of nomalized patterns | [
"Normalize",
"an",
"array",
"of",
"patterns",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/util/Path.java#L75-L84 | train |
ops4j/org.ops4j.pax.web | pax-web-api/src/main/java/org/ops4j/pax/web/utils/ClassPathUtil.java | ClassPathUtil.getClassPathJars | public static URL[] getClassPathJars(final Bundle bundle) {
final List<URL> urls = new ArrayList<>();
final String bundleClasspath = (String) bundle.getHeaders().get(
"Bundle-ClassPath");
if (bundleClasspath != null) {
String[] segments = bundleClasspath.split(",");
for (String segment : segments) {
... | java | public static URL[] getClassPathJars(final Bundle bundle) {
final List<URL> urls = new ArrayList<>();
final String bundleClasspath = (String) bundle.getHeaders().get(
"Bundle-ClassPath");
if (bundleClasspath != null) {
String[] segments = bundleClasspath.split(",");
for (String segment : segments) {
... | [
"public",
"static",
"URL",
"[",
"]",
"getClassPathJars",
"(",
"final",
"Bundle",
"bundle",
")",
"{",
"final",
"List",
"<",
"URL",
">",
"urls",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"String",
"bundleClasspath",
"=",
"(",
"String",
")",
... | Returns a list of urls to jars that composes the Bundle-ClassPath.
@param bundle the bundle from which the class path should be taken
@return list or urls to jars that composes the Bundle-ClassPath. | [
"Returns",
"a",
"list",
"of",
"urls",
"to",
"jars",
"that",
"composes",
"the",
"Bundle",
"-",
"ClassPath",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-api/src/main/java/org/ops4j/pax/web/utils/ClassPathUtil.java#L57-L84 | train |
ops4j/org.ops4j.pax.web | pax-web-api/src/main/java/org/ops4j/pax/web/utils/ClassPathUtil.java | ClassPathUtil.getBundlesInClassSpace | public static Set<Bundle> getBundlesInClassSpace(Bundle bundle,
Set<Bundle> bundleSet) {
return getBundlesInClassSpace(bundle.getBundleContext(), bundle,
bundleSet);
} | java | public static Set<Bundle> getBundlesInClassSpace(Bundle bundle,
Set<Bundle> bundleSet) {
return getBundlesInClassSpace(bundle.getBundleContext(), bundle,
bundleSet);
} | [
"public",
"static",
"Set",
"<",
"Bundle",
">",
"getBundlesInClassSpace",
"(",
"Bundle",
"bundle",
",",
"Set",
"<",
"Bundle",
">",
"bundleSet",
")",
"{",
"return",
"getBundlesInClassSpace",
"(",
"bundle",
".",
"getBundleContext",
"(",
")",
",",
"bundle",
",",
... | Gets a list of bundles that are imported or required by this bundle.
@param bundle the bundle for which to perform the lookup
@return list of imported and required bundles | [
"Gets",
"a",
"list",
"of",
"bundles",
"that",
"are",
"imported",
"or",
"required",
"by",
"this",
"bundle",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-api/src/main/java/org/ops4j/pax/web/utils/ClassPathUtil.java#L131-L135 | train |
ops4j/org.ops4j.pax.web | pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java | ServerModel.addServletModel | public void addServletModel(final ServletModel model) throws NamespaceException, ServletException {
servletLock.writeLock().lock();
try {
associateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
for (String virtualHost:resolveVirtualHosts(model)) {... | java | public void addServletModel(final ServletModel model) throws NamespaceException, ServletException {
servletLock.writeLock().lock();
try {
associateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
for (String virtualHost:resolveVirtualHosts(model)) {... | [
"public",
"void",
"addServletModel",
"(",
"final",
"ServletModel",
"model",
")",
"throws",
"NamespaceException",
",",
"ServletException",
"{",
"servletLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"associateBundle",
"(",
"model",
"... | Registers a servlet model.
@param model servlet model to register
@throws ServletException - If servlet is already registered
@throws NamespaceException - If servlet alias is already registered | [
"Registers",
"a",
"servlet",
"model",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java#L185-L220 | train |
ops4j/org.ops4j.pax.web | pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java | ServerModel.removeServletModel | public void removeServletModel(final ServletModel model) {
servletLock.writeLock().lock();
try {
deassociateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
for (String virtualHost:resolveVirtualHosts(model)) {
if (model.getAlias() ... | java | public void removeServletModel(final ServletModel model) {
servletLock.writeLock().lock();
try {
deassociateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
for (String virtualHost:resolveVirtualHosts(model)) {
if (model.getAlias() ... | [
"public",
"void",
"removeServletModel",
"(",
"final",
"ServletModel",
"model",
")",
"{",
"servletLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"deassociateBundle",
"(",
"model",
".",
"getContextModel",
"(",
")",
".",
"getVirtualH... | Unregisters a servlet model.
@param model servlet model to unregister | [
"Unregisters",
"a",
"servlet",
"model",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java#L227-L247 | train |
ops4j/org.ops4j.pax.web | pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java | ServerModel.addFilterModel | public void addFilterModel(final FilterModel model) {
if (model.getUrlPatterns() != null) {
try {
filterLock.writeLock().lock();
associateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
for (String virtualHost : resolveVirtualHosts(model)) {
for (Strin... | java | public void addFilterModel(final FilterModel model) {
if (model.getUrlPatterns() != null) {
try {
filterLock.writeLock().lock();
associateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
for (String virtualHost : resolveVirtualHosts(model)) {
for (Strin... | [
"public",
"void",
"addFilterModel",
"(",
"final",
"FilterModel",
"model",
")",
"{",
"if",
"(",
"model",
".",
"getUrlPatterns",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"filterLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"associat... | Registers a filter model.
@param model filter model to register | [
"Registers",
"a",
"filter",
"model",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java#L254-L288 | train |
ops4j/org.ops4j.pax.web | pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java | ServerModel.removeFilterModel | public void removeFilterModel(final FilterModel model) {
if (model.getUrlPatterns() != null) {
try {
deassociateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
filterLock.writeLock().lock();
for (String virtualHost:resolveVirtualHosts(model)) {
for (St... | java | public void removeFilterModel(final FilterModel model) {
if (model.getUrlPatterns() != null) {
try {
deassociateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
filterLock.writeLock().lock();
for (String virtualHost:resolveVirtualHosts(model)) {
for (St... | [
"public",
"void",
"removeFilterModel",
"(",
"final",
"FilterModel",
"model",
")",
"{",
"if",
"(",
"model",
".",
"getUrlPatterns",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"deassociateBundle",
"(",
"model",
".",
"getContextModel",
"(",
")",
".",
"getVi... | Unregister a filter model.
@param model filter model to unregister | [
"Unregister",
"a",
"filter",
"model",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java#L295-L321 | train |
ops4j/org.ops4j.pax.web | pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java | ServerModel.associateHttpContext | public void associateHttpContext(final WebContainerContext httpContext, final Bundle bundle,
final boolean allowReAsssociation) {
List<String> virtualHosts = resolveVirtualHosts(bundle);
for (String virtualHost : virtualHosts) {
ConcurrentMap<WebContainerContext, Bundle> virtualHostHttpContexts = h... | java | public void associateHttpContext(final WebContainerContext httpContext, final Bundle bundle,
final boolean allowReAsssociation) {
List<String> virtualHosts = resolveVirtualHosts(bundle);
for (String virtualHost : virtualHosts) {
ConcurrentMap<WebContainerContext, Bundle> virtualHostHttpContexts = h... | [
"public",
"void",
"associateHttpContext",
"(",
"final",
"WebContainerContext",
"httpContext",
",",
"final",
"Bundle",
"bundle",
",",
"final",
"boolean",
"allowReAsssociation",
")",
"{",
"List",
"<",
"String",
">",
"virtualHosts",
"=",
"resolveVirtualHosts",
"(",
"bu... | Associates a http context with a bundle if the http service is not
already associated to another bundle. This is done in order to prevent
sharing http context between bundles. The implementation is not 100%
correct as it can be that at a certain moment in time when this method is
called,another thread is processing a r... | [
"Associates",
"a",
"http",
"context",
"with",
"a",
"bundle",
"if",
"the",
"http",
"service",
"is",
"not",
"already",
"associated",
"to",
"another",
"bundle",
".",
"This",
"is",
"done",
"in",
"order",
"to",
"prevent",
"sharing",
"http",
"context",
"between",
... | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServerModel.java#L354-L369 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/tracker/AbstractTracker.java | AbstractTracker.create | protected final ServiceTracker<T, W> create(String filter) {
try {
return new ServiceTracker<>(bundleContext, bundleContext.createFilter(filter), this);
} catch (InvalidSyntaxException e) {
throw new IllegalArgumentException("Unexpected InvalidSyntaxException: " + e.getMessage());
}
} | java | protected final ServiceTracker<T, W> create(String filter) {
try {
return new ServiceTracker<>(bundleContext, bundleContext.createFilter(filter), this);
} catch (InvalidSyntaxException e) {
throw new IllegalArgumentException("Unexpected InvalidSyntaxException: " + e.getMessage());
}
} | [
"protected",
"final",
"ServiceTracker",
"<",
"T",
",",
"W",
">",
"create",
"(",
"String",
"filter",
")",
"{",
"try",
"{",
"return",
"new",
"ServiceTracker",
"<>",
"(",
"bundleContext",
",",
"bundleContext",
".",
"createFilter",
"(",
"filter",
")",
",",
"th... | Creates a new tracker that tracks services by generic filter
@param filter generic filter to use for tracker
@return a configured osgi service tracker | [
"Creates",
"a",
"new",
"tracker",
"that",
"tracks",
"services",
"by",
"generic",
"filter"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/tracker/AbstractTracker.java#L102-L108 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java | RegisterWebAppVisitorHS.visit | public void visit(final WebApp webApp) {
NullArgumentException.validateNotNull(webApp, "Web app");
bundleClassLoader = new BundleClassLoader(webApp.getBundle());
httpContext = new WebAppHttpContext(
httpService.createDefaultHttpContext(), webApp.getRootPath(),
webApp.getBundle(), webApp.getMimeMappin... | java | public void visit(final WebApp webApp) {
NullArgumentException.validateNotNull(webApp, "Web app");
bundleClassLoader = new BundleClassLoader(webApp.getBundle());
httpContext = new WebAppHttpContext(
httpService.createDefaultHttpContext(), webApp.getRootPath(),
webApp.getBundle(), webApp.getMimeMappin... | [
"public",
"void",
"visit",
"(",
"final",
"WebApp",
"webApp",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webApp",
",",
"\"Web app\"",
")",
";",
"bundleClassLoader",
"=",
"new",
"BundleClassLoader",
"(",
"webApp",
".",
"getBundle",
"(",
")",
... | Creates a default context that will be used for all following
registrations and registers a resource for root of war.
@throws NullArgumentException if web app is null
@see WebAppVisitor#visit(WebApp) | [
"Creates",
"a",
"default",
"context",
"that",
"will",
"be",
"used",
"for",
"all",
"following",
"registrations",
"and",
"registers",
"a",
"resource",
"for",
"root",
"of",
"war",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java#L86-L100 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java | RegisterWebAppVisitorHS.visit | public void visit(final WebAppServlet webAppServlet) {
NullArgumentException.validateNotNull(webAppServlet, "Web app servlet");
final String[] aliases = webAppServlet.getAliases();
if (aliases != null && aliases.length > 0) {
for (final String alias : aliases) {
try {
final Servlet servlet = new... | java | public void visit(final WebAppServlet webAppServlet) {
NullArgumentException.validateNotNull(webAppServlet, "Web app servlet");
final String[] aliases = webAppServlet.getAliases();
if (aliases != null && aliases.length > 0) {
for (final String alias : aliases) {
try {
final Servlet servlet = new... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppServlet",
"webAppServlet",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppServlet",
",",
"\"Web app servlet\"",
")",
";",
"final",
"String",
"[",
"]",
"aliases",
"=",
"webAppServlet",
".",
"ge... | Registers servlets with http context.
@throws NullArgumentException if servlet is null
@see WebAppVisitor#visit(WebAppServlet) | [
"Registers",
"servlets",
"with",
"http",
"context",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java#L108-L130 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java | RegisterWebAppVisitorHS.newInstance | public static <T> T newInstance(final Class<T> clazz,
final ClassLoader classLoader, final String className)
throws ClassNotFoundException, IllegalAccessException,
InstantiationException {
return loadClass(clazz, classLoader, className).newInstance();
} | java | public static <T> T newInstance(final Class<T> clazz,
final ClassLoader classLoader, final String className)
throws ClassNotFoundException, IllegalAccessException,
InstantiationException {
return loadClass(clazz, classLoader, className).newInstance();
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"String",
"className",
")",
"throws",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
... | Creates an instance of a class from class name.
@param clazz class of the required object
@param classLoader class loader to use to load the class
@param className class name for the object to create
@return created object
@throws NullArgumentException if any of the parameters is null
@throws ClassNotFoundExc... | [
"Creates",
"an",
"instance",
"of",
"a",
"class",
"from",
"class",
"name",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java#L201-L206 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java | RegisterWebAppVisitorHS.loadClass | @SuppressWarnings("unchecked")
public static <T> Class<? extends T> loadClass(final Class<T> clazz,
final ClassLoader classLoader, final String className)
throws ClassNotFoundException, IllegalAccessException {
NullArgumentException.validateNotNull(clazz, "Class");
NullArgumentException.vali... | java | @SuppressWarnings("unchecked")
public static <T> Class<? extends T> loadClass(final Class<T> clazz,
final ClassLoader classLoader, final String className)
throws ClassNotFoundException, IllegalAccessException {
NullArgumentException.validateNotNull(clazz, "Class");
NullArgumentException.vali... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Class",
"<",
"?",
"extends",
"T",
">",
"loadClass",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"String",
... | Load a class from class name.
@param clazz class of the required object
@param classLoader class loader to use to load the class
@param className class name for the class to load
@return class object
@throws NullArgumentException if any of the parameters is null
@throws ClassNotFoundException re-thrown
@throw... | [
"Load",
"a",
"class",
"from",
"class",
"name",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java#L219-L227 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.