code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Transactional(readOnly=true)
public List<Permission> loadRolesAndPermissions() throws Exception {
return _persistence.getResults(_qRoleAuthorizations, null);
} | java |
public static AbstractConfiguration[] execute(String applicationNamespace, ClassLoader loader, Logger log) throws Exception {
String packageName= "de.jiac.micro.internal.latebind";
MicroJIACToolContext context= new MicroJIACToolContext(loader);
ConfigurationGenerator generator= new Configuratio... | java |
public static void generate(ConfigurationImpl configuration, String profileName) {
ProfilePackageIndexFrameWriter profpackgen;
DocPath filename = DocPaths.profileFrame(profileName);
try {
profpackgen = new ProfilePackageIndexFrameWriter(configuration, filename);
profpackg... | java |
static String getTypeString(DocEnv env, Type t, boolean full) {
// TODO: should annotations be included here?
if (t.isAnnotated()) {
t = t.unannotatedType();
}
switch (t.getTag()) {
case ARRAY:
StringBuilder s = new StringBuilder();
while (t.ha... | java |
public static String getWebProjectPath(Object currentObject) {
Class<? extends Object> class1 = currentObject.getClass();
ClassLoader classLoader = class1.getClassLoader();
URL resource = classLoader.getResource("/");
String path = resource.getPath();
int webRootIndex = StringUt... | java |
public void flattenPackagesSourcesAndArtifacts(Map<String,Module> m) {
modules = m;
// Extract all the found packages.
for (Module i : modules.values()) {
for (Map.Entry<String,Package> j : i.packages().entrySet()) {
Package p = packages.get(j.getKey());
... | java |
public void checkInternalState(String msg, boolean linkedOnly, Map<String,Source> srcs) {
boolean baad = false;
Map<String,Source> original = new HashMap<String,Source>();
Map<String,Source> calculated = new HashMap<String,Source>();
for (String s : sources.keySet()) {
Sourc... | java |
public RepositoryAdmin getRepositoryAdmin(BundleContext context, ObrClassFinderService autoStartNotify) throws InvalidSyntaxException
{
RepositoryAdmin admin = null;
ServiceReference[] ref = context.getServiceReferences(RepositoryAdmin.class.getName(), null);
if ((ref != null) && (ref.le... | java |
public void addBootstrapRepository(RepositoryAdmin repositoryAdmin, BundleContext context)
{
if (repositoryAdmin == null)
return;
String repository = context.getProperty("jbundle.repository.url");
if (repository != null)
if (repository.length() > 0)
this.addRep... | java |
public void addRepository(RepositoryAdmin repositoryAdmin, String repository)
{
try {
if (repository != null)
{
boolean duplicate = false;
for (Repository repo : repositoryAdmin.listRepositories())
{
if (repository.e... | java |
public boolean startClassFinderActivator(BundleContext context)
{
if (ClassFinderActivator.getClassFinder(context, 0) == this)
return true; // Already up!
// If the repository is not up, but the bundle is deployed, this will find it
String packageName = ClassFinderActivator.getPackageName... | java |
public Object deployThisResource(String packageName, String versionRange, boolean start)
{
int options = 0;
//?if (start)
//? options = Resolver.START;
if (repositoryAdmin == null)
return null;
DataModelHelper helper = repositoryAdmin.getHelper();
if (this.getResourceFromCa... | java |
public void deployResources(Resource[] resources, int options)
{
if (resources != null)
{
for (Resource resource : resources)
{
this.deployResource(resource, options);
}
}
} | java |
public void deployResource(Resource resource, int options)
{
String name = resource.getSymbolicName() + "/" + resource.getVersion();
Lock lock = this.getLock(name);
try {
boolean acquired = lock.tryLock();
if (acquired) { // Good, deploy this resource
try {
R... | java |
public boolean isResourceBundleMatch(Object objResource, Bundle bundle)
{
Resource resource = (Resource)objResource;
return ((bundle.getSymbolicName().equals(resource.getSymbolicName())) && (isValidVersion(bundle.getVersion(), resource.getVersion().toString())));
} | java |
@SuppressWarnings("unchecked")
public List<RpcResponse> request(List<RpcRequest> reqList) {
List<RpcResponse> respList = new ArrayList<RpcResponse>();
List<Map> marshaledReqs = new ArrayList<Map>();
Map<String,RpcRequest> byReqId = new HashMap<String,RpcRequest>();
for (RpcRequest r... | java |
public URLConnection createURLConnection(URL url) throws IOException {
URLConnection conn = url.openConnection();
return conn;
} | java |
public Content getSignature(MethodDoc method) {
Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(method, pre);
addModifiers(method, pre);
addTypeParameters(method, pre);
addReturnType(method, pre);
if (configuration.linksource) {
Content metho... | java |
public String generateTemporaryToken(String key, int secondsToLive, Object context) {
checkNotNull(key);
String token = tokenGenerator.generate();
tokenCache.put(key, Triplet.of(token, DateTime.now().plusSeconds(secondsToLive).getMillis(), context));
return token;
} | java |
public Optional<Object> getContextForToken(String key, String token) {
Object context = validateTokenAndGetContext(key, token).second();
return null != context ? Optional.of(context) : Optional.absent();
} | java |
public Object put(Object key, Object value)
{
long objectStamp = System.currentTimeMillis();
synchronized (objects)
{
objectTimeStamps.put(key, objectStamp);
if (nextTimeSomeExpired == NO_OBJECTS)
{
nextTimeSomeExpired = objectStamp;
... | java |
public Object remove(Object key)
{
synchronized (objects)
{
Object remove = objects.remove(key);
objectTimeStamps.remove(key);
if (remove != null)
{
findNextExpireTime();
}
return remove;
}
} | java |
private void findNextExpireTime()
{
if (objects.size() == 0)
{
nextTimeSomeExpired = NO_OBJECTS;
}
else
{
nextTimeSomeExpired = NO_OBJECTS;
Collection<Long> longs = null;
synchronized (objects)
{
long... | java |
@SuppressWarnings("unchecked")
public static <M extends Enum<M>> void attach(Service service, String milestore, ServiceMilestone.Evaluation evaluation) throws Exception {
for (Field field: Beans.getKnownInstanceFields(service.getClass())) {
if (ServiceMilestone.class.isAssignableFrom(field.getTy... | java |
public void attach(M m, Evaluation eval) {
_evaluations[m.ordinal()] = _evaluations[m.ordinal()] == null ? eval : new CompoundMilestoneEvaluation(eval, _evaluations[m.ordinal()]);
} | java |
public void detach(M m, Evaluation eval) {
_evaluations[m.ordinal()] = CompoundMilestoneEvaluation.cleanse(_evaluations[m.ordinal()], eval);
} | java |
@SuppressWarnings("unchecked")
public Recommendation evaluate(M milestone, DataBinder binder, Reifier dict, Persistence persist) {
Evaluation evaluation = _evaluations[milestone.ordinal()];
return evaluation != null ? evaluation.evaluate((Class<M>)milestone.getClass(), milestone.toString(), binder, ... | java |
@Programmatic
public DocumentType findByReference(
final String reference) {
return queryResultsCache.execute(
() -> repositoryService.firstMatch(
new QueryDefault<>(DocumentType.class,
"findByReference",
... | java |
public Name xClassName(Type t) {
if (t.hasTag(CLASS)) {
return names.fromUtf(externalize(t.tsym.flatName()));
} else if (t.hasTag(ARRAY)) {
return typeSig(types.erasure(t));
} else {
throw new AssertionError("xClassName");
}
} | java |
Name fieldName(Symbol sym) {
if (scramble && (sym.flags() & PRIVATE) != 0 ||
scrambleAll && (sym.flags() & (PROTECTED | PUBLIC)) == 0)
return names.fromString("_$" + sym.name.getIndex());
else
return sym.name;
} | java |
void writeMethod(MethodSymbol m) {
int flags = adjustFlags(m.flags());
databuf.appendChar(flags);
if (dumpMethodModifiers) {
PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
pw.println("METHOD " + fieldName(m));
pw.println("---" + flagNames(m.flags()));
... | java |
public static Set<String> getPrimaryKey(DatabaseMetaData metadata, String tableName) throws Exception {
Set<String> columns = new HashSet<String>();
ResultSet keys = metadata.getPrimaryKeys(metadata.getConnection().getCatalog(), metadata.getUserName(), tableName);
while (keys.next()) {
... | java |
public static Map<String, ForeignKey> getExportedKeys(DatabaseMetaData metadata, String tableName) throws Exception {
ResultSet keys = metadata.getExportedKeys(metadata.getConnection().getCatalog(), metadata.getUserName(), tableName);
Map<String, ForeignKey> map = new HashMap<String, ForeignKey>();
... | java |
public static Map<String, ForeignKey> getForeignKeys(DatabaseMetaData metadata, String tableName) throws Exception {
ResultSet keys = metadata.getImportedKeys(metadata.getConnection().getCatalog(), metadata.getUserName(), tableName);
Map<String, ForeignKey> map = new HashMap<String, ForeignKey>();
... | java |
public static List<Column> getColumns(DatabaseMetaData metadata, String tableName) throws Exception {
List<Column> columns = new ArrayList<Column>();
PreparedStatement stmt = metadata.getConnection().prepareStatement("SELECT * FROM " + tableName);
ResultSetMetaData rsmeta = stmt.getMetaData();
... | java |
public static Table getTable(DatabaseMetaData metadata, String tableName) throws Exception {
return new Table(
tableName,
getPrimaryKey(metadata, tableName),
getForeignKeys(metadata, tableName),
getExportedKeys(metadata, tableName),
getColumns(metadata... | java |
public static String getClassName(ResultSetMetaData meta, int index) throws SQLException {
switch (meta.getColumnType(index)) {
case Types.NUMERIC:
int precision = meta.getPrecision(index);
if (meta.getScale(index) == 0) {
if (precision > 18) {
... | java |
public void add(Collection<Monitor> monitors)
{
for(Monitor monitor : monitors)
this.monitors.put(monitor.getId(), monitor);
} | java |
public LabelCache labels(String monitorId)
{
LabelCache cache = labels.get(monitorId);
if(cache == null)
labels.put(monitorId, cache = new LabelCache(monitorId));
return cache;
} | java |
public TabbedPanel put(Widget widget, String name, int index) {
if (index < 0 || index >= content.length) throw new IndexOutOfBoundsException();
if (widget == null) return this;
attach(widget);
content[index] = new Tab(widget, name);
this.sendElement();
return this;
} | java |
@Nonnull
public final EChange setAddress (@Nonnull final String sAddress)
{
ValueEnforcer.notNull (sAddress, "Address");
final String sRealAddress = EmailAddressHelper.getUnifiedEmailAddress (sAddress);
if (EqualsHelper.equals (sRealAddress, m_sAddress))
return EChange.UNCHANGED;
// Check on... | java |
public static void preRegister(Context context) {
context.put(JavaFileManager.class, new Context.Factory<JavaFileManager>() {
public JavaFileManager make(Context c) {
return new JavacFileManager(c, true, null);
}
});
} | java |
private void listDirectory(File directory,
RelativeDirectory subdirectory,
Set<JavaFileObject.Kind> fileKinds,
boolean recurse,
ListBuffer<JavaFileObject> resultList) {
File d = subdirecto... | java |
private void listArchive(Archive archive,
RelativeDirectory subdirectory,
Set<JavaFileObject.Kind> fileKinds,
boolean recurse,
ListBuffer<JavaFileObject> resultList) {
// Get the files dir... | java |
private void listContainer(File container,
RelativeDirectory subdirectory,
Set<JavaFileObject.Kind> fileKinds,
boolean recurse,
ListBuffer<JavaFileObject> resultList) {
Archive archive = a... | java |
private Archive openArchive(File zipFileName, boolean useOptimizedZip) throws IOException {
File origZipFileName = zipFileName;
if (symbolFileEnabled && locations.isDefaultBootClassPathRtJar(zipFileName)) {
File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
... | java |
public void add(Collection<KeyTransaction> keyTransactions)
{
for(KeyTransaction keyTransaction : keyTransactions)
this.keyTransactions.put(keyTransaction.getId(), keyTransaction);
} | java |
@Nullable
public static VATINStructure getFromValidVATIN (@Nullable final String sVATIN)
{
if (StringHelper.getLength (sVATIN) > 2)
for (final VATINStructure aStructure : s_aList)
if (aStructure.isValid (sVATIN))
return aStructure;
return null;
} | java |
@Nullable
public static VATINStructure getFromVATINCountry (@Nullable final String sVATIN)
{
if (StringHelper.getLength (sVATIN) >= 2)
{
final String sCountry = sVATIN.substring (0, 2);
for (final VATINStructure aStructure : s_aList)
if (aStructure.getExamples ().get (0).substring (0, 2)... | java |
protected Iterable<JavaFileObject> wrap(Iterable<JavaFileObject> fileObjects) {
List<JavaFileObject> mapped = new ArrayList<JavaFileObject>();
for (JavaFileObject fileObject : fileObjects)
mapped.add(wrap(fileObject));
return Collections.unmodifiableList(mapped);
} | java |
public static Control createInstance(ControlVersion version)
{
switch (version)
{
case _0_24:
return new Control0_24();
case _0_25:
return new Control0_25();
default:
throw new IllegalArgumentException("Unknown con... | java |
protected final void attach(Attachable widget) {
if (user != null) {
widget.addTo(user);
} else {
if (waitingForUser == null) waitingForUser = new LinkedList<Attachable>();
waitingForUser.add(widget);
}
} | java |
public org.jbundle.util.osgi.ClassFinder getClassFinder(Object context)
{
if (!classServiceAvailable)
return null;
try {
if (classFinder == null)
{
Class.forName("org.osgi.framework.BundleActivator"); // This tests to see if osgi exists
... | java |
public final ResourceBundle getResourceBundle(String className, Locale locale, String version, ClassLoader classLoader) throws MissingResourceException
{
MissingResourceException ex = null;
ResourceBundle resourceBundle = null;
try {
resourceBundle = ResourceBundle.getBundle(clas... | java |
public static String getFullClassName(String packageName, String className) {
return ClassServiceUtility.getFullClassName(null, packageName, className);
} | java |
public String find(String name) {
String value = null;
for (DataBinder top = this; top != null && (value = top.get(name)) == null; top = top.getLower());
return value;
} | java |
public String put(String name, String value, String alternative) {
return put(name, value != null ? value : alternative);
} | java |
public CachedResultSet putResultSet(String name, CachedResultSet rs) {
return _rsets.put(name, rs);
} | java |
@SuppressWarnings("unchecked")
public <T, V> T putNamedObject(String name, V object) {
return (T)_named.put(name, object);
} | java |
@SuppressWarnings("unchecked")
public <T> T getNamedObject(String name) {
return (T)_named.get(name);
} | java |
public <T> T getNamedObject(String name, Class<T> type) {
return type.cast(_named.get(name));
} | java |
public <K, V> Map<K, V> map(String name, Class<K> ktype, Class<V> vtype) {
Map<K, V> map = getNamedObject(name);
if (map == null) putNamedObject(name, map = new HashMap<K, V>());
return map;
} | java |
public <K, V> Multimap<K, V> mul(String name, Class<K> ktype, Class<V> vtype) {
Multimap<K, V> map = getNamedObject(name);
if (map == null) putNamedObject(name, map = new Multimap<K, V>());
return map;
} | java |
@Override
public DataBinder process(ResultSet rset) throws Exception {
try {
if (rset.next()) {
ResultSetMetaData meta = rset.getMetaData();
int width = meta.getColumnCount();
for (int i = 1; i <= width; ++i) {
Object value = rs... | java |
public DataBinder put(Object object) throws Exception {
for (Field field: Beans.getKnownInstanceFields(object.getClass())) {
Object value = field.get(object);
if (value != null) {
put(field.getName(), value.toString());
}
}
return this;
} | java |
public <T extends DataObject> DataBinder put(T object, String... names) throws Exception {
Class<?> type = object.getClass();
Object value;
for (String name: names) {
Field field = Beans.getKnownField(type, name);
if (!Modifier.isStatic(field.getModifiers()) && !Modifier.... | java |
public DataBinder load(String[] args, int offset) {
for (int i = offset; i < args.length; ++i) {
int equal = args[i].indexOf('=');
if (equal > 0) {
put(args[i].substring(0, equal), args[i].substring(equal + 1));
} else {
throw new RuntimeExcept... | java |
public DataBinder load(String filename) throws IOException {
Properties props = new Properties();
Reader reader = new FileReader(filename);
props.load(reader);
reader.close();
return load(props);
} | java |
public DataBinder load(Properties props) {
Enumeration<?> enumeration = props.propertyNames();
while (enumeration.hasMoreElements()) {
String key = (String)enumeration.nextElement();
put(key, props.getProperty(key));
}
return this;
} | java |
public int estimateMaximumBytes() {
int count = this.size();
for (String key: _rsets.keySet()) {
CachedResultSet crs = _rsets.get(key);
if (crs.rows != null) {
count += crs.columns.length*crs.rows.size();
}
}
return count * 64;
} | java |
public String toJSON() {
JSONBuilder jb = new JSONBuilder(estimateMaximumBytes()).append('{');
appendParams(jb).append(',');
appendTables(jb);
jb.append('}');
return jb.toString();
} | java |
private static long getDateForHour(long dt, TimeZone tz, int hour, int dayoffset)
{
Calendar c = getCalendar(tz);
c.setTimeInMillis(dt);
int dd = c.get(Calendar.DAY_OF_MONTH);
int mm = c.get(Calendar.MONTH);
int yy = c.get(Calendar.YEAR);
c.set(yy, mm, dd, hour, 0, 0)... | java |
public static Calendar getCalendar(TimeZone tz, Locale locale)
{
if(tz == null)
tz = getCurrentTimeZone();
if(locale == null)
locale = getCurrentLocale();
return Calendar.getInstance(tz, locale);
} | java |
public static Locale getLocale(String country)
{
if(country == null || country.length() == 0)
country = Locale.getDefault().getCountry();
List<Locale> locales = LocaleUtils.languagesByCountry(country);
Locale locale = Locale.getDefault();
if(locales.size() > 0)
... | java |
public static void setCalendarData(Calendar calendar, Locale locale)
{
int[] array = (int[])localeData.get(locale);
if(array == null)
{
Calendar c = Calendar.getInstance(locale);
array = new int[2];
array[0] = c.getFirstDayOfWeek();
array[1] = ... | java |
public static Date addDays(long dt, int days)
{
Calendar c = getCalendar();
if(dt > 0L)
c.setTimeInMillis(dt);
c.add(Calendar.DATE, days);
return c.getTime();
} | java |
public static long convertToUtc(long millis, String tz)
{
long ret = millis;
if(tz != null && tz.length() > 0)
{
DateTime dt = new DateTime(millis, DateTimeZone.forID(tz));
ret = dt.withZoneRetainFields(DateTimeZone.forID("UTC")).getMillis();
}
return ... | java |
public static int useServer(String settings, String[] args,
Set<URI> sourcesToCompile,
Set<URI> visibleSources,
Map<URI, Set<String>> visibleClasses,
Map<String, Set<URI>> packageArtifacts,
Map<String, Set<String>> packageDependencies,
Map<String, ... | java |
private static String fork(String sjavac, String portfile, String logfile, int poolsize, int keepalive,
final PrintStream err, String stdouterrfile, String background)
throws IOException, ProblemException {
if (stdouterrfile != null && stdouterrfile.trim().equals("")) {
stdou... | java |
public static SysInfo connectGetSysInfo(String serverSettings, PrintStream out, PrintStream err) {
SysInfo sysinfo = new SysInfo(-1, -1);
String id = Util.extractStringOption("id", serverSettings);
String portfile = Util.extractStringOption("portfile", serverSettings);
try {
... | java |
private void run(PortFile portFile, PrintStream err, int keepalive) {
boolean fileDeleted = false;
long timeSinceLastCompile;
try {
// Every 5 second (check_portfile_interval) we test if the portfile has disappeared => quit
// Or if the last request was finished more than... | java |
public <T extends Object> void writeValue(T value) throws IOException {
writeValue(value, (Class<T>) value.getClass());
} | java |
private void deserializeFromStream(final InputStream in) throws IOException
{
final byte[] dateTimeBytes = new byte[8];
in.read(dateTimeBytes, 0, 8);
eventDateTime = new DateTime(ByteBuffer.wrap(dateTimeBytes).getLong(0));
final byte[] sizeGranularityInBytes = new byte[4];
i... | java |
public void add(Collection<ApplicationInstance> applicationInstances)
{
for(ApplicationInstance applicationInstance : applicationInstances)
this.applicationInstances.put(applicationInstance.getId(), applicationInstance);
} | java |
public Object get()
{
synchronized(this)
{
if (freePool.isEmpty() || usedPool.size() >= capacity)
{
try
{
wait(1000);
}
catch (InterruptedException e)
{
}
... | java |
public SimpleDateFormat getFormat(String format)
{
SimpleDateFormat f = (SimpleDateFormat)get();
f.applyPattern(format);
return f;
} | java |
public void release(Object o)
{
synchronized(this)
{
usedPool.remove(o);
freePool.add(o);
notify();
}
} | java |
public void execute() throws MojoExecutionException {
ClassLoader classloader;
try {
classloader= createClassLoader();
} catch (Exception e) {
throw new MojoExecutionException("could not create classloader from dependencies", e);
}
Abstra... | java |
public String toShortString(StringBuilder sb) {
sb.setLength(0);
sb.append('[');
sb.append(left);
sb.append(',');
sb.append(top);
sb.append("][");
sb.append(right);
sb.append(',');
sb.append(bottom);
sb.append(']');
return sb.toStri... | java |
public String flattenToString() {
StringBuilder sb = new StringBuilder(32);
// WARNING: Do not change the format of this string, it must be
// preserved because Rects are saved in this flattened format.
sb.append(left);
sb.append(' ');
sb.append(top);
sb.append(' ... | java |
public void set(Rect src) {
this.left = src.left;
this.top = src.top;
this.right = src.right;
this.bottom = src.bottom;
} | java |
public void offset(int dx, int dy) {
left += dx;
top += dy;
right += dx;
bottom += dy;
} | java |
public boolean contains(int left, int top, int right, int bottom) {
// check for empty first
return this.left < this.right && this.top < this.bottom
// now check for containment
&& this.left <= left && this.top <= top
&& this.right >= right && this.bottom ... | java |
public boolean contains(Rect r) {
// check for empty first
return this.left < this.right && this.top < this.bottom
// now check for containment
&& left <= r.left && top <= r.top && right >= r.right && bottom >= r.bottom;
} | java |
public void union(Rect r) {
union(r.left, r.top, r.right, r.bottom);
} | java |
public void scale(float scale) {
if (scale != 1.0f) {
left = (int) (left * scale + 0.5f);
top = (int) (top * scale + 0.5f);
right = (int) (right * scale + 0.5f);
bottom = (int) (bottom * scale + 0.5f);
}
} | java |
public void add(Collection<Plugin> plugins)
{
for(Plugin plugin : plugins)
this.plugins.put(plugin.getId(), plugin);
} | java |
public PluginComponentCache components(long pluginId)
{
PluginComponentCache cache = components.get(pluginId);
if(cache == null)
components.put(pluginId, cache = new PluginComponentCache(pluginId));
return cache;
} | java |
public TypeConverter getTypeConverter() throws RpcException {
if (contract == null) {
throw new IllegalStateException("contract cannot be null");
}
if (type == null) {
throw new IllegalStateException("field type cannot be null");
}
TypeConverter tc = null... | java |
public String getJavaType(boolean wrapArray) {
String t = "";
if (type.equals("string")) {
t = "String";
}
else if (type.equals("float")) {
t = "Double";
}
else if (type.equals("int")) {
t = "Long";
}
else if (type.equal... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.