java.rmi.RemoteException Java Examples

The following examples show how to use java.rmi.RemoteException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataTrackTool.java    From tracker with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sends a message to a replyTo tool in the form of a String-to-String mapping.
 *
 * @param id the replyTo identifier
 * @param message the information to send
 * @return true if sent successfully
 */
public boolean reply(int id, Map<String, String> message) {
	Tool tool = replyToTools.get(id);
	if (tool==null) return false;
// get message control and set properties based on info map
XMLControl control = DataTrackSupport.getMessageControl(id);
for (String key: message.keySet()) {
	control.setValue(key, message.get(key));
}
	try {
	tool.send(new LocalJob(control.toXML()), null);
} catch (RemoteException e) {
	return false;
}
	return true;
}
 
Example #2
Source File: RMIContext.java    From oodt with Apache License 2.0 6 votes vote down vote up
/**
 * Get the RMI registry.
 *
 * @return a <code>Registry</code> value.
 * @throws NamingException if an error occurs.
 */
private Registry getRegistry() throws NamingException {
	if (registry != null) {
	  return registry;
	}
	try {
		String host = environment.containsKey("host")? (String) environment.get("host") : "localhost";
		int port = environment.containsKey("port")? (Integer) environment.get("port")
			: Registry.REGISTRY_PORT;

		
		registry = LocateRegistry.getRegistry(host, port);
	} catch (RemoteException ex) {
		throw new NamingException("Remote exception locating registry: " + ex.getMessage());
	}
	return registry;
}
 
Example #3
Source File: EntityEJBHomeHandler.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Override
protected Object removeByPrimaryKey(final Method method, final Object[] args, final Object proxy) throws Throwable {
    final Object primKey = args[0];

    if (primKey == null) {
        throw new NullPointerException("The primary key is null.");
    }

    final EJBRequest req = new EJBRequest(RequestMethodCode.EJB_HOME_REMOVE_BY_PKEY, ejb, method, args, primKey, client.getSerializer());

    final EJBResponse res = request(req);

    switch (res.getResponseCode()) {
        case ResponseCodes.EJB_ERROR:
            throw new SystemError((ThrowableArtifact) res.getResult());
        case ResponseCodes.EJB_SYS_EXCEPTION:
            throw new SystemException((ThrowableArtifact) res.getResult());
        case ResponseCodes.EJB_APP_EXCEPTION:
            throw new ApplicationException((ThrowableArtifact) res.getResult());
        case ResponseCodes.EJB_OK:
            invalidateAllHandlers(ejb.deploymentID + ":" + primKey);
            return null;
        default:
            throw new RemoteException("Received invalid response code from server: " + res.getResponseCode());
    }
}
 
Example #4
Source File: AppleImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a newly created and exported orange implementation.
 */
public Orange newOrange(String name) throws RemoteException {
    try {
        String threadName = Thread.currentThread().getName();
        logger.log(Level.FINEST,
            threadName + ": " + toString() +
            ".newOrange(" + name + "): BEGIN");

        Orange orange = new OrangeImpl(name);

        logger.log(Level.FINEST,
            threadName + ": " + toString() +
            ".newOrange(" + name + "): END");

        return orange;
    } catch (RuntimeException e) {
        logger.log(Level.SEVERE, toString() + ".newOrange():", e);
        throw e;
    }
}
 
Example #5
Source File: DataTrackSupport.java    From osp with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sends a message to the remote DataTrackTool in the form of a String-to-Object mapping.
 * The message may include Data as a "data"-to-Data mapping.
 *
 * @param id a number to identify the data source (typically hashcode())
 * @param message the message to send
 * @return true if sent successfully
 */
public static boolean sendMessage(int id, Map<String, Object> message) {
	Tool tool = getRemoteTool();
	if (tool==null) return false;
// get message control and set properties based on info map
XMLControl control = getMessageControl(id);
Data data = null;
for (String key: message.keySet()) {
	Object value = message.get(key);
	if (key.equals("data")) { //$NON-NLS-1$
		data = (Data)value;
	}
	control.setValue(key, value);
}
	try {
	tool.send(new LocalJob(control.toXML()), getSupportTool());
} catch (RemoteException e) {
	return false;
}
	if (data!=null) {
  	dataNames.add(data.getName());
	}
	return true;
}
 
