/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/**
* The RuntimeEnvironment class is used as a placeholder for the current
* configuration this execution context (classloader) is using.
*/
public final class RuntimeEnvironment {
/**
* Get the one and only instance of the RuntimeEnvironment
* @return the one and only instance of the RuntimeEnvironment
*/
return instance;
}
/**
* Creates a new instance of RuntimeEnvironment. Private to ensure a
* singleton pattern.
*/
private RuntimeEnvironment() {
config = new Configuration();
@SuppressWarnings("synthetic-access")
return config;
}
};
}
/**
* Makes testing easier by being able to drop the current env and replace it
* with a virgin one.
*/
instance = new RuntimeEnvironment();
return instance;
}
/**
* Check, whether the running JVM is older than version 1.7 .
* @return {@code true} if older than 1.7
*/
public static final boolean isOldJVM() {
.split("\\.");
int minor = 0;
int major = 0;
try {
} catch (Exception e) {
// ignore
}
}
return oldVM.booleanValue();
}
/**
* Register this thread in the thread/configuration map (so that all
* subsequent calls to the RuntimeEnvironment from this thread will use
* the same configuration
* @return this instance
*/
return instance;
}
/**
* Validate that I have a Exuberant ctags program I may use.
* @return {@code true} if Exuberant ctags could be run.
*/
public static boolean validateExuberantCtags() {
boolean ret = true;
"Please use option -c to specify path to a good Exuberant Ctags program\n"+
"Or set it in java system property "
ret = false;
}
return ret;
}
/**
* Read an configuration file and set it as the current configuration.
* @param file the file to read
* @throws IOException if an error occurs
*/
}
/**
* Write the current configuration to a file
* @param file the file to write the configuration into
* @throws IOException if an error occurs
*/
}
/**
* Write the current configuration to a socket
* @param host the host address to receive the configuration
* @param port the port to use on the host
* @throws IOException if an error occurs
*/
e.writeObject(getConfig());
e.close();
}
/**
* Send the current configuration to the web application [server].
* @throws IOException
*/
}
/**
* Set the current configuration for this instance to the given parameter.
* Involves invalidating known repositories of the {@link HistoryGuru}.
* @param config configuration to set.
*/
register();
}
/**
* Get the current configuration for this instance.
* @return the current configuration.
*/
}
/**
* Try to stop the configuration listener thread
*/
public static void stopConfigListenerThread() {
}
/**
* Start a thread to listen on a socket to receive new configurations
* to use.
* @param endpoint The socket address to listen on
* @return true if the endpoint was available (and the thread was started)
*/
boolean ret = false;
try {
ret = true;
@SuppressWarnings("synthetic-access")
public void run() {
try {
s.getInetAddress().getHostAddress());
byte[] buf = new byte[1024];
int len;
}
}
d.close();
if (obj instanceof Configuration) {
getConfig().getSourceRoot());
}
} catch (IOException e) {
} catch (RuntimeException e) {
} finally {
}
}
}
});
t.start();
} catch (UnknownHostException ex) {
} catch (IOException ex) {
}
}
return ret;
}
}