code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private void createProxy(final Class<L> listenerInterface, final ClassLoader classLoader) {
proxy = listenerInterface.cast(Proxy.newProxyInstance(classLoader,
new Class[] { listenerInterface }, createInvocationHandler()));
} | java |
@GwtIncompatible("incompatible method")
public final String translate(final CharSequence input) {
if (input == null) {
return null;
}
try {
final StringWriter writer = new StringWriter(input.length() * 2);
translate(input, writer);
return write... | java |
@GwtIncompatible("incompatible method")
private static boolean memberEquals(final Class<?> type, final Object o1, final Object o2) {
if (o1 == o2) {
return true;
}
if (o1 == null || o2 == null) {
return false;
}
if (type.isArray()) {
return... | java |
@GwtIncompatible("incompatible method")
private static boolean arrayMemberEquals(final Class<?> componentType, final Object o1, final Object o2) {
if (componentType.isAnnotation()) {
return annotationArrayMemberEquals((Annotation[]) o1, (Annotation[]) o2);
}
if (componentType.equ... | java |
@GwtIncompatible("incompatible method")
private static boolean annotationArrayMemberEquals(final Annotation[] a1, final Annotation[] a2) {
if (a1.length != a2.length) {
return false;
}
for (int i = 0; i < a1.length; i++) {
if (!equals(a1[i], a2[i])) {
... | java |
private static int arrayMemberHash(final Class<?> componentType, final Object o) {
if (componentType.equals(Byte.TYPE)) {
return Arrays.hashCode((byte[]) o);
}
if (componentType.equals(Short.TYPE)) {
return Arrays.hashCode((short[]) o);
}
if (componentType... | java |
public static StrMatcher charSetMatcher(final char... chars) {
if (chars == null || chars.length == 0) {
return NONE_MATCHER;
}
if (chars.length == 1) {
return new CharMatcher(chars[0]);
}
return new CharSetMatcher(chars);
} | java |
public static StrMatcher charSetMatcher(final String chars) {
if (StringUtils.isEmpty(chars)) {
return NONE_MATCHER;
}
if (chars.length() == 1) {
return new CharMatcher(chars.charAt(0));
}
return new CharSetMatcher(chars.toCharArray());
} | java |
public static StrMatcher stringMatcher(final String str) {
if (StringUtils.isEmpty(str)) {
return NONE_MATCHER;
}
return new StringMatcher(str);
} | java |
public final void evaluate() {
final LemmatizerEvaluator evaluator = new LemmatizerEvaluator(this.lemmatizer);
try {
evaluator.evaluate(this.testSamples);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(evaluator.getWordAccuracy());
} | java |
private static String modify(final String str, final String[] set, final boolean expect) {
final CharSet chars = CharSet.getInstance(set);
final StringBuilder buffer = new StringBuilder(str.length());
final char[] chrs = str.toCharArray();
for (final char chr : chrs) {
if (ch... | java |
private static boolean deepEmpty(final String[] strings) {
if (strings != null) {
for (final String s : strings) {
if (StringUtils.isNotEmpty(s)) {
return false;
}
}
}
return true;
} | java |
private int readArgumentIndex(final String pattern, final ParsePosition pos) {
final int start = pos.getIndex();
seekNonWs(pattern, pos);
final StringBuilder result = new StringBuilder();
boolean error = false;
for (; !error && pos.getIndex() < pattern.length(); next(pos)) {
... | java |
private String parseFormatDescription(final String pattern, final ParsePosition pos) {
final int start = pos.getIndex();
seekNonWs(pattern, pos);
final int text = pos.getIndex();
int depth = 1;
for (; pos.getIndex() < pattern.length(); next(pos)) {
switch (pattern.cha... | java |
private boolean containsElements(final Collection<?> coll) {
if (coll == null || coll.isEmpty()) {
return false;
}
for (final Object name : coll) {
if (name != null) {
return true;
}
}
return false;
} | java |
public WnsNotificationResponse pushTile(String channelUri, WnsTile tile) throws WnsException {
return this.pushTile(channelUri, null, tile);
} | java |
public WnsNotificationResponse pushTile(String channelUri, WnsNotificationRequestOptional optional, WnsTile tile) throws WnsException {
return this.client.push(xmlResourceBuilder, channelUri, tile, this.retryPolicy, optional);
} | java |
public List<WnsNotificationResponse> pushTile(List<String> channelUris, WnsTile tile) throws WnsException {
return this.pushTile(channelUris, null, tile);
} | java |
public WnsNotificationResponse pushToast(String channelUri, WnsToast toast) throws WnsException {
return this.pushToast(channelUri, null, toast);
} | java |
public WnsNotificationResponse pushToast(String channelUri, WnsNotificationRequestOptional optional, WnsToast toast) throws WnsException {
return this.client.push(xmlResourceBuilder, channelUri, toast, this.retryPolicy, optional);
} | java |
public List<WnsNotificationResponse> pushToast(List<String> channelUris, WnsToast toast) throws WnsException {
return this.pushToast(channelUris, null, toast);
} | java |
public WnsNotificationResponse pushBadge(String channelUri, WnsNotificationRequestOptional optional, WnsBadge badge) throws WnsException {
return this.client.push(xmlResourceBuilder, channelUri, badge, this.retryPolicy, optional);
} | java |
public List<WnsNotificationResponse> pushBadge(List<String> channelUris, WnsBadge badge) throws WnsException {
return this.pushBadge(channelUris, null, badge);
} | java |
public WnsNotificationResponse pushRaw(String channelUri, WnsNotificationRequestOptional optional, WnsRaw raw) throws WnsException {
return this.client.push(rawResourceBuilder, channelUri, raw, this.retryPolicy, optional);
} | java |
public List<WnsNotificationResponse> pushRaw(List<String> channelUris, WnsRaw raw) throws WnsException {
return this.pushRaw(channelUris, null, raw);
} | java |
public void render(
File outputDirectory,
ApplicationTemplate applicationTemplate,
File applicationDirectory,
Renderer renderer,
Map<String,String> options,
Map<String,String> typeAnnotations )
throws IOException {
options = fixOptions( options );
buildRenderer( outputDirectory, applicationTempl... | java |
private IRenderer buildRenderer(
File outputDirectory,
ApplicationTemplate applicationTemplate,
File applicationDirectory,
Renderer renderer,
Map<String,String> typeAnnotations ) {
IRenderer result = null;
switch( renderer ) {
case HTML:
result = new HtmlRenderer( outputDirectory, applicationTe... | java |
public static void save( File f, Application app ) throws IOException {
Properties properties = new Properties();
if( ! Utils.isEmptyOrWhitespaces( app.getDisplayName()))
properties.setProperty( APPLICATION_NAME, app.getDisplayName());
if( ! Utils.isEmptyOrWhitespaces( app.getDescription()))
properties.se... | java |
public static void addResourceAfterAngularJS(String library, String resource) {
FacesContext ctx = FacesContext.getCurrentInstance();
UIViewRoot v = ctx.getViewRoot();
Map<String, Object> viewMap = v.getViewMap();
@SuppressWarnings("unchecked")
Map<String, String> resourceMap = (Map<String, String>) viewMap.g... | java |
public Collection<InstanceContextBean> apply( Collection<InstanceContextBean> instances ) {
final ArrayList<InstanceContextBean> result = new ArrayList<InstanceContextBean> ();
for( InstanceContextBean instance : instances ) {
boolean installerMatches = this.installerName == null || this.installerName.equalsIgn... | java |
protected String acquireIpAddress( TargetHandlerParameters parameters, String machineId ) {
// Load IP addresses on demand (that's the case if we are in this method).
// This implementation is compliant with a same IP address being used in
// several "target.properties" files.
String result = null;
String ip... | java |
private InstanceContext findAgentContext( Application application, Instance instance ) {
Instance scopedInstance = InstanceHelpers.findScopedInstance( instance );
return new InstanceContext( application, scopedInstance );
} | java |
public static <T extends Serializable> byte[] serializeObject( T object ) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( os );
out.writeObject( object );
return os.toByteArray();
} | java |
public static <T extends Serializable> T deserializeObject( byte[] bytes, Class<T> clazz )
throws IOException, ClassNotFoundException {
ByteArrayInputStream is = new ByteArrayInputStream( bytes );
ObjectInputStream deserializer = new ObjectInputStream( is );
return clazz.cast( deserializer.readObject());
} | java |
static void checkErrors( Collection<RoboconfError> errors, Logger logger )
throws InvalidApplicationException {
if( RoboconfErrorHelpers.containsCriticalErrors( errors ))
throw new InvalidApplicationException( errors );
// Null language => English (right language for logs)
Collection<RoboconfError> warnings... | java |
private ManagedApplication createNewApplication(
String name,
String description,
ApplicationTemplate tpl,
File configurationDirectory )
throws AlreadyExistingException, IOException {
this.logger.info( "Creating application " + name + " from template " + tpl + "..." );
if( Utils.isEmptyOrWhitespaces( ... | java |
private static String getFileExtension(final String filename) {
String extension = "";
int i = filename.lastIndexOf('.');
int p = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
if (i > p)
extension = filename.substring(i+1);
return extension;
} | java |
public static Graphs loadGraph( File graphFile, File graphDirectory, ApplicationLoadResult alr ) {
FromGraphDefinition fromDef = new FromGraphDefinition( graphDirectory );
Graphs graph = fromDef.buildGraphs( graphFile );
alr.getParsedFiles().addAll( fromDef.getProcessedImports());
if( ! fromDef.getErrors().is... | java |
public static InstancesLoadResult loadInstances( File instancesFile, File rootDirectory, Graphs graph, String applicationName ) {
InstancesLoadResult result = new InstancesLoadResult();
INST: {
if( ! instancesFile.exists()) {
RoboconfError error = new RoboconfError( ErrorCode.PROJ_MISSING_INSTANCE_EP );
... | java |
public static void writeInstances( File targetFile, Collection<Instance> rootInstances ) throws IOException {
FileDefinition def = new FromInstances().buildFileDefinition( rootInstances, targetFile, false, true );
ParsingModelIo.saveRelationsFile( def, false, "\n" );
} | java |
public static AbstractLifeCycleManager build( Instance instance, String appName, IAgentClient messagingClient ) {
AbstractLifeCycleManager result;
switch( instance.getStatus()) {
case DEPLOYED_STARTED:
result = new DeployedStarted( appName, messagingClient );
break;
case DEPLOYED_STOPPED:
result = ne... | java |
public void updateStateFromImports( Instance impactedInstance, PluginInterface plugin, Import importChanged, InstanceStatus statusChanged )
throws IOException, PluginException {
// Do we have all the imports we need?
boolean haveAllImports = ImportHelpers.hasAllRequiredImports( impactedInstance, this.logger );
... | java |
public static void copyInstanceResources( Instance instance, Map<String,byte[]> fileNameToFileContent )
throws IOException {
File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance );
Utils.createDirectory( dir );
if( fileNameToFileContent != null ) {
for( Map.Entry<String,byte[]> entry : fileName... | java |
public static void executeScriptResources( File scriptsDir ) throws IOException {
if( scriptsDir.isDirectory()) {
List<File> scriptFiles = Utils.listAllFiles( scriptsDir );
Logger logger = Logger.getLogger( AgentUtils.class.getName());
for( File script : scriptFiles) {
if( script.getName().contains( Co... | java |
public static void deleteInstanceResources( Instance instance ) throws IOException {
File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance );
Utils.deleteFilesRecursively( dir );
} | java |
public static Map<String,byte[]> collectLogs( String karafData ) throws IOException {
Map<String,byte[]> logFiles = new HashMap<>( 2 );
if( ! Utils.isEmptyOrWhitespaces( karafData )) {
String[] names = { "karaf.log", "roboconf.log" };
for( String name : names ) {
File log = new File( karafData, AgentCon... | java |
public static void injectConfigurations(
String karafEtc,
String applicationName,
String scopedInstancePath,
String domain,
String ipAddress ) {
File injectionDir = new File( karafEtc, INJECTED_CONFIGS_DIR );
if( injectionDir.isDirectory()) {
for( File source : Utils.listAllFiles( injectionDir, "... | java |
private void cleanupAfterView() {
FacesContext ctx = FacesContext.getCurrentInstance();
ResponseWriter orig = (ResponseWriter) ctx.getAttributes().get(ORIGINAL_WRITER);
assert(null != orig);
// move aside the PartialResponseWriter
ctx.setResponseWriter(orig);
} | java |
public static File findTemplateDirectory( ApplicationTemplate tpl, File configurationDirectory ) {
StringBuilder sb = new StringBuilder( TEMPLATES );
sb.append( "/" );
sb.append( tpl.getName());
if( ! Utils.isEmptyOrWhitespaces( tpl.getVersion())) {
sb.append( " - " );
sb.append( tpl.getVersion());
}
... | java |
public static void saveInstances( Application app ) {
File targetFile = new File( app.getDirectory(), Constants.PROJECT_DIR_INSTANCES + "/" + INSTANCES_FILE );
try {
Utils.createDirectory( targetFile.getParentFile());
RuntimeModelIo.writeInstances( targetFile, app.getRootInstances());
} catch( IOException... | java |
public static InstancesLoadResult restoreInstances( ManagedApplication ma ) {
File sourceFile = new File( ma.getDirectory(), Constants.PROJECT_DIR_INSTANCES + "/" + INSTANCES_FILE );
Graphs graphs = ma.getApplication().getTemplate().getGraphs();
InstancesLoadResult result;
if( sourceFile.exists())
result = ... | java |
public static File findIcon( String name, String qualifier, File configurationDirectory ) {
// Deal with an invalid directory
if( configurationDirectory == null )
return null;
// Find the root directory
File root;
if( ! Utils.isEmptyOrWhitespaces( qualifier )) {
ApplicationTemplate tpl = new Applicati... | java |
public static void loadApplicationBindings( Application app ) {
File descDir = new File( app.getDirectory(), Constants.PROJECT_DIR_DESC );
File appBindingsFile = new File( descDir, APP_BINDINGS_FILE );
Logger logger = Logger.getLogger( ConfigurationUtils.class.getName());
Properties props = Utils.readProperti... | java |
public static void saveApplicationBindings( Application app ) {
File descDir = new File( app.getDirectory(), Constants.PROJECT_DIR_DESC );
File appBindingsFile = new File( descDir, APP_BINDINGS_FILE );
// Convert the bindings map
Map<String,String> format = new HashMap<> ();
for( Map.Entry<String,Set<String... | java |
protected ParsingError error( ErrorCode errorCode, ErrorDetails... details ) {
return new ParsingError(
errorCode,
this.context.getCommandFile(),
this.line,
details );
} | java |
public static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ) {
List<String> result = new ArrayList<> ();
for( BlockProperty p : holder.findPropertiesBlockByName( propertyName )) {
result.addAll( Utils.splitNicely( p.getValue(), ParsingConstants.PROPERTY_SEPARATOR ));
}
re... | java |
public static Map<String,String> getData( AbstractBlockHolder holder ) {
BlockProperty p = holder.findPropertyBlockByName( ParsingConstants.PROPERTY_INSTANCE_DATA );
Map<String,String> result = new HashMap<> ();
String propertyValue = p == null ? null : p.getValue();
for( String s : Utils.splitNicely( propert... | java |
public synchronized void setHttpServerIp( final String serverIp ) {
this.httpServerIp = serverIp;
this.dmClient.setHttpServerIp( serverIp );
this.logger.finer( "Server IP set to " + this.httpServerIp );
} | java |
private void resetClients( boolean shutdown ) {
// Only agent clients need to be reconfigured.
// Make fresh snapshots of the CLIENTS, as we don't want to reconfigure them while holding the lock.
final List<HttpAgentClient> clients;
synchronized( this ) {
// Get the snapshot.
clients = new ArrayList<>( ... | java |
public void handlerAppears( IMonitoringHandler handler ) {
if( handler != null ) {
this.logger.info( "Monitoring handler '" + handler.getName() + "' is now available." );
this.handlers.add( handler );
listHandlers( this.handlers, this.logger );
}
} | java |
public void handlerDisappears( IMonitoringHandler handler ) {
// May happen if a target could not be instantiated
// (iPojo uses proxies). In this case, it results in a NPE here.
if( handler == null ) {
this.logger.info( "An invalid monitoring handler is removed." );
} else {
this.handlers.remove( handle... | java |
public static void listHandlers( List<IMonitoringHandler> handlers, Logger logger ) {
if( handlers.isEmpty()) {
logger.info( "No monitoring handler was found." );
} else {
StringBuilder sb = new StringBuilder( "Available monitoring handlers: " );
for( Iterator<IMonitoringHandler> it = handlers.iterator()... | java |
public String validate() {
String result = null;
if( this.messagingConfiguration == null || this.messagingConfiguration.isEmpty())
result = "The message configuration cannot be null or empty.";
else if( this.messagingConfiguration.get(MessagingConstants.MESSAGING_TYPE_PROPERTY) == null)
result = "The messa... | java |
public static AgentProperties readIaasProperties( String rawProperties, Logger logger ) throws IOException {
Properties props = Utils.readPropertiesQuietly( rawProperties, logger );
return readIaasProperties( props );
} | java |
public static AgentProperties readIaasProperties( Properties props ) throws IOException {
// Deal with files transferred through user data.
// Store files in the system's temporary directory.
// In Karaf, this will point to the "data/tmp" directory.
File msgResourcesDirectory = new File( System.getProperty( "j... | java |
private static String updatedField( Properties props, String fieldName ) {
String property = props.getProperty( fieldName );
if( property != null )
property = property.replace( "\\:", ":" );
return property;
} | java |
public static Message deserializeObject( byte[] bytes )
throws IOException, ClassNotFoundException {
ByteArrayInputStream is = new ByteArrayInputStream( bytes );
ObjectInputStream deserializer = new ObjectInputStream( is );
return (Message) deserializer.readObject();
} | java |
public static Map<String,String> buildHeaders( String reqCorsHeader, String requestUri ) {
Map<String,String> result = new LinkedHashMap<> ();
result.put( CORS_ALLOW_ORIGIN, requestUri );
result.put( CORS_ALLOW_METHODS, VALUE_ALLOWED_METHODS );
result.put( CORS_ALLOW_CREDENTIALS, VALUE_ALLOW_CREDENTIALS );
... | java |
public static Version parseVersion( String rawVersion ) {
Version result = null;
Matcher m = Pattern.compile( "^(\\d+)\\.(\\d+)(\\.\\d+)?([.-].+)?$" ).matcher( rawVersion );
if( m.find()) {
result = new Version(
Integer.parseInt( m.group( 1 )),
Integer.parseInt( m.group( 2 )),
m.group( 3 ) == n... | java |
public static boolean containsCriticalErrors( Collection<? extends RoboconfError> errors ) {
boolean result = false;
for( RoboconfError error : errors ) {
if(( result = error.getErrorCode().getLevel() == ErrorLevel.SEVERE ))
break;
}
return result;
} | java |
public static Collection<RoboconfError> findWarnings( Collection<? extends RoboconfError> errors ) {
Collection<RoboconfError> result = new ArrayList<> ();
for( RoboconfError error : errors ) {
if( error.getErrorCode().getLevel() == ErrorLevel.WARNING )
result.add( error );
}
return result;
} | java |
public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) {
// No error code to filter? => errorCodes is an empty array (not null)
List<ErrorCode> codesToSkip = new ArrayList<> ();
codesToSkip.addAll( Arrays.asList( errorCodes ));
Collection<RoboconfError> toRemove... | java |
private void renderApplication() throws IOException {
StringBuilder sb = new StringBuilder();
// First pages
sb.append( renderDocumentTitle());
sb.append( renderPageBreak());
sb.append( renderParagraph( this.messages.get( "intro" ))); //$NON-NLS-1$
sb.append( renderPageBreak());
sb.append( renderDocume... | java |
private void renderRecipe() throws IOException {
StringBuilder sb = new StringBuilder();
// First pages
if( ! Constants.GENERATED.equalsIgnoreCase( this.applicationTemplate.getName())) {
sb.append( renderDocumentTitle());
sb.append( renderPageBreak());
sb.append( renderParagraph( this.messages.get( "in... | java |
private StringBuilder renderFacets() throws IOException {
StringBuilder sb = new StringBuilder();
if( ! this.applicationTemplate.getGraphs().getFacetNameToFacet().isEmpty()) {
sb.append( renderTitle1( this.messages.get( "facets" ))); //$NON-NLS-1$
sb.append( renderParagraph( this.messages.get( "facets.intro... | java |
private Object renderApplicationDescription() throws IOException {
// No locale? => Display the application's description.
// Otherwise, read app.desc_fr_FR.txt or the required file for another locale.
// If it does not exist, return the empty string.
String s;
if( this.locale == null
&& ! Utils.isEmpty... | java |
private void saveImage( final Component comp, DiagramType type, AbstractRoboconfTransformer transformer, StringBuilder sb )
throws IOException {
String baseName = comp.getName() + "_" + type; //$NON-NLS-1$
String relativePath = "png/" + baseName + ".png"; //$NON-NLS-1$ //$NON-NLS-2$
if( this.options.containsKey... | java |
private String readCustomInformation( File applicationDirectory, String prefix, String suffix )
throws IOException {
// Prepare the file name
StringBuilder sb = new StringBuilder();
sb.append( prefix );
if( this.locale != null )
sb.append( "_" + this.locale );
sb.append( suffix );
sb.insert( 0, "/" );... | java |
private List<String> convertImports( Collection<ImportedVariable> importedVariables ) {
List<String> result = new ArrayList<> ();
for( ImportedVariable var : importedVariables ) {
String componentOrFacet = VariableHelpers.parseVariableName( var.getName()).getKey();
String s = applyLink( var.getName(), compon... | java |
private List<String> convertExports( Map<String,String> exports ) {
List<String> result = new ArrayList<> ();
for( Map.Entry<String,String> entry : exports.entrySet()) {
String componentOrFacet = VariableHelpers.parseVariableName( entry.getKey()).getKey();
String s = Utils.isEmptyOrWhitespaces( componentOrFa... | java |
private List<String> getImportComponents( Component component ) {
List<String> result = new ArrayList<> ();
Map<String,Boolean> map = ComponentHelpers.findComponentDependenciesFor( component );
for( Map.Entry<String,Boolean> entry : map.entrySet()) {
String s = applyLink( entry.getKey(), entry.getKey());
s... | java |
private String renderListAsLinks( List<String> names ) {
List<String> newNames = new ArrayList<> ();
for( String s : names )
newNames.add( applyLink( s, s ));
return renderList( newNames );
} | java |
public void uploadZippedApplicationTemplate( File applicationFile ) throws ManagementWsException, IOException {
if( applicationFile == null
|| ! applicationFile.exists()
|| ! applicationFile.isFile())
throw new IOException( "Expected an existing file as parameter." );
this.logger.finer( "Loading an app... | java |
public void loadUnzippedApplicationTemplate( String localFilePath ) throws ManagementWsException {
this.logger.finer( "Loading an application from a local directory: " + localFilePath );
WebResource path = this.resource.path( UrlConstants.APPLICATIONS ).path( "templates" ).path( "local" );
if( localFilePath != n... | java |
public Application createApplication( String applicationName, String templateName, String templateQualifier )
throws ManagementWsException {
this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." );
ApplicationTemplate tpl = new ApplicationTempla... | java |
public List<Application> listApplications( String exactName ) throws ManagementWsException {
if( exactName != null )
this.logger.finer( "List/finding the application named " + exactName + "." );
else
this.logger.finer( "Listing all the applications." );
WebResource path = this.resource.path( UrlConstants.... | java |
public void shutdownApplication( String applicationName ) throws ManagementWsException {
this.logger.finer( "Removing application " + applicationName + "..." );
WebResource path = this.resource
.path( UrlConstants.APPLICATIONS )
.path( applicationName )
.path( "shutdown" );
ClientResponse respons... | java |
public static String fileTypeAsString( int fileType ) {
String result;
switch( fileType ) {
case AGGREGATOR:
result = "aggregator";
break;
case GRAPH:
result = "graph";
break;
case INSTANCE:
result = "intsnace";
break;
case UNDETERMINED:
result = "undetermined";
break;
default... | java |
public static RbcfInfo findInstances(
Manager manager,
String applicationName,
String scopedInstancePath,
PrintStream out ) {
ManagedApplication ma = null;
List<Instance> scopedInstances = new ArrayList<> ();
Instance scopedInstance;
if(( ma = manager.applicationMngr().findManagedApplicationByName... | java |
static NovaApi novaApi( Map<String,String> targetProperties ) throws TargetException {
validate( targetProperties );
return ContextBuilder
.newBuilder( PROVIDER_NOVA )
.endpoint( targetProperties.get( API_URL ))
.credentials( identity( targetProperties ), targetProperties.get( PASSWORD ))
.buildApi... | java |
static SwiftApi swiftApi( Map<String,String> targetProperties ) throws TargetException {
validate( targetProperties );
return ContextBuilder
.newBuilder( PROVIDER_SWIFT )
.endpoint( targetProperties.get( API_URL ))
.credentials( identity( targetProperties ), targetProperties.get( PASSWORD ))
.build... | java |
static void validate( Map<String,String> targetProperties ) throws TargetException {
checkProperty( API_URL, targetProperties );
checkProperty( IMAGE_NAME, targetProperties );
checkProperty( TENANT_NAME, targetProperties );
checkProperty( FLAVOR_NAME, targetProperties );
checkProperty( SECURITY_GROUP, target... | java |
static void validateAll( Map<String,String> targetProperties, String appName, String instanceName )
throws TargetException {
// Basic checks
validate( targetProperties );
// Storage checks
Set<String> mountPoints = new HashSet<> ();
Set<String> volumeNames = new HashSet<> ();
for( String s : findStorageI... | java |
static String findStorageProperty( Map<String,String> targetProperties, String storageId, String propertyPrefix ) {
String property = propertyPrefix + storageId;
String value = targetProperties.get( property );
return Utils.isEmptyOrWhitespaces( value ) ? DEFAULTS.get( propertyPrefix ) : value.trim();
} | java |
static String expandVolumeName( String nameTemplate, String appName, String instanceName ) {
String name = nameTemplate.replace( TPL_VOLUME_NAME, instanceName );
name = name.replace( TPL_VOLUME_APP, appName );
name = name.replaceAll( "[\\W_-]", "-" );
return name;
} | java |
public BlockProperty findPropertyBlockByName( String propertyName ) {
BlockProperty result = null;
for( AbstractBlock region : this.innerBlocks ) {
if( region.getInstructionType() == PROPERTY
&& propertyName.equals(((BlockProperty) region).getName())) {
result = (BlockProperty) region;
break;
}... | java |
public List<BlockProperty> findPropertiesBlockByName( String propertyName ) {
List<BlockProperty> result = new ArrayList<> ();
for( AbstractBlock region : this.innerBlocks ) {
if( region.getInstructionType() == PROPERTY
&& propertyName.equals(((BlockProperty) region).getName())) {
result.add((BlockPro... | java |
public static Map.Entry<String,String> decodeIconUrl( String path ) {
if( path.startsWith( "/" ))
path = path.substring( 1 );
String name = null, version = null;
String[] parts = path.split( "/" );
switch( parts.length ) {
case 2:
name = parts[ 0 ];
break;
case 3:
name = parts[ 0 ];
versio... | java |
public static String findIconUrl( AbstractApplication app ) {
StringBuilder sb = new StringBuilder();
File iconFile = findIcon( app );
if( iconFile != null ) {
sb.append( "/" );
sb.append( app.getName());
if( app instanceof ApplicationTemplate ) {
sb.append( "/" );
sb.append(((ApplicationTempla... | java |
public static String writeConfigurationFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator ) {
return new FileDefinitionSerializer( lineSeparator ).write( relationsFile, writeComments );
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.