Exemple #1
0
// Init initializes the JNI code with the given Java environment.  This method
// must be invoked before any other method in this package and must be called
// from the main Java thread (e.g., On_Load()).
func Init(env jutil.Env) error {
	var err error
	jVRuntimeImplClass, err = jutil.JFindClass(env, "io/v/impl/google/rt/VRuntimeImpl")
	if err != nil {
		return err
	}
	jInviteClass, err = jutil.JFindClass(env, "io/v/v23/syncbase/Invite")
	if err != nil {
		return err
	}
	return nil
}
Exemple #2
0
// Init initializes the JNI code with the given Java environment.  This method
// must be invoked before any other method in this package and must be called
// from the main Java thread (e.g., On_Load()).
func Init(env jutil.Env) error {
	var err error
	jInputChannelImplClass, err = jutil.JFindClass(env, "io/v/impl/google/channel/InputChannelImpl")
	if err != nil {
		return err
	}
	jOutputChannelImplClass, err = jutil.JFindClass(env, "io/v/impl/google/channel/OutputChannelImpl")
	if err != nil {
		return err
	}
	return nil
}
Exemple #3
0
func Init(env jutil.Env) error {
	var err error
	jAccessListClass, err = jutil.JFindClass(env, "io/v/v23/security/access/AccessList")
	if err != nil {
		return err
	}
	jPermissionsClass, err = jutil.JFindClass(env, "io/v/v23/security/access/Permissions")
	if err != nil {
		return err
	}
	return nil
}
Exemple #4
0
// Init initializes the JNI code with the given Java environment. This method
// must be called from the main Java thread.
func Init(env jutil.Env) error {
	// Cache global references to all Java classes used by the package.  This is
	// necessary because JNI gets access to the class loader only in the system
	// thread, so we aren't able to invoke FindClass in other threads.
	var err error
	jVContextClass, err = jutil.JFindClass(env, "io/v/v23/context/VContext")
	if err != nil {
		return err
	}
	jDoneReasonClass, err = jutil.JFindClass(env, "io/v/v23/context/VContext$DoneReason")
	if err != nil {
		return err
	}
	return nil
}
Exemple #5
0
func initDriverFactory(env jutil.Env) error {
	jDriverClass, err := jutil.JFindClass(env, "io/v/android/impl/google/discovery/plugins/ble/Driver")
	if err != nil {
		return err
	}
	factory := func(ctx *context.T, _ string) (ble.Driver, error) {
		env, freeFunc := jutil.GetEnv()
		defer freeFunc()

		jCtx, err := jcontext.JavaContext(env, ctx, nil)
		if err != nil {
			return nil, err
		}
		jDriver, err := jutil.NewObject(env, jDriverClass, []jutil.Sign{contextSign}, jCtx)
		if err != nil {
			return nil, err
		}
		// Reference the driver; it will be de-referenced when the driver is garbage-collected.
		jDriver = jutil.NewGlobalRef(env, jDriver)
		d := &driver{jDriver}
		runtime.SetFinalizer(d, func(*driver) {
			env, freeFunc := jutil.GetEnv()
			jutil.DeleteGlobalRef(env, d.jDriver)
			freeFunc()
		})
		return d, nil
	}
	ble.SetDriverFactory(factory)
	return nil
}
Exemple #6
0
func Init(env jutil.Env) error {
	var err error
	jVClass, err = jutil.JFindClass(env, "io/v/android/v23/V")
	if err != nil {
		return err
	}
	return nil
}
Exemple #7
0
// Init initializes the JNI code with the given Java environment. This method
// must be called from the main Java thread.
func Init(env jutil.Env) error {
	var err error
	jNamespaceImplClass, err = jutil.JFindClass(env, "io/v/impl/google/namespace/NamespaceImpl")
	if err != nil {
		return err
	}
	jGlobReplyClass, err = jutil.JFindClass(env, "io/v/v23/naming/GlobReply")
	if err != nil {
		return err
	}
	JMountEntryClass, err = jutil.JFindClass(env, "io/v/v23/naming/MountEntry")
	if err != nil {
		return err
	}
	jPermissionsClass, err = jutil.JFindClass(env, "io/v/v23/security/access/Permissions")
	if err != nil {
		return err
	}
	return nil
}
Exemple #8
0
func Init(env jutil.Env) error {
	// Cache global references to all Java classes used by the package.  This is
	// necessary because JNI gets access to the class loader only in the system
	// thread, so we aren't able to invoke FindClass in other threads.
	var err error
	jEndpointImplClass, err = jutil.JFindClass(env, "io/v/impl/google/naming/EndpointImpl")
	if err != nil {
		return err
	}
	return nil
}
Exemple #9
0
// Init initializes the JNI code with the given Java environment. This method
// must be called from the main Java thread.
func Init(env jutil.Env) error {
	// Cache global references to all Java classes used by the package.  This is
	// necessary because JNI gets access to the class loader only in the system
	// thread, so we aren't able to invoke FindClass in other threads.
	var err error
	jBluetoothClass, err = jutil.JFindClass(env, "io/v/android/impl/google/rpc/protocols/bt/"+btClassName)
	if err != nil {
		return err
	}
	flow.RegisterProtocol("bt", btProtocol{})
	return nil
}
Exemple #10
0
// Init initializes the JNI code with the given Java environment. This method
// must be called from the main Java thread.
func Init(env jutil.Env) error {
	// Cache global references to all Java classes used by the package.  This is
	// necessary because JNI gets access to the class loader only in the system
	// thread, so we aren't able to invoke FindClass in other threads.
	var err error
	jAdIdClass, err = jutil.JFindClass(env, "io/v/v23/discovery/AdId")
	if err != nil {
		return err
	}
	jAdvertisementClass, err = jutil.JFindClass(env, "io/v/v23/discovery/Advertisement")
	if err != nil {
		return err
	}
	jBlessingPatternClass, err = jutil.JFindClass(env, "io/v/v23/security/BlessingPattern")
	if err != nil {
		return err
	}
	jDiscoveryImplClass, err = jutil.JFindClass(env, "io/v/impl/google/lib/discovery/DiscoveryImpl")
	if err != nil {
		return err
	}
	jUpdateImplClass, err = jutil.JFindClass(env, "io/v/impl/google/lib/discovery/UpdateImpl")
	if err != nil {
		return err
	}
	jUUIDClass, err = jutil.JFindClass(env, "java/util/UUID")
	if err != nil {
		return err
	}
	return nil
}
Exemple #11
0
// Init initializes the JNI code with the given Java environment. This method
// must be called from the main Java thread.
func Init(env jutil.Env) error {
	if err := jbt.Init(env); err != nil {
		return err
	}
	if err := jble.Init(env); err != nil {
		// The BLE protocol isn't always compiled in, so don't fail if it
		// isn't available.
		vlog.Infof("Unable to initialize BLE protocol: %v", err)
	}
	// Cache global references to all Java classes used by the package.  This is
	// necessary because JNI gets access to the class loader only in the system
	// thread, so we aren't able to invoke FindClass in other threads.
	var err error
	jAddressChooserImplClass, err = jutil.JFindClass(env, "io/v/impl/google/rpc/AddressChooserImpl")
	if err != nil {
		return err
	}
	jServerImplClass, err = jutil.JFindClass(env, "io/v/impl/google/rpc/ServerImpl")
	if err != nil {
		return err
	}
	jClientImplClass, err = jutil.JFindClass(env, "io/v/impl/google/rpc/ClientImpl")
	if err != nil {
		return err
	}
	jClientCallImplClass, err = jutil.JFindClass(env, "io/v/impl/google/rpc/ClientCallImpl")
	if err != nil {
		return err
	}
	jStreamServerCallImplClass, err = jutil.JFindClass(env, "io/v/impl/google/rpc/StreamServerCallImpl")
	if err != nil {
		return err
	}
	jServerCallImplClass, err = jutil.JFindClass(env, "io/v/impl/google/rpc/ServerCallImpl")
	if err != nil {
		return err
	}
	jStreamImplClass, err = jutil.JFindClass(env, "io/v/impl/google/rpc/StreamImpl")
	if err != nil {
		return err
	}
	jServerRPCHelperClass, err = jutil.JFindClass(env, "io/v/impl/google/rpc/ServerRPCHelper")
	if err != nil {
		return err
	}
	jInvokerClass, err = jutil.JFindClass(env, "io/v/v23/rpc/Invoker")
	if err != nil {
		return err
	}
	jListenSpecClass, err = jutil.JFindClass(env, "io/v/v23/rpc/ListenSpec")
	if err != nil {
		return err
	}
	jListenSpecAddressClass, err = jutil.JFindClass(env, "io/v/v23/rpc/ListenSpec$Address")
	if err != nil {
		return err
	}
	jPublisherEntryClass, err = jutil.JFindClass(env, "io/v/v23/rpc/PublisherEntry")
	if err != nil {
		return err
	}
	jNetworkAddressClass, err = jutil.JFindClass(env, "io/v/v23/rpc/NetworkAddress")
	if err != nil {
		return err
	}
	jProxyStatusClass, err = jutil.JFindClass(env, "io/v/v23/rpc/ProxyStatus")
	if err != nil {
		return err
	}
	jReflectInvokerClass, err = jutil.JFindClass(env, "io/v/v23/rpc/ReflectInvoker")
	if err != nil {
		return err
	}
	jServerStatusClass, err = jutil.JFindClass(env, "io/v/v23/rpc/ServerStatus")
	if err != nil {
		return err
	}
	jServerStateClass, err = jutil.JFindClass(env, "io/v/v23/rpc/ServerState")
	if err != nil {
		return err
	}
	jOptionDefsClass, err = jutil.JFindClass(env, "io/v/v23/OptionDefs")
	if err != nil {
		return err
	}
	jEndpointClass, err = jutil.JFindClass(env, "io/v/v23/naming/Endpoint")
	if err != nil {
		return err
	}
	jInterfaceClass, err = jutil.JFindClass(env, "io/v/v23/vdlroot/signature/Interface")
	if err != nil {
		return err
	}
	jMethodClass, err = jutil.JFindClass(env, "io/v/v23/vdlroot/signature/Method")
	if err != nil {
		return err
	}
	jGlobReplyClass, err = jutil.JFindClass(env, "io/v/v23/naming/GlobReply")
	if err != nil {
		return err
	}
	jObjectClass, err = jutil.JFindClass(env, "java/lang/Object")
	if err != nil {
		return err
	}
	return nil
}
Exemple #12
0
// Init initializes the JNI code with the given Java evironment. This method
// must be called from the main Java thread.
func Init(env jutil.Env) error {
	security.OverrideCaveatValidation(caveatValidator)

	// Cache global references to all Java classes used by the package.  This is
	// necessary because JNI gets access to the class loader only in the system
	// thread, so we aren't able to invoke FindClass in other threads.
	var err error
	jBlessingsClass, err = jutil.JFindClass(env, "io/v/v23/security/Blessings")
	if err != nil {
		return err
	}
	jCaveatClass, err = jutil.JFindClass(env, "io/v/v23/security/Caveat")
	if err != nil {
		return err
	}
	jWireBlessingsClass, err = jutil.JFindClass(env, "io/v/v23/security/WireBlessings")
	if err != nil {
		return err
	}
	jVPrincipalImplClass, err = jutil.JFindClass(env, "io/v/v23/security/VPrincipalImpl")
	if err != nil {
		return err
	}
	jBlessingStoreImplClass, err = jutil.JFindClass(env, "io/v/v23/security/BlessingStoreImpl")
	if err != nil {
		return err
	}
	jBlessingRootsImplClass, err = jutil.JFindClass(env, "io/v/v23/security/BlessingRootsImpl")
	if err != nil {
		return err
	}
	jCallImplClass, err = jutil.JFindClass(env, "io/v/v23/security/CallImpl")
	if err != nil {
		return err
	}
	jBlessingPatternClass, err = jutil.JFindClass(env, "io/v/v23/security/BlessingPattern")
	if err != nil {
		return err
	}
	jCaveatRegistryClass, err = jutil.JFindClass(env, "io/v/v23/security/CaveatRegistry")
	if err != nil {
		return err
	}
	jUtilClass, err = jutil.JFindClass(env, "io/v/v23/security/Util")
	if err != nil {
		return err
	}
	jVSecurityClass, err = jutil.JFindClass(env, "io/v/v23/security/VSecurity")
	if err != nil {
		return err
	}
	jDischargeClass, err = jutil.JFindClass(env, "io/v/v23/security/Discharge")
	if err != nil {
		return err
	}
	jDischargeImpetusClass, err = jutil.JFindClass(env, "io/v/v23/security/DischargeImpetus")
	if err != nil {
		return err
	}
	jPermissionsAuthorizerClass, err = jutil.JFindClass(env, "io/v/v23/security/access/PermissionsAuthorizer")
	if err != nil {
		return err
	}
	jIdClass, err = jutil.JFindClass(env, "io/v/v23/uniqueid/Id")
	if err != nil {
		return err
	}
	jObjectClass, err = jutil.JFindClass(env, "java/lang/Object")
	if err != nil {
		return err
	}
	return nil
}