Example #6
Source File: HumanTaskAdminClient.java    From product-es with Apache License 2.0 6 votes vote down vote up
public WorkItem[] getWorkItems()
		throws IllegalStateFault, IllegalAccessFault, RemoteException, IllegalArgumentFault {

	TSimpleQueryInput queryInput = new TSimpleQueryInput();
	queryInput.setPageNumber(0);
	queryInput.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);

	TTaskSimpleQueryResultSet resultSet = htStub.simpleQuery(queryInput);
	if (resultSet == null || resultSet.getRow() == null || resultSet.getRow().length == 0) {
		return new WorkItem[0];
	}
	List<WorkItem> workItems = new LinkedList<>();
	for (TTaskSimpleQueryResultRow row : resultSet.getRow()) {
		URI id = row.getId();
		String taskUser = "";
		//Ready state notification doesn't have taskUser
		if (htStub.loadTask(id) != null && htStub.loadTask(id).getActualOwner() != null) {
			taskUser = htStub.loadTask(id).getActualOwner().getTUser();
		}

		workItems.add(new WorkItem(id, row.getPresentationSubject(),
				row.getPresentationName(), row.getPriority(), row.getStatus(),
				row.getCreatedTime(), taskUser));
	}
	return workItems.toArray(new WorkItem[workItems.size()]);
}
 
Example #7
Source File: RMIJRMPServerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void export(Remote obj) throws RemoteException {
    final RMIExporter exporter =
        (RMIExporter) env.get(RMIExporter.EXPORTER_ATTRIBUTE);
    final boolean daemon = EnvHelp.isServerDaemon(env);

    if (daemon && exporter != null) {
        throw new IllegalArgumentException("If "+EnvHelp.JMX_SERVER_DAEMON+
                " is specified as true, "+RMIExporter.EXPORTER_ATTRIBUTE+
                " cannot be used to specify an exporter!");
    }

    if (daemon) {
        if (csf == null && ssf == null) {
            new UnicastServerRef(port).exportObject(obj, null, true);
        } else {
            new UnicastServerRef2(port, csf, ssf).exportObject(obj, null, true);
        }
    } else if (exporter != null) {
        exporter.exportObject(obj, port, csf, ssf);
    } else {
        UnicastRemoteObject.exportObject(obj, port, csf, ssf);
    }
}
 
Example #8
Source File: Chatroom.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean compareChatMessage(String jid, String message) throws RemoteException {
  try {
    chatTab.activate();
    SarosSWTBot bot = new SarosSWTBot(chatTab.widget);
    String text = bot.lastChatLine().getText();
    return text.equals(message);
  } catch (Exception e) {
    log.error(e.getMessage(), e);
    return false;
  }
}
 
Example #9
Source File: StandardRemoteKernel.java    From openAGV with Apache License 2.0 5 votes vote down vote up
@Deprecated
@Override
public void activateTransportOrder(ClientID clientID, TCSObjectReference<TransportOrder> ref)
    throws CredentialsException, ObjectUnknownException, RemoteException {
  checkCredentialsForRole(clientID, UserPermission.MODIFY_ORDER);

  localKernel.activateTransportOrder(ref);
}
 
Example #10
Source File: TradeWSAction.java    From dacapobench with Apache License 2.0 5 votes vote down vote up
public boolean logout(String userID) throws RemoteException {
	try {
           trade.logout(userID);
           return true;
       } catch (Exception e) {
           throw new RemoteException("", e);
       }
}
 
Example #11
Source File: ESBIntegrationTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
protected  void uploadConnector(String repoLocation, String strFileName) throws MalformedURLException,
                                                                                RemoteException {
	List<LibraryFileItem> uploadLibraryInfoList = new ArrayList<LibraryFileItem>();
	LibraryFileItem uploadedFileItem = new LibraryFileItem();
	uploadedFileItem.setDataHandler(new DataHandler(new FileDataSource(new File(repoLocation +
	                                                        File.separator + strFileName))));
	uploadedFileItem.setFileName(strFileName);
	uploadedFileItem.setFileType("zip");
	uploadLibraryInfoList.add(uploadedFileItem);
	LibraryFileItem[] uploadServiceTypes = new LibraryFileItem[uploadLibraryInfoList.size()];
	uploadServiceTypes = uploadLibraryInfoList.toArray(uploadServiceTypes);
	esbUtils.uploadConnector(contextUrls.getBackEndUrl(),sessionCookie,uploadServiceTypes);
}
 
Example #12
Source File: WSDLOptionsSpecifiedSourceUrlTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void clearUploadedResource()
        throws InterruptedException, ResourceAdminServiceExceptionException, RemoteException, XPathExpressionException {

    ResourceAdminServiceClient resourceAdminServiceStub =
            new ResourceAdminServiceClient(context.getContextUrls().getBackEndUrl(), getSessionCookie());

    resourceAdminServiceStub.deleteResource("/_system/config/script_xslt");
}
 
Example #13
Source File: ESBTestCaseUtils.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * @param backEndUrl
 * @param sessionCookie
 * @param sequenceName
 * @return
 * @throws org.wso2.carbon.sequences.stub.types.SequenceEditorException
 * @throws java.rmi.RemoteException
 */
public boolean isSequenceExist(String backEndUrl, String sessionCookie, String sequenceName)
		throws SequenceEditorException, RemoteException {
	SequenceAdminServiceClient sequenceAdminServiceClient = new SequenceAdminServiceClient(backEndUrl,
	                                                                                       sessionCookie);
	String[] sequences = sequenceAdminServiceClient.getSequences();
	if (sequences == null || sequences.length == 0) {
		return false;
	}
	return ArrayUtils.contains(sequences, sequenceName);
}
 
Example #14
Source File: EventSimulatorAdminServiceClient.java    From product-cep with Apache License 2.0 5 votes vote down vote up
public StreamDefinitionInfoDto[] getAllEventStreamInfoDto() throws RemoteException {
    try {
        return executionSimulatorAdminServiceStub.getAllEventStreamInfoDto();
    } catch (RemoteException e) {
        log.error("RemoteException", e);
        throw new RemoteException();
    }
}
 
Example #15
Source File: Chaining.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Exception t = new RuntimeException();
    String foo = "foo";
    String fooMsg = "foo; nested exception is: \n\t" + t;
    test(new RemoteException(), null, null);
    test(new RemoteException(foo), foo, null);
    test(new RemoteException(foo, t), fooMsg, t);
    test(new ActivationException(), null, null);
    test(new ActivationException(foo), foo, null);
    test(new ActivationException(foo, t), fooMsg, t);
    test(new ServerCloneException(foo), foo, null);
    test(new ServerCloneException(foo, t), fooMsg, t);
}
 
Example #16
Source File: StandardRemoteKernel.java    From openAGV with Apache License 2.0 5 votes vote down vote up
@Deprecated
@Override
public Path createPath(ClientID clientID, TCSObjectReference<Point> srcRef,
                       TCSObjectReference<Point> destRef)
    throws CredentialsException, ObjectUnknownException, RemoteException {
  checkCredentialsForRole(clientID, UserPermission.MODIFY_MODEL);

  return localKernel.createPath(srcRef, destRef);
}
 
Example #17
Source File: MenuFileTest.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testNewProjectWithClass() throws RemoteException {
  assertFalse(
      ALICE
          .superBot()
          .views()
          .packageExplorerView()
          .tree()
          .existsWithRegex(Pattern.quote(Constants.PROJECT1) + ".*"));
  ALICE
      .superBot()
      .views()
      .packageExplorerView()
      .tree()
      .newC()
      .javaProjectWithClasses(Constants.PROJECT1, "pkg", "Cls");
  assertTrue(
      ALICE
          .superBot()
          .views()
          .packageExplorerView()
          .tree()
          .existsWithRegex(Pattern.quote(Constants.PROJECT1) + ".*"));
  assertTrue(
      ALICE
          .superBot()
          .views()
          .packageExplorerView()
          .selectPkg(Constants.PROJECT1, "pkg")
          .existsWithRegex(Pattern.quote("Cls" + SUFFIX_JAVA) + ".*"));
}
 
Example #18
Source File: Stub.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Connects this stub to an ORB. Required after the stub is deserialized
 * but not after it is demarshalled by an ORB stream. If an unconnected
 * stub is passed to an ORB stream for marshalling, it is implicitly
 * connected to that ORB. Application code should not call this method
 * directly, but should call the portable wrapper method
 * {@link javax.rmi.PortableRemoteObject#connect}.
 * @param orb the ORB to connect to.
 * @exception RemoteException if the stub is already connected to a different
 * ORB, or if the stub does not represent an exported remote or local object.
 */
public void connect(ORB orb) throws RemoteException {

    if (stubDelegate == null) {
        setDefaultDelegate();
    }

    if (stubDelegate != null) {
        stubDelegate.connect(this, orb);
    }

}
 
Example #19
Source File: EventPublisherAdminServiceClient.java    From product-cep with Apache License 2.0 5 votes vote down vote up
public String getActiveEventPublisherConfigurationContent(String eventPublisherName)
        throws RemoteException {
    try {
        return eventPublisherAdminServiceStub.getActiveEventPublisherConfigurationContent(eventPublisherName);
    } catch (RemoteException e) {
        log.error("RemoteException", e);
        throw new RemoteException();
    }
}
 
Example #20
Source File: RBQTasks.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * A hydra ENDTASK that validates values in the blackboard.
 *
 * @throws TestException
 *         If the number of poll operations does not equal the
 *         number of offer operations.
 */
public static void validate() throws RemoteException {
  RBQBlackboard bb = RBQBlackboard.getBB();
  bb.print();   // shows the contents of shared counters and the shared map

  // read and log the min and max times
  long minOfferTime = bb.getMinOfferTime();
  long maxOfferTime = bb.getMaxOfferTime();
  long minPollTime = bb.getMinPollTime();
  long maxPollTime = bb.getMaxPollTime();

  LogWriter log = Log.getLogWriter();
  log.info("Minimum time for offer: " + minOfferTime + " nanos");
  log.info("Maximum time for offer: " + maxOfferTime + " nanos");
  log.info("Minimum time for poll : " + minPollTime + " nanos");
  log.info("Maximum time for poll : " + maxPollTime + " nanos");

  // check that all elements put into the queue were actually removed
  long numPolls = bb.getNumPolls();
  long numOffers = bb.getNumOffers();

  if (numPolls != numOffers) {
    String s = "Expected number of poll operations " + numPolls +
      " to equal number of offer operations " + numOffers;
     throw new TestException(s); 
  }
}
 
Example #21
Source File: LoadBalanceEndpointTestCase.java    From product-ei with Apache License 2.0 4 votes vote down vote up
private void cleanupEndpoints() throws RemoteException, EndpointAdminEndpointAdminException {
    EndpointTestUtils.cleanupDefaultEndpoint(ENDPOINT_NAME, endPointAdminClient);
}
 
Example #22
Source File: JuddiTestimpl.java    From juddi with Apache License 2.0 4 votes vote down vote up
@Override
public NodeDetail saveNode(SaveNode body) throws DispositionReportFaultMessage, RemoteException {
        CLIServerTest.sink = true;
        return null;
}
 
Example #23
Source File: InviteWithDifferentVersionsTest.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
@AfterClass
public static void resetSarosVersion() throws RemoteException {
  BOB.superBot().internal().resetSarosVersion();
}
 
Example #24
Source File: DelegateTransactionService.java    From database with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void destroy() throws RemoteException {
    proxy.destroy();
}
 
Example #25
Source File: BenchServerImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Invoke the garbage collector.
 */
public void gc() throws RemoteException {
    System.gc();
}
 
Example #26
Source File: RemoteBotEditor.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void autoCompleteProposal(String insertText, String proposalText) throws RemoteException {
  widget.autoCompleteProposal(insertText, proposalText);
}
 
Example #27
Source File: DGCImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public Void run() {
    ClassLoader savedCcl =
        Thread.currentThread().getContextClassLoader();
    try {
        Thread.currentThread().setContextClassLoader(
            ClassLoader.getSystemClassLoader());

        /*
         * Put remote collector object in table by hand to prevent
         * listen on port.  (UnicastServerRef.exportObject would
         * cause transport to listen.)
         */
        try {
            dgc = new DGCImpl();
            ObjID dgcID = new ObjID(ObjID.DGC_ID);
            LiveRef ref = new LiveRef(dgcID, 0);
            UnicastServerRef disp = new UnicastServerRef(ref);
            Remote stub =
                Util.createProxy(DGCImpl.class,
                                 new UnicastRef(ref), true);
            disp.setSkeleton(dgc);

            Permissions perms = new Permissions();
            perms.add(new SocketPermission("*", "accept,resolve"));
            ProtectionDomain[] pd = { new ProtectionDomain(null, perms) };
            AccessControlContext acceptAcc = new AccessControlContext(pd);

            Target target = AccessController.doPrivileged(
                new PrivilegedAction<Target>() {
                    public Target run() {
                        return new Target(dgc, disp, stub, dgcID, true);
                    }
                }, acceptAcc);

            ObjectTable.putTarget(target);
        } catch (RemoteException e) {
            throw new Error(
                "exception initializing server-side DGC", e);
        }
    } finally {
        Thread.currentThread().setContextClassLoader(savedCcl);
    }
    return null;
}
 
Example #28
Source File: RemoteObjArrayCalls.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
RemoteObj() throws RemoteException {
}
 
Example #29
Source File: NonCheckpointableDiskFPSet.java    From tlaplus with MIT License 4 votes vote down vote up
protected NonCheckpointableDiskFPSet(FPSetConfiguration fpSetConfig) throws RemoteException {
	super(fpSetConfig);
}
 
Example #30
Source File: MTModule.java    From pra with MIT License 4 votes vote down vote up
public MapSD translateKeyTermRMI( String term )throws RemoteException{
	return translateKeyTerm(term);
}